cmTarget: Test impliedByUse number-compatible properties.

Test that it is an error to read a number-compatible property to
determine the link implementation.  An alternative would be to
consider the value to be "0", however, that is too arbitrary
given the use-cases of this feature.  Values from this feature may
be used in setting a define, where "0" may have special or invalid
meaning and should be explicit.
This commit is contained in:
Stephen Kelly 2013-12-30 11:37:34 +01:00
parent fbe1fa722f
commit c9f9b3cd94
4 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,4 @@
CMake Error: Property SOMEPROP on target "user" is
implied to be empty because it was used to determine the link libraries
already. The INTERFACE_SOMEPROP property on
dependency "foo" is in conflict.

View File

@ -0,0 +1,9 @@
add_library(foo UNKNOWN IMPORTED)
add_library(bar UNKNOWN IMPORTED)
set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_NUMBER_MIN SOMEPROP)
set_property(TARGET foo PROPERTY INTERFACE_SOMEPROP 42)
add_executable(user main.cpp)
target_link_libraries(user foo $<$<STREQUAL:$<TARGET_PROPERTY:SOMEPROP>,42>:bar>)

View File

@ -7,6 +7,7 @@ run_cmake(InterfaceBool-builtin-prop)
run_cmake(InterfaceString-mismatch-depends) run_cmake(InterfaceString-mismatch-depends)
run_cmake(InterfaceString-mismatch-depend-self) run_cmake(InterfaceString-mismatch-depend-self)
run_cmake(InterfaceString-mismatched-use) run_cmake(InterfaceString-mismatched-use)
run_cmake(InterfaceNumber-mismatched-use)
run_cmake(InterfaceString-builtin-prop) run_cmake(InterfaceString-builtin-prop)
run_cmake(InterfaceString-Bool-Conflict) run_cmake(InterfaceString-Bool-Conflict)
run_cmake(InterfaceString-Bool-Min-Conflict) run_cmake(InterfaceString-Bool-Min-Conflict)