I work on Ubuntu, and here is a part of my CMake code (the questionable part is in the last sentence):
include(ExternalProject)
ExternalProject_Add(fftw3_external
URL
http://www.fftw.org/fftw-3.3.8.tar.gz
URL_HASH
MD5=8aac833c943d8e90d51b697b27d4384d
DOWNLOAD_NO_PROGRESS
1
UPDATE_COMMAND
""
LOG_CONFIGURE
1
LOG_BUILD
1
LOG_INSTALL
1
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX}
-DBUILD_TESTS=OFF
CMAKE_CACHE_ARGS
-DCMAKE_C_FLAGS:STRING=$<$<BOOL:WIN32>:-DWITH_OUR_MALLOC>
)
After configuration I look inside the corresponding cache file, fftw3_external-cache.cmake, and it shows:
set(CMAKE_C_FLAGS "-DWITH_OUR_MALLOC" CACHE STRING "Initial cache" FORCE)
But this content corresponds to WIN32 being true. Why it is so?
In the generator expression
$<BOOL:WIN32>
CMake evaluates "WIN32" as a string, not as a variable. Because this string doesn't correspond to any false pattern, it is evaluated as TRUE.
You need to dereference the variable for check its value:
$<BOOL:${WIN32}>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With