diff options
author | Brad King <brad.king@kitware.com> | 2014-01-06 16:15:34 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-01-06 16:15:34 (GMT) |
commit | b225dbbd0235b545383105e0571f84a1bf6b1be0 (patch) | |
tree | f46e7515eb34bf6c51339a8b0d0cd7958daf09ef /Tests | |
parent | 1377542db5ab45043d6f3f6546fbd37a12dc9196 (diff) | |
parent | a55c70de78755d7086acaa639a92c9a7480d7938 (diff) | |
download | CMake-b225dbbd0235b545383105e0571f84a1bf6b1be0.zip CMake-b225dbbd0235b545383105e0571f84a1bf6b1be0.tar.gz CMake-b225dbbd0235b545383105e0571f84a1bf6b1be0.tar.bz2 |
Merge topic 'minor-cleanups'
a55c70d cmTarget: Remove support for <CONFIG>_LOCATION property.
c9f9b3c cmTarget: Test impliedByUse number-compatible properties.
fbe1fa7 cmTarget: Don't repeat property origin debug information.
01c545c cmTarget: Fix debug report for interface-set compatibility types.
c67e1a6 cmTarget: Fix reporting interface-set properties which are FALSE.
07b0f54 Qt Tests: Remove commented and unneeded line.
79db8ef cmTarget: Fix the property compatibility error message
43340a9 Help: Reformat Qt autogenerator documentation.
d98ea6c Help: Mark some code blocks as containing cmake code.
ea78935 GenerateExportHeader: Reformat docs.
272a20f cmTarget: Don't update IMPORTED target compilation properties
03d842a Run the add_compile_options command unit test.
cd3d0b6 get_property: Fix testing ALIASED_TARGET target property (#14670)
6a62228 install: Ensure that install(TARGETS) works with no DESTINATION
af3d3b8 export: Only generate and install configuration files if needed.
0de81bb Help: Workaround pygments reporting an error for genexes.
...
Diffstat (limited to 'Tests')
22 files changed, 133 insertions, 7 deletions
diff --git a/Tests/AliasTarget/CMakeLists.txt b/Tests/AliasTarget/CMakeLists.txt index fdb1638..9467fae 100644 --- a/Tests/AliasTarget/CMakeLists.txt +++ b/Tests/AliasTarget/CMakeLists.txt @@ -48,3 +48,25 @@ endif() add_library(iface INTERFACE) add_library(Alias::Iface ALIAS iface) + +get_target_property(_notAlias1 foo ALIASED_TARGET) +if (NOT DEFINED _notAlias1) + message(SEND_ERROR "_notAlias1 is not defined") +endif() +if (_notAlias1) + message(SEND_ERROR "_notAlias1 is defined, but foo is not an ALIAS") +endif() +if (NOT _notAlias1 STREQUAL _notAlias1-NOTFOUND) + message(SEND_ERROR "_notAlias1 not defined to a -NOTFOUND variant") +endif() + +get_property(_notAlias2 TARGET foo PROPERTY ALIASED_TARGET) +if (NOT DEFINED _notAlias2) + message(SEND_ERROR "_notAlias2 is not defined") +endif() +if (_notAlias2) + message(SEND_ERROR "_notAlias2 is defined, but foo is not an ALIAS") +endif() +if (NOT _notAlias2 STREQUAL _notAlias2-NOTFOUND) + message(SEND_ERROR "_notAlias2 not defined to a -NOTFOUND variant") +endif() diff --git a/Tests/CMakeCommands/add_compile_options/CMakeLists.txt b/Tests/CMakeCommands/add_compile_options/CMakeLists.txt index 1652cf6..995b32c 100644 --- a/Tests/CMakeCommands/add_compile_options/CMakeLists.txt +++ b/Tests/CMakeCommands/add_compile_options/CMakeLists.txt @@ -12,3 +12,10 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") "DO_GNU_TESTS" ) endif() + +add_compile_options(-rtti) +add_library(imp UNKNOWN IMPORTED) +get_target_property(_res imp COMPILE_OPTIONS) +if (_res) + message(SEND_ERROR "add_compile_options populated the COMPILE_OPTIONS target property") +endif() diff --git a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt index 900dbd0..14d40aa 100644 --- a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt @@ -25,3 +25,10 @@ target_compile_definitions(consumer target_compile_definitions(consumer PRIVATE ) + +add_definitions(-DSOME_DEF) +add_library(imp UNKNOWN IMPORTED) +get_target_property(_res imp COMPILE_DEFINITIONS) +if (_res) + message(SEND_ERROR "add_definitions populated the COMPILE_DEFINITIONS target property") +endif() diff --git a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt index 8a564c7..661bbaa 100644 --- a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt +++ b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt @@ -62,3 +62,10 @@ target_include_directories(consumer target_include_directories(consumer SYSTEM PRIVATE ) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +add_library(imp UNKNOWN IMPORTED) +get_target_property(_res imp INCLUDE_DIRECTORIES) +if (_res) + message(SEND_ERROR "include_directories populated the INCLUDE_DIRECTORIES target property") +endif() diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 063bd2d..78dddd3 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2168,6 +2168,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --output-log "${CMake_BINARY_DIR}/Tests/CTestConfig/ScriptWithArgs.log" ) + ADD_TEST_MACRO(CMakeCommands.add_compile_options add_compile_options) ADD_TEST_MACRO(CMakeCommands.target_link_libraries target_link_libraries) ADD_TEST_MACRO(CMakeCommands.target_include_directories target_include_directories) ADD_TEST_MACRO(CMakeCommands.target_compile_definitions target_compile_definitions) diff --git a/Tests/ExportImport/Export/Interface/CMakeLists.txt b/Tests/ExportImport/Export/Interface/CMakeLists.txt index f400f13..9d4793d 100644 --- a/Tests/ExportImport/Export/Interface/CMakeLists.txt +++ b/Tests/ExportImport/Export/Interface/CMakeLists.txt @@ -23,7 +23,10 @@ set_property(TARGET sharedlib PROPERTY INTERFACE_COMPILE_DEFINITIONS "SHAREDLIB_ add_library(sharediface INTERFACE) target_link_libraries(sharediface INTERFACE sharedlib) -install(TARGETS headeronly sharediface sharedlib +install(TARGETS headeronly sharediface + EXPORT expInterface +) +install(TARGETS sharedlib EXPORT expInterface RUNTIME DESTINATION bin LIBRARY DESTINATION lib NAMELINK_SKIP diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 9dd5289..7b99395 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -47,7 +47,6 @@ add_custom_target(generate_moc_input COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/myinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}" COMMAND ${CMAKE_COMMAND} -E rename "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h" ) -# set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/myinterface.h" PROPERTIES GENERATED TRUE) add_executable(QtAutogen main.cpp calwidget.cpp foo.cpp blub.cpp bar.cpp abc.cpp xyz.cpp yaf.cpp gadget.cpp $<TARGET_OBJECTS:privateSlot> diff --git a/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt index 0044564..e3efe28 100644 --- a/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt +++ b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt @@ -25,6 +25,28 @@ CMake Debug Log: \* Target "CompatibleInterface" property not set. + CMake Debug Log: + Boolean compatibility of property "BOOL_PROP5" for target + "CompatibleInterface" \(result: "FALSE"\): + + \* Target "CompatibleInterface" property not set. + \* Target "iface1" property value "FALSE" \(Interface set\) ++ +CMake Debug Log: + Boolean compatibility of property "BOOL_PROP6" for target + "CompatibleInterface" \(result: "FALSE"\): + + \* Target "CompatibleInterface" property not set. + \* Target "iface1" property value "FALSE" \(Interface set\) + \* Target "iface2" property value "FALSE" \(Agree\) ++ +CMake Debug Log: + Boolean compatibility of property "BOOL_PROP7" for target + "CompatibleInterface" \(result: "FALSE"\): + + \* Target "CompatibleInterface" property is implied by use. + \* Target "iface1" property value "FALSE" \(Agree\) ++ +CMake Debug Log: String compatibility of property "STRING_PROP1" for target "CompatibleInterface" \(result: "prop1"\): diff --git a/Tests/RunCMake/CompatibleInterface/DebugProperties.cmake b/Tests/RunCMake/CompatibleInterface/DebugProperties.cmake index 3214d8e..42a3af2 100644 --- a/Tests/RunCMake/CompatibleInterface/DebugProperties.cmake +++ b/Tests/RunCMake/CompatibleInterface/DebugProperties.cmake @@ -13,6 +13,9 @@ set_property(TARGET iface1 APPEND PROPERTY BOOL_PROP2 BOOL_PROP3 BOOL_PROP4 + BOOL_PROP5 + BOOL_PROP6 + BOOL_PROP7 ) set_property(TARGET iface1 APPEND PROPERTY COMPATIBLE_INTERFACE_STRING @@ -32,7 +35,7 @@ set_property(TARGET iface1 APPEND PROPERTY ) set(CMAKE_DEBUG_TARGET_PROPERTIES - BOOL_PROP1 BOOL_PROP2 BOOL_PROP3 BOOL_PROP4 + BOOL_PROP1 BOOL_PROP2 BOOL_PROP3 BOOL_PROP4 BOOL_PROP5 BOOL_PROP6 BOOL_PROP7 STRING_PROP1 STRING_PROP2 STRING_PROP3 NUMBER_MIN_PROP1 NUMBER_MIN_PROP2 NUMBER_MAX_PROP1 NUMBER_MAX_PROP2 @@ -40,6 +43,9 @@ set(CMAKE_DEBUG_TARGET_PROPERTIES set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP1 ON) set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP2 ON) +set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP5 OFF) +set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP6 OFF) +set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP7 OFF) set_property(TARGET iface1 PROPERTY INTERFACE_STRING_PROP1 prop1) set_property(TARGET iface1 PROPERTY INTERFACE_STRING_PROP2 prop2) set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP1 100) @@ -47,8 +53,15 @@ set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP2 200) set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP1 100) set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP2 200) +add_library(iface2 INTERFACE) +set_property(TARGET iface2 PROPERTY INTERFACE_BOOL_PROP6 OFF) + +add_library(iface3 INTERFACE) + add_executable(CompatibleInterface empty.cpp) -target_link_libraries(CompatibleInterface iface1) +target_link_libraries(CompatibleInterface iface1 iface2 + $<$<BOOL:$<TARGET_PROPERTY:BOOL_PROP7>>:iface3> +) set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP2 ON) set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP3 ON) diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-stderr.txt new file mode 100644 index 0000000..723daec --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-stderr.txt @@ -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. diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use.cmake new file mode 100644 index 0000000..a064d76 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use.cmake @@ -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>) diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-stderr.txt index 5a8f99d..900e3f8 100644 --- a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-stderr.txt +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-stderr.txt @@ -2,4 +2,5 @@ CMake Error in CMakeLists.txt: Property "SOMETHING" appears in both the COMPATIBLE_INTERFACE_BOOL and the COMPATIBLE_INTERFACE_STRING property in the dependencies of target "user". This is not allowed. A property may only require compatibility in a - boolean interpretation or a string interpretation, but not both. + boolean interpretation, a numeric minimum, a numeric maximum or a string + interpretation, but not a mixture. diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict.cmake index 711368a..4bae804 100644 --- a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict.cmake +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict.cmake @@ -1,9 +1,8 @@ add_library(foo UNKNOWN IMPORTED) -add_library(bar UNKNOWN IMPORTED) set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMETHING) set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING SOMETHING) add_executable(user main.cpp) -target_link_libraries(user foo bar) +target_link_libraries(user foo) diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-stderr.txt new file mode 100644 index 0000000..2cfbae4 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-stderr.txt @@ -0,0 +1,7 @@ +CMake Error in CMakeLists.txt: + Property "OTHER" appears in both the COMPATIBLE_INTERFACE_BOOL, + COMPATIBLE_INTERFACE_NUMBER_MIN and the COMPATIBLE_INTERFACE_STRING + property in the dependencies of target "user". This is not allowed. A + property may only require compatibility in a boolean interpretation, a + numeric minimum, a numeric maximum or a string interpretation, but not a + mixture. diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict.cmake new file mode 100644 index 0000000..164ffd9 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict.cmake @@ -0,0 +1,9 @@ + +add_library(foo UNKNOWN IMPORTED) + +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL OTHER) +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING OTHER) +set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_NUMBER_MIN OTHER) + +add_executable(user main.cpp) +target_link_libraries(user foo) diff --git a/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake b/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake index b87adc8..0b9729b 100644 --- a/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake @@ -7,8 +7,10 @@ run_cmake(InterfaceBool-builtin-prop) run_cmake(InterfaceString-mismatch-depends) run_cmake(InterfaceString-mismatch-depend-self) run_cmake(InterfaceString-mismatched-use) +run_cmake(InterfaceNumber-mismatched-use) run_cmake(InterfaceString-builtin-prop) run_cmake(InterfaceString-Bool-Conflict) +run_cmake(InterfaceString-Bool-Min-Conflict) run_cmake(DebugProperties) if (QT_QMAKE_EXECUTABLE}) diff --git a/Tests/RunCMake/interface_library/RunCMakeTest.cmake b/Tests/RunCMake/interface_library/RunCMakeTest.cmake index 0d00b71..d76600c 100644 --- a/Tests/RunCMake/interface_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/interface_library/RunCMakeTest.cmake @@ -5,3 +5,4 @@ run_cmake(target_commands) run_cmake(no_shared_libs) run_cmake(whitelist) run_cmake(genex_link) +run_cmake(add_dependencies) diff --git a/Tests/RunCMake/interface_library/add_dependencies-result.txt b/Tests/RunCMake/interface_library/add_dependencies-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/interface_library/add_dependencies-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/interface_library/add_dependencies-stderr.txt b/Tests/RunCMake/interface_library/add_dependencies-stderr.txt new file mode 100644 index 0000000..c550b68 --- /dev/null +++ b/Tests/RunCMake/interface_library/add_dependencies-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at add_dependencies.cmake:4 \(add_dependencies\): + add_dependencies Cannot add target-level dependencies to INTERFACE library + target "iface". + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/interface_library/add_dependencies.cmake b/Tests/RunCMake/interface_library/add_dependencies.cmake new file mode 100644 index 0000000..12cdfb4 --- /dev/null +++ b/Tests/RunCMake/interface_library/add_dependencies.cmake @@ -0,0 +1,4 @@ + +add_library(foo empty.cpp) +add_library(iface INTERFACE) +add_dependencies(iface foo) |