Tests: Cover set_property for buildsystem target properties
Extend the RunCMake.set_property test with cases covering buildsystem target properties: * COMPILE_DEFINITIONS * COMPILE_FEATURES * COMPILE_OPTIONS * INCLUDE_DIRECTORIES * LINK_LIBRARIES * SOURCES Also test a non-buildsystem property to document the current difference in behavior. Refactor the existing LINK_LIBRARIES case to the same more-extensive test as the rest. Use the output generated by CMake 3.3 as the expected output for each test case.
This commit is contained in:
parent
407ff47eca
commit
b9856862fe
|
@ -0,0 +1 @@
|
|||
-- Target COMPILE_DEFINITIONS is 'a;;b;c;;d;;e'
|
|
@ -0,0 +1,2 @@
|
|||
include(Common.cmake)
|
||||
test_target_property(COMPILE_DEFINITIONS)
|
|
@ -0,0 +1 @@
|
|||
-- Target COMPILE_FEATURES is 'a;;b;c;;d;;e'
|
|
@ -0,0 +1,2 @@
|
|||
include(Common.cmake)
|
||||
test_target_property(COMPILE_FEATURES)
|
|
@ -0,0 +1 @@
|
|||
-- Target COMPILE_OPTIONS is 'a;;b;c;;d;;e'
|
|
@ -0,0 +1,2 @@
|
|||
include(Common.cmake)
|
||||
test_target_property(COMPILE_OPTIONS)
|
|
@ -0,0 +1,14 @@
|
|||
macro(test_target_property PROP)
|
||||
add_custom_target(CustomTarget)
|
||||
set_property(TARGET CustomTarget PROPERTY ${PROP} x)
|
||||
set_property(TARGET CustomTarget PROPERTY ${PROP})
|
||||
set_property(TARGET CustomTarget APPEND PROPERTY ${PROP})
|
||||
set_property(TARGET CustomTarget PROPERTY ${PROP} a)
|
||||
set_property(TARGET CustomTarget APPEND PROPERTY ${PROP} "")
|
||||
set_property(TARGET CustomTarget APPEND PROPERTY ${PROP} b c)
|
||||
set_property(TARGET CustomTarget APPEND PROPERTY ${PROP})
|
||||
set_property(TARGET CustomTarget APPEND PROPERTY ${PROP} "d;;e")
|
||||
get_property(val TARGET CustomTarget PROPERTY ${PROP})
|
||||
message(STATUS "Target ${PROP} is '${val}'")
|
||||
set_property(TARGET CustomTarget PROPERTY ${PROP})
|
||||
endmacro()
|
|
@ -0,0 +1 @@
|
|||
-- Target INCLUDE_DIRECTORIES is 'a;;b;c;;d;;e'
|
|
@ -0,0 +1,2 @@
|
|||
include(Common.cmake)
|
||||
test_target_property(INCLUDE_DIRECTORIES)
|
|
@ -0,0 +1 @@
|
|||
-- Target LINK_LIBRARIES is 'a;;b;c;;d;;e'
|
|
@ -1,7 +1,2 @@
|
|||
add_custom_target(CustomTarget)
|
||||
set_property(TARGET CustomTarget PROPERTY LINK_LIBRARIES)
|
||||
set_property(TARGET CustomTarget APPEND PROPERTY LINK_LIBRARIES)
|
||||
get_property(val TARGET CustomTarget PROPERTY LINK_LIBRARIES)
|
||||
if (NOT "${val}" STREQUAL "")
|
||||
message(FATAL_ERROR "LINK_LIBRARIES value is '${val}' but should be ''")
|
||||
endif()
|
||||
include(Common.cmake)
|
||||
test_target_property(LINK_LIBRARIES)
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
include(RunCMake)
|
||||
|
||||
run_cmake(COMPILE_DEFINITIONS)
|
||||
run_cmake(COMPILE_FEATURES)
|
||||
run_cmake(COMPILE_OPTIONS)
|
||||
run_cmake(INCLUDE_DIRECTORIES)
|
||||
run_cmake(LINK_LIBRARIES)
|
||||
run_cmake(SOURCES)
|
||||
run_cmake(USER_PROP)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
-- Target SOURCES is 'a;b;c;d;e'
|
|
@ -0,0 +1,2 @@
|
|||
include(Common.cmake)
|
||||
test_target_property(SOURCES)
|
|
@ -0,0 +1 @@
|
|||
-- Target USER_PROP is 'a;b;c;d;;e'
|
|
@ -0,0 +1,2 @@
|
|||
include(Common.cmake)
|
||||
test_target_property(USER_PROP)
|
Loading…
Reference in New Issue