Consider set_target_properties()
as a specialized form of set_property()
.
Advantages of …
-
set_target_properties(...)
is a convenience function because it allows to set multiple properties of multiple targets.For example:
add_executable(a ...) add_executable(b ...) set_target_properties( a b PROPERTIES LINKER_LANGUAGE CXX FOLDER "Executable" )
-
set_property(TARGET ...)
canAPPEND
to a list- orAPPEND_STRING
to a string-based property of targets.For example:
add_executable(a ...) set_property( TARGET a APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}" )
References
- How to change the name of the output binary to not be a.out with CMake?
- target_include_directories prior to 2.8.12?
- Appending compiler flags to a file with CMake