CMake: improvements#325
Conversation
timblechmann
commented
Feb 25, 2026
- by default enable tests/examples/docs only if the project is the top-level project
- use CMAKE_XXX_LAUNCHER variables, as the RULE_LAUNCH properties are internal to cmake
- add alias target, to make linking more robust
- expose headers to IDEs via FILE_SET
* by default enable tests/examples/docs only if the project is the top-level project * use CMAKE_XXX_LAUNCHER variables, as the RULE_LAUNCH properties are internal to cmake * add alias target, to make linking more robust * expose headers to IDEs via FILE_SET
| option(ENABLE_BOOST_COROUTINE "run benchmarks with boost coroutine" off) | ||
|
|
||
| option(immer_BUILD_TESTS "Build tests" ON) | ||
| option(immer_BUILD_TESTS "Build tests" "${PROJECT_IS_TOP_LEVEL}") |
There was a problem hiding this comment.
PROJECT_IS_TOP_LEVEL was introduced in 3.12. it could be emulated via CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME, but i wonder if that's worth the effort: cmake 3.21 is from 2021, so widely available already
|
|
||
| install(TARGETS immer EXPORT ImmerConfig) | ||
| target_sources(immer PUBLIC FILE_SET HEADERS | ||
| FILES |
There was a problem hiding this comment.
exposing the headers to IDE project files ... quite a bit of a quality-of-life improvement
There was a problem hiding this comment.
What happens if I forget to update it?
There was a problem hiding this comment.
afaict it is mainly cosmetic, i.e. it will allow IDEs to populate targets with headers and aid indexers (at least that's how it's used with qtcreator/clangd). if a file is missing, it won't show up in IDEs, but afaict that's it ...
|
Looking good, thank you! Will merge this and the ones in |