-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Overview
This project's CMakeLists.txt unconditionally requires beman-install-library to be resolvable via find_package, but does not guarantee its own ./infra/cmake/beman-install-library-config.cmake file is resolvable.
Line 61 in 4e2a094
| find_package(beman-install-library REQUIRED) |
Nothing in the CMakeLists.txt file takes steps to check/provide this before hard-erroring, and all README-described build steps are broken (except for the preset builds, see below).
Broken Build Output
[pszenher ~/src/optional]$ cmake -B .build -S . -DOPTIONAL_ENABLE_TESTING=OFF
-- The CXX compiler identification is GNU 15.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /nix/store/kbw2j1vag664b3sj3rjwz9v53cqx87sb-gcc-wrapper-15.2.0/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:61 (find_package):
By not providing "Findbeman-install-library.cmake" in CMAKE_MODULE_PATH
this project has asked CMake to find a package configuration file provided
by "beman-install-library", but CMake did not find one.
Could not find a package configuration file provided by
"beman-install-library" with any of the following names:
beman-install-libraryConfig.cmake
beman-install-library-config.cmake
Add the installation prefix of "beman-install-library" to CMAKE_PREFIX_PATH
or set "beman-install-library_DIR" to a directory containing one of the
above files. If "beman-install-library" provides a separate development
package or SDK, be sure it has been installed.
Details
I had originally drafted up an issue about incompatibility of this package being fetched/built via CMake FetchContent, but realized midway through that the primary build instructions are broken.
There are only three currently working build-flows:
- Setting
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=.infra/cmake/use-fetch-content.cmakeat configure-time- note that this is not the readme-recommended
cmake/use-fetch-content.cmakefrom the top-levelcmakedir; build using the readme-suggestedCMAKE_PROJECT_TOP_LEVEL_INCLUDESfile are broken
- note that this is not the readme-recommended
- Any of the CMake preset builds, which use the infra toolchain files, each of which call
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}")- note that these would work without the toolchain cmake files, as the
_root-configbase preset also setsCMAKE_PROJECT_TOP_LEVEL_INCLUDESto./infra/cmake/use-fetch-content.cmake, reducing to the same case as above
- note that these would work without the toolchain cmake files, as the
- Building on a system/in a context where
beman-install-libraryis resolvable fromCMAKE_PREFIX_PATH
It appears that all of the CI workflows explicitly inject "./infra/cmake" into CMAKE_PREFIX_PATH via the strategy matrix, which is why CI flows remain green.
Recommendation
This project's top-level CMakeLists.txt file should likely change:
Line 61 in 4e2a094
| find_package(beman-install-library REQUIRED) |
to:
find_package(
beman-install-library REQUIRED
HINTS "${CMAKE_CURRENT_LIST_DIR}/infra/cmake"
)