diff options
Diffstat (limited to 'Tests')
51 files changed, 187 insertions, 80 deletions
diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt index 07d7c43..33757b6 100644 --- a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt @@ -22,6 +22,9 @@ generate_export_header(staticlib1) add_library(staticlib2 STATIC staticlib2.cpp) generate_export_header(staticlib2) target_link_libraries(staticlib1 LINK_PUBLIC staticlib2) +if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang) + target_link_libraries(staticlib1 LINK_PRIVATE "-Wl,-v") +endif() add_executable(staticlib_exe staticlib_exe.cpp) target_link_libraries(staticlib_exe staticlib1) diff --git a/Tests/CPackWiXGenerator/CMakeLists.txt b/Tests/CPackWiXGenerator/CMakeLists.txt index 475e60d..b54925a 100644 --- a/Tests/CPackWiXGenerator/CMakeLists.txt +++ b/Tests/CPackWiXGenerator/CMakeLists.txt @@ -4,15 +4,17 @@ project(CPackWiXGenerator) add_library(mylib mylib.cpp) -add_executable(mylibapp mylibapp.cpp) -target_link_libraries(mylibapp mylib) +add_executable(my-libapp mylibapp.cpp) +target_link_libraries(my-libapp mylib) + +add_executable(my-other-app myotherapp.cpp) install(TARGETS mylib ARCHIVE DESTINATION lib COMPONENT libraries) -install(TARGETS mylibapp +install(TARGETS my-libapp my-other-app RUNTIME DESTINATION bin COMPONENT applications) @@ -36,7 +38,11 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example") set(CPACK_WIX_UPGRADE_GUID "BF20CE5E-7F7C-401D-8F7C-AB45E8D170E6") set(CPACK_WIX_UNINSTALL "1") -set(CPACK_PACKAGE_EXECUTABLES "mylibapp; CPack Wix Test") + +set(CPACK_PACKAGE_EXECUTABLES + "my-libapp" "CPack WiX Test" + "my-other-app" "Second CPack WiX Test" +) include(CPack) diff --git a/Tests/CPackWiXGenerator/myotherapp.cpp b/Tests/CPackWiXGenerator/myotherapp.cpp new file mode 100644 index 0000000..c272dab --- /dev/null +++ b/Tests/CPackWiXGenerator/myotherapp.cpp @@ -0,0 +1 @@ +int main() {}
\ No newline at end of file diff --git a/Tests/CTestTest2/test.cmake.in b/Tests/CTestTest2/test.cmake.in index 26a77a7..c5a7b45 100644 --- a/Tests/CTestTest2/test.cmake.in +++ b/Tests/CTestTest2/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestBadExe/test.cmake.in b/Tests/CTestTestBadExe/test.cmake.in index 03ebd04..a7420fc 100644 --- a/Tests/CTestTestBadExe/test.cmake.in +++ b/Tests/CTestTestBadExe/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestChecksum/test.cmake.in b/Tests/CTestTestChecksum/test.cmake.in index efc53fb..b18cdf3 100644 --- a/Tests/CTestTestChecksum/test.cmake.in +++ b/Tests/CTestTestChecksum/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestCostSerial/test.cmake.in b/Tests/CTestTestCostSerial/test.cmake.in index bfb3d9a..e2dda95 100644 --- a/Tests/CTestTestCostSerial/test.cmake.in +++ b/Tests/CTestTestCostSerial/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestCrash/test.cmake.in b/Tests/CTestTestCrash/test.cmake.in index 492966c..7ac1bb9 100644 --- a/Tests/CTestTestCrash/test.cmake.in +++ b/Tests/CTestTestCrash/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestCycle/test.cmake.in b/Tests/CTestTestCycle/test.cmake.in index e9c9a4e..94b9cac 100644 --- a/Tests/CTestTestCycle/test.cmake.in +++ b/Tests/CTestTestCycle/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestDepends/test.cmake.in b/Tests/CTestTestDepends/test.cmake.in index 002958b..98b2a27 100644 --- a/Tests/CTestTestDepends/test.cmake.in +++ b/Tests/CTestTestDepends/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestFailure/testNoBuild.cmake.in b/Tests/CTestTestFailure/testNoBuild.cmake.in index 3c4d219..1dee1ae 100644 --- a/Tests/CTestTestFailure/testNoBuild.cmake.in +++ b/Tests/CTestTestFailure/testNoBuild.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestFailure/testNoExe.cmake.in b/Tests/CTestTestFailure/testNoExe.cmake.in index a133e2a..04e444d 100644 --- a/Tests/CTestTestFailure/testNoExe.cmake.in +++ b/Tests/CTestTestFailure/testNoExe.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestParallel/test.cmake.in b/Tests/CTestTestParallel/test.cmake.in index a0d9fb3..5826342 100644 --- a/Tests/CTestTestParallel/test.cmake.in +++ b/Tests/CTestTestParallel/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestResourceLock/test.cmake.in b/Tests/CTestTestResourceLock/test.cmake.in index 1e7e344..f69b519 100644 --- a/Tests/CTestTestResourceLock/test.cmake.in +++ b/Tests/CTestTestResourceLock/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestScheduler/test.cmake.in b/Tests/CTestTestScheduler/test.cmake.in index 8ad6137..26d8058 100644 --- a/Tests/CTestTestScheduler/test.cmake.in +++ b/Tests/CTestTestScheduler/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestStopTime/GetDate.cmake b/Tests/CTestTestStopTime/GetDate.cmake index 60f1e0c..fc55031 100644 --- a/Tests/CTestTestStopTime/GetDate.cmake +++ b/Tests/CTestTestStopTime/GetDate.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.2) +cmake_minimum_required(VERSION 2.4) macro(GET_DATE) # diff --git a/Tests/CTestTestStopTime/test.cmake.in b/Tests/CTestTestStopTime/test.cmake.in index 6804789..d4e5a25 100644 --- a/Tests/CTestTestStopTime/test.cmake.in +++ b/Tests/CTestTestStopTime/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestSubdir/test.cmake.in b/Tests/CTestTestSubdir/test.cmake.in index 526d453..2b4ef4f 100644 --- a/Tests/CTestTestSubdir/test.cmake.in +++ b/Tests/CTestTestSubdir/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestTimeout/test.cmake.in b/Tests/CTestTestTimeout/test.cmake.in index 40241ff..d3d0888 100644 --- a/Tests/CTestTestTimeout/test.cmake.in +++ b/Tests/CTestTestTimeout/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestUpload/test.cmake.in b/Tests/CTestTestUpload/test.cmake.in index 19abc89..340877f 100644 --- a/Tests/CTestTestUpload/test.cmake.in +++ b/Tests/CTestTestUpload/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CTestTestZeroTimeout/test.cmake.in b/Tests/CTestTestZeroTimeout/test.cmake.in index 745e5bc..3252754 100644 --- a/Tests/CTestTestZeroTimeout/test.cmake.in +++ b/Tests/CTestTestZeroTimeout/test.cmake.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.1) +cmake_minimum_required(VERSION 2.4) # Settings: set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") diff --git a/Tests/CompatibleInterface/CMakeLists.txt b/Tests/CompatibleInterface/CMakeLists.txt index 5ee9fd7..8186c61 100644 --- a/Tests/CompatibleInterface/CMakeLists.txt +++ b/Tests/CompatibleInterface/CMakeLists.txt @@ -20,11 +20,25 @@ set_property(TARGET iface1 APPEND PROPERTY STRING_PROP2 STRING_PROP3 ) +set_property(TARGET iface1 APPEND PROPERTY + COMPATIBLE_INTERFACE_NUMBER_MIN + NUMBER_MIN_PROP1 + NUMBER_MIN_PROP2 +) +set_property(TARGET iface1 APPEND PROPERTY + COMPATIBLE_INTERFACE_NUMBER_MAX + NUMBER_MAX_PROP1 + NUMBER_MAX_PROP2 +) set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP1 ON) set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP2 ON) 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) +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_executable(CompatibleInterface main.cpp) target_link_libraries(CompatibleInterface iface1) @@ -33,6 +47,10 @@ set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP2 ON) set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP3 ON) set_property(TARGET CompatibleInterface PROPERTY STRING_PROP2 prop2) set_property(TARGET CompatibleInterface PROPERTY STRING_PROP3 prop3) +set_property(TARGET CompatibleInterface PROPERTY NUMBER_MIN_PROP1 50) +set_property(TARGET CompatibleInterface PROPERTY NUMBER_MIN_PROP2 250) +set_property(TARGET CompatibleInterface PROPERTY NUMBER_MAX_PROP1 50) +set_property(TARGET CompatibleInterface PROPERTY NUMBER_MAX_PROP2 250) target_compile_definitions(CompatibleInterface PRIVATE @@ -42,6 +60,10 @@ target_compile_definitions(CompatibleInterface $<$<STREQUAL:$<TARGET_PROPERTY:STRING_PROP1>,prop1>:STRING_PROP1> $<$<STREQUAL:$<TARGET_PROPERTY:STRING_PROP2>,prop2>:STRING_PROP2> $<$<STREQUAL:$<TARGET_PROPERTY:STRING_PROP3>,prop3>:STRING_PROP3> + $<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MIN_PROP1>,50>:NUMBER_MIN_PROP1=50> + $<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MIN_PROP2>,200>:NUMBER_MIN_PROP2=200> + $<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MAX_PROP1>,100>:NUMBER_MAX_PROP1=100> + $<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MAX_PROP2>,250>:NUMBER_MAX_PROP2=250> ) diff --git a/Tests/CompatibleInterface/main.cpp b/Tests/CompatibleInterface/main.cpp index f5e6e38..fa299e9 100644 --- a/Tests/CompatibleInterface/main.cpp +++ b/Tests/CompatibleInterface/main.cpp @@ -23,6 +23,19 @@ #error Expected STRING_PROP3 #endif +template<bool test> +struct CMakeStaticAssert; + +template<> +struct CMakeStaticAssert<true> {}; + +enum { + NumericMaxTest1 = sizeof(CMakeStaticAssert<NUMBER_MAX_PROP1 == 100>), + NumericMaxTest2 = sizeof(CMakeStaticAssert<NUMBER_MAX_PROP2 == 250>), + NumericMinTest1 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP1 == 50>), + NumericMinTest2 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP2 == 200>) +}; + #include "iface2.h" int main(int argc, char **argv) diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index 50dccbe..6711147 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -1,7 +1,7 @@ # # A more complex test case # -set(CMAKE_BACKWARDS_COMPATIBILITY 1.4) +cmake_minimum_required(VERSION 2.4) project (Complex) # Try setting a new policy. The IF test is for coverage. diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt index 2613f27..bf23d4a 100644 --- a/Tests/Complex/Executable/CMakeLists.txt +++ b/Tests/Complex/Executable/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 1.3) # # Create exe. # diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx index e904f28..31442ba 100644 --- a/Tests/Complex/Executable/complex.cxx +++ b/Tests/Complex/Executable/complex.cxx @@ -838,13 +838,13 @@ int main() #endif #endif // defined(_WIN32) && !defined(__CYGWIN__) - if(strcmp(CMAKE_MINIMUM_REQUIRED_VERSION, "1.3") == 0) + if(strcmp(CMAKE_MINIMUM_REQUIRED_VERSION, "2.4") == 0) { - cmPassed("CMAKE_MINIMUM_REQUIRED_VERSION is set to 1.3"); + cmPassed("CMAKE_MINIMUM_REQUIRED_VERSION is set to 2.4"); } else { - cmFailed("CMAKE_MINIMUM_REQUIRED_VERSION is not set to the expected 1.3"); + cmFailed("CMAKE_MINIMUM_REQUIRED_VERSION is not set to the expected 2.4"); } // ---------------------------------------------------------------------- diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index cbb4286..1abf45d 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -1,7 +1,7 @@ # # A more complex test case # -set(CMAKE_BACKWARDS_COMPATIBILITY 1.4) +cmake_minimum_required(VERSION 2.4) project (Complex) # Try setting a new policy. The IF test is for coverage. diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt index 432dbf8..01f1005 100644 --- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 1.3) # # Create exe. # diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx index e904f28..31442ba 100644 --- a/Tests/ComplexOneConfig/Executable/complex.cxx +++ b/Tests/ComplexOneConfig/Executable/complex.cxx @@ -838,13 +838,13 @@ int main() #endif #endif // defined(_WIN32) && !defined(__CYGWIN__) - if(strcmp(CMAKE_MINIMUM_REQUIRED_VERSION, "1.3") == 0) + if(strcmp(CMAKE_MINIMUM_REQUIRED_VERSION, "2.4") == 0) { - cmPassed("CMAKE_MINIMUM_REQUIRED_VERSION is set to 1.3"); + cmPassed("CMAKE_MINIMUM_REQUIRED_VERSION is set to 2.4"); } else { - cmFailed("CMAKE_MINIMUM_REQUIRED_VERSION is not set to the expected 1.3"); + cmFailed("CMAKE_MINIMUM_REQUIRED_VERSION is not set to the expected 2.4"); } // ---------------------------------------------------------------------- diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt index 13a07b4..0aeefaa 100644 --- a/Tests/ObjectLibrary/CMakeLists.txt +++ b/Tests/ObjectLibrary/CMakeLists.txt @@ -58,3 +58,5 @@ target_compile_definitions(ABmain PUBLIC $<TARGET_PROPERTY:B,INTERFACE_COMPILE_D add_executable(UseABinternal ${dummy} $<TARGET_OBJECTS:ABmain> $<TARGET_OBJECTS:A> $<TARGET_OBJECTS:B> ) + +add_subdirectory(ExportLanguages) diff --git a/Tests/ObjectLibrary/ExportLanguages/CMakeLists.txt b/Tests/ObjectLibrary/ExportLanguages/CMakeLists.txt new file mode 100644 index 0000000..22c92a7 --- /dev/null +++ b/Tests/ObjectLibrary/ExportLanguages/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.8) +project(ExportLanguages CXX) +add_library(ExportLanguagesA OBJECT a.cxx) +add_library(ExportLanguagesB STATIC a.c $<TARGET_OBJECTS:ExportLanguagesA>) + +# Verify that object library languages are propagated. +export(TARGETS ExportLanguagesB NAMESPACE Exp FILE BExport.cmake) +include(ExternalProject) +ExternalProject_Add(ExportLanguagesTest + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ExportLanguagesTest" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/ExportLanguagesTest" + DOWNLOAD_COMMAND "" + INSTALL_COMMAND "" +) +add_dependencies(ExportLanguagesTest ExportLanguagesA ExportLanguagesB) diff --git a/Tests/ObjectLibrary/ExportLanguages/ExportLanguagesTest/CMakeLists.txt b/Tests/ObjectLibrary/ExportLanguages/ExportLanguagesTest/CMakeLists.txt new file mode 100644 index 0000000..fc8dd2b --- /dev/null +++ b/Tests/ObjectLibrary/ExportLanguages/ExportLanguagesTest/CMakeLists.txt @@ -0,0 +1,14 @@ + +cmake_minimum_required(VERSION 2.8) + +project(ExportLanguagesTest) + +include(${CMAKE_CURRENT_BINARY_DIR}/../BExport.cmake) +get_property(configs TARGET ExpExportLanguagesB PROPERTY IMPORTED_CONFIGURATIONS) +foreach(c ${configs}) + get_property(langs TARGET ExpExportLanguagesB PROPERTY IMPORTED_LINK_INTERFACE_LANGUAGES_${c}) + list(FIND langs CXX pos) + if(${pos} LESS 0) + message(FATAL_ERROR "Target export does not list object library languages.") + endif() +endforeach() diff --git a/Tests/ObjectLibrary/ExportLanguages/a.c b/Tests/ObjectLibrary/ExportLanguages/a.c new file mode 100644 index 0000000..af20d3f --- /dev/null +++ b/Tests/ObjectLibrary/ExportLanguages/a.c @@ -0,0 +1 @@ +int a(void) { return 0; } diff --git a/Tests/RunCMake/ObjectLibrary/a.cxx b/Tests/ObjectLibrary/ExportLanguages/a.cxx index ae9c87c..ae9c87c 100644 --- a/Tests/RunCMake/ObjectLibrary/a.cxx +++ b/Tests/ObjectLibrary/ExportLanguages/a.cxx diff --git a/Tests/Plugin/CMakeLists.txt b/Tests/Plugin/CMakeLists.txt index d1b8334..c6ed15d 100644 --- a/Tests/Plugin/CMakeLists.txt +++ b/Tests/Plugin/CMakeLists.txt @@ -50,37 +50,15 @@ if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG AND # Verify that targets export with proper IMPORTED SONAME properties. export(TARGETS example_mod_1 example_mod_2 NAMESPACE exp_ FILE ${CMAKE_CURRENT_BINARY_DIR}/mods.cmake) - include(${CMAKE_CURRENT_BINARY_DIR}/mods.cmake) - get_property(configs TARGET exp_example_mod_1 PROPERTY IMPORTED_CONFIGURATIONS) - foreach(c ${configs}) - string(TOUPPER "${c}" CONFIG) - get_property(soname1 TARGET exp_example_mod_1 PROPERTY IMPORTED_SONAME_${CONFIG}) - get_property(soname2 TARGET exp_example_mod_2 PROPERTY IMPORTED_NO_SONAME_${CONFIG}) - if(soname1) - message(STATUS "exp_example_mod_1 has IMPORTED_SONAME_${CONFIG} as expected: ${soname1}") - else() - message(SEND_ERROR "exp_example_mod_1 does not have IMPORTED_SONAME_${CONFIG} but should") - endif() - if(soname2) - message(STATUS "exp_example_mod_2 has IMPORTED_NO_SONAME_${CONFIG} as expected: ${soname2}") - else() - message(SEND_ERROR "exp_example_mod_2 does not have IMPORTED_NO_SONAME_${CONFIG} but should") - endif() - endforeach() - # Parse the binary to check for SONAME if possible. - if("${CMAKE_EXECUTABLE_FORMAT}" MATCHES "ELF") - find_program(READELF_EXE readelf) - if(READELF_EXE) - add_custom_target(check_mod_soname ALL COMMAND - ${CMAKE_COMMAND} -Dreadelf=${READELF_EXE} - -Dmod1=$<TARGET_FILE:example_mod_1> - -Dmod2=$<TARGET_FILE:example_mod_2> - -P ${CMAKE_CURRENT_SOURCE_DIR}/check_mod_soname.cmake - ) - add_dependencies(check_mod_soname example_mod_1 example_mod_2) - endif() - endif() + include(ExternalProject) + ExternalProject_Add(PluginTest + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/PluginTest" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/PluginTest" + DOWNLOAD_COMMAND "" + INSTALL_COMMAND "" + ) + add_dependencies(PluginTest example_mod_1 example_mod_2) endif() # TODO: diff --git a/Tests/Plugin/PluginTest/CMakeLists.txt b/Tests/Plugin/PluginTest/CMakeLists.txt new file mode 100644 index 0000000..79ef8a9 --- /dev/null +++ b/Tests/Plugin/PluginTest/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 2.8) + +project(PluginTest) + +include(${CMAKE_CURRENT_BINARY_DIR}/../mods.cmake) +get_property(configs TARGET exp_example_mod_1 PROPERTY IMPORTED_CONFIGURATIONS) +foreach(c ${configs}) + string(TOUPPER "${c}" CONFIG) + get_property(soname1 TARGET exp_example_mod_1 PROPERTY IMPORTED_SONAME_${CONFIG}) + get_property(soname2 TARGET exp_example_mod_2 PROPERTY IMPORTED_NO_SONAME_${CONFIG}) + if(soname1) + message(STATUS "exp_example_mod_1 has IMPORTED_SONAME_${CONFIG} as expected: ${soname1}") + else() + message(SEND_ERROR "exp_example_mod_1 does not have IMPORTED_SONAME_${CONFIG} but should") + endif() + if(soname2) + message(STATUS "exp_example_mod_2 has IMPORTED_NO_SONAME_${CONFIG} as expected: ${soname2}") + else() + message(SEND_ERROR "exp_example_mod_2 does not have IMPORTED_NO_SONAME_${CONFIG} but should") + endif() +endforeach() + +# Parse the binary to check for SONAME if possible. +if("${CMAKE_EXECUTABLE_FORMAT}" MATCHES "ELF") + find_program(READELF_EXE readelf) + if(READELF_EXE) + add_custom_target(check_mod_soname ALL COMMAND + ${CMAKE_COMMAND} -Dreadelf=${READELF_EXE} + -Dmod1=$<TARGET_FILE:exp_example_mod_1> + -Dmod2=$<TARGET_FILE:exp_example_mod_2> + -P ${CMAKE_CURRENT_SOURCE_DIR}/../check_mod_soname.cmake + ) + endif() +endif() diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake index 3e4144f..ad3b8df 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake +++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static.cmake @@ -5,4 +5,8 @@ add_library(foo STATIC empty_vs6_1.cpp) add_library(bar STATIC empty_vs6_2.cpp) add_library(bat STATIC empty_vs6_3.cpp) target_link_libraries(foo bar) -target_link_libraries(bar bat) +# The last element here needs to contain a space so that it is a single +# element which is not a valid target name. As bar is a STATIC library, +# this tests that the LINK_ONLY generator expression is not used for +# that element, creating an error. +target_link_libraries(bar bat "-lz -lm") diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 8148cb6..e84aba2 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -93,6 +93,7 @@ add_RunCMake_test(Syntax) add_RunCMake_test(add_dependencies) add_RunCMake_test(build_command) +add_RunCMake_test(cmake_minimum_required) add_RunCMake_test(find_package) add_RunCMake_test(get_filename_component) add_RunCMake_test(if) diff --git a/Tests/RunCMake/DisallowedCommands/CMakeLists.txt b/Tests/RunCMake/DisallowedCommands/CMakeLists.txt index e8db6b0..12cd3c7 100644 --- a/Tests/RunCMake/DisallowedCommands/CMakeLists.txt +++ b/Tests/RunCMake/DisallowedCommands/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.4) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ObjectLibrary/ExportLanguages.cmake b/Tests/RunCMake/ObjectLibrary/ExportLanguages.cmake deleted file mode 100644 index 0796c21..0000000 --- a/Tests/RunCMake/ObjectLibrary/ExportLanguages.cmake +++ /dev/null @@ -1,15 +0,0 @@ -enable_language(CXX) -add_library(A OBJECT a.cxx) -add_library(B STATIC a.c $<TARGET_OBJECTS:A>) - -# Verify that object library languages are propagated. -export(TARGETS B NAMESPACE Exp FILE BExport.cmake) -include(${CMAKE_CURRENT_BINARY_DIR}/BExport.cmake) -get_property(configs TARGET ExpB PROPERTY IMPORTED_CONFIGURATIONS) -foreach(c ${configs}) - get_property(langs TARGET ExpB PROPERTY IMPORTED_LINK_INTERFACE_LANGUAGES_${c}) - list(FIND langs CXX pos) - if(${pos} LESS 0) - message(FATAL_ERROR "Target export does not list object library languages.") - endif() -endforeach() diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake index 55db14d..a74eaa8 100644 --- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake +++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake @@ -6,7 +6,6 @@ run_cmake(BadSourceExpression3) run_cmake(BadObjSource1) run_cmake(BadObjSource2) run_cmake(Export) -run_cmake(ExportLanguages) run_cmake(Import) run_cmake(Install) run_cmake(LinkObjLHS) diff --git a/Tests/RunCMake/cmake_minimum_required/Before24-stderr.txt b/Tests/RunCMake/cmake_minimum_required/Before24-stderr.txt new file mode 100644 index 0000000..4a6f16d --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Before24-stderr.txt @@ -0,0 +1,5 @@ +CMake Warning \(dev\) at Before24.cmake:1 \(cmake_minimum_required\): + Compatibility with CMake < 2.4 is not supported by CMake >= 3.0. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/cmake_minimum_required/Before24.cmake b/Tests/RunCMake/cmake_minimum_required/Before24.cmake new file mode 100644 index 0000000..c28fc8a --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Before24.cmake @@ -0,0 +1 @@ +cmake_minimum_required(VERSION 2.2) diff --git a/Tests/RunCMake/cmake_minimum_required/CMakeLists.txt b/Tests/RunCMake/cmake_minimum_required/CMakeLists.txt new file mode 100644 index 0000000..e8db6b0 --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/cmake_minimum_required/CompatBefore24-result.txt b/Tests/RunCMake/cmake_minimum_required/CompatBefore24-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/CompatBefore24-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_minimum_required/CompatBefore24-stderr.txt b/Tests/RunCMake/cmake_minimum_required/CompatBefore24-stderr.txt new file mode 100644 index 0000000..a874466 --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/CompatBefore24-stderr.txt @@ -0,0 +1,5 @@ +CMake Error in CMakeLists.txt: + You have set CMAKE_BACKWARDS_COMPATIBILITY to a CMake version less than + 2.4. This version of CMake only supports backwards compatibility with + CMake 2.4 or later. For compatibility with older versions please use any + CMake 2.8.x release or lower. diff --git a/Tests/RunCMake/cmake_minimum_required/CompatBefore24.cmake b/Tests/RunCMake/cmake_minimum_required/CompatBefore24.cmake new file mode 100644 index 0000000..ca0cb1d --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/CompatBefore24.cmake @@ -0,0 +1,2 @@ +cmake_minimum_required(VERSION 2.4) +set(CMAKE_BACKWARDS_COMPATIBILITY 2.2) diff --git a/Tests/RunCMake/cmake_minimum_required/PolicyBefore24-result.txt b/Tests/RunCMake/cmake_minimum_required/PolicyBefore24-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/PolicyBefore24-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_minimum_required/PolicyBefore24-stderr.txt b/Tests/RunCMake/cmake_minimum_required/PolicyBefore24-stderr.txt new file mode 100644 index 0000000..840211a --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/PolicyBefore24-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at PolicyBefore24.cmake:2 \(cmake_policy\): + Compatibility with CMake < 2.4 is not supported by CMake >= 3.0. For + compatibility with older versions please use any CMake 2.8.x release or + lower. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_minimum_required/PolicyBefore24.cmake b/Tests/RunCMake/cmake_minimum_required/PolicyBefore24.cmake new file mode 100644 index 0000000..62d3836 --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/PolicyBefore24.cmake @@ -0,0 +1,2 @@ +cmake_minimum_required(VERSION 2.4) +cmake_policy(VERSION 2.2) diff --git a/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake b/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake new file mode 100644 index 0000000..e4c65e3 --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(Before24) +run_cmake(CompatBefore24) +run_cmake(PolicyBefore24) |