2012-08-09 11:44:15 +04:00
|
|
|
|
|
|
|
project(target_prop)
|
|
|
|
|
2012-08-22 15:03:56 +04:00
|
|
|
add_executable(target_prop_executable ../compiletest.cpp)
|
2012-08-09 11:44:15 +04:00
|
|
|
|
2012-08-21 13:05:07 +04:00
|
|
|
set_target_properties(target_prop_executable PROPERTIES COMPILE_DEFINITIONS CMAKE_IS_FUN)
|
2012-08-09 11:44:15 +04:00
|
|
|
|
2013-05-22 12:25:27 +04:00
|
|
|
if (NOT NO_SPACES_IN_DEFINE_VALUES)
|
|
|
|
set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS_REALLY="Very Fun" CMAKE_IS=Fun)
|
|
|
|
else()
|
|
|
|
set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS=Fun)
|
|
|
|
endif()
|
2012-08-09 11:44:15 +04:00
|
|
|
set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS_FUN CMAKE_IS_="Fun")
|
2012-09-21 01:28:09 +04:00
|
|
|
|
|
|
|
set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS
|
|
|
|
TEST_GENERATOR_EXPRESSIONS
|
|
|
|
"$<1:CMAKE_IS_DECLARATIVE>"
|
|
|
|
"$<0:GE_NOT_DEFINED>"
|
2012-10-12 19:17:30 +04:00
|
|
|
"$<1:ARGUMENT;LIST>"
|
2013-02-26 03:50:49 +04:00
|
|
|
PREFIX_$<JOIN:DEF1;DEF2,;PREFIX_>
|
|
|
|
LETTER_LIST1=\"$<JOIN:A;B;C;D,,>\"
|
|
|
|
LETTER_LIST2=\"$<JOIN:A;B;C;D,,,>\"
|
|
|
|
LETTER_LIST3=\"$<JOIN:A;B;C;D,,->\"
|
|
|
|
LETTER_LIST4=\"$<JOIN:A;B;C;D,-,->\"
|
|
|
|
LETTER_LIST5=\"$<JOIN:A;B;C;D,-,>\"
|
2013-07-18 14:58:48 +04:00
|
|
|
"$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:LINK_CXX_DEFINE>"
|
|
|
|
"$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,C>:LINK_C_DEFINE>"
|
|
|
|
"LINK_LANGUAGE_IS_$<TARGET_PROPERTY:LINKER_LANGUAGE>"
|
2012-09-21 01:28:09 +04:00
|
|
|
)
|
2013-03-25 17:43:22 +04:00
|
|
|
|
|
|
|
set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS
|
|
|
|
BUILD_IS_DEBUG=$<CONFIG:Debug>
|
|
|
|
BUILD_IS_NOT_DEBUG=$<NOT:$<CONFIG:Debug>>
|
|
|
|
)
|
2013-05-16 17:52:25 +04:00
|
|
|
|
|
|
|
add_executable(target_prop_c_executable ../compiletest.c)
|
|
|
|
|
2013-12-30 16:33:02 +04:00
|
|
|
cmake_policy(SET CMP0043 NEW)
|
|
|
|
set_property(TARGET target_prop_c_executable APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG_MODE)
|
|
|
|
|
2013-05-16 17:52:25 +04:00
|
|
|
set_property(TARGET target_prop_c_executable APPEND PROPERTY COMPILE_DEFINITIONS
|
2013-07-18 14:58:48 +04:00
|
|
|
"$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:LINK_CXX_DEFINE>"
|
|
|
|
"$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,C>:LINK_C_DEFINE>"
|
|
|
|
"LINK_LANGUAGE_IS_$<TARGET_PROPERTY:LINKER_LANGUAGE>"
|
2013-05-16 17:52:25 +04:00
|
|
|
)
|
|
|
|
|
|
|
|
# Resulting link language will be CXX
|
|
|
|
add_executable(target_prop_mixed_executable ../compiletest_mixed_c.c ../compiletest_mixed_cxx.cpp)
|
|
|
|
|
|
|
|
set_property(TARGET target_prop_mixed_executable APPEND PROPERTY COMPILE_DEFINITIONS
|
2013-07-18 14:58:48 +04:00
|
|
|
"$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:LINK_CXX_DEFINE>"
|
|
|
|
"$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,C>:LINK_C_DEFINE>"
|
|
|
|
"LINK_LANGUAGE_IS_$<TARGET_PROPERTY:LINKER_LANGUAGE>"
|
|
|
|
"C_EXECUTABLE_LINK_LANGUAGE_IS_$<TARGET_PROPERTY:target_prop_c_executable,LINKER_LANGUAGE>"
|
2013-05-16 17:52:25 +04:00
|
|
|
)
|
2014-08-06 17:51:08 +04:00
|
|
|
|
|
|
|
add_library(tgt STATIC IMPORTED)
|
|
|
|
set_property(TARGET tgt APPEND PROPERTY COMPILE_DEFINITIONS TGT_DEF TGT_TYPE_$<TARGET_PROPERTY:TYPE>)
|
|
|
|
add_executable(usetgt usetgt.c)
|
|
|
|
target_compile_definitions(usetgt PRIVATE $<TARGET_PROPERTY:tgt,COMPILE_DEFINITIONS>)
|