module-level options are unpredictable
I was trying to enable testing globally, and also enable example specifically in Kirigami. I got strange error messages: suddenly Qt started defaulting to 5.x, and other weirdness. Looking closely at cmake.log before and after commenting out the module-level option:
# global options only:
# global
# cmake-options -DBUILD_TESTING=1
# cmake-options -DCMAKE_BUILD_TYPE=RelWithDebInfo
# end global
cmake -B . -S /home/ratijas/kde/src-kf6/kirigami -G 'Kate - Ninja' \
-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_TESTING=TRUE \
-DBUILD_WITH_QT6=ON \
-DEXCLUDE_DEPRECATED_BEFORE_AND_AT=5.99.0 \
-DCMAKE_CXX_FLAGS:STRING=-pipe \
-DCMAKE_INSTALL_PREFIX=/usr/local/kde6
# global with module-level option:
# options kirigami
# cmake-options -DBUILD_EXAMPLES=ON
# end options
cmake -B . -S /home/ratijas/kde/src-kf6/kirigami -G 'Kate - Ninja' \
-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_EXAMPLES=1 \
-DCMAKE_CXX_FLAGS:STRING=-pipe \
-DCMAKE_INSTALL_PREFIX=/usr/local/kde6
It seems like -DBUILD_EXAMPLES=ON
does not stack well with options coming from other different levels:
not only it disabled most of stuff that should come for free with KF6 builds, but it also turned off BUILD_TESTING
, however it left CMAKE_BUILD_TYPE=RelWithDebInfo
intact.