[BUG] Incorrect configuration using toolchain file.
raplonu opened this issue · comments
Describe the Bug
CMake allows to specify a toolchain file to, among other things, specify options.
However, setting up options in the toolchain file does not have any effect.
To Reproduce
- Create a
conan_toolchain.cmake
in the project root directory with the following content:
set(MATX_BUILD_EXAMPLES ON CACHE BOOL "")
- Run the following commands:
mkdir build && cd build
cmake --toolchain ../conan_toolchain.cmake ..
make -j
Expected Behavior
The project should build the examples but looking at CMakeCache.txt
, MATX_BUILD_EXAMPLES
is still set to OFF
.
System Details
- OS: AlmaLinux release 8.4
- CUDA version: 12.2
- g++ version: 11.2
Additional Context
CMake being CMake, this issue seems to depends on the relative position of the option
s and project
in the CMakeLists.txt
. When project
comes first, using a toolchain file will modify the cache as expected.
AFAIK, this is undocumented.