Update generator expressions paragraph

Thu, 18 Oct 2018 21:26:00 +0200

author
David Demelier <markand@malikania.fr>
date
Thu, 18 Oct 2018 21:26:00 +0200
changeset 40
cb25a20c1fc9
parent 39
ddf3183ec5ce
child 41
8a783de20b75

Update generator expressions paragraph

STYLE.md file | annotate | diff | comparison | revisions
--- 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

mercurial