diff options
Diffstat (limited to 'Tests/RunCMake')
127 files changed, 870 insertions, 140 deletions
diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake index f4c070d..fd56e75 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake @@ -1,4 +1,4 @@ - +enable_language(CXX) cmake_policy(SET CMP0037 NEW) add_library("lib:colon" empty.cpp) diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake index e9f6404..83a7119 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved.cmake @@ -1,4 +1,4 @@ - +enable_language(CXX) cmake_policy(SET CMP0037 NEW) add_library(all empty.cpp) diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake b/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake index 9227986..2a288cc 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake @@ -1,4 +1,4 @@ - +enable_language(CXX) cmake_policy(SET CMP0037 NEW) add_library("lib with spaces" empty.cpp) diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake index 870a286..f52e4d2 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake +++ b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved.cmake @@ -1,4 +1,4 @@ - +enable_language(CXX) cmake_policy(SET CMP0037 OLD) add_library(all empty.cpp) diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake b/Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake index 46193a1..c9fb6c8 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake +++ b/Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake @@ -1,4 +1,4 @@ - +enable_language(CXX) cmake_policy(SET CMP0037 OLD) add_library("lib with spaces" empty.cpp) diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake index 445e3b2..1b1a405 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake +++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake @@ -1,4 +1,4 @@ - +enable_language(CXX) add_library("lib:colon" empty.cpp) add_executable("exe:colon" empty.cpp) add_custom_target("custom:colon") diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-reserved-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-reserved-stderr.txt new file mode 100644 index 0000000..2d556a7 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-reserved-stderr.txt @@ -0,0 +1,36 @@ +CMake Warning \(dev\) at CMP0037-WARN-reserved.cmake:2 \(add_library\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "all" is reserved or not valid for certain CMake features, + such as generator expressions, and may result in undefined behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at CMP0037-WARN-reserved.cmake:3 \(add_executable\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "clean" is reserved or not valid for certain CMake + features, such as generator expressions, and may result in undefined + behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at CMP0037-WARN-reserved.cmake:4 \(add_custom_target\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "help" is reserved or not valid for certain CMake features, + such as generator expressions, and may result in undefined behavior. +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/CMP0037/CMP0037-WARN-reserved.cmake b/Tests/RunCMake/CMP0037/CMP0037-WARN-reserved.cmake new file mode 100644 index 0000000..a5e0f10 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-reserved.cmake @@ -0,0 +1,4 @@ +enable_language(CXX) +add_library(all empty.cpp) +add_executable(clean empty.cpp) +add_custom_target(help) diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake b/Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake index e50a64d..e01b8e5 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake +++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake @@ -1,4 +1,4 @@ - +enable_language(CXX) add_library("lib with spaces" empty.cpp) add_executable("exe with spaces" empty.cpp) add_custom_target("custom with spaces") diff --git a/Tests/RunCMake/CMP0037/CMakeLists.txt b/Tests/RunCMake/CMP0037/CMakeLists.txt index f452db1..12cd3c7 100644 --- a/Tests/RunCMake/CMP0037/CMakeLists.txt +++ b/Tests/RunCMake/CMP0037/CMakeLists.txt @@ -1,3 +1,3 @@ cmake_minimum_required(VERSION 2.8.4) -project(${RunCMake_TEST} CXX) +project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-result.txt b/Tests/RunCMake/CMP0037/NEW-cond-package-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-result.txt +++ b/Tests/RunCMake/CMP0037/NEW-cond-package-result.txt diff --git a/Tests/RunCMake/CMP0037/NEW-cond-package-stderr.txt b/Tests/RunCMake/CMP0037/NEW-cond-package-stderr.txt new file mode 100644 index 0000000..270fa6d --- /dev/null +++ b/Tests/RunCMake/CMP0037/NEW-cond-package-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NEW-cond-package.cmake:4 \(add_custom_target\): + The target name "package" is reserved when CPack packaging is enabled. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0037/NEW-cond-package.cmake b/Tests/RunCMake/CMP0037/NEW-cond-package.cmake new file mode 100644 index 0000000..ceea907 --- /dev/null +++ b/Tests/RunCMake/CMP0037/NEW-cond-package.cmake @@ -0,0 +1,5 @@ +cmake_policy(SET CMP0037 NEW) +file(WRITE "${CMAKE_BINARY_DIR}/CPackConfig.cmake" "") +add_custom_target(test) +add_custom_target(package) +add_custom_target(package_source) diff --git a/Tests/RunCMake/add_executable/OnlyObjectSources-result.txt b/Tests/RunCMake/CMP0037/NEW-cond-package_source-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/add_executable/OnlyObjectSources-result.txt +++ b/Tests/RunCMake/CMP0037/NEW-cond-package_source-result.txt diff --git a/Tests/RunCMake/CMP0037/NEW-cond-package_source-stderr.txt b/Tests/RunCMake/CMP0037/NEW-cond-package_source-stderr.txt new file mode 100644 index 0000000..2d32147 --- /dev/null +++ b/Tests/RunCMake/CMP0037/NEW-cond-package_source-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at NEW-cond-package_source.cmake:5 \(add_custom_target\): + The target name "package_source" is reserved when CPack source packaging is + enabled. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0037/NEW-cond-package_source.cmake b/Tests/RunCMake/CMP0037/NEW-cond-package_source.cmake new file mode 100644 index 0000000..3f8883b --- /dev/null +++ b/Tests/RunCMake/CMP0037/NEW-cond-package_source.cmake @@ -0,0 +1,5 @@ +cmake_policy(SET CMP0037 NEW) +file(WRITE "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake" "") +add_custom_target(test) +add_custom_target(package) +add_custom_target(package_source) diff --git a/Tests/RunCMake/CMP0037/NEW-cond-test-result.txt b/Tests/RunCMake/CMP0037/NEW-cond-test-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0037/NEW-cond-test-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0037/NEW-cond-test-stderr.txt b/Tests/RunCMake/CMP0037/NEW-cond-test-stderr.txt new file mode 100644 index 0000000..44b4741 --- /dev/null +++ b/Tests/RunCMake/CMP0037/NEW-cond-test-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NEW-cond-test.cmake:3 \(add_custom_target\): + The target name "test" is reserved when CTest testing is enabled. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0037/NEW-cond-test.cmake b/Tests/RunCMake/CMP0037/NEW-cond-test.cmake new file mode 100644 index 0000000..7eeaffc --- /dev/null +++ b/Tests/RunCMake/CMP0037/NEW-cond-test.cmake @@ -0,0 +1,5 @@ +cmake_policy(SET CMP0037 NEW) +enable_testing() +add_custom_target(test) +add_custom_target(package) +add_custom_target(package_source) diff --git a/Tests/RunCMake/CMP0037/NEW-cond.cmake b/Tests/RunCMake/CMP0037/NEW-cond.cmake new file mode 100644 index 0000000..d0dc77af --- /dev/null +++ b/Tests/RunCMake/CMP0037/NEW-cond.cmake @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0037 NEW) +add_custom_target(test) +add_custom_target(package) +add_custom_target(package_source) diff --git a/Tests/RunCMake/CMP0037/OLD-cond-package.cmake b/Tests/RunCMake/CMP0037/OLD-cond-package.cmake new file mode 100644 index 0000000..7a0afbe --- /dev/null +++ b/Tests/RunCMake/CMP0037/OLD-cond-package.cmake @@ -0,0 +1,5 @@ +cmake_policy(SET CMP0037 OLD) +file(WRITE "${CMAKE_BINARY_DIR}/CPackConfig.cmake" "") +add_custom_target(test) +add_custom_target(package) +add_custom_target(package_source) diff --git a/Tests/RunCMake/CMP0037/OLD-cond-package_source.cmake b/Tests/RunCMake/CMP0037/OLD-cond-package_source.cmake new file mode 100644 index 0000000..95616b6 --- /dev/null +++ b/Tests/RunCMake/CMP0037/OLD-cond-package_source.cmake @@ -0,0 +1,5 @@ +cmake_policy(SET CMP0037 OLD) +file(WRITE "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake" "") +add_custom_target(test) +add_custom_target(package) +add_custom_target(package_source) diff --git a/Tests/RunCMake/CMP0037/OLD-cond-test.cmake b/Tests/RunCMake/CMP0037/OLD-cond-test.cmake new file mode 100644 index 0000000..bfa32a9 --- /dev/null +++ b/Tests/RunCMake/CMP0037/OLD-cond-test.cmake @@ -0,0 +1,5 @@ +cmake_policy(SET CMP0037 OLD) +enable_testing() +add_custom_target(test) +add_custom_target(package) +add_custom_target(package_source) diff --git a/Tests/RunCMake/CMP0037/OLD-cond.cmake b/Tests/RunCMake/CMP0037/OLD-cond.cmake new file mode 100644 index 0000000..abad680 --- /dev/null +++ b/Tests/RunCMake/CMP0037/OLD-cond.cmake @@ -0,0 +1,5 @@ +cmake_policy(SET CMP0037 OLD) + +add_custom_target(test) +add_custom_target(package) +add_custom_target(package_source) diff --git a/Tests/RunCMake/CMP0037/RunCMakeTest.cmake b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake index b7d8d7b..98274f0 100644 --- a/Tests/RunCMake/CMP0037/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake @@ -9,5 +9,22 @@ if(NOT (WIN32 AND "${RunCMake_GENERATOR}" MATCHES "Make")) run_cmake(CMP0037-WARN-colon) endif() +run_cmake(CMP0037-WARN-reserved) run_cmake(CMP0037-OLD-reserved) run_cmake(CMP0037-NEW-reserved) + +run_cmake(NEW-cond) +run_cmake(NEW-cond-test) +run_cmake(NEW-cond-package) +run_cmake(OLD-cond) +run_cmake(OLD-cond-test) +run_cmake(OLD-cond-package) +run_cmake(WARN-cond) +run_cmake(WARN-cond-test) +run_cmake(WARN-cond-package) + +if(RunCMake_GENERATOR MATCHES "Make|Ninja") + run_cmake(NEW-cond-package_source) + run_cmake(OLD-cond-package_source) + run_cmake(WARN-cond-package_source) +endif() diff --git a/Tests/RunCMake/CMP0037/WARN-cond-package-stderr.txt b/Tests/RunCMake/CMP0037/WARN-cond-package-stderr.txt new file mode 100644 index 0000000..5960e51 --- /dev/null +++ b/Tests/RunCMake/CMP0037/WARN-cond-package-stderr.txt @@ -0,0 +1,11 @@ +^CMake Warning \(dev\) at WARN-cond-package.cmake:4 \(add_custom_target\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "package" is reserved when CPack packaging is enabled. It + may result in undefined behavior. +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/CMP0037/WARN-cond-package.cmake b/Tests/RunCMake/CMP0037/WARN-cond-package.cmake new file mode 100644 index 0000000..61cdc68 --- /dev/null +++ b/Tests/RunCMake/CMP0037/WARN-cond-package.cmake @@ -0,0 +1,5 @@ + +file(WRITE "${CMAKE_BINARY_DIR}/CPackConfig.cmake" "") +add_custom_target(test) +add_custom_target(package) +add_custom_target(package_source) diff --git a/Tests/RunCMake/CMP0037/WARN-cond-package_source-stderr.txt b/Tests/RunCMake/CMP0037/WARN-cond-package_source-stderr.txt new file mode 100644 index 0000000..ae72909 --- /dev/null +++ b/Tests/RunCMake/CMP0037/WARN-cond-package_source-stderr.txt @@ -0,0 +1,11 @@ +^CMake Warning \(dev\) at WARN-cond-package_source.cmake:5 \(add_custom_target\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "package_source" is reserved when CPack source packaging is + enabled. It may result in undefined behavior. +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/CMP0037/WARN-cond-package_source.cmake b/Tests/RunCMake/CMP0037/WARN-cond-package_source.cmake new file mode 100644 index 0000000..468380c --- /dev/null +++ b/Tests/RunCMake/CMP0037/WARN-cond-package_source.cmake @@ -0,0 +1,5 @@ + +file(WRITE "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake" "") +add_custom_target(test) +add_custom_target(package) +add_custom_target(package_source) diff --git a/Tests/RunCMake/CMP0037/WARN-cond-test-stderr.txt b/Tests/RunCMake/CMP0037/WARN-cond-test-stderr.txt new file mode 100644 index 0000000..e7a3ee5 --- /dev/null +++ b/Tests/RunCMake/CMP0037/WARN-cond-test-stderr.txt @@ -0,0 +1,11 @@ +^CMake Warning \(dev\) at WARN-cond-test.cmake:3 \(add_custom_target\): + Policy CMP0037 is not set: Target names should not be reserved and should + match a validity pattern. Run "cmake --help-policy CMP0037" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + The target name "test" is reserved when CTest testing is enabled. It may + result in undefined behavior. +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/CMP0037/WARN-cond-test.cmake b/Tests/RunCMake/CMP0037/WARN-cond-test.cmake new file mode 100644 index 0000000..982af36 --- /dev/null +++ b/Tests/RunCMake/CMP0037/WARN-cond-test.cmake @@ -0,0 +1,5 @@ + +enable_testing() +add_custom_target(test) +add_custom_target(package) +add_custom_target(package_source) diff --git a/Tests/RunCMake/CMP0037/WARN-cond.cmake b/Tests/RunCMake/CMP0037/WARN-cond.cmake new file mode 100644 index 0000000..04a7f9d --- /dev/null +++ b/Tests/RunCMake/CMP0037/WARN-cond.cmake @@ -0,0 +1,4 @@ + +add_custom_target(test) +add_custom_target(package) +add_custom_target(package_source) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 29325ff..5d584af 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -15,6 +15,7 @@ macro(add_RunCMake_test test) add_test(NAME RunCMake.${test} COMMAND ${CMAKE_CMAKE_COMMAND} -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} -DRunCMake_GENERATOR=${CMAKE_GENERATOR} + -DRunCMake_GENERATOR_INSTANCE=${CMAKE_GENERATOR_INSTANCE} -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} -DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} -DRunCMake_MAKE_PROGRAM=${CMake_TEST_EXPLICIT_MAKE_PROGRAM} @@ -47,6 +48,7 @@ function(add_RunCMake_test_group test types) -DTEST_TYPE=${type} -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} -DRunCMake_GENERATOR=${CMAKE_GENERATOR} + -DRunCMake_GENERATOR_INSTANCE=${CMAKE_GENERATOR_INSTANCE} -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} -DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} -DRunCMake_MAKE_PROGRAM=${CMake_TEST_EXPLICIT_MAKE_PROGRAM} @@ -146,6 +148,7 @@ if(NOT CMAKE_C_COMPILER_ID MATCHES "Watcom") add_RunCMake_test(GenerateExportHeader) endif() add_RunCMake_test(GeneratorExpression) +add_RunCMake_test(GeneratorInstance) add_RunCMake_test(GeneratorPlatform) add_RunCMake_test(GeneratorToolset) add_RunCMake_test(GetPrerequisites) @@ -327,6 +330,7 @@ add_RunCMake_test(install) add_RunCMake_test(CPackConfig) add_RunCMake_test(CPackInstallProperties) add_RunCMake_test(ExternalProject) +add_RunCMake_test(FetchContent) add_RunCMake_test(CTestCommandLine) # Only run this test on unix platforms that support # symbolic links diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index aa55c44..b00e373 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -12,7 +12,7 @@ run_cpack_test(DIST "RPM" false "MONOLITHIC") run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true "MONOLITHIC;COMPONENT") run_cpack_test(VERSION "RPM;DEB" false "MONOLITHIC;COMPONENT") run_cpack_test(EXTRA "DEB" false "COMPONENT") -run_cpack_test(GENERATE_SHLIBS "DEB" true "COMPONENT") +run_cpack_test_subtests(GENERATE_SHLIBS "soversion_not_zero;soversion_zero" "DEB" true "COMPONENT") run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB" true "COMPONENT") run_cpack_test(INSTALL_SCRIPTS "RPM" false "COMPONENT") run_cpack_test(LONG_FILENAMES "DEB" false "MONOLITHIC") diff --git a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/VerifyResult.cmake index b1952ef..8cefeea 100644 --- a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/VerifyResult.cmake @@ -1,4 +1,9 @@ -set(shlibs_shlibs "^libtest_lib 0\\.8 generate_shlibs \\(\\= 0\\.1\\.1\\)\n$") +if(RunCMake_SUBTEST_SUFFIX STREQUAL "soversion_not_zero") + set(shlibs_shlibs "^libtest_lib 0\\.8 generate_shlibs \\(\\= 0\\.1\\.1\\)\n$") +else() # soversion_zero + set(shlibs_shlibs "^libtest_lib 0 generate_shlibs \\(\\= 0\\.1\\.1\\)\n$") +endif() + # optional dot at the end of permissions regex is for SELinux enabled systems set(shlibs_shlibs_permissions_regex "-rw-r--r--\.? .*") verifyDebControl("${FOUND_FILE_1}" "shlibs" "shlibs") diff --git a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/test.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/test.cmake index 90351ba..e0eb67b 100644 --- a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/test.cmake +++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/test.cmake @@ -9,6 +9,11 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n") add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp") -set_target_properties(test_lib PROPERTIES SOVERSION "0.8") + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "soversion_not_zero") + set_target_properties(test_lib PROPERTIES SOVERSION "0.8") +else() # soversion_zero + set_target_properties(test_lib PROPERTIES SOVERSION "0") +endif() install(TARGETS test_lib DESTINATION foo COMPONENT libs) diff --git a/Tests/RunCMake/FetchContent/CMakeLists.txt b/Tests/RunCMake/FetchContent/CMakeLists.txt new file mode 100644 index 0000000..d3137f6 --- /dev/null +++ b/Tests/RunCMake/FetchContent/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.9) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FetchContent/DirOverrides.cmake b/Tests/RunCMake/FetchContent/DirOverrides.cmake new file mode 100644 index 0000000..50eef16 --- /dev/null +++ b/Tests/RunCMake/FetchContent/DirOverrides.cmake @@ -0,0 +1,46 @@ +include(FetchContent) + +# Test using saved details +FetchContent_Declare( + t1 + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/savedSrc + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E make_directory <SOURCE_DIR> +) +FetchContent_Populate(t1) +if(NOT IS_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/savedSrc) + message(FATAL_ERROR "Saved details SOURCE_DIR override failed") +endif() + +# Test direct population +FetchContent_Populate( + t2 + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/directSrc + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E make_directory <SOURCE_DIR> +) +if(NOT IS_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/directSrc) + message(FATAL_ERROR "Direct details SOURCE_DIR override failed") +endif() + +# Ensure setting BINARY_DIR to SOURCE_DIR works (a technique to +# prevent an unwanted separate BINARY_DIR from being created, which +# ExternalProject_Add() does whether we like it or not) +FetchContent_Declare( + t3 + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/savedNoBuildDir + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/savedNoBuildDir + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E make_directory <SOURCE_DIR> +) +FetchContent_Populate(t3) +if(IS_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/savedNobuildDir-build) + message(FATAL_ERROR "Saved details BINARY_DIR override failed") +endif() + +FetchContent_Populate( + t4 + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/directNoBuildDir + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/directNoBuildDir + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E make_directory <SOURCE_DIR> +) +if(IS_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/savedNobuildDir-build) + message(FATAL_ERROR "Direct details BINARY_DIR override failed") +endif() diff --git a/Tests/RunCMake/FetchContent/DirectIgnoresDetails-stdout.txt b/Tests/RunCMake/FetchContent/DirectIgnoresDetails-stdout.txt new file mode 100644 index 0000000..6fa5a57 --- /dev/null +++ b/Tests/RunCMake/FetchContent/DirectIgnoresDetails-stdout.txt @@ -0,0 +1 @@ +Local details used diff --git a/Tests/RunCMake/FetchContent/DirectIgnoresDetails.cmake b/Tests/RunCMake/FetchContent/DirectIgnoresDetails.cmake new file mode 100644 index 0000000..0731b43 --- /dev/null +++ b/Tests/RunCMake/FetchContent/DirectIgnoresDetails.cmake @@ -0,0 +1,12 @@ +include(FetchContent) + +FetchContent_Declare( + t1 + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E echo "Saved details used" +) + +# No QUIET option given, so command output will be shown +FetchContent_Populate( + t1 + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E echo "Local details used" +) diff --git a/Tests/RunCMake/FetchContent/DownloadTwice-result.txt b/Tests/RunCMake/FetchContent/DownloadTwice-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FetchContent/DownloadTwice-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FetchContent/DownloadTwice-stderr.txt b/Tests/RunCMake/FetchContent/DownloadTwice-stderr.txt new file mode 100644 index 0000000..96fed48 --- /dev/null +++ b/Tests/RunCMake/FetchContent/DownloadTwice-stderr.txt @@ -0,0 +1 @@ +Content t1 already populated in diff --git a/Tests/RunCMake/FetchContent/DownloadTwice.cmake b/Tests/RunCMake/FetchContent/DownloadTwice.cmake new file mode 100644 index 0000000..6863c30 --- /dev/null +++ b/Tests/RunCMake/FetchContent/DownloadTwice.cmake @@ -0,0 +1,9 @@ +include(FetchContent) + +FetchContent_Declare( + t1 + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E echo "Download command executed" +) + +FetchContent_Populate(t1) +FetchContent_Populate(t1) # Triggers error diff --git a/Tests/RunCMake/FetchContent/FirstDetailsWin-stdout.txt b/Tests/RunCMake/FetchContent/FirstDetailsWin-stdout.txt new file mode 100644 index 0000000..7a8bf18 --- /dev/null +++ b/Tests/RunCMake/FetchContent/FirstDetailsWin-stdout.txt @@ -0,0 +1 @@ +First details used diff --git a/Tests/RunCMake/FetchContent/FirstDetailsWin.cmake b/Tests/RunCMake/FetchContent/FirstDetailsWin.cmake new file mode 100644 index 0000000..208b12d --- /dev/null +++ b/Tests/RunCMake/FetchContent/FirstDetailsWin.cmake @@ -0,0 +1,16 @@ +include(FetchContent) + +# Need to see the download command output +set(FETCHCONTENT_QUIET OFF) + +FetchContent_Declare( + t1 + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E echo "First details used" +) + +FetchContent_Declare( + t1 + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E echo "Second details used" +) + +FetchContent_Populate(t1) diff --git a/Tests/RunCMake/FetchContent/GetProperties.cmake b/Tests/RunCMake/FetchContent/GetProperties.cmake new file mode 100644 index 0000000..61c99fe --- /dev/null +++ b/Tests/RunCMake/FetchContent/GetProperties.cmake @@ -0,0 +1,67 @@ +include(FetchContent) + +# First confirm properties are empty even before declare +FetchContent_GetProperties(t1) +if(t1_POPULATED) + message(FATAL_ERROR "Property says populated before doing anything") +endif() +if(t1_SOURCE_DIR) + message(FATAL_ERROR "SOURCE_DIR property not initially empty") +endif() +if(t1_BINARY_DIR) + message(FATAL_ERROR "BINARY_DIR property not initially empty") +endif() + +# Declare, but no properties should change yet +FetchContent_Declare( + t1 + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/savedSrc + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/savedBin + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E echo "Do nothing" +) + +FetchContent_GetProperties(t1) +if(t1_POPULATED) + message(FATAL_ERROR "Property says populated after only declaring details") +endif() +if(t1_SOURCE_DIR) + message(FATAL_ERROR "SOURCE_DIR property not empty after declare") +endif() +if(t1_BINARY_DIR) + message(FATAL_ERROR "BINARY_DIR property not empty after declare") +endif() + +# Populate should make all properties non-empty/set +FetchContent_Populate(t1) + +FetchContent_GetProperties(t1) +if(NOT t1_POPULATED) + message(FATAL_ERROR "Population did not set POPULATED property") +endif() +if(NOT "${t1_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/savedSrc") + message(FATAL_ERROR "SOURCE_DIR property not correct after population: " + "${t1_SOURCE_DIR}\n" + " Expected: ${CMAKE_CURRENT_BINARY_DIR}/savedSrc") +endif() +if(NOT "${t1_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/savedBin") + message(FATAL_ERROR "BINARY_DIR property not correct after population: " + "${t1_BINARY_DIR}\n" + " Expected: ${CMAKE_CURRENT_BINARY_DIR}/savedBin") +endif() + +# Verify we can retrieve properties individually too +FetchContent_GetProperties(t1 POPULATED varPop) +FetchContent_GetProperties(t1 SOURCE_DIR varSrc) +FetchContent_GetProperties(t1 BINARY_DIR varBin) + +if(NOT varPop) + message(FATAL_ERROR "Failed to retrieve POPULATED property") +endif() +if(NOT "${varSrc}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/savedSrc") + message(FATAL_ERROR "SOURCE_DIR property not retrieved correctly: ${varSrc}\n" + " Expected: ${CMAKE_CURRENT_BINARY_DIR}/savedSrc") +endif() +if(NOT "${varBin}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/savedBin") + message(FATAL_ERROR "BINARY_DIR property not retrieved correctly: ${varBin}\n" + " Expected: ${CMAKE_CURRENT_BINARY_DIR}/savedBin") +endif() diff --git a/Tests/RunCMake/FetchContent/MissingDetails-result.txt b/Tests/RunCMake/FetchContent/MissingDetails-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FetchContent/MissingDetails-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FetchContent/MissingDetails-stderr.txt b/Tests/RunCMake/FetchContent/MissingDetails-stderr.txt new file mode 100644 index 0000000..c4f1daf --- /dev/null +++ b/Tests/RunCMake/FetchContent/MissingDetails-stderr.txt @@ -0,0 +1 @@ +No content details recorded for t1 diff --git a/Tests/RunCMake/FetchContent/MissingDetails.cmake b/Tests/RunCMake/FetchContent/MissingDetails.cmake new file mode 100644 index 0000000..ba8d121 --- /dev/null +++ b/Tests/RunCMake/FetchContent/MissingDetails.cmake @@ -0,0 +1,3 @@ +include(FetchContent) + +FetchContent_Populate(t1) diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake new file mode 100644 index 0000000..621fb8b --- /dev/null +++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake @@ -0,0 +1,28 @@ +include(RunCMake) + +unset(RunCMake_TEST_NO_CLEAN) + +run_cmake(MissingDetails) +run_cmake(DirectIgnoresDetails) +run_cmake(FirstDetailsWin) +run_cmake(DownloadTwice) +run_cmake(SameGenerator) +run_cmake(VarDefinitions) +run_cmake(GetProperties) +run_cmake(DirOverrides) + +# We need to pass through CMAKE_GENERATOR and CMAKE_MAKE_PROGRAM +# to ensure the test can run on machines where the build tool +# isn't on the PATH. Some build slaves explicitly test with such +# an arrangement (e.g. to test with spaces in the path). We also +# pass through the platform and toolset for completeness, even +# though we don't build anything, just in case this somehow affects +# the way the build tool is invoked. +run_cmake_command(ScriptMode + ${CMAKE_COMMAND} + -DCMAKE_GENERATOR=${RunCMake_GENERATOR} + -DCMAKE_GENERATOR_PLATFORM=${RunCMake_GENERATOR_PLATFORM} + -DCMAKE_GENERATOR_TOOLSET=${RunCMake_GENERATOR_TOOLSET} + -DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM} + -P ${CMAKE_CURRENT_LIST_DIR}/ScriptMode.cmake +) diff --git a/Tests/RunCMake/FetchContent/SameGenerator.cmake b/Tests/RunCMake/FetchContent/SameGenerator.cmake new file mode 100644 index 0000000..58204ef --- /dev/null +++ b/Tests/RunCMake/FetchContent/SameGenerator.cmake @@ -0,0 +1,17 @@ +include(FetchContent) + +FetchContent_Declare( + t1 + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E echo "Download command executed" +) + +FetchContent_Populate(t1) + +file(STRINGS "${FETCHCONTENT_BASE_DIR}/t1-subbuild/CMakeCache.txt" + matchLine REGEX "^CMAKE_GENERATOR:.*=" + LIMIT_COUNT 1 +) +if(NOT matchLine MATCHES "${CMAKE_GENERATOR}") + message(FATAL_ERROR "Generator line mismatch: ${matchLine}\n" + " Expected type: ${CMAKE_GENERATOR}") +endif() diff --git a/Tests/RunCMake/FetchContent/ScriptMode.cmake b/Tests/RunCMake/FetchContent/ScriptMode.cmake new file mode 100644 index 0000000..0a93d62 --- /dev/null +++ b/Tests/RunCMake/FetchContent/ScriptMode.cmake @@ -0,0 +1,35 @@ +include(FetchContent) + +file(WRITE tmpFile.txt "Generated contents, not important") + +FetchContent_Populate( + t1 + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_BINARY_DIR}/tmpFile.txt + <SOURCE_DIR>/done1.txt +) +if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/t1-src/done1.txt) + message(FATAL_ERROR "Default SOURCE_DIR doesn't contain done1.txt") +endif() + +FetchContent_Populate( + t2 + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/mysrc + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_BINARY_DIR}/tmpFile.txt + <SOURCE_DIR>/done2.txt +) +if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/mysrc/done2.txt) + message(FATAL_ERROR "Specified SOURCE_DIR doesn't contain done2.txt") +endif() + +FetchContent_Populate( + t3 + SOURCE_DIR myrelsrc + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_BINARY_DIR}/tmpFile.txt + <SOURCE_DIR>/done3.txt +) +if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/myrelsrc/done3.txt) + message(FATAL_ERROR "Relative SOURCE_DIR doesn't contain done3.txt") +endif() diff --git a/Tests/RunCMake/FetchContent/VarDefinitions.cmake b/Tests/RunCMake/FetchContent/VarDefinitions.cmake new file mode 100644 index 0000000..4d2a929 --- /dev/null +++ b/Tests/RunCMake/FetchContent/VarDefinitions.cmake @@ -0,0 +1,75 @@ +unset(FETCHCONTENT_FULLY_DISCONNECTED CACHE) +unset(FETCHCONTENT_UPDATES_DISCONNECTED CACHE) +unset(FETCHCONTENT_QUIET CACHE) +unset(FETCHCONTENT_BASE_DIR CACHE) + +include(FetchContent) + +# Each of the cache entries should be defined and have the +# expected value. Be careful to check unset separately from a +# false value, since unset also equates to false. +if(FETCHCONTENT_FULLY_DISCONNECTED STREQUAL "") + message(FATAL_ERROR "FETCHCONTENT_FULLY_DISCONNECTED not defined") +elseif(FETCHCONTENT_FULLY_DISCONNECTED) + message(FATAL_ERROR "FETCHCONTENT_FULLY_DISCONNECTED not defaulted to OFF") +endif() + +if(FETCHCONTENT_UPDATES_DISCONNECTED STREQUAL "") + message(FATAL_ERROR "FETCHCONTENT_UPDATES_DISCONNECTED not defined") +elseif(FETCHCONTENT_UPDATES_DISCONNECTED) + message(FATAL_ERROR "FETCHCONTENT_UPDATES_DISCONNECTED not defaulted to OFF") +endif() + +if(FETCHCONTENT_QUIET STREQUAL "") + message(FATAL_ERROR "FETCHCONTENT_QUIET not defined") +elseif(NOT FETCHCONTENT_QUIET) + message(FATAL_ERROR "FETCHCONTENT_QUIET not defaulted to ON") +endif() + +if(NOT FETCHCONTENT_BASE_DIR STREQUAL "${CMAKE_BINARY_DIR}/_deps") + message(FATAL_ERROR "FETCHCONTENT_BASE_DIR has default value: " + "${FETCHCONTENT_BASE_DIR}\n Expected: ${CMAKE_BINARY_DIR}/_deps") +endif() + +file(REMOVE_RECURSE ${FETCHCONTENT_BASE_DIR}/t1-subbuild) + +# Use uppercase T1 test name to confirm conversion to lowercase +# for the t1_... variable names that get set +FetchContent_Declare( + T1 + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E echo "Download command executed" +) +FetchContent_Populate(T1) + +# Be careful to check both regular and cache variables. Since they have +# the same name, we can only confirm them separately by using get_property(). +get_property(srcRegVarSet VARIABLE PROPERTY t1_SOURCE_DIR SET) +get_property(bldRegVarSet VARIABLE PROPERTY t1_BINARY_DIR SET) + +get_property(srcCacheVarSet CACHE t1_SOURCE_DIR PROPERTY VALUE SET) +get_property(bldCacheVarSet CACHE t1_BINARY_DIR PROPERTY VALUE SET) + +if(NOT srcRegVarSet) + message(FATAL_ERROR "t1_SOURCE_DIR regular variable not set") +endif() +if(NOT bldRegVarSet) + message(FATAL_ERROR "t1_BINARY_DIR regular variable not set") +endif() +if(srcCacheVarSet) + message(FATAL_ERROR "t1_SOURCE_DIR cache variable unexpectedly set") +endif() +if(bldCacheVarSet) + message(FATAL_ERROR "t1_BINARY_DIR cache variable unexpectedly set") +endif() + +set(srcRegVar ${t1_SOURCE_DIR}) +set(bldRegVar ${t1_BINARY_DIR}) + +if(NOT srcRegVar STREQUAL "${CMAKE_BINARY_DIR}/_deps/t1-src") + message(FATAL_ERROR "Unexpected t1_SOURCE_DIR value: ${srcRegVar}\n" + " Expected: ${CMAKE_BINARY_DIR}/_deps/t1-src") +endif() +if(NOT bldRegVar STREQUAL "${CMAKE_BINARY_DIR}/_deps/t1-build") + message(FATAL_ERROR "Unexpected t1_BINARY_DIR value: ${bldRegVar}\n" + " Expected: ${CMAKE_BINARY_DIR}/_deps/t1-build") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake index f1452b5..c1a0f5b 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake @@ -1,8 +1,5 @@ file(READ ${RunCMake_TEST_BINARY_DIR}/foo.txt foo_sources) -# VS generators inject CMakeLists.txt as a source. Remove it. -string(REGEX REPLACE ";[^;]*CMakeLists.txt$" "" foo_sources "${foo_sources}") - set(foo_expected "empty.c;empty2.c;empty3.c") if(NOT foo_sources STREQUAL foo_expected) set(RunCMake_TEST_FAILED "foo SOURCES was:\n [[${foo_sources}]]\nbut expected:\n [[${foo_expected}]]") diff --git a/Tests/RunCMake/GeneratorInstance/BadInstance-result.txt b/Tests/RunCMake/GeneratorInstance/BadInstance-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadInstance-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorInstance/BadInstance-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadInstance-stderr.txt new file mode 100644 index 0000000..5d01c4f --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadInstance-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + .* + + does not support instance specification, but instance + + Bad Instance + + was specified.$ diff --git a/Tests/RunCMake/GeneratorInstance/BadInstance-toolchain.cmake b/Tests/RunCMake/GeneratorInstance/BadInstance-toolchain.cmake new file mode 100644 index 0000000..1d99259 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadInstance-toolchain.cmake @@ -0,0 +1 @@ +set(CMAKE_GENERATOR_INSTANCE "Bad Instance") diff --git a/Tests/RunCMake/GeneratorInstance/BadInstance.cmake b/Tests/RunCMake/GeneratorInstance/BadInstance.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadInstance.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorInstance/BadInstanceToolchain-result.txt b/Tests/RunCMake/GeneratorInstance/BadInstanceToolchain-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadInstanceToolchain-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorInstance/BadInstanceToolchain-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadInstanceToolchain-stderr.txt new file mode 100644 index 0000000..5d01c4f --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadInstanceToolchain-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + .* + + does not support instance specification, but instance + + Bad Instance + + was specified.$ diff --git a/Tests/RunCMake/GeneratorInstance/BadInstanceToolchain.cmake b/Tests/RunCMake/GeneratorInstance/BadInstanceToolchain.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadInstanceToolchain.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorInstance/CMakeLists.txt b/Tests/RunCMake/GeneratorInstance/CMakeLists.txt new file mode 100644 index 0000000..d3137f6 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.9) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake b/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake new file mode 100644 index 0000000..7750c2e --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake @@ -0,0 +1,13 @@ +if("x${CMAKE_GENERATOR_INSTANCE}" STREQUAL "x") + message(FATAL_ERROR "CMAKE_GENERATOR_INSTANCE is empty but should have a value.") +elseif("x${CMAKE_GENERATOR_INSTANCE}" MATCHES [[\\]]) + message(FATAL_ERROR + "CMAKE_GENERATOR_INSTANCE is\n" + " ${CMAKE_GENERATOR_INSTANCE}\n" + "which contains a backslash.") +elseif(NOT IS_DIRECTORY "${CMAKE_GENERATOR_INSTANCE}") + message(FATAL_ERROR + "CMAKE_GENERATOR_INSTANCE is\n" + " ${CMAKE_GENERATOR_INSTANCE}\n" + "which is not an existing directory.") +endif() diff --git a/Tests/RunCMake/GeneratorInstance/MissingInstance-result.txt b/Tests/RunCMake/GeneratorInstance/MissingInstance-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/MissingInstance-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorInstance/MissingInstance-stderr.txt b/Tests/RunCMake/GeneratorInstance/MissingInstance-stderr.txt new file mode 100644 index 0000000..623bf2e --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/MissingInstance-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + .* + + could not find specified instance of .*: + + .*/Tests/RunCMake/GeneratorInstance/instance_does_not_exist$ diff --git a/Tests/RunCMake/GeneratorInstance/MissingInstance-toolchain.cmake b/Tests/RunCMake/GeneratorInstance/MissingInstance-toolchain.cmake new file mode 100644 index 0000000..f803f14 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/MissingInstance-toolchain.cmake @@ -0,0 +1 @@ +set(CMAKE_GENERATOR_INSTANCE "${CMAKE_CURRENT_LIST_DIR}/instance_does_not_exist") diff --git a/Tests/RunCMake/GeneratorInstance/MissingInstance.cmake b/Tests/RunCMake/GeneratorInstance/MissingInstance.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/MissingInstance.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorInstance/MissingInstanceToolchain-result.txt b/Tests/RunCMake/GeneratorInstance/MissingInstanceToolchain-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/MissingInstanceToolchain-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorInstance/MissingInstanceToolchain-stderr.txt b/Tests/RunCMake/GeneratorInstance/MissingInstanceToolchain-stderr.txt new file mode 100644 index 0000000..623bf2e --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/MissingInstanceToolchain-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + .* + + could not find specified instance of .*: + + .*/Tests/RunCMake/GeneratorInstance/instance_does_not_exist$ diff --git a/Tests/RunCMake/GeneratorInstance/MissingInstanceToolchain.cmake b/Tests/RunCMake/GeneratorInstance/MissingInstanceToolchain.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/MissingInstanceToolchain.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorInstance/NoInstance-result.txt b/Tests/RunCMake/GeneratorInstance/NoInstance-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/NoInstance-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorInstance/NoInstance-stderr.txt b/Tests/RunCMake/GeneratorInstance/NoInstance-stderr.txt new file mode 100644 index 0000000..e7b52fd --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/NoInstance-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at NoInstance.cmake:2 \(message\): + CMAKE_GENERATOR_INSTANCE is empty as expected. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorInstance/NoInstance.cmake b/Tests/RunCMake/GeneratorInstance/NoInstance.cmake new file mode 100644 index 0000000..2e6782e --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/NoInstance.cmake @@ -0,0 +1,7 @@ +if("x${CMAKE_GENERATOR_INSTANCE}" STREQUAL "x") + message(FATAL_ERROR "CMAKE_GENERATOR_INSTANCE is empty as expected.") +else() + message(FATAL_ERROR + "CMAKE_GENERATOR_INSTANCE is \"${CMAKE_GENERATOR_INSTANCE}\" " + "but should be empty!") +endif() diff --git a/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake new file mode 100644 index 0000000..e7f9ccb --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake @@ -0,0 +1,22 @@ +include(RunCMake) + +if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio 1[56789]") + set(RunCMake_GENERATOR_INSTANCE "") + run_cmake(DefaultInstance) + + set(RunCMake_GENERATOR_INSTANCE "${RunCMake_SOURCE_DIR}/instance_does_not_exist") + run_cmake(MissingInstance) + set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/MissingInstance-toolchain.cmake) + run_cmake(MissingInstanceToolchain) + unset(RunCMake_TEST_OPTIONS) +else() + set(RunCMake_GENERATOR_INSTANCE "") + run_cmake(NoInstance) + + set(RunCMake_GENERATOR_INSTANCE "Bad Instance") + run_cmake(BadInstance) + + set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/BadInstance-toolchain.cmake) + run_cmake(BadInstanceToolchain) + unset(RunCMake_TEST_OPTIONS) +endif() diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 26312c4..e688830 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -79,11 +79,17 @@ function(run_cmake test) ${maybe_timeout} ) else() + if(RunCMake_GENERATOR_INSTANCE) + set(_D_CMAKE_GENERATOR_INSTANCE "-DCMAKE_GENERATOR_INSTANCE=${RunCMake_GENERATOR_INSTANCE}") + else() + set(_D_CMAKE_GENERATOR_INSTANCE "") + endif() execute_process( COMMAND ${CMAKE_COMMAND} "${RunCMake_TEST_SOURCE_DIR}" -G "${RunCMake_GENERATOR}" -A "${RunCMake_GENERATOR_PLATFORM}" -T "${RunCMake_GENERATOR_TOOLSET}" + ${_D_CMAKE_GENERATOR_INSTANCE} -DRunCMake_TEST=${test} --no-warn-unused-cli ${RunCMake_TEST_OPTIONS} @@ -99,9 +105,21 @@ function(run_cmake test) if(NOT "${actual_result}" MATCHES "${expect_result}") string(APPEND msg "Result is [${actual_result}], not [${expect_result}].\n") endif() + string(CONCAT ignore_line_regex + "(^|\n)((==[0-9]+==" + "|BullseyeCoverage" + "|[a-z]+\\([0-9]+\\) malloc:" + "|clang[^:]*: warning: the object size sanitizer has no effect at -O0, but is explicitly enabled:" + "|Error kstat returned" + "|Hit xcodebuild bug" + "|[^\n]*is a member of multiple groups" + "|[^\n]*from Time Machine by path" + "|[^\n]*Bullseye Testing Technology" + ")[^\n]*\n)+" + ) foreach(o out err) string(REGEX REPLACE "\r\n" "\n" actual_std${o} "${actual_std${o}}") - string(REGEX REPLACE "(^|\n)((==[0-9]+==|BullseyeCoverage|[a-z]+\\([0-9]+\\) malloc:|Error kstat returned|Hit xcodebuild bug|[^\n]*is a member of multiple groups|[^\n]*from Time Machine by path|[^\n]*Bullseye Testing Technology)[^\n]*\n)+" "\\1" actual_std${o} "${actual_std${o}}") + string(REGEX REPLACE "${ignore_line_regex}" "\\1" actual_std${o} "${actual_std${o}}") string(REGEX REPLACE "\n+$" "" actual_std${o} "${actual_std${o}}") set(expect_${o} "") if(DEFINED expect_std${o}) diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index 5f6be87..8d5139d 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -12,6 +12,7 @@ \* CMP0021 \* CMP0022 \* CMP0027 + \* CMP0037 \* CMP0038 \* CMP0041 \* CMP0042 diff --git a/Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt b/Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt index 1de5dd7..c6b75fc 100644 --- a/Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt +++ b/Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt @@ -6,9 +6,7 @@ CMake Error in CMakeLists.txt: .*/Tests/RunCMake/TargetSources/empty_1.cpp .*/Tests/RunCMake/TargetSources/empty_2.cpp - .*/Tests/RunCMake/TargetSources/CMakeLists.txt Config "Release": .*/Tests/RunCMake/TargetSources/empty_1.cpp - .*/Tests/RunCMake/TargetSources/CMakeLists.txt diff --git a/Tests/RunCMake/TargetSources/OriginDebugIDE-result.txt b/Tests/RunCMake/TargetSources/OriginDebugIDE-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/TargetSources/OriginDebugIDE-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt b/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt deleted file mode 100644 index 6fdcce7..0000000 --- a/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt +++ /dev/null @@ -1,40 +0,0 @@ -CMake Debug Log at OriginDebug.cmake:13 \(add_library\): - Used sources for target OriginDebug: - - \* .*Tests/RunCMake/TargetSources/empty_2.cpp - -Call Stack \(most recent call first\): - OriginDebugIDE.cmake:4 \(include\) - CMakeLists.txt:3 \(include\) -+ -CMake Debug Log at OriginDebug.cmake:16 \(set_property\): - Used sources for target OriginDebug: - - \* .*Tests/RunCMake/TargetSources/empty_3.cpp - -Call Stack \(most recent call first\): - OriginDebugIDE.cmake:4 \(include\) - CMakeLists.txt:3 \(include\) -+ -CMake Debug Log at OriginDebug.cmake:20 \(target_sources\): - Used sources for target OriginDebug: - - \* .*Tests/RunCMake/TargetSources/empty_4.cpp - -Call Stack \(most recent call first\): - OriginDebugIDE.cmake:4 \(include\) - CMakeLists.txt:3 \(include\) -+ -CMake Debug Log in CMakeLists.txt: - Used sources for target OriginDebug: - - * .*CMakeLists.txt -+ -CMake Debug Log at OriginDebug.cmake:14 \(target_link_libraries\): - Used sources for target OriginDebug: - - \* .*Tests/RunCMake/TargetSources/empty_1.cpp - -Call Stack \(most recent call first\): - OriginDebugIDE.cmake:4 \(include\) - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetSources/OriginDebugIDE.cmake b/Tests/RunCMake/TargetSources/OriginDebugIDE.cmake deleted file mode 100644 index a3cc3a8..0000000 --- a/Tests/RunCMake/TargetSources/OriginDebugIDE.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -# Separate test for the IDEs, because they show the CMakeLists.txt file -# as a source file. -include(${CMAKE_CURRENT_LIST_DIR}/OriginDebug.cmake) diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake index bb55a6e..36d01de 100644 --- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake @@ -2,11 +2,9 @@ include(RunCMake) if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode") run_cmake(ConfigNotAllowed) - run_cmake(OriginDebugIDE) -else() - run_cmake(OriginDebug) endif() +run_cmake(OriginDebug) run_cmake(CMP0026-LOCATION) run_cmake(RelativePathInInterface) run_cmake(ExportBuild) diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 7d436b6..f730b83 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -8,6 +8,7 @@ run_cmake(XcodeFileType) run_cmake(XcodeAttributeLocation) run_cmake(XcodeAttributeGenex) run_cmake(XcodeAttributeGenexError) +run_cmake(XcodeGenerateTopLevelProjectOnly) run_cmake(XcodeObjectNeedsEscape) run_cmake(XcodeObjectNeedsQuote) run_cmake(XcodeOptimizationFlags) diff --git a/Tests/RunCMake/XcodeProject/XcodeGenerateTopLevelProjectOnly-check.cmake b/Tests/RunCMake/XcodeProject/XcodeGenerateTopLevelProjectOnly-check.cmake new file mode 100644 index 0000000..64654af --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeGenerateTopLevelProjectOnly-check.cmake @@ -0,0 +1,3 @@ +if(EXISTS "${RunCMake_TEST_BINARY_DIR}/subproject/subproject.xcodeproj") + message(SEND_ERROR "Unexpected project file for subproject found.") +endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeGenerateTopLevelProjectOnly.cmake b/Tests/RunCMake/XcodeProject/XcodeGenerateTopLevelProjectOnly.cmake new file mode 100644 index 0000000..7e53c49 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeGenerateTopLevelProjectOnly.cmake @@ -0,0 +1,3 @@ +set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY TRUE) +project(XcodeGenerateTopLevelProjectOnly NONE) +add_subdirectory(subproject) diff --git a/Tests/RunCMake/XcodeProject/subproject/CMakeLists.txt b/Tests/RunCMake/XcodeProject/subproject/CMakeLists.txt new file mode 100644 index 0000000..20e12b1 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/subproject/CMakeLists.txt @@ -0,0 +1 @@ +project(subproject) diff --git a/Tests/RunCMake/add_executable/NoSources-stderr.txt b/Tests/RunCMake/add_executable/NoSources-stderr.txt index 5985905..4fcfd49 100644 --- a/Tests/RunCMake/add_executable/NoSources-stderr.txt +++ b/Tests/RunCMake/add_executable/NoSources-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at NoSources.cmake:[0-9]+ \(add_executable\): - add_executable called with incorrect number of arguments + No SOURCES given to target: TestExeWithoutSources Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-stderr.txt index c8afadb..5561daa 100644 --- a/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-stderr.txt +++ b/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-stderr.txt @@ -1,11 +1,4 @@ ^CMake Error at NoSourcesButLinkObjects.cmake:[0-9]+ \(add_executable\): - add_executable called with incorrect number of arguments -Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\) - - -CMake Error at NoSourcesButLinkObjects.cmake:[0-9]+ \(target_link_libraries\): - Cannot specify link libraries for target \"TestExeWithoutSources\" which is - not built by this project. + No SOURCES given to target: TestExeWithoutSources Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_executable/OnlyObjectSources-stderr.txt b/Tests/RunCMake/add_executable/OnlyObjectSources-stderr.txt deleted file mode 100644 index ea72d5d..0000000 --- a/Tests/RunCMake/add_executable/OnlyObjectSources-stderr.txt +++ /dev/null @@ -1,11 +0,0 @@ -^CMake Error at OnlyObjectSources.cmake:[0-9]+ \(add_executable\): - add_executable called with incorrect number of arguments -Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\) - - -CMake Error at OnlyObjectSources.cmake:[0-9]+ \(target_sources\): - Cannot specify sources for target \"TestExeWithoutSources\" which is not - built by this project. -Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_executable/RunCMakeTest.cmake b/Tests/RunCMake/add_executable/RunCMakeTest.cmake index 70a68f2..88916b7 100644 --- a/Tests/RunCMake/add_executable/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_executable/RunCMakeTest.cmake @@ -2,4 +2,6 @@ include(RunCMake) run_cmake(NoSources) run_cmake(OnlyObjectSources) -run_cmake(NoSourcesButLinkObjects) +if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]") + run_cmake(NoSourcesButLinkObjects) +endif() diff --git a/Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt b/Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt index 5cf0b1e..41da381 100644 --- a/Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt +++ b/Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt @@ -1,3 +1,4 @@ -^You have called ADD_LIBRARY for library TestModuleLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file( -CMake Error: CMake can not determine linker language for target: TestModuleLibWithoutSources)+( -CMake Error: Cannot determine link language for target \"TestModuleLibWithoutSources\".)?$ +^CMake Error at MODULEwithNoSources.cmake:[0-9]+ \(add_library\): + No SOURCES given to target: TestModuleLibWithoutSources +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt index 951594a..67dd87c 100644 --- a/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt +++ b/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt @@ -1,3 +1,4 @@ -^You have called ADD_LIBRARY for library TestModuleLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file( -CMake Error: CMake can not determine linker language for target: TestModuleLibWithoutSources)+( -CMake Error: Cannot determine link language for target \"TestModuleLibWithoutSources\".)*$ +^CMake Error at MODULEwithNoSourcesButLinkObjects.cmake:[0-9]+ \(add_library\): + No SOURCES given to target: TestModuleLibWithoutSources +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/MODULEwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/MODULEwithOnlyObjectSources-stderr.txt deleted file mode 100644 index de83755..0000000 --- a/Tests/RunCMake/add_library/MODULEwithOnlyObjectSources-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^You have called ADD_LIBRARY for library TestModuleLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file$ diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSources-result.txt b/Tests/RunCMake/add_library/OBJECTwithNoSources-result.txt index 9c558e3..d00491f 100644 --- a/Tests/RunCMake/add_library/OBJECTwithNoSources-result.txt +++ b/Tests/RunCMake/add_library/OBJECTwithNoSources-result.txt @@ -1 +1 @@ -. +1 diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt index 099ec4f..20d3a8a 100644 --- a/Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt +++ b/Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt @@ -1,2 +1,4 @@ -^You have called ADD_LIBRARY for library TestObjectLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file( -CMake Error: CMake can not determine linker language for target: TestObjectLibWithoutSources)*$ +^CMake Error at OBJECTwithNoSources.cmake:[0-9]+ \(add_library\): + No SOURCES given to target: TestObjectLibWithoutSources +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt index 8f20096..cd6f1e0 100644 --- a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt +++ b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt @@ -1,5 +1,4 @@ -^You have called ADD_LIBRARY for library TestObjectLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file -CMake Error at OBJECTwithNoSourcesButLinkObjects.cmake:[0-9]+ \(target_link_libraries\): +^CMake Error at OBJECTwithNoSourcesButLinkObjects.cmake:[0-9]+ \(target_link_libraries\): Object library target \"TestObjectLibWithoutSources\" may not link to anything. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt index f9cbf6b..77a72f1 100644 --- a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt +++ b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt @@ -1,5 +1,4 @@ -^You have called ADD_LIBRARY for library TestObjectLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file -CMake Error at OBJECTwithOnlyObjectSources.cmake:[0-9]+ \(add_library\): +^CMake Error at OBJECTwithOnlyObjectSources.cmake:[0-9]+ \(add_library\): OBJECT library \"TestObjectLibWithoutSources\" contains: [^ diff --git a/Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt b/Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt index 228d1cc..5cedd62 100644 --- a/Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt +++ b/Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt @@ -1,3 +1,4 @@ -^You have called ADD_LIBRARY for library TestSharedLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file( -CMake Error: CMake can not determine linker language for target: TestSharedLibWithoutSources)+( -CMake Error: Cannot determine link language for target \"TestSharedLibWithoutSources\".)*$ +^CMake Error at SHAREDwithNoSources.cmake:[0-9]+ \(add_library\): + No SOURCES given to target: TestSharedLibWithoutSources +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt index 228d1cc..d621e76 100644 --- a/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt +++ b/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt @@ -1,3 +1,4 @@ -^You have called ADD_LIBRARY for library TestSharedLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file( -CMake Error: CMake can not determine linker language for target: TestSharedLibWithoutSources)+( -CMake Error: Cannot determine link language for target \"TestSharedLibWithoutSources\".)*$ +^CMake Error at SHAREDwithNoSourcesButLinkObjects.cmake:[0-9]+ \(add_library\): + No SOURCES given to target: TestSharedLibWithoutSources +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/SHAREDwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/SHAREDwithOnlyObjectSources-stderr.txt deleted file mode 100644 index ec350cd..0000000 --- a/Tests/RunCMake/add_library/SHAREDwithOnlyObjectSources-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^You have called ADD_LIBRARY for library TestSharedLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file$ diff --git a/Tests/RunCMake/add_library/STATICwithNoSources-stderr.txt b/Tests/RunCMake/add_library/STATICwithNoSources-stderr.txt index 830eb22..10b2112 100644 --- a/Tests/RunCMake/add_library/STATICwithNoSources-stderr.txt +++ b/Tests/RunCMake/add_library/STATICwithNoSources-stderr.txt @@ -1,3 +1,4 @@ -^You have called ADD_LIBRARY for library TestStaticLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file( -CMake Error: Cannot determine link language for target \"TestStaticLibWithoutSources\".)?( -CMake Error: CMake can not determine linker language for target: TestStaticLibWithoutSources)+$ +^CMake Error at STATICwithNoSources.cmake:[0-9]+ \(add_library\): + No SOURCES given to target: TestStaticLibWithoutSources +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt index 830eb22..33c23b2 100644 --- a/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt +++ b/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt @@ -1,3 +1,4 @@ -^You have called ADD_LIBRARY for library TestStaticLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file( -CMake Error: Cannot determine link language for target \"TestStaticLibWithoutSources\".)?( -CMake Error: CMake can not determine linker language for target: TestStaticLibWithoutSources)+$ +^CMake Error at STATICwithNoSourcesButLinkObjects.cmake:[0-9]+ \(add_library\): + No SOURCES given to target: TestStaticLibWithoutSources +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/STATICwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/STATICwithOnlyObjectSources-stderr.txt deleted file mode 100644 index 5cd10d4..0000000 --- a/Tests/RunCMake/add_library/STATICwithOnlyObjectSources-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^You have called ADD_LIBRARY for library TestStaticLibWithoutSources without any source files. This typically indicates a problem with your CMakeLists.txt file$ diff --git a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-stderr.txt deleted file mode 100644 index adcd3a2..0000000 --- a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -^CMake Error at UNKNOWNwithNoSourcesButLinkObjects.cmake:[0-9]+ \(target_link_libraries\): - Cannot specify link libraries for target \"TestUnknownLibWithoutSources\" - which is not built by this project. -Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake b/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake index 8e014c2..a977d42 100644 --- a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake +++ b/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake @@ -2,4 +2,4 @@ enable_language(CXX) add_library(ObjectLibDependency OBJECT test.cpp) add_library(TestUnknownLibWithoutSources UNKNOWN IMPORTED) -target_link_libraries(TestUnknownLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) +target_link_libraries(TestUnknownLibWithoutSources INTERFACE $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/alias_targets/RunCMakeTest.cmake b/Tests/RunCMake/alias_targets/RunCMakeTest.cmake index 9a5eaaf..dded248 100644 --- a/Tests/RunCMake/alias_targets/RunCMakeTest.cmake +++ b/Tests/RunCMake/alias_targets/RunCMakeTest.cmake @@ -6,6 +6,7 @@ run_cmake(exclude-from-all) run_cmake(imported) run_cmake(invalid-name) run_cmake(invalid-target) +run_cmake(imported-global-target) run_cmake(imported-target) run_cmake(alias-target) run_cmake(set_property) diff --git a/Tests/RunCMake/alias_targets/imported-global-target-stderr.txt b/Tests/RunCMake/alias_targets/imported-global-target-stderr.txt new file mode 100644 index 0000000..8259c80 --- /dev/null +++ b/Tests/RunCMake/alias_targets/imported-global-target-stderr.txt @@ -0,0 +1,2 @@ +^'alias-test-exe' is an alias for 'test-exe' and its name-property contains 'test-exe'. +'alias-test-lib' is an alias for 'test-lib' and its name-property contains 'test-lib'.$ diff --git a/Tests/RunCMake/alias_targets/imported-global-target.cmake b/Tests/RunCMake/alias_targets/imported-global-target.cmake new file mode 100644 index 0000000..12c4e0a --- /dev/null +++ b/Tests/RunCMake/alias_targets/imported-global-target.cmake @@ -0,0 +1,46 @@ + +enable_language(CXX) + + +add_executable(test-exe IMPORTED GLOBAL) +add_executable(alias-test-exe ALIAS test-exe) + +if(TARGET alias-test-exe) + get_target_property(aliased-target alias-test-exe ALIASED_TARGET) + if("${aliased-target}" STREQUAL "test-exe") + get_target_property(aliased-name alias-test-exe NAME) + if("${aliased-name}" STREQUAL "test-exe") + message("'alias-test-exe' is an alias for '${aliased-target}'" + " and its name-property contains '${aliased-name}'.") + else() + message("'alias-test-exe' is an alias for '${aliased-target}'" + " but its name-property contains '${aliased-name}'!?") + endif() + else() + message("'alias-test-exe' is something but not a real target!?") + endif() +else() + message("'alias-test-exe' does not exist!?") +endif() + + +add_library(test-lib SHARED IMPORTED GLOBAL) +add_library(alias-test-lib ALIAS test-lib) + +if(TARGET alias-test-lib) + get_target_property(aliased-target alias-test-lib ALIASED_TARGET) + if("${aliased-target}" STREQUAL "test-lib") + get_target_property(aliased-name alias-test-lib NAME) + if("${aliased-name}" STREQUAL "test-lib") + message("'alias-test-lib' is an alias for '${aliased-target}'" + " and its name-property contains '${aliased-name}'.") + else() + message("'alias-test-lib' is an alias for '${aliased-target}'" + " but its name-property contains '${aliased-name}'!?") + endif() + else() + message("'alias-test-lib' is something but not a real target!?") + endif() +else() + message("'alias-test-lib' does not exist!?") +endif() diff --git a/Tests/RunCMake/alias_targets/imported-target-stderr.txt b/Tests/RunCMake/alias_targets/imported-target-stderr.txt index bbff29a..12ffbc2 100644 --- a/Tests/RunCMake/alias_targets/imported-target-stderr.txt +++ b/Tests/RunCMake/alias_targets/imported-target-stderr.txt @@ -1,5 +1,9 @@ -CMake Error at imported-target.cmake:6 \(add_library\): - add_library cannot create ALIAS target "alias" because target "foo" is - IMPORTED. +^CMake Error at imported-target.cmake:[0-9]+ \(add_executable\): + add_executable cannot create ALIAS target \"alias-test-exe\" because target + \"test-exe\" is imported but not globally visible. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) + + +'alias-test-exe' does not exist![?] +'alias-test-lib' does not exist![?]$ diff --git a/Tests/RunCMake/alias_targets/imported-target.cmake b/Tests/RunCMake/alias_targets/imported-target.cmake index 7259ab0..bb682fe 100644 --- a/Tests/RunCMake/alias_targets/imported-target.cmake +++ b/Tests/RunCMake/alias_targets/imported-target.cmake @@ -1,6 +1,46 @@ enable_language(CXX) -add_library(foo SHARED IMPORTED) -add_library(alias ALIAS foo) +add_executable(test-exe IMPORTED) +add_executable(alias-test-exe ALIAS test-exe) + +if(TARGET alias-test-exe) + get_target_property(aliased-target alias-test-exe ALIASED_TARGET) + if("${aliased-target}" STREQUAL "test-exe") + get_target_property(aliased-name alias-test-exe NAME) + if("${aliased-name}" STREQUAL "test-exe") + message("'alias-test-exe' is an alias for '${aliased-target}'" + " and its name-property contains '${aliased-name}'.") + else() + message("'alias-test-exe' is an alias for '${aliased-target}'" + " but its name-property contains '${aliased-name}'!?") + endif() + else() + message("'alias-test-exe' is something but not a real target!?") + endif() +else() + message("'alias-test-exe' does not exist!?") +endif() + + +add_library(test-lib SHARED IMPORTED) +add_library(alias-test-lib ALIAS test-lib) + +if(TARGET alias-test-lib) + get_target_property(aliased-target alias-test-lib ALIASED_TARGET) + if("${aliased-target}" STREQUAL "test-lib") + get_target_property(aliased-name alias-test-lib NAME) + if("${aliased-name}" STREQUAL "test-lib") + message("'alias-test-lib' is an alias for '${aliased-target}'" + " and its name-property contains '${aliased-name}'.") + else() + message("'alias-test-lib' is an alias for '${aliased-target}'" + " but its name-property contains '${aliased-name}'!?") + endif() + else() + message("'alias-test-lib' is something but not a real target!?") + endif() +else() + message("'alias-test-lib' does not exist!?") +endif() diff --git a/Tests/RunCMake/file/DOWNLOAD-netrc-bad-result.txt b/Tests/RunCMake/file/DOWNLOAD-netrc-bad-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-netrc-bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/DOWNLOAD-netrc-bad-stderr.txt b/Tests/RunCMake/file/DOWNLOAD-netrc-bad-stderr.txt new file mode 100644 index 0000000..96ce62a --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-netrc-bad-stderr.txt @@ -0,0 +1,19 @@ +^CMake Error at DOWNLOAD-netrc-bad\.cmake:[0-9]+ \(file\): + file DOWNLOAD missing level value for NETRC\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at DOWNLOAD-netrc-bad\.cmake:[0-9]+ \(file\): + file DOWNLOAD missing file value for NETRC_FILE\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at DOWNLOAD-netrc-bad\.cmake:[0-9]+ \(file\): + file NETRC accepts OPTIONAL, IGNORED or REQUIRED but got: INVALID +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at DOWNLOAD-netrc-bad\.cmake:[0-9]+ \(file\): + file NETRC accepts OPTIONAL, IGNORED or REQUIRED but got: FALSE +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/DOWNLOAD-netrc-bad.cmake b/Tests/RunCMake/file/DOWNLOAD-netrc-bad.cmake new file mode 100644 index 0000000..6a62df9 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-netrc-bad.cmake @@ -0,0 +1,15 @@ +if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "^/") + set(slash /) +endif() +file(DOWNLOAD "" "" NETRC) +file(DOWNLOAD "" "" NETRC_FILE) +set(CMAKE_NETRC FALSE) +file(DOWNLOAD + "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-netrc-bad.txt" + "${CMAKE_CURRENT_BINARY_DIR}/netrc-bad.txt" + NETRC INVALID + ) +file(DOWNLOAD + "file://${slash}${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-netrc-bad.txt" + "${CMAKE_CURRENT_BINARY_DIR}/netrc-bad.txt" + ) diff --git a/Tests/RunCMake/file/DOWNLOAD-netrc-bad.txt b/Tests/RunCMake/file/DOWNLOAD-netrc-bad.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-netrc-bad.txt diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index 26051b4..3be4fb7 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -3,9 +3,11 @@ include(RunCMake) run_cmake(DOWNLOAD-hash-mismatch) run_cmake(DOWNLOAD-unused-argument) run_cmake(DOWNLOAD-httpheader-not-set) +run_cmake(DOWNLOAD-netrc-bad) run_cmake(DOWNLOAD-pass-not-set) run_cmake(UPLOAD-unused-argument) run_cmake(UPLOAD-httpheader-not-set) +run_cmake(UPLOAD-netrc-bad) run_cmake(UPLOAD-pass-not-set) run_cmake(INSTALL-DIRECTORY) run_cmake(INSTALL-FILES_FROM_DIR) diff --git a/Tests/RunCMake/file/UPLOAD-netrc-bad-result.txt b/Tests/RunCMake/file/UPLOAD-netrc-bad-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-netrc-bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/UPLOAD-netrc-bad-stderr.txt b/Tests/RunCMake/file/UPLOAD-netrc-bad-stderr.txt new file mode 100644 index 0000000..d5752ea --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-netrc-bad-stderr.txt @@ -0,0 +1,19 @@ +^CMake Error at UPLOAD-netrc-bad\.cmake:[0-9]+ \(file\): + file UPLOAD missing level value for NETRC\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at UPLOAD-netrc-bad\.cmake:[0-9]+ \(file\): + file UPLOAD missing file value for NETRC_FILE\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at UPLOAD-netrc-bad\.cmake:[0-9]+ \(file\): + file NETRC accepts OPTIONAL, IGNORED or REQUIRED but got: INVALID +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at UPLOAD-netrc-bad\.cmake:[0-9]+ \(file\): + file NETRC accepts OPTIONAL, IGNORED or REQUIRED but got: FALSE +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/UPLOAD-netrc-bad.cmake b/Tests/RunCMake/file/UPLOAD-netrc-bad.cmake new file mode 100644 index 0000000..e59a2c4 --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-netrc-bad.cmake @@ -0,0 +1,15 @@ +if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "^/") + set(slash /) +endif() +file(UPLOAD "" "" NETRC) +file(UPLOAD "" "" NETRC_FILE) +set(CMAKE_NETRC FALSE) +file(UPLOAD + "${CMAKE_CURRENT_SOURCE_DIR}/UPLOAD-netrc-bad.txt" + "file://${slash}${CMAKE_CURRENT_BINARY_DIR}/netrc-bad.txt" + NETRC INVALID + ) +file(UPLOAD + "${CMAKE_CURRENT_SOURCE_DIR}/UPLOAD-netrc-bad.txt" + "file://${slash}${CMAKE_CURRENT_BINARY_DIR}/netrc-bad.txt" + ) diff --git a/Tests/RunCMake/file/UPLOAD-netrc-bad.txt b/Tests/RunCMake/file/UPLOAD-netrc-bad.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-netrc-bad.txt diff --git a/Tests/RunCMake/interface_library/target_commands-stderr.txt b/Tests/RunCMake/interface_library/target_commands-stderr.txt index be11b77..9362a75 100644 --- a/Tests/RunCMake/interface_library/target_commands-stderr.txt +++ b/Tests/RunCMake/interface_library/target_commands-stderr.txt @@ -23,25 +23,25 @@ Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at target_commands.cmake:9 \(target_include_directories\): - target_include_directories may only be set INTERFACE properties on - INTERFACE targets + target_include_directories may only set INTERFACE properties on INTERFACE + targets Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at target_commands.cmake:10 \(target_include_directories\): - target_include_directories may only be set INTERFACE properties on - INTERFACE targets + target_include_directories may only set INTERFACE properties on INTERFACE + targets Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at target_commands.cmake:12 \(target_compile_definitions\): - target_compile_definitions may only be set INTERFACE properties on - INTERFACE targets + target_compile_definitions may only set INTERFACE properties on INTERFACE + targets Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at target_commands.cmake:13 \(target_compile_definitions\): - target_compile_definitions may only be set INTERFACE properties on - INTERFACE targets + target_compile_definitions may only set INTERFACE properties on INTERFACE + targets Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_compile_features/imported_target-stderr.txt b/Tests/RunCMake/target_compile_features/imported_target-stderr.txt index 7a07427..afad537 100644 --- a/Tests/RunCMake/target_compile_features/imported_target-stderr.txt +++ b/Tests/RunCMake/target_compile_features/imported_target-stderr.txt @@ -1,4 +1,5 @@ -CMake Error at imported_target.cmake:[0-9]+ \(target_compile_features\): - Cannot specify compile features for imported target "main". +^CMake Error at imported_target.cmake:[0-9]+ \(target_compile_features\): + target_compile_features may only set INTERFACE properties on INTERFACE + targets Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/target_compile_features/imported_target.cmake b/Tests/RunCMake/target_compile_features/imported_target.cmake index e886ce9..e410ace 100644 --- a/Tests/RunCMake/target_compile_features/imported_target.cmake +++ b/Tests/RunCMake/target_compile_features/imported_target.cmake @@ -1,4 +1,10 @@ enable_language(CXX) -add_library(main INTERFACE IMPORTED) -target_compile_features(main INTERFACE cxx_delegating_constructors) +add_library(lib1-interface INTERFACE IMPORTED) +target_compile_features(lib1-interface INTERFACE cxx_delegating_constructors) + +add_library(lib2-interface INTERFACE IMPORTED) +target_compile_features(lib2-interface PUBLIC cxx_delegating_constructors) + +add_library(lib-shared SHARED IMPORTED) +target_compile_features(lib-shared INTERFACE cxx_delegating_constructors) diff --git a/Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt b/Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt index 3708998..23a8eeb 100644 --- a/Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt +++ b/Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt @@ -1,5 +1,5 @@ CMake Error at invalid_args_on_interface.cmake:[0-9]+ \(target_compile_features\): - target_compile_features may only be set INTERFACE properties on INTERFACE + target_compile_features may only set INTERFACE properties on INTERFACE targets Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_link_libraries/ImportedTarget.cmake b/Tests/RunCMake/target_link_libraries/ImportedTarget.cmake new file mode 100644 index 0000000..e5ec3f6 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/ImportedTarget.cmake @@ -0,0 +1,2 @@ +add_library(UnknownImportedGlobal UNKNOWN IMPORTED GLOBAL) +target_link_libraries(UnknownImportedGlobal INTERFACE z) diff --git a/Tests/RunCMake/target_link_libraries/ImportedTargetFailure-result.txt b/Tests/RunCMake/target_link_libraries/ImportedTargetFailure-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/ImportedTargetFailure-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_link_libraries/ImportedTargetFailure-stderr.txt b/Tests/RunCMake/target_link_libraries/ImportedTargetFailure-stderr.txt new file mode 100644 index 0000000..1cafa5b --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/ImportedTargetFailure-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at ImportedTargetFailure.cmake:[0-9]+ \(target_link_libraries\): + IMPORTED library can only be used with the INTERFACE keyword of + target_link_libraries +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_link_libraries/ImportedTargetFailure.cmake b/Tests/RunCMake/target_link_libraries/ImportedTargetFailure.cmake new file mode 100644 index 0000000..3ac0aa9 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/ImportedTargetFailure.cmake @@ -0,0 +1,2 @@ +add_library(UnknownImportedGlobal UNKNOWN IMPORTED GLOBAL) +target_link_libraries(UnknownImportedGlobal PRIVATE z) diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake index b1c9435..97b0888 100644 --- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake @@ -4,6 +4,8 @@ run_cmake(CMP0023-WARN) run_cmake(CMP0023-NEW) run_cmake(CMP0023-WARN-2) run_cmake(CMP0023-NEW-2) +run_cmake(ImportedTarget) +run_cmake(ImportedTargetFailure) run_cmake(MixedSignature) run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses) run_cmake(SubDirTarget) |