Mercurial > template
changeset 40:cb25a20c1fc9
Update generator expressions paragraph
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 18 Oct 2018 21:26:00 +0200 |
parents | ddf3183ec5ce |
children | 8a783de20b75 |
files | STYLE.md |
diffstat | 1 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/STYLE.md Thu Oct 18 21:21:00 2018 +0200 +++ b/STYLE.md Thu Oct 18 21:26:00 2018 +0200 @@ -571,17 +571,17 @@ target_link_libraries(main Boost::system) ``` -### Use generator expressions +### Generator expressions -Use generator expressions as much as you can, they offer much more flexibility -in case of multiple generators. Remember that CMake is not meant to be used only -with Makefiles. +Use generator expressions when it make sense. For example you should use them +for variables that are not used at generation time (e.g CMAKE\_BUILD\_TYPE). ```cmake -target_link_libraries( +target_include_directories( myapp - $<$<STREQUAL:${CMAKE_SYSTEM_NAME},Windows>:shlwapi> - $<$<STREQUAL:${CMAKE_SYSTEM_NAME},Linux>:dl> + $<BUILD_INTERFACE:${myapp_SOURCE_DIR}> + $<INSTALL_INTERFACE:include> +) ``` Warning: do never test against `CMAKE_BUILD_TYPE` in any CMakeLists.txt, IDEs