diff options
Diffstat (limited to 'Tests/RunCMake')
595 files changed, 4482 insertions, 1206 deletions
diff --git a/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake b/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake index f268de7..27a609d 100644 --- a/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake +++ b/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake @@ -12,7 +12,7 @@ if("${RunCMake_GENERATOR}" MATCHES "Watcom WMake|Borland Makefiles") endif() # we build debug so the say.exe will be found in Debug/say.exe for # Visual Studio generators -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode") +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) set(INTDIR "Debug/") endif() # build AutoExport diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index 9941c70..3445beb 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -11,7 +11,7 @@ function(run_BuildDepends CASE) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${CASE}-build) set(RunCMake_TEST_NO_CLEAN 1) - if(RunCMake_GENERATOR MATCHES "Make|Ninja") + if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) endif() file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") @@ -32,7 +32,8 @@ endfunction() run_BuildDepends(C-Exe) if(NOT RunCMake_GENERATOR STREQUAL "Xcode") - if(RunCMake_GENERATOR MATCHES "Visual Studio 10") + if(RunCMake_GENERATOR MATCHES "Visual Studio 10" OR + RunCMake_GENERATOR_TOOLSET MATCHES "^(v80|v90|v100)$") # VS 10 forgets to re-link when a manifest changes set(run_BuildDepends_skip_step_2 1) endif() 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-result.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt new file mode 100644 index 0000000..de09351 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-OLD-reserved-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0037-OLD-reserved.cmake:2 \(cmake_policy\): + The OLD behavior for policy CMP0037 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ 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-result.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-space-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/CMP0037/CMP0037-OLD-space-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt new file mode 100644 index 0000000..4d13e59 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0037-OLD-space.cmake:2 \(cmake_policy\): + The OLD behavior for policy CMP0037 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ 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/TargetPropertyGeneratorExpressions/BadSelfReference6-result.txt b/Tests/RunCMake/CMP0037/NEW-cond-package-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6-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/TargetPropertyGeneratorExpressions/BadSelfReference5-result.txt b/Tests/RunCMake/CMP0037/NEW-cond-package_source-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5-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/TargetPropertyGeneratorExpressions/BadSelfReference4-result.txt b/Tests/RunCMake/CMP0037/NEW-cond-test-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4-result.txt +++ b/Tests/RunCMake/CMP0037/NEW-cond-test-result.txt 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-stderr.txt b/Tests/RunCMake/CMP0037/OLD-cond-package-stderr.txt new file mode 100644 index 0000000..5a29a49 --- /dev/null +++ b/Tests/RunCMake/CMP0037/OLD-cond-package-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at OLD-cond-package.cmake:1 \(cmake_policy\): + The OLD behavior for policy CMP0037 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ 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-stderr.txt b/Tests/RunCMake/CMP0037/OLD-cond-package_source-stderr.txt new file mode 100644 index 0000000..5f72e16 --- /dev/null +++ b/Tests/RunCMake/CMP0037/OLD-cond-package_source-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at OLD-cond-package_source.cmake:1 \(cmake_policy\): + The OLD behavior for policy CMP0037 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ 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-stderr.txt b/Tests/RunCMake/CMP0037/OLD-cond-stderr.txt new file mode 100644 index 0000000..94e4575 --- /dev/null +++ b/Tests/RunCMake/CMP0037/OLD-cond-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at OLD-cond.cmake:1 \(cmake_policy\): + The OLD behavior for policy CMP0037 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0037/OLD-cond-test-stderr.txt b/Tests/RunCMake/CMP0037/OLD-cond-test-stderr.txt new file mode 100644 index 0000000..81e10ce --- /dev/null +++ b/Tests/RunCMake/CMP0037/OLD-cond-test-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at OLD-cond-test.cmake:1 \(cmake_policy\): + The OLD behavior for policy CMP0037 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ 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/CMP0038/CMP0038-OLD-result.txt b/Tests/RunCMake/CMP0038/CMP0038-OLD-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/CMP0038/CMP0038-OLD-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt b/Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt new file mode 100644 index 0000000..c754128 --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0038-OLD.cmake:2 \(cmake_policy\): + The OLD behavior for policy CMP0038 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0039/CMP0039-OLD-result.txt b/Tests/RunCMake/CMP0039/CMP0039-OLD-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/CMP0039/CMP0039-OLD-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt b/Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt new file mode 100644 index 0000000..d7863fd --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0039-OLD.cmake:2 \(cmake_policy\): + The OLD behavior for policy CMP0039 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-result.txt b/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-stderr.txt new file mode 100644 index 0000000..f38c03d --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-OLD-existing-target-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0040-OLD-existing-target.cmake:1 \(cmake_policy\): + The OLD behavior for policy CMP0040 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-result.txt b/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-stderr.txt new file mode 100644 index 0000000..61f4f03 --- /dev/null +++ b/Tests/RunCMake/CMP0040/CMP0040-OLD-missing-target-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0040-OLD-missing-target.cmake:1 \(cmake_policy\): + The OLD behavior for policy CMP0040 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt index e3e3ff4..70ed05b 100644 --- a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt +++ b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt @@ -1,8 +1,8 @@ CMake Warning \(dev\) at CMP0040-WARN-missing-target.cmake:2 \(add_custom_command\): Policy CMP0040 is not set: The target in the TARGET signature of - add_custom_command\(\) must exist. Run "cmake --help-policy CMP0040" for - policy details. Use the cmake_policy command to set the policy and - suppress this warning. + add_custom_command\(\) must exist and must be defined in the current + directory. Run "cmake --help-policy CMP0040" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + No TARGET 'foobar' has been created in this directory. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/CMP0041/CMP0041-OLD-result.txt b/Tests/RunCMake/CMP0041/CMP0041-OLD-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/CMP0041/CMP0041-OLD-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt new file mode 100644 index 0000000..1b736da --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0041-OLD.cmake:2 \(cmake_policy\): + The OLD behavior for policy CMP0041 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-result.txt b/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-stderr.txt b/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-stderr.txt new file mode 100644 index 0000000..dbc5167 --- /dev/null +++ b/Tests/RunCMake/CMP0041/CMP0041-tid-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0041-tid-OLD.cmake:2 \(cmake_policy\): + The OLD behavior for policy CMP0041 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0042/CMP0042-OLD-result.txt b/Tests/RunCMake/CMP0042/CMP0042-OLD-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/CMP0042/CMP0042-OLD-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt b/Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt new file mode 100644 index 0000000..9d1488d --- /dev/null +++ b/Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0042-OLD.cmake:2 \(cmake_policy\): + The OLD behavior for policy CMP0042 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0043/CMP0043-OLD-result.txt b/Tests/RunCMake/CMP0043/CMP0043-OLD-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/CMP0043/CMP0043-OLD-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0043/CMP0043-OLD-stderr.txt b/Tests/RunCMake/CMP0043/CMP0043-OLD-stderr.txt new file mode 100644 index 0000000..ebbb361 --- /dev/null +++ b/Tests/RunCMake/CMP0043/CMP0043-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0043-OLD.cmake:2 \(cmake_policy\): + The OLD behavior for policy CMP0043 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0045/CMP0045-OLD-result.txt b/Tests/RunCMake/CMP0045/CMP0045-OLD-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/CMP0045/CMP0045-OLD-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0045/CMP0045-OLD-stderr.txt b/Tests/RunCMake/CMP0045/CMP0045-OLD-stderr.txt new file mode 100644 index 0000000..0dac20f --- /dev/null +++ b/Tests/RunCMake/CMP0045/CMP0045-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0045-OLD.cmake:2 \(cmake_policy\): + The OLD behavior for policy CMP0045 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency-stderr.txt new file mode 100644 index 0000000..4444118 --- /dev/null +++ b/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0046-OLD-existing-dependency.cmake:1 \(cmake_policy\): + The OLD behavior for policy CMP0046 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency-stderr.txt new file mode 100644 index 0000000..525954f --- /dev/null +++ b/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0046-OLD-missing-dependency.cmake:1 \(cmake_policy\): + The OLD behavior for policy CMP0046 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0049/CMP0049-OLD-result.txt b/Tests/RunCMake/CMP0049/CMP0049-OLD-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/CMP0049/CMP0049-OLD-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0049/CMP0049-OLD-stderr.txt b/Tests/RunCMake/CMP0049/CMP0049-OLD-stderr.txt new file mode 100644 index 0000000..b373970 --- /dev/null +++ b/Tests/RunCMake/CMP0049/CMP0049-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0049-OLD.cmake:2 \(cmake_policy\): + The OLD behavior for policy CMP0049 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0050/CMP0050-OLD-result.txt b/Tests/RunCMake/CMP0050/CMP0050-OLD-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/CMP0050/CMP0050-OLD-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0050/CMP0050-OLD-stderr.txt b/Tests/RunCMake/CMP0050/CMP0050-OLD-stderr.txt new file mode 100644 index 0000000..3e7fa97 --- /dev/null +++ b/Tests/RunCMake/CMP0050/CMP0050-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0050-OLD.cmake:2 \(cmake_policy\): + The OLD behavior for policy CMP0050 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0051/CMP0051-OLD-result.txt b/Tests/RunCMake/CMP0051/CMP0051-OLD-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/CMP0051/CMP0051-OLD-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0051/CMP0051-OLD-stderr.txt b/Tests/RunCMake/CMP0051/CMP0051-OLD-stderr.txt index cc17f33..697265e 100644 --- a/Tests/RunCMake/CMP0051/CMP0051-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0051/CMP0051-OLD-stderr.txt @@ -1 +1,12 @@ -^Sources: "empty.cpp"$ +^CMake Deprecation Warning at CMP0051-OLD.cmake:2 \(cmake_policy\): + The OLD behavior for policy CMP0051 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +Sources: "empty.cpp"$ diff --git a/Tests/RunCMake/CMP0053/CMP0053-OLD-stderr.txt b/Tests/RunCMake/CMP0053/CMP0053-OLD-stderr.txt index 836b0ff..2a0ddbaa 100644 --- a/Tests/RunCMake/CMP0053/CMP0053-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0053/CMP0053-OLD-stderr.txt @@ -1,2 +1,13 @@ -^called +^CMake Deprecation Warning at CMP0053-OLD.cmake:1 \(cmake_policy\): + The OLD behavior for policy CMP0053 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +called --><--$ diff --git a/Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt index f5a8fbe..0500280 100644 --- a/Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt @@ -1 +1,10 @@ -$^ +^CMake Deprecation Warning at CMP0054-OLD.cmake:1 \(cmake_policy\): + The OLD behavior for policy CMP0054 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD-stderr.txt index f5a8fbe..60303cd 100644 --- a/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0054/CMP0054-keywords-OLD-stderr.txt @@ -1 +1,10 @@ -$^ +^CMake Deprecation Warning at CMP0054-keywords-OLD.cmake:1 \(cmake_policy\): + The OLD behavior for policy CMP0054 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope-stderr.txt index f5a8fbe..1b35472 100644 --- a/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope-stderr.txt +++ b/Tests/RunCMake/CMP0054/CMP0054-policy-command-scope-stderr.txt @@ -1 +1,10 @@ -$^ +^CMake Deprecation Warning at CMP0054-policy-command-scope.cmake:25 \(cmake_policy\): + The OLD behavior for policy CMP0054 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope-stderr.txt index f5a8fbe..4eac90e 100644 --- a/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope-stderr.txt +++ b/Tests/RunCMake/CMP0054/CMP0054-policy-foreach-scope-stderr.txt @@ -1 +1,54 @@ -$^ +^CMake Deprecation Warning at CMP0054-policy-foreach-scope.cmake:14 \(cmake_policy\): + The OLD behavior for policy CMP0054 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Deprecation Warning at CMP0054-policy-foreach-scope.cmake:14 \(cmake_policy\): + The OLD behavior for policy CMP0054 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Deprecation Warning at CMP0054-policy-foreach-scope.cmake:27 \(cmake_policy\): + The OLD behavior for policy CMP0054 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Deprecation Warning at CMP0054-policy-foreach-scope.cmake:48 \(cmake_policy\): + The OLD behavior for policy CMP0054 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Deprecation Warning at CMP0054-policy-foreach-scope.cmake:48 \(cmake_policy\): + The OLD behavior for policy CMP0054 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if-stderr.txt index f5a8fbe..a2dd62e 100644 --- a/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if-stderr.txt +++ b/Tests/RunCMake/CMP0054/CMP0054-policy-nested-if-stderr.txt @@ -1 +1,10 @@ -$^ +^CMake Deprecation Warning at CMP0054-policy-nested-if.cmake:23 \(cmake_policy\): + The OLD behavior for policy CMP0054 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope-stderr.txt index f5a8fbe..718904d 100644 --- a/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope-stderr.txt +++ b/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope-stderr.txt @@ -1 +1,54 @@ -$^ +^CMake Deprecation Warning at CMP0054-policy-while-scope.cmake:16 \(cmake_policy\): + The OLD behavior for policy CMP0054 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Deprecation Warning at CMP0054-policy-while-scope.cmake:16 \(cmake_policy\): + The OLD behavior for policy CMP0054 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Deprecation Warning at CMP0054-policy-while-scope.cmake:37 \(cmake_policy\): + The OLD behavior for policy CMP0054 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Deprecation Warning at CMP0054-policy-while-scope.cmake:58 \(cmake_policy\): + The OLD behavior for policy CMP0054 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Deprecation Warning at CMP0054-policy-while-scope.cmake:58 \(cmake_policy\): + The OLD behavior for policy CMP0054 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/CMP0060/CMP0060-Common.cmake b/Tests/RunCMake/CMP0060/CMP0060-Common.cmake index e0a56e6..06955ee 100644 --- a/Tests/RunCMake/CMP0060/CMP0060-Common.cmake +++ b/Tests/RunCMake/CMP0060/CMP0060-Common.cmake @@ -1,6 +1,7 @@ # Always build in a predictable configuration. For multi-config # generators we depend on RunCMakeTest.cmake to do this for us. -if(NOT CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _isMultiConfig) set(CMAKE_BUILD_TYPE Debug) endif() diff --git a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt index f6cc978..e2c280e 100644 --- a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt +++ b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt @@ -12,5 +12,5 @@ will ask the linker to search for these by library name. Call Stack \(most recent call first\): CMP0060-WARN-ON.cmake:[0-9]+ \(include\) - CMakeLists.txt:3 \(include\) + CMakeLists.txt:4 \(include\) This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CMP0060/CMakeLists.txt b/Tests/RunCMake/CMP0060/CMakeLists.txt index db6b701..291d34d 100644 --- a/Tests/RunCMake/CMP0060/CMakeLists.txt +++ b/Tests/RunCMake/CMP0060/CMakeLists.txt @@ -1,3 +1,4 @@ -cmake_minimum_required(VERSION 3.2) +cmake_minimum_required(VERSION 3.9) +cmake_policy(VERSION 3.2) project(${RunCMake_TEST} C) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 347b9d2..d5bd297 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -1,5 +1,8 @@ # See adjacent README.rst for documentation of this test infrastructure. +# Note that the _isMultiConfig variable is set in the parent directory's +# CMakeLists.txt (slightly complex logic to support CMake versions before 3.9) + macro(add_RunCMake_test test) set(TEST_ARGS ${ARGN}) if ("${ARGV1}" STREQUAL "TEST_DIR") @@ -14,7 +17,9 @@ macro(add_RunCMake_test test) endif() add_test(NAME RunCMake.${test} COMMAND ${CMAKE_CMAKE_COMMAND} -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} + -DRunCMake_GENERATOR_IS_MULTI_CONFIG=${_isMultiConfig} -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} @@ -46,7 +51,9 @@ function(add_RunCMake_test_group test types) add_test(NAME RunCMake.${test}_${type} COMMAND ${CMAKE_CMAKE_COMMAND} -DTEST_TYPE=${type} -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} + -DRunCMake_GENERATOR_IS_MULTI_CONFIG=${_isMultiConfig} -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} @@ -141,13 +148,18 @@ add_RunCMake_test(DisallowedCommands) add_RunCMake_test(ExternalData) add_RunCMake_test(FeatureSummary) add_RunCMake_test(FPHSA) +add_RunCMake_test(FindBoost) +add_RunCMake_test(FindOpenGL) 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) add_RunCMake_test(GNUInstallDirs -DSYSTEM_NAME=${CMAKE_SYSTEM_NAME}) +add_RunCMake_test(GoogleTest) # Note: does not actually depend on Google Test add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) add_RunCMake_test(LinkStatic) @@ -164,6 +176,7 @@ add_RunCMake_test(CompileDefinitions) add_RunCMake_test(CompileFeatures) add_RunCMake_test(PolicyScope) add_RunCMake_test(WriteCompilerDetectionHeader) +add_RunCMake_test(SourceProperties) if(NOT WIN32) add_RunCMake_test(PositionIndependentCode) endif() @@ -179,6 +192,8 @@ add_RunCMake_test(Syntax) add_RunCMake_test(add_custom_command) add_RunCMake_test(add_custom_target) add_RunCMake_test(add_dependencies) +add_RunCMake_test(add_executable) +add_RunCMake_test(add_library) add_RunCMake_test(add_subdirectory) add_RunCMake_test(build_command) add_executable(exit_code exit_code.c) @@ -210,6 +225,7 @@ add_RunCMake_test(find_library) add_RunCMake_test(find_package) add_RunCMake_test(find_path) add_RunCMake_test(find_program -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) +add_RunCMake_test(foreach) add_RunCMake_test(get_filename_component) add_RunCMake_test(get_property) add_RunCMake_test(if) @@ -224,20 +240,38 @@ add_RunCMake_test(separate_arguments) add_RunCMake_test(set_property) add_RunCMake_test(string) add_RunCMake_test(test_include_dirs) -foreach(var - CMAKE_C_COMPILER_ID - CMAKE_C_COMPILER_VERSION - CMAKE_C_STANDARD_DEFAULT - CMAKE_CXX_COMPILER_ID - CMAKE_CXX_COMPILER_VERSION - CMAKE_CXX_STANDARD_DEFAULT - CMake_TEST_CUDA - ) - if(DEFINED ${var}) - list(APPEND try_compile_ARGS -D${var}=${${var}}) + +function(add_RunCMake_test_try_compile) + if(CMAKE_VERSION VERSION_LESS 3.9.20170907 AND "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") + # Older CMake versions do not know about MSVC language standards. + # Approximate our logic from MSVC-CXX.cmake. + if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND + CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10) OR + CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.10.25017) + set(CMAKE_CXX_STANDARD_DEFAULT 14) + elseif (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0) + set(CMAKE_CXX_STANDARD_DEFAULT "") + else() + unset(CMAKE_CXX_STANDARD_DEFAULT) + endif() endif() -endforeach() -add_RunCMake_test(try_compile) + foreach(var + CMAKE_C_COMPILER_ID + CMAKE_C_COMPILER_VERSION + CMAKE_C_STANDARD_DEFAULT + CMAKE_CXX_COMPILER_ID + CMAKE_CXX_COMPILER_VERSION + CMAKE_CXX_STANDARD_DEFAULT + CMake_TEST_CUDA + ) + if(DEFINED ${var}) + list(APPEND try_compile_ARGS -D${var}=${${var}}) + endif() + endforeach() + add_RunCMake_test(try_compile) +endfunction() +add_RunCMake_test_try_compile() + add_RunCMake_test(try_run) add_RunCMake_test(set) add_RunCMake_test(variable_watch) @@ -304,7 +338,9 @@ add_RunCMake_test(install) add_RunCMake_test(CPackConfig) add_RunCMake_test(CPackInstallProperties) add_RunCMake_test(ExternalProject) +add_RunCMake_test(FetchContent) add_RunCMake_test(CTestCommandLine) +add_RunCMake_test(CacheNewline) # Only run this test on unix platforms that support # symbolic links if(UNIX) @@ -317,8 +353,6 @@ add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths) set(IfacePaths_SOURCES_ARGS -DTEST_PROP=SOURCES) add_RunCMake_test(IfacePaths_SOURCES TEST_DIR IfacePaths) -add_RunCMake_test(COMPILE_LANGUAGE-genex) - # Matlab module related tests if(CMake_TEST_FindMatlab) add_RunCMake_test(FindMatlab) @@ -342,12 +376,23 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") add_executable(pseudo_tidy pseudo_tidy.c) add_executable(pseudo_iwyu pseudo_iwyu.c) add_executable(pseudo_cpplint pseudo_cpplint.c) + add_executable(pseudo_cppcheck pseudo_cppcheck.c) add_RunCMake_test(ClangTidy -DPSEUDO_TIDY=$<TARGET_FILE:pseudo_tidy>) add_RunCMake_test(IncludeWhatYouUse -DPSEUDO_IWYU=$<TARGET_FILE:pseudo_iwyu>) add_RunCMake_test(Cpplint -DPSEUDO_CPPLINT=$<TARGET_FILE:pseudo_cpplint>) + add_RunCMake_test(Cppcheck -DPSEUDO_CPPCHECK=$<TARGET_FILE:pseudo_cppcheck>) + add_RunCMake_test(MultiLint + -DPSEUDO_TIDY=$<TARGET_FILE:pseudo_tidy> + -DPSEUDO_IWYU=$<TARGET_FILE:pseudo_iwyu> + -DPSEUDO_CPPLINT=$<TARGET_FILE:pseudo_cpplint> + -DPSEUDO_CPPCHECK=$<TARGET_FILE:pseudo_cppcheck> + ) if(DEFINED CMake_TEST_CUDA) list(APPEND CompilerLauncher_ARGS -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) endif() + if(CMAKE_Fortran_COMPILER) + list(APPEND CompilerLauncher_ARGS -DCMake_TEST_Fortran=1) + endif() add_RunCMake_test(CompilerLauncher) add_RunCMake_test(ctest_labels_for_subprojects) endif() diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt deleted file mode 100644 index 73b66ac..0000000 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\): - Error evaluating generator expression: - - \$<COMPILE_LANGUAGE:CXX> - - \$<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt deleted file mode 100644 index a1ed633..0000000 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt +++ /dev/null @@ -1,9 +0,0 @@ -CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\): - Error evaluating generator expression: - - \$<COMPILE_LANGUAGE:CXX> - - \$<COMPILE_LANGUAGE:...> may only be used with COMPILE_OPTIONS with the - Xcode generator. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake deleted file mode 100644 index 7935d88..0000000 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake +++ /dev/null @@ -1,5 +0,0 @@ - -enable_language(CXX) - -add_executable(main main.cpp) -target_compile_definitions(main PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-DANYTHING>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt deleted file mode 100644 index e9e8e9f..0000000 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at CompileOptions.cmake:5 \(target_compile_options\): - Error evaluating generator expression: - - \$<COMPILE_LANGUAGE:CXX> - - \$<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake deleted file mode 100644 index 6c92abc..0000000 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake +++ /dev/null @@ -1,5 +0,0 @@ - -enable_language(CXX) - -add_executable(main main.cpp) -target_compile_options(main PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-DANYTHING>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt deleted file mode 100644 index ec15068..0000000 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\): - Error evaluating generator expression: - - \$<COMPILE_LANGUAGE:CXX> - - \$<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt deleted file mode 100644 index fdf92b2..0000000 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt +++ /dev/null @@ -1,9 +0,0 @@ -CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\): - Error evaluating generator expression: - - \$<COMPILE_LANGUAGE:CXX> - - \$<COMPILE_LANGUAGE:...> may only be used with COMPILE_OPTIONS with the - Xcode generator. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake deleted file mode 100644 index 31771f6..0000000 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake +++ /dev/null @@ -1,5 +0,0 @@ - -enable_language(CXX) - -add_executable(main main.cpp) -target_include_directories(main PRIVATE $<$<COMPILE_LANGUAGE:CXX>:anydir>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake deleted file mode 100644 index 5e0a5f5..0000000 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake +++ /dev/null @@ -1,20 +0,0 @@ -include(RunCMake) - -if (RunCMake_GENERATOR MATCHES "Visual Studio") - set(RunCMake-stderr-file CompileOptions-stderr-VS.txt) - run_cmake(CompileOptions) -endif() -if (RunCMake_GENERATOR STREQUAL "Xcode") - set(RunCMake-stderr-file CompileDefinitions-stderr-Xcode.txt) - run_cmake(CompileDefinitions) -elseif (RunCMake_GENERATOR MATCHES "Visual Studio") - set(RunCMake-stderr-file CompileDefinitions-stderr-VS.txt) - run_cmake(CompileDefinitions) -endif() -if (RunCMake_GENERATOR STREQUAL "Xcode") - set(RunCMake-stderr-file IncludeDirectories-stderr-Xcode.txt) - run_cmake(IncludeDirectories) -elseif (RunCMake_GENERATOR MATCHES "Visual Studio") - set(RunCMake-stderr-file IncludeDirectories-stderr-VS.txt) - run_cmake(IncludeDirectories) -endif() diff --git a/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake b/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake index 99d3155..948c6ab 100644 --- a/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake +++ b/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake @@ -45,13 +45,22 @@ function(toExpectedContentList FILE_NO CONTENT_VAR) unset(prefix_) endif() - if(NOT DEFINED TEST_MAIN_INSTALL_PREFIX_PATH) - set(TEST_MAIN_INSTALL_PREFIX_PATH "/usr") + # add install prefix to expected paths + if(DEFINED EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX) + set(EXPECTED_FILE_PACKAGING_PREFIX + "${EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX}") + elseif(NOT DEFINED EXPECTED_FILE_PACKAGING_PREFIX) + # default CPack Archive packaging install prefix + set(EXPECTED_FILE_PACKAGING_PREFIX "/") endif() + set(prepared_ "${EXPECTED_FILE_PACKAGING_PREFIX}") + foreach(part_ IN LISTS ${CONTENT_VAR}) + list(APPEND prepared_ "${EXPECTED_FILE_PACKAGING_PREFIX}${part_}") + endforeach() unset(filtered_) - foreach(part_ IN LISTS ${CONTENT_VAR}) - string(REGEX REPLACE "^${TEST_MAIN_INSTALL_PREFIX_PATH}(/|$)" "" part_ "${part_}") + foreach(part_ IN LISTS prepared_) + string(REGEX REPLACE "^/" "" part_ "${part_}") if(part_) list(APPEND filtered_ "${prefix_}${part_}") diff --git a/Tests/RunCMake/CPack/CMakeLists.txt b/Tests/RunCMake/CPack/CMakeLists.txt index c361af0..1b3dbb2 100644 --- a/Tests/RunCMake/CPack/CMakeLists.txt +++ b/Tests/RunCMake/CPack/CMakeLists.txt @@ -15,3 +15,7 @@ include(tests/${RunCMake_TEST_FILE_PREFIX}/test.cmake) set(CPACK_GENERATOR "${GENERATOR_TYPE}") include(CPack) + +if(COMMAND run_after_include_cpack) + run_after_include_cpack() +endif() diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake index f883c69..447b08b 100644 --- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -35,10 +35,27 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK "-DRunCMake_TEST_FILE_PREFIX=${TEST_NAME}" "-DRunCMake_SUBTEST_SUFFIX=${SUBTEST_SUFFIX}" "-DPACKAGING_TYPE=${PACKAGING_TYPE}") + + foreach(o out err) + if(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/configure-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/configure-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt") + elseif(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/configure-${SUBTEST_SUFFIX}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/configure-${SUBTEST_SUFFIX}-std${o}.txt") + elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/configure-${PACKAGING_TYPE}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/configure-${PACKAGING_TYPE}-std${o}.txt") + elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/configure-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/configure-std${o}.txt") + else() + unset(RunCMake-std${o}-file) + endif() + endforeach() + run_cmake(${full_test_name_}) # execute optional build step if(build) + unset(RunCMake-stdout-file) + unset(RunCMake-stderr-file) run_cmake_command(${full_test_name_}-Build "${CMAKE_COMMAND}" --build "${RunCMake_TEST_BINARY_DIR}") endif() @@ -68,8 +85,12 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK set(RunCMake-std${o}-file "tests/${TEST_NAME}/${TEST_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt") elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-std${o}.txt) set(RunCMake-std${o}-file "tests/${TEST_NAME}/${TEST_TYPE}-std${o}.txt") + elseif(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${SUBTEST_SUFFIX}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/${SUBTEST_SUFFIX}-std${o}.txt") elseif(EXISTS ${RunCMake_SOURCE_DIR}/${TEST_TYPE}/default_expected_std${o}.txt) set(RunCMake-std${o}-file "${TEST_TYPE}/default_expected_std${o}.txt") + else() + unset(RunCMake-std${o}-file) endif() endforeach() diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake index ad1b47b..f7c5c84 100644 --- a/Tests/RunCMake/CPack/DEB/Helpers.cmake +++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake @@ -23,7 +23,7 @@ function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_V endif() if(GENERATOR_SPECIFIC_FORMAT) - set(${RESULT_VAR} "${NAME}${COMPONENT}_${VERSION}-${REVISION}_*.deb" PARENT_SCOPE) + set(${RESULT_VAR} "${NAME}${COMPONENT}_${VERSION}_*.deb" PARENT_SCOPE) else() set(${RESULT_VAR} "${NAME}-${VERSION}-*${COMPONENT}.deb" PARENT_SCOPE) endif() @@ -47,7 +47,20 @@ function(getPackageContentList FILE RESULT_VAR) endfunction() function(toExpectedContentList FILE_NO CONTENT_VAR) - # no need to do anything + # add install prefix to expected paths + if(DEFINED EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX) + set(EXPECTED_FILE_PACKAGING_PREFIX + "${EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX}") + elseif(NOT DEFINED EXPECTED_FILE_PACKAGING_PREFIX) + # default CPackDeb packaging install prefix + set(EXPECTED_FILE_PACKAGING_PREFIX "/usr") + endif() + set(prepared_ "${EXPECTED_FILE_PACKAGING_PREFIX}") + foreach(part_ IN LISTS ${CONTENT_VAR}) + list(APPEND prepared_ "${EXPECTED_FILE_PACKAGING_PREFIX}${part_}") + endforeach() + + set(${CONTENT_VAR} "${prepared_}" PARENT_SCOPE) endfunction() function(getMissingShlibsErrorExtra FILE RESULT_VAR) diff --git a/Tests/RunCMake/CPack/README.txt b/Tests/RunCMake/CPack/README.txt index 7c98f69..2165125 100644 --- a/Tests/RunCMake/CPack/README.txt +++ b/Tests/RunCMake/CPack/README.txt @@ -91,6 +91,19 @@ If test will be used for multiple generators but some of them require some generator specific commands then those commands should be added to 'test.cmake' script wrapped with 'if(GENERATOR_TYPE STREQUAL <name_of_the_generator>)'. +NOTE: In some cases (for example when testing CPackComponent.cmake functions) +the test has to run some functions after CPack.cmake is included. In such cases +a function run_after_include_cpack can be declared in test.cmake file and that +function will run after the inclusion of CPack.cmake. + +NOTE: During CMake configure stage developer warnings may be expected. In such +cases an expected output regular expression can be provided by creating +'<test_name>/configure-stdout.txt' and/or '<test_name>/configure-stderr.txt' +file. There are also more specialized versions of the file available: +- configure-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt +- configure-${SUBTEST_SUFFIX}-std${o}.txt +- configure-${PACKAGING_TYPE}-std${o}.txt + build phase (optional and not available for source package tests) ----------------------------------------------------------------- @@ -144,17 +157,23 @@ this step and must contain NOTE: This variable should be used only as last resort as it sets generator specific regular expression. EXPECTED_FILE_CONTENT_<file_number_starting_with_1>_LIST should be - prefered as it requires a list of expected files and directories that + preferred as it requires a list of expected files and directories that is later changed automatically depending on the generator so expected package content can be written only once per test for all generators. -Optional verification phase is generator specific and is optionaly executed. +- EXPECTED_FILE_PACKAGING_PREFIX and + EXPECTED_FILE_<file_number_starting_with_1>_PACKAGING_PREFIX variables can be + set to explicitly specified CPACK_PACKAGING_PREFIX value. By default this + variable does not need to be set as it is implicitly set to package generator + specific prefix. + +Optional verification phase is generator specific and is optionally executed. This phase is executed if '<test_name>/VerifyResult.cmake' script exists. VerifyResult.cmake script also automatically prints out standard output and standard error from CPack execution phase that is compared with '<test_name>/<generator_name>-stdout.txt' regular expression and -and '<test_name>/<generator_name>-stderr.txt' regular expresson respectively. +'<test_name>/<generator_name>-stderr.txt' regular expresson respectively. NOTE: For subtests generator name can also be suffixed with subtest name and/or packaging type (MONOLITHIC, COMPONENT, GROUP) and in such cases the preferences of which file will be used are as follows: @@ -162,6 +181,7 @@ NOTE: For subtests generator name can also be suffixed with subtest name and/or - generator name + packaging type - generator name + subtest name - generator name + - subtest name - default generator File name format: '<generator_name>-<packaging_type>-<subtest_name>-std<type>.txt' where <type> can either be 'out' or 'err'. @@ -204,7 +224,7 @@ To add a new generator we must + FILE that will contain the package file for which the package content should be returned. + RESULT_VAR that will tell the function which variable in parent scope - should contain the result (list of pacakge content) + should contain the result (list of package content) - toExpectedContentList: This function should convert an expected package content list into one that is expected for the generator (e.g. rpm packages have install/relocate diff --git a/Tests/RunCMake/CPack/RPM/Helpers.cmake b/Tests/RunCMake/CPack/RPM/Helpers.cmake index d8012b1..a29c020 100644 --- a/Tests/RunCMake/CPack/RPM/Helpers.cmake +++ b/Tests/RunCMake/CPack/RPM/Helpers.cmake @@ -23,6 +23,9 @@ function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_V endif() if(GENERATOR_SPECIFIC_FORMAT) + if(NOT REVISION) + set(REVISION "1") + endif() set(${RESULT_VAR} "${NAME}${COMPONENT}-${VERSION}-${REVISION}.*.rpm" PARENT_SCOPE) else() set(${RESULT_VAR} "${NAME}-${VERSION}-*${COMPONENT}.rpm" PARENT_SCOPE) @@ -44,14 +47,29 @@ function(getPackageContentList FILE RESULT_VAR) endfunction() function(toExpectedContentList FILE_NO CONTENT_VAR) - if(NOT DEFINED TEST_INSTALL_PREFIX_PATHS) - set(TEST_INSTALL_PREFIX_PATHS "/usr") + # add install prefix to expected paths + if(DEFINED EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX) + set(EXPECTED_FILE_PACKAGING_PREFIX + "${EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX}") + elseif(NOT DEFINED EXPECTED_FILE_PACKAGING_PREFIX) + # default CPackRPM packaging install prefix + set(EXPECTED_FILE_PACKAGING_PREFIX "/usr") endif() + set(prepared_ "${EXPECTED_FILE_PACKAGING_PREFIX}") + foreach(part_ IN LISTS ${CONTENT_VAR}) + list(APPEND prepared_ "${EXPECTED_FILE_PACKAGING_PREFIX}${part_}") + endforeach() + # remove paths that are excluded from auto packaging + if(NOT DEFINED CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) + set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST + /etc /etc/init.d /usr /usr/bin /usr/include /usr/lib + /usr/libx32 /usr/lib64 /usr/share /usr/share/aclocal /usr/share/doc) + endif() unset(filtered_) - foreach(part_ IN LISTS ${CONTENT_VAR}) + foreach(part_ IN LISTS prepared_) unset(dont_add_) - foreach(for_removal_ IN LISTS TEST_INSTALL_PREFIX_PATHS) + foreach(for_removal_ IN LISTS CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) if(part_ STREQUAL for_removal_) set(dont_add_ TRUE) break() diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index faf151a..4b7f146 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -7,11 +7,13 @@ include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake") run_cpack_test(CUSTOM_BINARY_SPEC_FILE "RPM" false "MONOLITHIC;COMPONENT") run_cpack_test(CUSTOM_NAMES "RPM;DEB;TGZ" true "COMPONENT") run_cpack_test(DEBUGINFO "RPM" true "COMPONENT") +run_cpack_test_subtests(DEFAULT_PERMISSIONS "CMAKE_var_set;CPACK_var_set;both_set;invalid_CMAKE_var;invalid_CPACK_var" "RPM;DEB" false "MONOLITHIC;COMPONENT") run_cpack_test(DEPENDENCIES "RPM;DEB" true "COMPONENT") 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") @@ -27,3 +29,5 @@ run_cpack_test(SUGGESTS "RPM" false "MONOLITHIC") run_cpack_test(SYMLINKS "RPM;TGZ" false "MONOLITHIC;COMPONENT") run_cpack_test(USER_FILELIST "RPM" false "MONOLITHIC") run_cpack_test(MD5SUMS "DEB" false "MONOLITHIC;COMPONENT") +run_cpack_test(CPACK_INSTALL_SCRIPT "ZIP" false "MONOLITHIC") +run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB" false "MONOLITHIC;COMPONENT") diff --git a/Tests/RunCMake/CPack/STGZ/Helpers.cmake b/Tests/RunCMake/CPack/STGZ/Helpers.cmake index 68b1eab..1756645 100644 --- a/Tests/RunCMake/CPack/STGZ/Helpers.cmake +++ b/Tests/RunCMake/CPack/STGZ/Helpers.cmake @@ -47,18 +47,29 @@ function(toExpectedContentList FILE_NO CONTENT_VAR) string(SUBSTRING "${prefix_}" 0 ${pos_} prefix_) endif() - if(NOT DEFINED TEST_MAIN_INSTALL_PREFIX_PATH) - set(TEST_MAIN_INSTALL_PREFIX_PATH "/usr") + # add install prefix to expected paths + if(DEFINED EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX) + set(EXPECTED_FILE_PACKAGING_PREFIX + "${EXPECTED_FILE_${FILE_NO}_PACKAGING_PREFIX}") + elseif(NOT DEFINED EXPECTED_FILE_PACKAGING_PREFIX) + # default CPack Archive packaging install prefix + set(EXPECTED_FILE_PACKAGING_PREFIX "/") endif() - set(filtered_ "${prefix_}") - foreach(part_ IN LISTS ${CONTENT_VAR}) - string(REGEX REPLACE "^${TEST_MAIN_INSTALL_PREFIX_PATH}(/|$)" "" part_ "${part_}") + # remove trailing slash otherwise path concatenation will cause double slashes + string(REGEX REPLACE "/$" "" EXPECTED_FILE_PACKAGING_PREFIX + "${EXPECTED_FILE_PACKAGING_PREFIX}") + + if(EXPECTED_FILE_PACKAGING_PREFIX) + set(prepared_ "${prefix_}") + else() + unset(prepared_) + endif() - if(part_) - list(APPEND filtered_ "${prefix_}/${part_}") - endif() + list(APPEND prepared_ "${prefix_}${EXPECTED_FILE_PACKAGING_PREFIX}") + foreach(part_ IN LISTS ${CONTENT_VAR}) + list(APPEND prepared_ "${prefix_}${EXPECTED_FILE_PACKAGING_PREFIX}${part_}") endforeach() - set(${CONTENT_VAR} "${filtered_}" PARENT_SCOPE) + set(${CONTENT_VAR} "${prepared_}" PARENT_SCOPE) endfunction() diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake index 470ebf7..1f5ab87 100644 --- a/Tests/RunCMake/CPack/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/VerifyResult.cmake @@ -8,9 +8,7 @@ function(findExpectedFile FILE_NO RESULT_VAR GLOBING_EXPR_VAR) endif() if(NOT DEFINED EXPECTED_FILE_${FILE_NO}_VERSION) set(EXPECTED_FILE_${FILE_NO}_VERSION "0.1.1") - endif() - if(NOT DEFINED EXPECTED_FILE_${FILE_NO}_REVISION) - set(EXPECTED_FILE_${FILE_NO}_REVISION "1") + set(EXPECTED_FILE_${FILE_NO}_VERSION "0.1.1" PARENT_SCOPE) endif() getPackageNameGlobexpr("${EXPECTED_FILE_${FILE_NO}_NAME}" diff --git a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/ExpectedFiles.cmake new file mode 100644 index 0000000..02a7821 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/ExpectedFiles.cmake @@ -0,0 +1,3 @@ +set(EXPECTED_FILES_COUNT "1") + +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/abc.txt") diff --git a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/test.cmake b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/test.cmake new file mode 100644 index 0000000..e3fe0ca --- /dev/null +++ b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_SCRIPT/test.cmake @@ -0,0 +1,11 @@ +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/abc.txt" "test content") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/user-script.cmake" + "file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/foo\" + TYPE FILE FILES \"${CMAKE_CURRENT_BINARY_DIR}/abc.txt\")") +set(CPACK_INSTALL_SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/user-script.cmake") + +function(run_after_include_cpack) + file(READ "${CPACK_OUTPUT_CONFIG_FILE}" conf_file_) + string(REGEX REPLACE "SET\\(CPACK_INSTALL_CMAKE_PROJECTS [^)]*\\)" "" conf_file_ "${conf_file_}") + file(WRITE "${CPACK_OUTPUT_CONFIG_FILE}" "${conf_file_}") +endfunction() diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/ExpectedFiles.cmake index 694dc00..6d895ec 100644 --- a/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/ExpectedFiles.cmake @@ -1,9 +1,9 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") if(PACKAGING_TYPE STREQUAL "COMPONENT") set(EXPECTED_FILES_COUNT "2") set(EXPECTED_FILE_1_COMPONENT "test") set(EXPECTED_FILE_2_COMPONENT "test2") - set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") + set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") endif() diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake index 5cb280c..07226df 100644 --- a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake @@ -1,10 +1,10 @@ set(EXPECTED_FILES_COUNT "3") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) set(EXPECTED_FILE_1_COMPONENT "pkg_1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_2_NAME "second") -set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") -set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_2_LIST "/foo;/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_3_LIST "/foo;/foo/CMakeLists.txt") if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM") string(TOLOWER "${GENERATOR_TYPE}" file_extension_) diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake index 3d8de74..c745828 100644 --- a/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake @@ -5,14 +5,14 @@ set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) set(EXPECTED_FILE_1_NAME "Debuginfo") set(EXPECTED_FILE_1_COMPONENT "applications") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") set(EXPECTED_FILE_2 "TestDinfo-pkg*-headers.rpm") -set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") set(EXPECTED_FILE_3 "TestDinfo-pkg*-libs.rpm") -set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bas;/usr/bas/libtest_lib.so") +set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/libtest_lib.so") set(EXPECTED_FILE_4_NAME "Debuginfo") set(EXPECTED_FILE_4_COMPONENT "applications-debuginfo") -set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*") +set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*\.debug.*") set(EXPECTED_FILE_5 "libs-DebugInfoPackage.rpm") -set(EXPECTED_FILE_CONTENT_5 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/test_lib.cpp.*") +set(EXPECTED_FILE_CONTENT_5 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/test_lib.cpp.*\.debug.*") diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake index f1b6738..71457d4 100644 --- a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake +++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake @@ -8,6 +8,10 @@ endif() set(CMAKE_BUILD_TYPE Debug) +# for rpm packages execute flag must be set for shared libs if debuginfo +# packages are generated +set(CPACK_RPM_INSTALL_WITH_EXEC TRUE) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" "int test_lib();\n") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" diff --git a/Tests/RunCMake/CPack/tests/DEB_PACKAGE_VERSION_BACK_COMPATIBILITY/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEB_PACKAGE_VERSION_BACK_COMPATIBILITY/ExpectedFiles.cmake new file mode 100644 index 0000000..d1a3a5f --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEB_PACKAGE_VERSION_BACK_COMPATIBILITY/ExpectedFiles.cmake @@ -0,0 +1,2 @@ +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/DEB_PACKAGE_VERSION_BACK_COMPATIBILITY/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DEB_PACKAGE_VERSION_BACK_COMPATIBILITY/VerifyResult.cmake new file mode 100644 index 0000000..771cc10 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEB_PACKAGE_VERSION_BACK_COMPATIBILITY/VerifyResult.cmake @@ -0,0 +1,11 @@ +function(checkPackageInfo_ TYPE FILE REGEX) + getPackageInfo("${FILE}" "FILE_INFO_") + if(NOT FILE_INFO_ MATCHES "${REGEX}") + message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}' ${EXPECTED_FILE_1_VERSION} ${EXPECTED_FILE_1_REVISION}; file info: '${FILE_INFO_}'") + endif() +endfunction() + +set(whitespaces_ "[\t\n\r ]*") + +checkPackageInfo_("version" "${FOUND_FILE_1}" + ".*Version${whitespaces_}:${whitespaces_}5.0.1-71-g884852e") diff --git a/Tests/RunCMake/CPack/tests/DEB_PACKAGE_VERSION_BACK_COMPATIBILITY/test.cmake b/Tests/RunCMake/CPack/tests/DEB_PACKAGE_VERSION_BACK_COMPATIBILITY/test.cmake new file mode 100644 index 0000000..403e60d --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEB_PACKAGE_VERSION_BACK_COMPATIBILITY/test.cmake @@ -0,0 +1,7 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) + +set(CPACK_DEBIAN_PACKAGE_VERSION "5.0.1-71-g884852e") + +if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(CPACK_COMPONENTS_ALL test) +endif() diff --git a/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/ExpectedFiles.cmake new file mode 100644 index 0000000..b6fcc17 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/ExpectedFiles.cmake @@ -0,0 +1,6 @@ +if(${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid_.*_var") + set(EXPECTED_FILES_COUNT "0") +else() + set(EXPECTED_FILES_COUNT "1") + set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") +endif() diff --git a/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/VerifyResult.cmake new file mode 100644 index 0000000..16ebcdc --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/VerifyResult.cmake @@ -0,0 +1,39 @@ +if(NOT ${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid_.*_var") + if(GENERATOR_TYPE STREQUAL "RPM") + function(checkContentPermissions_ FILE REGEX) + execute_process(COMMAND ${RPM_EXECUTABLE} -qp --dump ${FILE} + WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" + OUTPUT_VARIABLE PERMISSIONS_ + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(NOT PERMISSIONS_ MATCHES "${REGEX}") + message(FATAL_ERROR "Permissions in '${FILE}'. Permissions: '${PERMISSIONS_}'") + endif() + endfunction() + + if(${RunCMake_SUBTEST_SUFFIX} MATCHES "CMAKE_var_set") + checkContentPermissions_("${FOUND_FILE_1}" + "/usr/foo .*740 root root.*") + else() + checkContentPermissions_("${FOUND_FILE_1}" + "/usr/foo .*700 root root.*") + endif() + else() # DEB + function(checkContentPermissions_ FILE REGEX) + getPackageContent("${FILE}" PERMISSIONS_) + + if(NOT PERMISSIONS_ MATCHES "${REGEX}") + message(FATAL_ERROR "Permissions in '${FILE}'. Permissions: '${PERMISSIONS_}'") + endif() + endfunction() + + if(${RunCMake_SUBTEST_SUFFIX} MATCHES "CMAKE_var_set") + checkContentPermissions_("${FOUND_FILE_1}" + "drwxr----- root/root .* ./usr/\ndrwxr----- root/root .* ./usr/foo/\n.*") + else() + checkContentPermissions_("${FOUND_FILE_1}" + "drwx------ root/root .* ./usr/\ndrwx------ root/root .* ./usr/foo/\n.*") + endif() + endif() +endif() diff --git a/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/invalid_CMAKE_var-stderr.txt b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/invalid_CMAKE_var-stderr.txt new file mode 100644 index 0000000..541763a --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/invalid_CMAKE_var-stderr.txt @@ -0,0 +1 @@ +.*CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS value is invalid.* diff --git a/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/invalid_CPACK_var-stderr.txt b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/invalid_CPACK_var-stderr.txt new file mode 100644 index 0000000..541763a --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/invalid_CPACK_var-stderr.txt @@ -0,0 +1 @@ +.*CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS value is invalid.* diff --git a/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/test.cmake b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/test.cmake new file mode 100644 index 0000000..afe9390 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEFAULT_PERMISSIONS/test.cmake @@ -0,0 +1,34 @@ +if(${RunCMake_SUBTEST_SUFFIX} MATCHES "CMAKE_var_set" OR + ${RunCMake_SUBTEST_SUFFIX} MATCHES "both_set") + + set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS + OWNER_READ + OWNER_WRITE + OWNER_EXECUTE + GROUP_READ + ) +endif() + +if(${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid_CMAKE_var") + list(APPEND CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS "INVALID") +endif() + +if(${RunCMake_SUBTEST_SUFFIX} MATCHES "CPACK_var_set" OR + ${RunCMake_SUBTEST_SUFFIX} MATCHES "both_set") + + set(CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS + OWNER_READ + OWNER_WRITE + OWNER_EXECUTE + ) +endif() + +if(${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid_CPACK_var") + list(APPEND CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS "INVALID") +endif() + +install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) + +if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(CPACK_COMPONENTS_ALL test) +endif() diff --git a/Tests/RunCMake/CPack/tests/DEPENDENCIES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEPENDENCIES/ExpectedFiles.cmake index 3b280ba..be7ba07 100644 --- a/Tests/RunCMake/CPack/tests/DEPENDENCIES/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DEPENDENCIES/ExpectedFiles.cmake @@ -1,14 +1,14 @@ set(EXPECTED_FILES_COUNT "5") set(EXPECTED_FILE_1_COMPONENT "applications") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") set(EXPECTED_FILE_2_COMPONENT "applications_auto") -set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/foo_auto;/usr/foo_auto/test_prog") +set(EXPECTED_FILE_CONTENT_2_LIST "/foo_auto;/foo_auto/test_prog") set(EXPECTED_FILE_3_COMPONENT "headers") -set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_3_LIST "/bar;/bar/CMakeLists.txt") set(EXPECTED_FILE_4_COMPONENT "libs") -set(EXPECTED_FILE_CONTENT_4_LIST "/usr/bas;/usr/bas/libtest_lib.so") +set(EXPECTED_FILE_CONTENT_4_LIST "/bas;/bas/libtest_lib.so") set(EXPECTED_FILE_5_COMPONENT "libs_auto") -set(EXPECTED_FILE_CONTENT_5_LIST "/usr;/usr/bas_auto;/usr/bas_auto/libtest_lib.so") +set(EXPECTED_FILE_CONTENT_5_LIST "/bas_auto;/bas_auto/libtest_lib.so") if(GENERATOR_TYPE STREQUAL "DEB") set(whitespaces_ "[\t\n\r ]*") diff --git a/Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake index 6142eb3..d1a3a5f 100644 --- a/Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake @@ -1,2 +1,2 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/DIST/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DIST/VerifyResult.cmake index 7375ecc..1b2eb48 100644 --- a/Tests/RunCMake/CPack/tests/DIST/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/tests/DIST/VerifyResult.cmake @@ -5,6 +5,11 @@ execute_process(COMMAND ${RPMBUILD_EXECUTABLE} -E %{?dist} set(whitespaces_ "[\t\n\r ]*") +# since we have no control over dist tag value we should try to escape +# the content for use as a regular expression +string(REPLACE "+" "\\+" DIST_TAG "${DIST_TAG}") +string(REPLACE "." "\\." DIST_TAG "${DIST_TAG}") + getPackageInfo("${FOUND_FILE_1}" "FILE_INFO_") if(NOT FILE_INFO_ MATCHES ".*Release${whitespaces_}:${whitespaces_}1${DIST_TAG}") message(FATAL_ERROR "Unexpected Release in '${FOUND_FILE_1}'; file info: '${FILE_INFO_}'") diff --git a/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake index 650687c..8df6831 100644 --- a/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake @@ -1,6 +1,6 @@ set(EXPECTED_FILES_COUNT "1") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/empty") +set(EXPECTED_FILE_CONTENT_1_LIST "/empty") if(PACKAGING_TYPE STREQUAL "COMPONENT") set(EXPECTED_FILE_1_COMPONENT "test") diff --git a/Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake index ded2923..407cbe6 100644 --- a/Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake @@ -1,8 +1,8 @@ set(EXPECTED_FILES_COUNT "3") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) set(EXPECTED_FILE_1_COMPONENT "foo") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_2_COMPONENT "bar") -set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") set(EXPECTED_FILE_3_COMPONENT "bas") -set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bas;/usr/bas/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/ExpectedFiles.cmake index a45b38d..3fb0534 100644 --- a/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/ExpectedFiles.cmake @@ -2,6 +2,7 @@ set(whitespaces_ "[\t\n\r ]*") set(EXPECTED_FILES_COUNT "5") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) +set(EXPECTED_FILE_PACKAGING_PREFIX "") set(EXPECTED_FILE_1_COMPONENT "applications") set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") @@ -11,6 +12,6 @@ set(EXPECTED_FILE_3 "extra_slash_in_path*-libs.rpm") set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/libtest_lib.so") set(EXPECTED_FILE_4_COMPONENT "applications-debuginfo") -set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*") +set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*\.debug.*") set(EXPECTED_FILE_5_COMPONENT "libs-debuginfo") -set(EXPECTED_FILE_CONTENT_5 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/test_lib.cpp.*") +set(EXPECTED_FILE_CONTENT_5 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/test_lib.cpp.*\.debug.*") diff --git a/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/test.cmake b/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/test.cmake index 4fd1e81..7cee188 100644 --- a/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/test.cmake +++ b/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/test.cmake @@ -8,6 +8,10 @@ endif() set(CMAKE_BUILD_TYPE Debug) +# for rpm packages execute flag must be set for shared libs if debuginfo +# packages are generated +set(CPACK_RPM_INSTALL_WITH_EXEC TRUE) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" "int test_lib();\n") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" 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/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake index 44346ab..de38df9 100644 --- a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake @@ -1,5 +1,5 @@ set(EXPECTED_FILES_COUNT "2") set(EXPECTED_FILE_1_COMPONENT "foo") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_2_COMPONENT "bar") -set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake index 631d957..4cb8dd0 100644 --- a/Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake @@ -1,3 +1,3 @@ set(EXPECTED_FILES_COUNT "1") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/llllllllll_oooooooooo_nnnnnnnnnn_gggggggggg_ffffffffff_iiiiiiiiii_llllllllll_eeeeeeeeee_nnnnnnnnnn_aaaaaaaaaa_mmmmmmmmmm_eeeeeeeeee.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/llllllllll_oooooooooo_nnnnnnnnnn_gggggggggg_ffffffffff_iiiiiiiiii_llllllllll_eeeeeeeeee_nnnnnnnnnn_aaaaaaaaaa_mmmmmmmmmm_eeeeeeeeee.txt") diff --git a/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake index 6bfb0c1..629be9e 100644 --- a/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake @@ -3,9 +3,9 @@ set(EXPECTED_FILES_COUNT "0") if(NOT RunCMake_SUBTEST_SUFFIX STREQUAL "invalid") set(EXPECTED_FILES_COUNT "3") set(EXPECTED_FILE_1 "main_component-0.1.1-1.*.rpm") - set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") + set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_2_COMPONENT "headers") - set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") + set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") set(EXPECTED_FILE_3_COMPONENT "libs") - set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bas;/usr/bas/CMakeLists.txt") + set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/CMakeLists.txt") endif() diff --git a/Tests/RunCMake/CPack/tests/MD5SUMS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/MD5SUMS/ExpectedFiles.cmake index 6142eb3..d1a3a5f 100644 --- a/Tests/RunCMake/CPack/tests/MD5SUMS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/MD5SUMS/ExpectedFiles.cmake @@ -1,2 +1,2 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake index 6142eb3..d1a3a5f 100644 --- a/Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake @@ -1,2 +1,2 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake index eed5b92..c375aca 100644 --- a/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake @@ -2,5 +2,5 @@ set(EXPECTED_FILES_COUNT "0") if(NOT ${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid") set(EXPECTED_FILES_COUNT "1") - set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") + set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") endif() diff --git a/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/VerifyResult.cmake index e4f9618..2bb4d3f 100644 --- a/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/VerifyResult.cmake @@ -1,8 +1,7 @@ if(NOT ${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid") - string(TOLOWER ${RunCMake_SUBTEST_SUFFIX} EXTENSION) + string(TOLOWER ${RunCMake_SUBTEST_SUFFIX} CHECKSUM_EXTENSION) file(GLOB PACKAGE RELATIVE ${bin_dir} "*.tar.gz") - file(GLOB CSUMFILE RELATIVE ${bin_dir} "*.${EXTENSION}") - file(STRINGS ${CSUMFILE} CHSUM_VALUE) + file(STRINGS ${PACKAGE}.${CHECKSUM_EXTENSION} CHSUM_VALUE) file(${RunCMake_SUBTEST_SUFFIX} ${PACKAGE} expected_value ) set(expected_value "${expected_value} ${PACKAGE}") diff --git a/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake index ae58c4b..137da47 100644 --- a/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake @@ -1,2 +1,4 @@ set(EXPECTED_FILES_COUNT "1") +# don't set the prefix here as we have absolute paths that should not be prefixed +set(EXPECTED_FILE_PACKAGING_PREFIX "") set(EXPECTED_FILE_CONTENT_1_LIST "/not_relocatable;/not_relocatable/CMakeLists.txt;/opt") diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake index 9bdb176..26fa1df 100644 --- a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake @@ -1,8 +1,8 @@ set(EXPECTED_FILES_COUNT "3") set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) set(EXPECTED_FILE_1_COMPONENT "pkg_1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_2_NAME "second") -set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_2_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_3_COMPONENT "pkg_3") -set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_3_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake index ca866ea..936e4ed 100644 --- a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake @@ -5,26 +5,26 @@ set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo") set(EXPECTED_FILES_COUNT "4") set(EXPECTED_FILE_1 "single_debuginfo-0.1.1-1.*.rpm") - set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog") + set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") set(EXPECTED_FILE_2 "single_debuginfo*-headers.rpm") - set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt") + set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") set(EXPECTED_FILE_3 "single_debuginfo*-libs.rpm") - set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bas;/usr/bas/libtest_lib.so") + set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/libtest_lib.so") set(EXPECTED_FILE_4_COMPONENT "debuginfo") - set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp${whitespaces_}/src/src_1/test_lib.cpp.*") + set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp${whitespaces_}/src/src_1/test_lib.cpp.*\.debug.*") elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component" OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_no_debuginfo") set(EXPECTED_FILES_COUNT "2") set(EXPECTED_FILE_1 "single_debuginfo-0*-applications.rpm") - set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog") + set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") set(EXPECTED_FILE_2 "single_debuginfo-applications-debuginfo*.rpm") - set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*") + set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*\.debug.*") elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_main" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_components") set(EXPECTED_FILES_COUNT "2") set(EXPECTED_FILE_1 "single_debuginfo-0*.rpm") - set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog") + set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") set(EXPECTED_FILE_2 "single_debuginfo-debuginfo*.rpm") - set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*") + set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*\.debug.*") endif() diff --git a/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake index 0a3e426..d78f222 100644 --- a/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake @@ -1,2 +1,3 @@ set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_PACKAGING_PREFIX "") set(EXPECTED_FILE_CONTENT_1_LIST "source_package-0.1.1.tar.gz;source_package.spec") diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake index 6142eb3..d1a3a5f 100644 --- a/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake @@ -1,2 +1,2 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake index 32cc6d1..61ce752 100644 --- a/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake @@ -13,7 +13,7 @@ if(NOT RPMBUILD_CAPS_RESULT) endif() # Only verify that suggests tag is present only if that tag is supported. -# If it is not supported the rpm package was corretly generated by ignoring +# If it is not supported the rpm package was correctly generated by ignoring # that tag and that was already checked by expected files test. if(should_contain_suggests_tag_) execute_process(COMMAND ${RPM_EXECUTABLE} -q --suggests -p "${FOUND_FILE_1}" diff --git a/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake index 05be748..e8281a8 100644 --- a/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/SYMLINKS/ExpectedFiles.cmake @@ -1,12 +1,11 @@ set(EXPECTED_FILES_COUNT "1") set(EXPECTED_FILE_CONTENT_1_LIST - "/usr" - "/usr/empty_dir" - "/usr/non_empty_dir" - "/usr/non_empty_dir/CMakeLists.txt" - "/usr/symlink_to_empty_dir" - "/usr/symlink_to_non_empty_dir") + "/empty_dir" + "/non_empty_dir" + "/non_empty_dir/CMakeLists.txt" + "/symlink_to_empty_dir" + "/symlink_to_non_empty_dir") if(PACKAGING_TYPE STREQUAL "COMPONENT") set(EXPECTED_FILE_1_COMPONENT "links") diff --git a/Tests/RunCMake/CPack/tests/USER_FILELIST/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/USER_FILELIST/ExpectedFiles.cmake index aabe537..8420986 100644 --- a/Tests/RunCMake/CPack/tests/USER_FILELIST/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/USER_FILELIST/ExpectedFiles.cmake @@ -1,2 +1,2 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/usr/one;/usr/one/foo.txt;/usr/one/two;/usr/one/two/bar.txt;/usr/three;/usr/three/baz.txt;/usr/three/qux.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/one;/one/foo.txt;/one/two;/one/two/bar.txt;/three;/three/baz.txt;/three/qux.txt") diff --git a/Tests/RunCMake/CPack/tests/VERSION/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/VERSION/ExpectedFiles.cmake new file mode 100644 index 0000000..372f71b --- /dev/null +++ b/Tests/RunCMake/CPack/tests/VERSION/ExpectedFiles.cmake @@ -0,0 +1,3 @@ +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") +set(EXPECTED_FILE_1_REVISION "1") diff --git a/Tests/RunCMake/CPack/tests/VERSION/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/VERSION/VerifyResult.cmake new file mode 100644 index 0000000..eed9696 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/VERSION/VerifyResult.cmake @@ -0,0 +1,17 @@ +function(checkPackageInfo_ TYPE FILE REGEX) + getPackageInfo("${FILE}" "FILE_INFO_") + if(NOT FILE_INFO_ MATCHES "${REGEX}") + message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}' ${EXPECTED_FILE_1_VERSION} ${EXPECTED_FILE_1_REVISION}; file info: '${FILE_INFO_}'") + endif() +endfunction() + +set(whitespaces_ "[\t\n\r ]*") + +if(GENERATOR_TYPE STREQUAL "RPM") + checkPackageInfo_("package version" "${FOUND_FILE_1}" "Version${whitespaces_}:${whitespaces_}${EXPECTED_FILE_1_VERSION}") + checkPackageInfo_("package revision" "${FOUND_FILE_1}" "Release${whitespaces_}:${whitespaces_}${EXPECTED_FILE_1_REVISION}") + checkPackageInfo_("epoch version" "${FOUND_FILE_1}" "Epoch${whitespaces_}:${whitespaces_}3") +else() # DEB + checkPackageInfo_("version" "${FOUND_FILE_1}" + ".*Version${whitespaces_}:${whitespaces_}3:${EXPECTED_FILE_1_VERSION}-${EXPECTED_FILE_1_REVISION}") +endif() diff --git a/Tests/RunCMake/CPack/tests/VERSION/test.cmake b/Tests/RunCMake/CPack/tests/VERSION/test.cmake new file mode 100644 index 0000000..301ab61 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/VERSION/test.cmake @@ -0,0 +1,14 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) + +if(GENERATOR_TYPE STREQUAL "DEB") + set(package_type_ "DEBIAN") + set(CPACK_DEBIAN_PACKAGE_RELEASE "1") +else() + set(package_type_ "${GENERATOR_TYPE}") +endif() + +set(CPACK_${package_type_}_PACKAGE_EPOCH "3") + +if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(CPACK_COMPONENTS_ALL test) +endif() diff --git a/Tests/RunCMake/CTestCommandLine/LabelCount-stdout.txt b/Tests/RunCMake/CTestCommandLine/LabelCount-stdout.txt index 7fe04eb..9cfe41c 100644 --- a/Tests/RunCMake/CTestCommandLine/LabelCount-stdout.txt +++ b/Tests/RunCMake/CTestCommandLine/LabelCount-stdout.txt @@ -1,7 +1,7 @@ 100% tests passed, 0 tests failed out of 4 + +Label Time Summary: -+'bar' = +[0-9.]+ sec \(3 tests\) -+'foo' = +[0-9.]+ sec \(1 test\) ++'bar' = +[0-9.]+ sec\*proc \(3 tests\) ++'foo' = +[0-9.]+ sec\*proc \(1 test\) + Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index e936dab..0fafea5 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -102,7 +102,7 @@ function(run_TestLoad name load) add_test(TestLoad1 \"${CMAKE_COMMAND}\" -E echo \"test of --test-load\") add_test(TestLoad2 \"${CMAKE_COMMAND}\" -E echo \"test of --test-load\") ") - run_cmake_command(${name} ${CMAKE_CTEST_COMMAND} -j2 --test-load ${load} --test-timeout 5) + run_cmake_command(${name} ${CMAKE_CTEST_COMMAND} -j2 --test-load ${load}) endfunction() # Tests for the --test-load feature of ctest diff --git a/Tests/RunCMake/CacheNewline/CMakeLists.txt b/Tests/RunCMake/CacheNewline/CMakeLists.txt new file mode 100644 index 0000000..93ee9df --- /dev/null +++ b/Tests/RunCMake/CacheNewline/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.5) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CacheNewline/CacheNewline-check.cmake b/Tests/RunCMake/CacheNewline/CacheNewline-check.cmake new file mode 100644 index 0000000..6534f63 --- /dev/null +++ b/Tests/RunCMake/CacheNewline/CacheNewline-check.cmake @@ -0,0 +1,16 @@ +set(CACHE_EXPECTED_FILE "${RunCMake_TEST_SOURCE_DIR}/cache-regex.txt") +set(CACHE_ACTUAL_FILE "${RunCMake_BINARY_DIR}/CacheNewline-build/CMakeCache.txt") + +file(READ ${CACHE_EXPECTED_FILE} CACHE_EXPECTED) +string(REGEX REPLACE "\r\n" "\n" CACHE_EXPECTED "${CACHE_EXPECTED}") +string(REGEX REPLACE "\n+$" "" CACHE_EXPECTED "${CACHE_EXPECTED}") +file(READ ${CACHE_ACTUAL_FILE} CACHE_ACTUAL) +string(REGEX REPLACE "\r\n" "\n" CACHE_ACTUAL "${CACHE_ACTUAL}") +string(REGEX REPLACE "\n+$" "" CACHE_ACTUAL "${CACHE_ACTUAL}") + +if(NOT "${CACHE_ACTUAL}" MATCHES "${CACHE_EXPECTED}") + set(RunCMake_TEST_FAILED "${CACHE_ACTUAL_FILE} does not match ${CACHE_EXPECTED_FILE}: + +CMakeCache.txt contents = [\n${CACHE_ACTUAL}\n] +Expected = [\n${CACHE_EXPECTED}\n]") +endif() diff --git a/Tests/RunCMake/CacheNewline/CacheNewline-stderr.txt b/Tests/RunCMake/CacheNewline/CacheNewline-stderr.txt new file mode 100644 index 0000000..726c65c --- /dev/null +++ b/Tests/RunCMake/CacheNewline/CacheNewline-stderr.txt @@ -0,0 +1,2 @@ +CMake Warning: + Value of NEWLINE_VARIABLE contained a newline; truncating diff --git a/Tests/RunCMake/CacheNewline/CacheNewline.cmake b/Tests/RunCMake/CacheNewline/CacheNewline.cmake new file mode 100644 index 0000000..81851db --- /dev/null +++ b/Tests/RunCMake/CacheNewline/CacheNewline.cmake @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.5) + +project(CacheNewlineTest NONE) + +set(NEWLINE_VARIABLE "a\nb" CACHE STRING "Offending entry") diff --git a/Tests/RunCMake/CacheNewline/RunCMakeTest.cmake b/Tests/RunCMake/CacheNewline/RunCMakeTest.cmake new file mode 100644 index 0000000..5e3d2d4 --- /dev/null +++ b/Tests/RunCMake/CacheNewline/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(CacheNewline) diff --git a/Tests/RunCMake/CacheNewline/cache-regex.txt b/Tests/RunCMake/CacheNewline/cache-regex.txt new file mode 100644 index 0000000..b239dbc --- /dev/null +++ b/Tests/RunCMake/CacheNewline/cache-regex.txt @@ -0,0 +1,6 @@ +//Offending entry +NEWLINE_VARIABLE:STRING=a +# WARNING: Value of NEWLINE_VARIABLE contained a newline and was +# truncated\. Original value: +# a +# \\nb diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3-result.txt b/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3-result.txt +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage-result.txt diff --git a/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage-stderr.txt b/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage-stderr.txt new file mode 100644 index 0000000..36c28f9 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at .*/Modules/CheckIncludeFiles.cmake:[0-9]+. \(message\): + No languages listed for LANGUAGE option. + + Supported languages: C, CXX. + +Call Stack \(most recent call first\): + CheckIncludeFilesMissingLanguage.cmake:[0-9]+ \(check_include_files\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage.cmake b/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage.cmake new file mode 100644 index 0000000..59accb0 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesMissingLanguage.cmake @@ -0,0 +1,3 @@ +enable_language(C) +include(CheckIncludeFiles) +check_include_files("stddef.h;stdlib.h" HAVE_MISSING_ARGUMENT_H LANGUAGE) diff --git a/Tests/RunCMake/CheckModules/CheckIncludeFilesOk.cmake b/Tests/RunCMake/CheckModules/CheckIncludeFilesOk.cmake new file mode 100644 index 0000000..0891ec6 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesOk.cmake @@ -0,0 +1,6 @@ +enable_language(C) +enable_language(CXX) +include(CheckIncludeFiles) +check_include_files("stddef.h;stdlib.h" HAVE_STDLIB_H) +check_include_files("stddef.h;stdlib.h" HAVE_STDLIB_H2 LANGUAGE C) +check_include_files("cstddef;cstdlib" HAVE_CSTDLIB_H LANGUAGE CXX) diff --git a/Tests/RunCMake/CheckModules/CheckIncludeFilesOkNoC.cmake b/Tests/RunCMake/CheckModules/CheckIncludeFilesOkNoC.cmake new file mode 100644 index 0000000..a1d2843 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesOkNoC.cmake @@ -0,0 +1,4 @@ +enable_language(CXX) +include(CheckIncludeFiles) +check_include_files("cstddef;cstdlib" HAVE_CSTDLIB_H3 LANGUAGE CXX) +check_include_files("cstddef;cstdlib" HAVE_CSTDLIB_H4) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2-result.txt b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownArgument-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2-result.txt +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownArgument-result.txt diff --git a/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownArgument-stderr.txt b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownArgument-stderr.txt new file mode 100644 index 0000000..098da79 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownArgument-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at .*/Modules/CheckIncludeFiles.cmake:[0-9]+. \(message\): + Unknown arguments: + + FOOBAR + +Call Stack \(most recent call first\): + CheckIncludeFilesUnknownArgument.cmake:[0-9]+ \(check_include_files\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownArgument.cmake b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownArgument.cmake new file mode 100644 index 0000000..dfc2b93 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownArgument.cmake @@ -0,0 +1,3 @@ +enable_language(C) +include(CheckIncludeFiles) +check_include_files("stddef.h;stdlib.h" HAVE_UNKNOWN_ARGUMENT_H FOOBAR) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1-result.txt b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownLanguage-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1-result.txt +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownLanguage-result.txt diff --git a/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownLanguage-stderr.txt b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownLanguage-stderr.txt new file mode 100644 index 0000000..5d4a9ec --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownLanguage-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at .*/Modules/CheckIncludeFiles.cmake:[0-9]+. \(message\): + Unknown language: + + FOOBAR + + Supported languages: C, CXX. + +Call Stack \(most recent call first\): + CheckIncludeFilesUnknownLanguage.cmake:[0-9]+ \(check_include_files\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownLanguage.cmake b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownLanguage.cmake new file mode 100644 index 0000000..3a77cf9 --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckIncludeFilesUnknownLanguage.cmake @@ -0,0 +1,3 @@ +enable_language(C) +include(CheckIncludeFiles) +check_include_files("stddef.h;stdlib.h" HAVE_UNKNOWN_ARGUMENT_H LANGUAGE FOOBAR) diff --git a/Tests/RunCMake/CheckModules/RunCMakeTest.cmake b/Tests/RunCMake/CheckModules/RunCMakeTest.cmake index 5b4e57e..c5aaa64 100644 --- a/Tests/RunCMake/CheckModules/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckModules/RunCMakeTest.cmake @@ -14,3 +14,9 @@ run_cmake(CheckTypeSizeUnknownArgument) run_cmake(CheckTypeSizeMixedArgs) run_cmake(CheckTypeSizeOkNoC) + +run_cmake(CheckIncludeFilesOk) +run_cmake(CheckIncludeFilesOkNoC) +run_cmake(CheckIncludeFilesMissingLanguage) +run_cmake(CheckIncludeFilesUnknownArgument) +run_cmake(CheckIncludeFilesUnknownLanguage) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8-result.txt b/Tests/RunCMake/CommandLine/E___run_co_compile-bad-iwyu-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8-result.txt +++ b/Tests/RunCMake/CommandLine/E___run_co_compile-bad-iwyu-result.txt diff --git a/Tests/RunCMake/CommandLine/E___run_iwyu-bad-iwyu-stderr.txt b/Tests/RunCMake/CommandLine/E___run_co_compile-bad-iwyu-stderr.txt index 338f7c4..338f7c4 100644 --- a/Tests/RunCMake/CommandLine/E___run_iwyu-bad-iwyu-stderr.txt +++ b/Tests/RunCMake/CommandLine/E___run_co_compile-bad-iwyu-stderr.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7-result.txt b/Tests/RunCMake/CommandLine/E___run_co_compile-no----result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7-result.txt +++ b/Tests/RunCMake/CommandLine/E___run_co_compile-no----result.txt diff --git a/Tests/RunCMake/CommandLine/E___run_co_compile-no----stderr.txt b/Tests/RunCMake/CommandLine/E___run_co_compile-no----stderr.txt new file mode 100644 index 0000000..f0597d2 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E___run_co_compile-no----stderr.txt @@ -0,0 +1 @@ +^__run_co_compile given unknown argument: command-does-not-exist$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6-result.txt b/Tests/RunCMake/CommandLine/E___run_co_compile-no-cc-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6-result.txt +++ b/Tests/RunCMake/CommandLine/E___run_co_compile-no-cc-result.txt diff --git a/Tests/RunCMake/CommandLine/E___run_co_compile-no-cc-stderr.txt b/Tests/RunCMake/CommandLine/E___run_co_compile-no-cc-stderr.txt new file mode 100644 index 0000000..bba846e --- /dev/null +++ b/Tests/RunCMake/CommandLine/E___run_co_compile-no-cc-stderr.txt @@ -0,0 +1 @@ +^__run_co_compile missing compile command after --$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5-result.txt b/Tests/RunCMake/CommandLine/E___run_co_compile-no-iwyu-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5-result.txt +++ b/Tests/RunCMake/CommandLine/E___run_co_compile-no-iwyu-result.txt diff --git a/Tests/RunCMake/CommandLine/E___run_co_compile-no-iwyu-stderr.txt b/Tests/RunCMake/CommandLine/E___run_co_compile-no-iwyu-stderr.txt new file mode 100644 index 0000000..a7fbad6 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E___run_co_compile-no-iwyu-stderr.txt @@ -0,0 +1,6 @@ +^__run_co_compile missing command to run. Looking for one or more of the following: +--cppcheck= +--cpplint= +--iwyu= +--lwyu= +--tidy= diff --git a/Tests/RunCMake/CommandLine/E___run_iwyu-no----stderr.txt b/Tests/RunCMake/CommandLine/E___run_iwyu-no----stderr.txt deleted file mode 100644 index c251adf..0000000 --- a/Tests/RunCMake/CommandLine/E___run_iwyu-no----stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^__run_iwyu given unknown argument: command-does-not-exist$ diff --git a/Tests/RunCMake/CommandLine/E___run_iwyu-no-cc-stderr.txt b/Tests/RunCMake/CommandLine/E___run_iwyu-no-cc-stderr.txt deleted file mode 100644 index 1998abb..0000000 --- a/Tests/RunCMake/CommandLine/E___run_iwyu-no-cc-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^__run_iwyu missing compile command after --$ diff --git a/Tests/RunCMake/CommandLine/E___run_iwyu-no-iwyu-stderr.txt b/Tests/RunCMake/CommandLine/E___run_iwyu-no-iwyu-stderr.txt deleted file mode 100644 index 35f50b7..0000000 --- a/Tests/RunCMake/CommandLine/E___run_iwyu-no-iwyu-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^__run_iwyu missing --cpplint=, --iwyu=, --lwyu=, and/or --tidy=$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 6efcc12..55eac5e 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -21,10 +21,10 @@ run_cmake_command(E_touch_nocreate-no-arg ${CMAKE_COMMAND} -E touch_nocreate) run_cmake_command(E_time ${CMAKE_COMMAND} -E time ${CMAKE_COMMAND} -E echo "hello world") run_cmake_command(E_time-no-arg ${CMAKE_COMMAND} -E time) -run_cmake_command(E___run_iwyu-no-iwyu ${CMAKE_COMMAND} -E __run_iwyu -- command-does-not-exist) -run_cmake_command(E___run_iwyu-bad-iwyu ${CMAKE_COMMAND} -E __run_iwyu --iwyu=iwyu-does-not-exist -- command-does-not-exist) -run_cmake_command(E___run_iwyu-no--- ${CMAKE_COMMAND} -E __run_iwyu --iwyu=iwyu-does-not-exist command-does-not-exist) -run_cmake_command(E___run_iwyu-no-cc ${CMAKE_COMMAND} -E __run_iwyu --iwyu=iwyu-does-not-exist --) +run_cmake_command(E___run_co_compile-no-iwyu ${CMAKE_COMMAND} -E __run_co_compile -- command-does-not-exist) +run_cmake_command(E___run_co_compile-bad-iwyu ${CMAKE_COMMAND} -E __run_co_compile --iwyu=iwyu-does-not-exist -- command-does-not-exist) +run_cmake_command(E___run_co_compile-no--- ${CMAKE_COMMAND} -E __run_co_compile --iwyu=iwyu-does-not-exist command-does-not-exist) +run_cmake_command(E___run_co_compile-no-cc ${CMAKE_COMMAND} -E __run_co_compile --iwyu=iwyu-does-not-exist --) run_cmake_command(G_no-arg ${CMAKE_COMMAND} -G) run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -G NoSuchGenerator) diff --git a/Tests/RunCMake/CompilerLauncher/Fortran-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/Fortran-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/Fortran-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/Fortran-launch-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran-launch-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/Fortran-launch.cmake b/Tests/RunCMake/CompilerLauncher/Fortran-launch.cmake new file mode 100644 index 0000000..7e9a564 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(Fortran.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/Fortran.cmake b/Tests/RunCMake/CompilerLauncher/Fortran.cmake new file mode 100644 index 0000000..72cc03e --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran.cmake @@ -0,0 +1,4 @@ +enable_language(Fortran) +set(CMAKE_Fortran_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1") +set(CMAKE_VERBOSE_MAKEFILE TRUE) +add_executable(main main.F) diff --git a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake index ab26512..bb8da03 100644 --- a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake @@ -19,6 +19,9 @@ set(langs C CXX) if(CMake_TEST_CUDA) list(APPEND langs CUDA) endif() +if(CMake_TEST_Fortran) + list(APPEND langs Fortran) +endif() foreach(lang ${langs}) run_compiler_launcher(${lang}) diff --git a/Tests/RunCMake/CompilerLauncher/main.F b/Tests/RunCMake/CompilerLauncher/main.F new file mode 100644 index 0000000..53ec0d1 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/main.F @@ -0,0 +1,2 @@ + PROGRAM MAIN + END diff --git a/Tests/RunCMake/Cppcheck/C-Build-stdout.txt b/Tests/RunCMake/Cppcheck/C-Build-stdout.txt new file mode 100644 index 0000000..26eded3 --- /dev/null +++ b/Tests/RunCMake/Cppcheck/C-Build-stdout.txt @@ -0,0 +1 @@ +.*Warning: cppcheck reported diagnostics.*error.*warning.*style.*performance.*information.* diff --git a/Tests/RunCMake/TargetSources/OriginDebugIDE-result.txt b/Tests/RunCMake/Cppcheck/C-bad-Build-result.txt index 573541a..573541a 100644 --- a/Tests/RunCMake/TargetSources/OriginDebugIDE-result.txt +++ b/Tests/RunCMake/Cppcheck/C-bad-Build-result.txt diff --git a/Tests/RunCMake/Cppcheck/C-bad-Build-stdout.txt b/Tests/RunCMake/Cppcheck/C-bad-Build-stdout.txt new file mode 100644 index 0000000..2370ce1 --- /dev/null +++ b/Tests/RunCMake/Cppcheck/C-bad-Build-stdout.txt @@ -0,0 +1,2 @@ +stdout from bad command line arg '-bad' +stderr from bad command line arg '-bad' diff --git a/Tests/RunCMake/Cppcheck/C-bad.cmake b/Tests/RunCMake/Cppcheck/C-bad.cmake new file mode 100644 index 0000000..920e4b4 --- /dev/null +++ b/Tests/RunCMake/Cppcheck/C-bad.cmake @@ -0,0 +1,3 @@ +enable_language(C) +set(CMAKE_C_CPPCHECK "${PSEUDO_CPPCHECK}" -bad) +add_executable(main main.c) diff --git a/Tests/RunCMake/Cppcheck/C-launch-Build-stdout.txt b/Tests/RunCMake/Cppcheck/C-launch-Build-stdout.txt new file mode 100644 index 0000000..26eded3 --- /dev/null +++ b/Tests/RunCMake/Cppcheck/C-launch-Build-stdout.txt @@ -0,0 +1 @@ +.*Warning: cppcheck reported diagnostics.*error.*warning.*style.*performance.*information.* diff --git a/Tests/RunCMake/Cppcheck/C-launch.cmake b/Tests/RunCMake/Cppcheck/C-launch.cmake new file mode 100644 index 0000000..e66ca20 --- /dev/null +++ b/Tests/RunCMake/Cppcheck/C-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(C.cmake) diff --git a/Tests/RunCMake/Cppcheck/C.cmake b/Tests/RunCMake/Cppcheck/C.cmake new file mode 100644 index 0000000..b1f5bf7 --- /dev/null +++ b/Tests/RunCMake/Cppcheck/C.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +set(CMAKE_C_CPPCHECK "${PSEUDO_CPPCHECK}") +add_executable(main main.c) diff --git a/Tests/RunCMake/Cppcheck/CMakeLists.txt b/Tests/RunCMake/Cppcheck/CMakeLists.txt new file mode 100644 index 0000000..a640c56 --- /dev/null +++ b/Tests/RunCMake/Cppcheck/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.7) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Cppcheck/CXX-Build-stdout.txt b/Tests/RunCMake/Cppcheck/CXX-Build-stdout.txt new file mode 100644 index 0000000..26eded3 --- /dev/null +++ b/Tests/RunCMake/Cppcheck/CXX-Build-stdout.txt @@ -0,0 +1 @@ +.*Warning: cppcheck reported diagnostics.*error.*warning.*style.*performance.*information.* diff --git a/Tests/RunCMake/Cppcheck/CXX-launch-Build-stdout.txt b/Tests/RunCMake/Cppcheck/CXX-launch-Build-stdout.txt new file mode 100644 index 0000000..26eded3 --- /dev/null +++ b/Tests/RunCMake/Cppcheck/CXX-launch-Build-stdout.txt @@ -0,0 +1 @@ +.*Warning: cppcheck reported diagnostics.*error.*warning.*style.*performance.*information.* diff --git a/Tests/RunCMake/Cppcheck/CXX-launch.cmake b/Tests/RunCMake/Cppcheck/CXX-launch.cmake new file mode 100644 index 0000000..3002c9d --- /dev/null +++ b/Tests/RunCMake/Cppcheck/CXX-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(CXX.cmake) diff --git a/Tests/RunCMake/Cppcheck/CXX.cmake b/Tests/RunCMake/Cppcheck/CXX.cmake new file mode 100644 index 0000000..3b79471 --- /dev/null +++ b/Tests/RunCMake/Cppcheck/CXX.cmake @@ -0,0 +1,3 @@ +enable_language(CXX) +set(CMAKE_CXX_CPPCHECK "${PSEUDO_CPPCHECK}") +add_executable(main main.cxx) diff --git a/Tests/RunCMake/Cppcheck/RunCMakeTest.cmake b/Tests/RunCMake/Cppcheck/RunCMakeTest.cmake new file mode 100644 index 0000000..5fd4ead --- /dev/null +++ b/Tests/RunCMake/Cppcheck/RunCMakeTest.cmake @@ -0,0 +1,23 @@ +include(RunCMake) + +set(RunCMake_TEST_OPTIONS "-DPSEUDO_CPPCHECK=${PSEUDO_CPPCHECK}") + +function(run_cppcheck lang) + # Use a single build tree for tests without cleaning. + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${lang}-build") + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${lang}) + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(${lang}-Build ${CMAKE_COMMAND} --build .) +endfunction() + +run_cppcheck(C) +run_cppcheck(CXX) +run_cppcheck(C-bad) + +if(NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") + run_cppcheck(C-launch) + run_cppcheck(CXX-launch) +endif() diff --git a/Tests/RunCMake/Cppcheck/main.c b/Tests/RunCMake/Cppcheck/main.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/RunCMake/Cppcheck/main.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/Cppcheck/main.cxx b/Tests/RunCMake/Cppcheck/main.cxx new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/RunCMake/Cppcheck/main.cxx @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/Cpplint/C-error-Build-result.txt b/Tests/RunCMake/Cpplint/C-error-Build-result.txt index d197c91..573541a 100644 --- a/Tests/RunCMake/Cpplint/C-error-Build-result.txt +++ b/Tests/RunCMake/Cpplint/C-error-Build-result.txt @@ -1 +1 @@ -[^0] +0 diff --git a/Tests/RunCMake/Cpplint/C-error-launch-Build-result.txt b/Tests/RunCMake/Cpplint/C-error-launch-Build-result.txt index d197c91..573541a 100644 --- a/Tests/RunCMake/Cpplint/C-error-launch-Build-result.txt +++ b/Tests/RunCMake/Cpplint/C-error-launch-Build-result.txt @@ -1 +1 @@ -[^0] +0 diff --git a/Tests/RunCMake/Cpplint/CXX-error-Build-result.txt b/Tests/RunCMake/Cpplint/CXX-error-Build-result.txt index d197c91..573541a 100644 --- a/Tests/RunCMake/Cpplint/CXX-error-Build-result.txt +++ b/Tests/RunCMake/Cpplint/CXX-error-Build-result.txt @@ -1 +1 @@ -[^0] +0 diff --git a/Tests/RunCMake/Cpplint/CXX-error-launch-Build-result.txt b/Tests/RunCMake/Cpplint/CXX-error-launch-Build-result.txt index d197c91..573541a 100644 --- a/Tests/RunCMake/Cpplint/CXX-error-launch-Build-result.txt +++ b/Tests/RunCMake/Cpplint/CXX-error-launch-Build-result.txt @@ -1 +1 @@ -[^0] +0 diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake index 1f76fd0..dcb992d 100644 --- a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake @@ -1,4 +1,5 @@ -if(NOT CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _isMultiConfig) set(CMAKE_BUILD_TYPE Debug) endif() include(ExternalProject) diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake index 1b619c8..4b4b40e 100644 --- a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake @@ -1,4 +1,5 @@ -if(NOT CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _isMultiConfig) set(CMAKE_BUILD_TYPE Debug) endif() include(ExternalProject) diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake index 192776b..2fb0705 100644 --- a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake @@ -1,4 +1,5 @@ -if(NOT CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _isMultiConfig) set(CMAKE_BUILD_TYPE Debug) endif() include(ExternalProject) diff --git a/Tests/RunCMake/ExternalProject/MultiCommand-build-stdout.txt b/Tests/RunCMake/ExternalProject/MultiCommand-build-stdout.txt new file mode 100644 index 0000000..30ebc7d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/MultiCommand-build-stdout.txt @@ -0,0 +1,15 @@ +.* *download 1 +.* *download 2 +.* *update 1 +.* *update 2 +.* *patch 1 +.* *patch 2 +.* *configure 1 +.* *configure 2 +.* *build 1 +.* *build 2 +.* *install 1 +.* *install 2 +.* *test 1 +.* *test 2 +.* diff --git a/Tests/RunCMake/ExternalProject/MultiCommand.cmake b/Tests/RunCMake/ExternalProject/MultiCommand.cmake new file mode 100644 index 0000000..a8dbfea --- /dev/null +++ b/Tests/RunCMake/ExternalProject/MultiCommand.cmake @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 3.9) + +include(ExternalProject) + +# Verify COMMAND keyword is recognised after various *_COMMAND options +ExternalProject_Add(multiCommand + DOWNLOAD_COMMAND "${CMAKE_COMMAND}" -E echo "download 1" + COMMAND "${CMAKE_COMMAND}" -E echo "download 2" + UPDATE_COMMAND "${CMAKE_COMMAND}" -E echo "update 1" + COMMAND "${CMAKE_COMMAND}" -E echo "update 2" + PATCH_COMMAND "${CMAKE_COMMAND}" -E echo "patch 1" + COMMAND "${CMAKE_COMMAND}" -E echo "patch 2" + CONFIGURE_COMMAND "${CMAKE_COMMAND}" -E echo "configure 1" + COMMAND "${CMAKE_COMMAND}" -E echo "configure 2" + BUILD_COMMAND "${CMAKE_COMMAND}" -E echo "build 1" + COMMAND "${CMAKE_COMMAND}" -E echo "build 2" + TEST_COMMAND "${CMAKE_COMMAND}" -E echo "test 1" + COMMAND "${CMAKE_COMMAND}" -E echo "test 2" + INSTALL_COMMAND "${CMAKE_COMMAND}" -E echo "install 1" + COMMAND "${CMAKE_COMMAND}" -E echo "install 2" +) + +# Workaround for issue 17229 (missing dependency between update and patch steps) +ExternalProject_Add_StepTargets(multiCommand NO_DEPENDS update) +ExternalProject_Add_StepDependencies(multiCommand patch multiCommand-update) + +# Force all steps to be re-run by removing timestamps from any previous run +ExternalProject_Get_Property(multiCommand STAMP_DIR) +file(REMOVE_RECURSE "${STAMP_DIR}") +file(MAKE_DIRECTORY "${STAMP_DIR}") diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index 47d6129..09607f6 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -12,3 +12,34 @@ run_cmake(Add_StepDependencies_iface) run_cmake(Add_StepDependencies_iface_step) run_cmake(Add_StepDependencies_no_target) run_cmake(UsesTerminal) + +# Run both cmake and build steps. We always do a clean before the +# build to ensure that the download step re-runs each time. +function(__ep_test_with_build testName) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${testName}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${testName}) + run_cmake_command(${testName}-clean ${CMAKE_COMMAND} --build . --target clean) + run_cmake_command(${testName}-build ${CMAKE_COMMAND} --build .) +endfunction() + +__ep_test_with_build(MultiCommand) + +# We can't test the substitution when using the old MSYS due to +# make/sh mangling the paths (substitution is performed correctly, +# but the mangling means we can't reliably test the output). +# There is no such issue when using the newer MSYS though. Therefore, +# we need to bypass the substitution test if using old MSYS. +# See merge request 1537 for discussion. +set(doSubstitutionTest YES) +if(RunCMake_GENERATOR STREQUAL "MSYS Makefiles") + execute_process(COMMAND uname OUTPUT_VARIABLE uname) + if(uname MATCHES "^MINGW32_NT") + set(doSubstitutionTest NO) + endif() +endif() +if(doSubstitutionTest) + __ep_test_with_build(Substitutions) +endif() diff --git a/Tests/RunCMake/ExternalProject/Substitutions-build-stdout.txt b/Tests/RunCMake/ExternalProject/Substitutions-build-stdout.txt new file mode 100644 index 0000000..d6a823a --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Substitutions-build-stdout.txt @@ -0,0 +1,7 @@ +.*Download dir = .*/xxxx_dwn +.*Download file = .*/zzzz_tmp.txt +.*Source dir = .*/xxxx_src +.*Source subdir = /yyyy_subdir +.*Binary dir = .*/xxxx_bin +.*Install dir = .*/xxxx_install +.*Tmp dir = .*/xxxx_tmp diff --git a/Tests/RunCMake/ExternalProject/Substitutions.cmake b/Tests/RunCMake/ExternalProject/Substitutions.cmake new file mode 100644 index 0000000..db79491 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Substitutions.cmake @@ -0,0 +1,25 @@ +include(ExternalProject) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zzzz_tmp.txt "Dummy file") +file(MD5 ${CMAKE_CURRENT_BINARY_DIR}/zzzz_tmp.txt md5hash) +ExternalProject_Add(Subst + URL file://${CMAKE_CURRENT_BINARY_DIR}/zzzz_tmp.txt + URL_HASH MD5=${md5hash} + DOWNLOAD_NO_EXTRACT ON + DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/xxxx_dwn + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/xxxx_src + SOURCE_SUBDIR yyyy_subdir + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/xxxx_bin + INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/xxxx_install + TMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/xxxx_tmp + CONFIGURE_COMMAND ${CMAKE_COMMAND} -E echo "Download dir = <DOWNLOAD_DIR>" + COMMAND ${CMAKE_COMMAND} -E echo "Download file = <DOWNLOADED_FILE>" + COMMAND ${CMAKE_COMMAND} -E echo "Source dir = <SOURCE_DIR>" + COMMAND ${CMAKE_COMMAND} -E echo "Source subdir = <SOURCE_SUBDIR>" + COMMAND ${CMAKE_COMMAND} -E echo "Binary dir = <BINARY_DIR>" + COMMAND ${CMAKE_COMMAND} -E echo "Install dir = <INSTALL_DIR>" + COMMAND ${CMAKE_COMMAND} -E echo "Tmp dir = <TMP_DIR>" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" +) diff --git a/Tests/RunCMake/ExternalProject/UsesTerminal.cmake b/Tests/RunCMake/ExternalProject/UsesTerminal.cmake index cd87403..d3494fd 100644 --- a/Tests/RunCMake/ExternalProject/UsesTerminal.cmake +++ b/Tests/RunCMake/ExternalProject/UsesTerminal.cmake @@ -1,4 +1,5 @@ -if(NOT CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _isMultiConfig) set(CMAKE_BUILD_TYPE Debug) endif() include(ExternalProject) diff --git a/Tests/RunCMake/FPHSA/FindPseudoNoVersionVar.cmake b/Tests/RunCMake/FPHSA/FindPseudoNoVersionVar.cmake new file mode 100644 index 0000000..d961c64 --- /dev/null +++ b/Tests/RunCMake/FPHSA/FindPseudoNoVersionVar.cmake @@ -0,0 +1,6 @@ +# pseudo find_module without specifying VERSION_VAR + +set(FOOBAR TRUE) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(PseudoNoVersionVar REQUIRED_VARS FOOBAR) diff --git a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake index e9b2a7a..dd73cd4 100644 --- a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake +++ b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake @@ -4,7 +4,18 @@ run_cmake(BadFoundVar) # The pseudo module will "find" a package with the given version. Check if the # version selection code in FPHSA works correctly. -set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=1.2.3.4.5") + +# Find a package with version 0. +set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=0") +run_cmake(any_version_find_0) + +# Find a package with more customary version number, without requesting a specific version and in +# the presence of a cache variable VERSION. +set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudoNoVersionVar_VERSION=1.2.3.4_SHOULD_BE_IGNORED" "-DVERSION=BAD_VERSION") +run_cmake(any_version_VERSION_cache_variable) + +# Find a package with a more customary version number, without requesting a specific version. +set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=1.2.3.4") run_cmake(any_version) # test EXACT mode with every subcomponent diff --git a/Tests/RunCMake/FPHSA/any_version_VERSION_cache_variable-stdout.txt b/Tests/RunCMake/FPHSA/any_version_VERSION_cache_variable-stdout.txt new file mode 100644 index 0000000..f9acece --- /dev/null +++ b/Tests/RunCMake/FPHSA/any_version_VERSION_cache_variable-stdout.txt @@ -0,0 +1,2 @@ +Found PseudoNoVersionVar: TRUE * ++ diff --git a/Tests/RunCMake/FPHSA/any_version_VERSION_cache_variable.cmake b/Tests/RunCMake/FPHSA/any_version_VERSION_cache_variable.cmake new file mode 100644 index 0000000..9f27897 --- /dev/null +++ b/Tests/RunCMake/FPHSA/any_version_VERSION_cache_variable.cmake @@ -0,0 +1 @@ +find_package(PseudoNoVersionVar REQUIRED) diff --git a/Tests/RunCMake/FPHSA/any_version_find_0-stdout.txt b/Tests/RunCMake/FPHSA/any_version_find_0-stdout.txt new file mode 100644 index 0000000..861a339 --- /dev/null +++ b/Tests/RunCMake/FPHSA/any_version_find_0-stdout.txt @@ -0,0 +1,2 @@ +Found Pseudo: [^ +]*\(found version "0\"\) diff --git a/Tests/RunCMake/FPHSA/any_version_find_0.cmake b/Tests/RunCMake/FPHSA/any_version_find_0.cmake new file mode 100644 index 0000000..b34a540 --- /dev/null +++ b/Tests/RunCMake/FPHSA/any_version_find_0.cmake @@ -0,0 +1 @@ +find_package(Pseudo REQUIRED) 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/TargetPropertyGeneratorExpressions/BadInvalidName4-result.txt b/Tests/RunCMake/FetchContent/DownloadTwice-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4-result.txt +++ b/Tests/RunCMake/FetchContent/DownloadTwice-result.txt 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/TargetPropertyGeneratorExpressions/BadInvalidName3-result.txt b/Tests/RunCMake/FetchContent/MissingDetails-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3-result.txt +++ b/Tests/RunCMake/FetchContent/MissingDetails-result.txt 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/File_Generate/COMPILE_LANGUAGE-genex-result.txt b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake index 59ccf19..bead2af 100644 --- a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake +++ b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake @@ -1,12 +1,6 @@ - enable_language(CXX C) -add_library(empty empty.cpp empty.c) -target_compile_options(empty - PRIVATE LANG_IS_$<COMPILE_LANGUAGE> -) - file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opts-$<COMPILE_LANGUAGE>.txt - CONTENT "$<TARGET_PROPERTY:empty,COMPILE_OPTIONS>\n" + CONTENT "LANG_IS_$<COMPILE_LANGUAGE>\n" ) diff --git a/Tests/RunCMake/File_Generate/CarryPermissions-result.txt b/Tests/RunCMake/File_Generate/CarryPermissions-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/CarryPermissions-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/GenerateSource-result.txt b/Tests/RunCMake/File_Generate/GenerateSource-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/GenerateSource-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-result.txt b/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/ReRunCMake-result.txt b/Tests/RunCMake/File_Generate/ReRunCMake-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/ReRunCMake-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index b660463..94aaca8 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -5,7 +5,7 @@ run_cmake(CMP0070-OLD) run_cmake(CMP0070-WARN) run_cmake(CommandConflict) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode") +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) run_cmake(OutputConflict) endif() run_cmake(EmptyCondition1) @@ -21,15 +21,13 @@ if (NOT file_contents MATCHES "generated.cpp.rule") message(SEND_ERROR "Rule file not in target sources! ${file_contents}") endif() -if (NOT RunCMake_GENERATOR MATCHES "Visual Studio") - run_cmake(COMPILE_LANGUAGE-genex) - foreach(l CXX C) - file(READ "${RunCMake_BINARY_DIR}/COMPILE_LANGUAGE-genex-build/opts-${l}.txt" l_defs) - if (NOT l_defs STREQUAL "LANG_IS_${l}\n") - message(FATAL_ERROR "File content does not match: ${l_defs}") - endif() - endforeach() -endif() +run_cmake(COMPILE_LANGUAGE-genex) +foreach(l CXX C) + file(READ "${RunCMake_BINARY_DIR}/COMPILE_LANGUAGE-genex-build/opts-${l}.txt" l_defs) + if (NOT l_defs STREQUAL "LANG_IS_${l}\n") + message(FATAL_ERROR "File content does not match: ${l_defs}") + endif() +endforeach() set(timeformat "%Y%j%H%M%S") diff --git a/Tests/RunCMake/File_Generate/WriteIfDifferent-result.txt b/Tests/RunCMake/File_Generate/WriteIfDifferent-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/File_Generate/WriteIfDifferent-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/FindBoost/CMakeLists.txt b/Tests/RunCMake/FindBoost/CMakeLists.txt new file mode 100644 index 0000000..d3137f6 --- /dev/null +++ b/Tests/RunCMake/FindBoost/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/FindBoost/CMakePackage-stdout.txt b/Tests/RunCMake/FindBoost/CMakePackage-stdout.txt new file mode 100644 index 0000000..664e4a5 --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage-stdout.txt @@ -0,0 +1,3 @@ +-- Boost 1\.12345 found\. +-- Found Boost components: + date_time diff --git a/Tests/RunCMake/FindBoost/CMakePackage.cmake b/Tests/RunCMake/FindBoost/CMakePackage.cmake new file mode 100644 index 0000000..06aeccb --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage.cmake @@ -0,0 +1,2 @@ +set(Boost_DIR ${CMAKE_CURRENT_SOURCE_DIR}/CMakePackage) +find_package(Boost 1.12345 COMPONENTS date_time) diff --git a/Tests/RunCMake/FindBoost/CMakePackage/BoostConfig.cmake b/Tests/RunCMake/FindBoost/CMakePackage/BoostConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage/BoostConfig.cmake diff --git a/Tests/RunCMake/FindBoost/CMakePackage/BoostConfigVersion.cmake b/Tests/RunCMake/FindBoost/CMakePackage/BoostConfigVersion.cmake new file mode 100644 index 0000000..8176ced --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage/BoostConfigVersion.cmake @@ -0,0 +1,7 @@ +set(PACKAGE_VERSION 1.12345) +if(PACKAGE_FIND_VERSION_MAJOR EQUAL 1) + set(PACKAGE_VERSION_COMPATIBLE 1) + if(PACKAGE_FIND_VERSION_MINOR EQUAL 12345) + set(PACKAGE_VERSION_EXACT 1) + endif() +endif() diff --git a/Tests/RunCMake/FindBoost/RunCMakeTest.cmake b/Tests/RunCMake/FindBoost/RunCMakeTest.cmake new file mode 100644 index 0000000..a153ae1 --- /dev/null +++ b/Tests/RunCMake/FindBoost/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(CMakePackage) diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-NEW-stdout.txt b/Tests/RunCMake/FindOpenGL/CMP0072-NEW-stdout.txt new file mode 100644 index 0000000..f5ee220 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-NEW-stdout.txt @@ -0,0 +1,3 @@ +-- OpenGL_GL_PREFERENCE='GLVND' +-- OPENGL_gl_LIBRARY='' +-- OPENGL_LIBRARIES='OpenGL;GLX;GLU' diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-NEW.cmake b/Tests/RunCMake/FindOpenGL/CMP0072-NEW.cmake new file mode 100644 index 0000000..6cbbeec --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0072 NEW) +include(CMP0072-common.cmake) diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-OLD-stdout.txt b/Tests/RunCMake/FindOpenGL/CMP0072-OLD-stdout.txt new file mode 100644 index 0000000..22df1b1 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-OLD-stdout.txt @@ -0,0 +1,3 @@ +-- OpenGL_GL_PREFERENCE='LEGACY' +-- OPENGL_gl_LIBRARY='GL' +-- OPENGL_LIBRARIES='GL;GLU' diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-OLD.cmake b/Tests/RunCMake/FindOpenGL/CMP0072-OLD.cmake new file mode 100644 index 0000000..6d57004 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0072 OLD) +include(CMP0072-common.cmake) diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stderr.txt b/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stderr.txt new file mode 100644 index 0000000..f26f217 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stderr.txt @@ -0,0 +1,21 @@ +^CMake Warning \(dev\) at .*/Modules/FindOpenGL.cmake:[0-9]+ \(message\): + Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when + available. Run "cmake --help-policy CMP0072" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + FindOpenGL found both a legacy GL library: + + OPENGL_gl_LIBRARY: GL + + and GLVND libraries for OpenGL and GLX: + + OPENGL_opengl_LIBRARY: OpenGL + OPENGL_glx_LIBRARY: GLX + + OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for + compatibility with CMake 3.10 and below the legacy GL library will be used. +Call Stack \(most recent call first\): + CMP0072-common.cmake:[0-9]+ \(find_package\) + CMP0072-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stdout.txt b/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stdout.txt new file mode 100644 index 0000000..22df1b1 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stdout.txt @@ -0,0 +1,3 @@ +-- OpenGL_GL_PREFERENCE='LEGACY' +-- OPENGL_gl_LIBRARY='GL' +-- OPENGL_LIBRARIES='GL;GLU' diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-WARN.cmake b/Tests/RunCMake/FindOpenGL/CMP0072-WARN.cmake new file mode 100644 index 0000000..459c458 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-WARN.cmake @@ -0,0 +1 @@ +include(CMP0072-common.cmake) diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-common.cmake b/Tests/RunCMake/FindOpenGL/CMP0072-common.cmake new file mode 100644 index 0000000..3fe8030 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMP0072-common.cmake @@ -0,0 +1,13 @@ +set(CYGWIN 0) +set(WIN32 0) +set(APPLE 0) +set(OPENGL_INCLUDE_DIR GL/include) +set(OPENGL_GLX_INCLUDE_DIR GLX/include) +set(OPENGL_gl_LIBRARY GL) +set(OPENGL_opengl_LIBRARY OpenGL) +set(OPENGL_glx_LIBRARY GLX) +set(OPENGL_glu_LIBRARY GLU) +find_package(OpenGL) +message(STATUS "OpenGL_GL_PREFERENCE='${OpenGL_GL_PREFERENCE}'") +message(STATUS "OPENGL_gl_LIBRARY='${OPENGL_gl_LIBRARY}'") +message(STATUS "OPENGL_LIBRARIES='${OPENGL_LIBRARIES}'") diff --git a/Tests/RunCMake/FindOpenGL/CMakeLists.txt b/Tests/RunCMake/FindOpenGL/CMakeLists.txt new file mode 100644 index 0000000..bf2ef15 --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.10) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FindOpenGL/RunCMakeTest.cmake b/Tests/RunCMake/FindOpenGL/RunCMakeTest.cmake new file mode 100644 index 0000000..fcc130f --- /dev/null +++ b/Tests/RunCMake/FindOpenGL/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0072-WARN) +run_cmake(CMP0072-OLD) +run_cmake(CMP0072-NEW) diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake index 00cbb7b..606b1df 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake @@ -24,3 +24,64 @@ if (NCURSES_FOUND) else () message(STATUS "skipping test; ncurses not found") endif () + + +# Setup for the remaining package tests below +set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH) +set(fakePkgDir ${CMAKE_CURRENT_BINARY_DIR}/pc-fakepackage) +foreach(i 1 2) + set(pname cmakeinternalfakepackage${i}) + file(WRITE ${fakePkgDir}/lib/lib${pname}.a "") + file(WRITE ${fakePkgDir}/lib/${pname}.lib "") + file(WRITE ${fakePkgDir}/lib/pkgconfig/${pname}.pc +"Name: CMakeInternalFakePackage${i} +Description: Dummy package (${i}) for FindPkgConfig IMPORTED_TARGET test +Version: 1.2.3 +Libs: -l${pname} +") +endforeach() + +# Always find the .pc file in the calls further below so that we can test that +# the import target find_library() calls handle the NO...PATH options correctly +set(ENV{PKG_CONFIG_PATH} ${fakePkgDir}/lib/pkgconfig) + +# Confirm correct behavior of NO_CMAKE_PATH, ensuring we only find the library +# for the imported target if we have both set CMAKE_PREFIX_PATH and have not +# given the NO_CMAKE_PATH option +unset(CMAKE_PREFIX_PATH) +unset(ENV{CMAKE_PREFIX_PATH}) +pkg_check_modules(FakePackage1 QUIET IMPORTED_TARGET cmakeinternalfakepackage1) +if (TARGET PkgConfig::FakePackage1) + message(FATAL_ERROR "Have import target for fake package 1 with no path prefix") +endif() + +set(CMAKE_PREFIX_PATH ${fakePkgDir}) +pkg_check_modules(FakePackage1 QUIET IMPORTED_TARGET NO_CMAKE_PATH cmakeinternalfakepackage1) +if (TARGET PkgConfig::FakePackage1) + message(FATAL_ERROR "Have import target for fake package 1 with ignored cmake path") +endif() + +pkg_check_modules(FakePackage1 REQUIRED QUIET IMPORTED_TARGET cmakeinternalfakepackage1) +if (NOT TARGET PkgConfig::FakePackage1) + message(FATAL_ERROR "No import target for fake package 1 with prefix path") +endif() + +# And now do the same for the NO_CMAKE_ENVIRONMENT_PATH - ENV{CMAKE_PREFIX_PATH} +# combination +unset(CMAKE_PREFIX_PATH) +unset(ENV{CMAKE_PREFIX_PATH}) +pkg_check_modules(FakePackage2 QUIET IMPORTED_TARGET cmakeinternalfakepackage2) +if (TARGET PkgConfig::FakePackage2) + message(FATAL_ERROR "Have import target for fake package 2 with no path prefix") +endif() + +set(ENV{CMAKE_PREFIX_PATH} ${fakePkgDir}) +pkg_check_modules(FakePackage2 QUIET IMPORTED_TARGET NO_CMAKE_ENVIRONMENT_PATH cmakeinternalfakepackage2) +if (TARGET PkgConfig::FakePackage2) + message(FATAL_ERROR "Have import target for fake package 2 with ignored cmake path") +endif() + +pkg_check_modules(FakePackage2 REQUIRED QUIET IMPORTED_TARGET cmakeinternalfakepackage2) +if (NOT TARGET PkgConfig::FakePackage2) + message(FATAL_ERROR "No import target for fake package 2 with prefix path") +endif() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake index 1defde8..d1d5385 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake @@ -29,7 +29,7 @@ if(NOT DEFINED CMAKE_SYSTEM_NAME set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") endif() else() - # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS propertie + # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties get_property(uselibx32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIBX32_PATHS) get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) diff --git a/Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt b/Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt index 532cfed..4b5f761 100644 --- a/Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt +++ b/Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt @@ -1,2 +1,2 @@ -.*/Framework:( Mach-O universal binary with [^ -]*)? current ar archive random library.* +/Framework: (Mach-O universal binary with [^ +]*)?current ar archive random library diff --git a/Tests/RunCMake/Framework/ios.cmake b/Tests/RunCMake/Framework/ios.cmake index 209a50d..446e914 100644 --- a/Tests/RunCMake/Framework/ios.cmake +++ b/Tests/RunCMake/Framework/ios.cmake @@ -20,6 +20,16 @@ execute_process( OUTPUT_VARIABLE IOS_SDK_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) +execute_process( + COMMAND ${XCRUN_EXECUTABLE} --sdk iphoneos --show-sdk-version + OUTPUT_VARIABLE IOS_SDK_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) +if(IOS_SDK_VERSION VERSION_GREATER_EQUAL 11.0) + set(IOS_ARCH arm64) +else() + set(IOS_ARCH armv7) +endif() + set(CMAKE_OSX_SYSROOT ${IOS_SDK_PATH} CACHE PATH "Sysroot used for iOS support") -set(CMAKE_OSX_ARCHITECTURES "armv7" CACHE STRING "Architectures to build for") +set(CMAKE_OSX_ARCHITECTURES "${IOS_ARCH}" CACHE STRING "Architectures to build for") set(CMAKE_FIND_ROOT_PATH ${IOS_SDK_PATH} CACHE PATH "Find search path root") diff --git a/Tests/RunCMake/GenerateExportHeader/GEH.cmake b/Tests/RunCMake/GenerateExportHeader/GEH.cmake index e0677a7..ae9a84c 100644 --- a/Tests/RunCMake/GenerateExportHeader/GEH.cmake +++ b/Tests/RunCMake/GenerateExportHeader/GEH.cmake @@ -45,13 +45,6 @@ include(GenerateExportHeader) set(CMAKE_CXX_STANDARD 98) -# Those versions of the HP compiler that need a flag to get proper C++98 -# template support also need a flag to use the newer C++ library. -if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND - CMAKE_CXX98_STANDARD_COMPILE_OPTION STREQUAL "+hpxstd98") - string(APPEND CMAKE_CXX_FLAGS " -AA") -endif () - # Clang/C2 in C++98 mode cannot properly handle some of MSVC headers if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") @@ -60,7 +53,16 @@ endif() add_subdirectory(lib_shared_and_static) -add_compiler_export_flags() +if(CMAKE_SYSTEM_NAME MATCHES "AIX" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU" + AND CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY) + # With GNU 7 on AIX, passing -fvisibility=hidden when driving the + # linker for a shared library drops the so init/destruct symbols. + # Just use the modern approach instead of testing the macro. + set(CMAKE_CXX_VISIBILITY_PRESET hidden) + set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) +else() + add_compiler_export_flags() +endif() set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}) @@ -83,6 +85,7 @@ macro_add_test_library(libshared) macro_add_test_library(libstatic) add_subdirectory(nodeprecated) +add_subdirectory(includeguard) if(NOT BORLAND) add_subdirectory(c_identifier) endif() diff --git a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake index 9423ef5..18c3340 100644 --- a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake @@ -4,7 +4,7 @@ function(run_GEH) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/GEH-build) set(RunCMake_TEST_NO_CLEAN 1) - if(RunCMake_GENERATOR MATCHES "Make|Ninja") + if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) endif() file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") @@ -12,6 +12,8 @@ function(run_GEH) run_cmake(GEH) run_cmake_command(GEH-build ${CMAKE_COMMAND} --build . --config Debug) run_cmake_command(GEH-run ${RunCMake_TEST_BINARY_DIR}/GenerateExportHeader) + run_cmake_command(GEH-incguard-macro-run ${RunCMake_TEST_BINARY_DIR}/test_includeguard_macro) + run_cmake_command(GEH-incguard-custom-run ${RunCMake_TEST_BINARY_DIR}/test_includeguard_custom) file(STRINGS "${RunCMake_TEST_BINARY_DIR}/failure_test_targets" failure_test_targets) diff --git a/Tests/RunCMake/GenerateExportHeader/includeguard/CMakeLists.txt b/Tests/RunCMake/GenerateExportHeader/includeguard/CMakeLists.txt new file mode 100644 index 0000000..514d27b --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/includeguard/CMakeLists.txt @@ -0,0 +1,19 @@ +set(libincludeguard_SRC libincludeguard.cpp) + +add_library(includeguard_macro ${libincludeguard_SRC}) +generate_export_header(includeguard_macro) + +set(EXPORT_HEADER includeguard_macro_export.h) +set(DEF_SYMBOL INCLUDEGUARD_MACRO_EXPORT_H) +set(NDEF_SYMBOL CUSTOM_GUARD) +configure_file(main.cpp.in main_macro.cpp) +add_executable(test_includeguard_macro ${CMAKE_CURRENT_BINARY_DIR}/main_macro.cpp) + +add_library(includeguard_custom ${libincludeguard_SRC}) +generate_export_header(includeguard_custom INCLUDE_GUARD_NAME CUSTOM_GUARD) + +set(EXPORT_HEADER includeguard_custom_export.h) +set(DEF_SYMBOL CUSTOM_GUARD) +set(NDEF_SYMBOL INCLUDEGUARD_CUSTOM_EXPORT_H) +configure_file(main.cpp.in main_custom.cpp) +add_executable(test_includeguard_custom ${CMAKE_CURRENT_BINARY_DIR}/main_custom.cpp) diff --git a/Tests/RunCMake/GenerateExportHeader/includeguard/libincludeguard.cpp b/Tests/RunCMake/GenerateExportHeader/includeguard/libincludeguard.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/includeguard/libincludeguard.cpp diff --git a/Tests/RunCMake/GenerateExportHeader/includeguard/main.cpp.in b/Tests/RunCMake/GenerateExportHeader/includeguard/main.cpp.in new file mode 100644 index 0000000..51bd5d9 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/includeguard/main.cpp.in @@ -0,0 +1,10 @@ +#include "@EXPORT_HEADER@" + +int main() +{ +#if defined(@DEF_SYMBOL@) && !defined(@NDEF_SYMBOL@) + return 0; +#else + return 1; +#endif +} diff --git a/Tests/RunCMake/GenerateExportHeader/libshared/CMakeLists.txt b/Tests/RunCMake/GenerateExportHeader/libshared/CMakeLists.txt index c4a761c..9516a5a 100644 --- a/Tests/RunCMake/GenerateExportHeader/libshared/CMakeLists.txt +++ b/Tests/RunCMake/GenerateExportHeader/libshared/CMakeLists.txt @@ -1,7 +1,5 @@ include(GenerateExportHeader) -add_compiler_export_flags() - set(CMAKE_INCLUDE_CURRENT_DIR ON) add_library(libshared SHARED libshared.cpp) diff --git a/Tests/RunCMake/GenerateExportHeader/libstatic/CMakeLists.txt b/Tests/RunCMake/GenerateExportHeader/libstatic/CMakeLists.txt index 0fd136c..56e8335 100644 --- a/Tests/RunCMake/GenerateExportHeader/libstatic/CMakeLists.txt +++ b/Tests/RunCMake/GenerateExportHeader/libstatic/CMakeLists.txt @@ -2,8 +2,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) include(GenerateExportHeader) -add_compiler_export_flags() - # Show that the export header has no effect on a static library. add_library(libstatic STATIC libstatic.cpp) diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h index e8af0a5..0b1dcba 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h index 598bd71..5e3ac9f 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h index cc20e09..dac4fda 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h index 4aaa848..b6e2a4a 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h index 053ad18..11f8042 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h index 4aaa848..b6e2a4a 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h index 808ff01..1481acd 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h index 4aaa848..b6e2a4a 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h index cc20e09..dac4fda 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h index 4aaa848..b6e2a4a 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h index 4e675af..3ba2d2e 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h index 4d5ed4e..3c7e093 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h index 84340e3..bf9163e 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSHARED_EXPORT_H */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h index 598bd71..5e3ac9f 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* LIBSTATIC_EXPORT_H */ diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-stderr.txt index 533d38c..a597d79 100644 --- a/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at BadTargetTypeObject.cmake:3 \(add_custom_target\): +CMake Error at BadTargetTypeObject.cmake:2 \(add_custom_target\): Error evaluating generator expression: \$<TARGET_FILE:objlib> @@ -7,7 +7,7 @@ CMake Error at BadTargetTypeObject.cmake:3 \(add_custom_target\): Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + -CMake Error at BadTargetTypeObject.cmake:3 \(add_custom_target\): +CMake Error at BadTargetTypeObject.cmake:2 \(add_custom_target\): Error evaluating generator expression: \$<TARGET_SONAME_FILE:objlib> @@ -16,7 +16,7 @@ CMake Error at BadTargetTypeObject.cmake:3 \(add_custom_target\): Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + -CMake Error at BadTargetTypeObject.cmake:3 \(add_custom_target\): +CMake Error at BadTargetTypeObject.cmake:2 \(add_custom_target\): Error evaluating generator expression: \$<TARGET_LINKER_FILE:objlib> diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject.cmake b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject.cmake index c47ee2b..60e2c0d 100644 --- a/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject.cmake +++ b/Tests/RunCMake/GeneratorExpression/BadTargetTypeObject.cmake @@ -1,5 +1,4 @@ -enable_language(C) -add_library(objlib OBJECT empty.c) +add_library(objlib OBJECT) add_custom_target(check ALL COMMAND echo $<TARGET_FILE:objlib> $<TARGET_SONAME_FILE:objlib> diff --git a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake index d5b85c9..dfa23e0 100644 --- a/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake +++ b/Tests/RunCMake/GeneratorExpression/CMP0044-WARN.cmake @@ -1,5 +1,5 @@ -project(CMP0044-WARN) +enable_language(C) string(TOLOWER ${CMAKE_C_COMPILER_ID} lc_test) if (lc_test STREQUAL CMAKE_C_COMPILER_ID) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-stderr.txt index 789b4d0..c8f773a 100644 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-stderr.txt @@ -1,10 +1,10 @@ -CMake Error at COMPILE_LANGUAGE-add_custom_command.cmake:6 \(add_custom_command\): +CMake Error at COMPILE_LANGUAGE-add_custom_command.cmake:2 \(add_custom_command\): Error evaluating generator expression: \$<COMPILE_LANGUAGE> - \$<COMPILE_LANGUAGE:...> may only be used to specify include directories - compile definitions, compile options and to evaluate components of the + \$<COMPILE_LANGUAGE:...> may only be used to specify include directories, + compile definitions, compile options, and to evaluate components of the file\(GENERATE\) command. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command.cmake index f4ba261..c3f051a 100644 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command.cmake +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command.cmake @@ -1,8 +1,4 @@ - -enable_language(C) - -add_library(empty empty.c) - -add_custom_command(TARGET empty PRE_BUILD +add_custom_target(drive) +add_custom_command(TARGET drive PRE_BUILD COMMAND ${CMAKE_COMMAND} -E echo $<COMPILE_LANGUAGE> ) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-stderr.txt index 400fbc0..7025838 100644 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-stderr.txt @@ -1,10 +1,10 @@ -CMake Error at COMPILE_LANGUAGE-add_custom_target.cmake:4 \(add_custom_target\): +CMake Error at COMPILE_LANGUAGE-add_custom_target.cmake:1 \(add_custom_target\): Error evaluating generator expression: \$<COMPILE_LANGUAGE> - \$<COMPILE_LANGUAGE:...> may only be used to specify include directories - compile definitions, compile options and to evaluate components of the + \$<COMPILE_LANGUAGE:...> may only be used to specify include directories, + compile definitions, compile options, and to evaluate components of the file\(GENERATE\) command. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target.cmake index 4102623..b826772 100644 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target.cmake +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target.cmake @@ -1,6 +1,3 @@ - -enable_language(C) - -add_custom_target(empty +add_custom_target(drive COMMAND ${CMAKE_COMMAND} -E echo $<COMPILE_LANGUAGE> ) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-stderr.txt index e45bb02..8d05e59 100644 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-stderr.txt @@ -1,10 +1,10 @@ -CMake Error at COMPILE_LANGUAGE-add_executable.cmake:4 \(add_executable\): +CMake Error at COMPILE_LANGUAGE-add_executable.cmake:1 \(add_executable\): Error evaluating generator expression: \$<COMPILE_LANGUAGE> - \$<COMPILE_LANGUAGE:...> may only be used to specify include directories - compile definitions, compile options and to evaluate components of the + \$<COMPILE_LANGUAGE:...> may only be used to specify include directories, + compile definitions, compile options, and to evaluate components of the file\(GENERATE\) command. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable.cmake index 5c2ff35..ff965a9 100644 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable.cmake +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable.cmake @@ -1,4 +1 @@ - -enable_language(C) - add_executable(empty empty.$<COMPILE_LANGUAGE>) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-stderr.txt index c9ee6fe..2ac9b76 100644 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-stderr.txt @@ -1,10 +1,10 @@ -CMake Error at COMPILE_LANGUAGE-add_library.cmake:4 \(add_library\): +CMake Error at COMPILE_LANGUAGE-add_library.cmake:1 \(add_library\): Error evaluating generator expression: \$<COMPILE_LANGUAGE> - \$<COMPILE_LANGUAGE:...> may only be used to specify include directories - compile definitions, compile options and to evaluate components of the + \$<COMPILE_LANGUAGE:...> may only be used to specify include directories, + compile definitions, compile options, and to evaluate components of the file\(GENERATE\) command. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library.cmake index dd9f824..dd1b5a2 100644 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library.cmake +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library.cmake @@ -1,4 +1 @@ - -enable_language(C) - add_library(empty empty.$<COMPILE_LANGUAGE>) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-stderr.txt index 9955f5d..fd8a731 100644 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-stderr.txt @@ -3,8 +3,8 @@ CMake Error at COMPILE_LANGUAGE-add_test.cmake:5 \(add_test\): \$<COMPILE_LANGUAGE> - \$<COMPILE_LANGUAGE:...> may only be used to specify include directories - compile definitions, compile options and to evaluate components of the + \$<COMPILE_LANGUAGE:...> may only be used to specify include directories, + compile definitions, compile options, and to evaluate components of the file\(GENERATE\) command. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-stderr.txt index eca700f..bef7f63 100644 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-stderr.txt @@ -3,6 +3,6 @@ CMake Error: \$<COMPILE_LANGUAGE> - \$<COMPILE_LANGUAGE:...> may only be used to specify include directories - compile definitions, compile options and to evaluate components of the + \$<COMPILE_LANGUAGE:...> may only be used to specify include directories, + compile definitions, compile options, and to evaluate components of the file\(GENERATE\) command. diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-stderr.txt index 2d324e2..8e7f881 100644 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-stderr.txt @@ -1,10 +1,10 @@ -CMake Error at COMPILE_LANGUAGE-target_sources.cmake:5 \(target_sources\): +CMake Error at COMPILE_LANGUAGE-target_sources.cmake:2 \(target_sources\): Error evaluating generator expression: \$<COMPILE_LANGUAGE> - \$<COMPILE_LANGUAGE:...> may only be used to specify include directories - compile definitions, compile options and to evaluate components of the + \$<COMPILE_LANGUAGE:...> may only be used to specify include directories, + compile definitions, compile options, and to evaluate components of the file\(GENERATE\) command. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources.cmake index 0c78acd..a4a5abb 100644 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources.cmake +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources.cmake @@ -1,5 +1,2 @@ - -enable_language(C) - -add_library(empty empty.c) +add_library(empty) target_sources(empty PRIVATE empty.$<COMPILE_LANGUAGE>) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID-stderr.txt index dd7a183..0c21aa6 100644 --- a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at NonValidTarget-CXX_COMPILER_ID.cmake:4 \(add_custom_command\): +CMake Error at NonValidTarget-CXX_COMPILER_ID.cmake:1 \(add_custom_command\): Error evaluating generator expression: \$<CXX_COMPILER_ID> diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID.cmake index 7dd38da..a9fb092 100644 --- a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID.cmake +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_ID.cmake @@ -1,8 +1,4 @@ - -enable_language(CXX) - add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp" COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<CXX_COMPILER_ID>.cpp" ) - -add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION-stderr.txt index d4a064a..fae1bd2 100644 --- a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at NonValidTarget-CXX_COMPILER_VERSION.cmake:4 \(add_custom_command\): +CMake Error at NonValidTarget-CXX_COMPILER_VERSION.cmake:1 \(add_custom_command\): Error evaluating generator expression: \$<CXX_COMPILER_VERSION> diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION.cmake index 1afb2b5..41610c4 100644 --- a/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION.cmake +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-CXX_COMPILER_VERSION.cmake @@ -1,8 +1,4 @@ - -enable_language(CXX) - add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp" COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<CXX_COMPILER_VERSION>.cpp" ) - -add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID-stderr.txt index b8e53ed..337b299 100644 --- a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at NonValidTarget-C_COMPILER_ID.cmake:4 \(add_custom_command\): +CMake Error at NonValidTarget-C_COMPILER_ID.cmake:1 \(add_custom_command\): Error evaluating generator expression: \$<C_COMPILER_ID> diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID.cmake index 2d92ee3..1b02431 100644 --- a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID.cmake +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_ID.cmake @@ -1,8 +1,4 @@ - -enable_language(CXX) - -add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp" - COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<C_COMPILER_ID>.cpp" +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.c" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<C_COMPILER_ID>.c" ) - -add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c") diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION-stderr.txt index 551efe9..d8548b5 100644 --- a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at NonValidTarget-C_COMPILER_VERSION.cmake:4 \(add_custom_command\): +CMake Error at NonValidTarget-C_COMPILER_VERSION.cmake:1 \(add_custom_command\): Error evaluating generator expression: \$<C_COMPILER_VERSION> diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION.cmake index 9b8a531..bc1ffe0 100644 --- a/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION.cmake +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-C_COMPILER_VERSION.cmake @@ -1,8 +1,4 @@ - -enable_language(CXX) - -add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp" - COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<C_COMPILER_VERSION>.cpp" +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.c" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<C_COMPILER_VERSION>.c" ) - -add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.c") diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY-stderr.txt index 0e87538..4babf43 100644 --- a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at NonValidTarget-TARGET_POLICY.cmake:4 \(add_custom_command\): +CMake Error at NonValidTarget-TARGET_POLICY.cmake:1 \(add_custom_command\): Error evaluating generator expression: \$<TARGET_POLICY:CMP0004> diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY.cmake index 10b37b5..55d8a99 100644 --- a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY.cmake +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_POLICY.cmake @@ -1,8 +1,4 @@ - -enable_language(CXX) - add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp" COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<TARGET_POLICY:CMP0004>.cpp" ) - -add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY-stderr.txt index 08ad3c2..c414947 100644 --- a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at NonValidTarget-TARGET_PROPERTY.cmake:4 \(add_custom_command\): +CMake Error at NonValidTarget-TARGET_PROPERTY.cmake:1 \(add_custom_command\): Error evaluating generator expression: \$<TARGET_PROPERTY:NotAProperty> diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY.cmake index 64abc5f..9e246b2 100644 --- a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY.cmake +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PROPERTY.cmake @@ -1,8 +1,4 @@ - -enable_language(CXX) - add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp" COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/copied_file$<TARGET_PROPERTY:NotAProperty>.cpp" ) - -add_library(empty "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") +add_custom_target(drive DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/copied_file.cpp") diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 63cd2da..2486259 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -32,6 +32,7 @@ run_cmake(COMPILE_LANGUAGE-unknown-lang) run_cmake(TARGET_FILE-recursion) run_cmake(OUTPUT_NAME-recursion) run_cmake(TARGET_PROPERTY-LOCATION) +run_cmake(TARGET_PROPERTY-SOURCES) run_cmake(LINK_ONLY-not-linking) run_cmake(ImportedTarget-TARGET_BUNDLE_DIR) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake new file mode 100644 index 0000000..c1a0f5b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake @@ -0,0 +1,6 @@ +file(READ ${RunCMake_TEST_BINARY_DIR}/foo.txt 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}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES.cmake new file mode 100644 index 0000000..dee7ead --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES.cmake @@ -0,0 +1,5 @@ +cmake_policy(SET CMP0070 NEW) +enable_language(C) +add_library(foo empty.c empty2.c) +target_sources(foo PRIVATE empty3.c) +file(GENERATE OUTPUT foo.txt CONTENT "$<TARGET_PROPERTY:foo,SOURCES>") diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake index 38e47f9..a66394b 100644 --- a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake @@ -3,7 +3,8 @@ enable_language(C) add_library(empty SHARED empty.c) -if(CMAKE_CONFIGURATION_TYPES) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) set(GENERATE_CONDITION CONDITION $<CONFIG:${FIRST_CONFIG}>) endif() diff --git a/Tests/RunCMake/GeneratorExpression/empty2.c b/Tests/RunCMake/GeneratorExpression/empty2.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/empty2.c diff --git a/Tests/RunCMake/GeneratorExpression/empty3.c b/Tests/RunCMake/GeneratorExpression/empty3.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/empty3.c diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2-result.txt b/Tests/RunCMake/GeneratorInstance/BadInstance-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2-result.txt +++ b/Tests/RunCMake/GeneratorInstance/BadInstance-result.txt 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/TargetPropertyGeneratorExpressions/BadInvalidName1-result.txt b/Tests/RunCMake/GeneratorInstance/BadInstanceToolchain-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1-result.txt +++ b/Tests/RunCMake/GeneratorInstance/BadInstanceToolchain-result.txt 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/CommandLine/E___run_iwyu-no-iwyu-result.txt b/Tests/RunCMake/GeneratorInstance/MissingInstance-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CommandLine/E___run_iwyu-no-iwyu-result.txt +++ b/Tests/RunCMake/GeneratorInstance/MissingInstance-result.txt 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/CommandLine/E___run_iwyu-no-cc-result.txt b/Tests/RunCMake/GeneratorInstance/MissingInstanceToolchain-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CommandLine/E___run_iwyu-no-cc-result.txt +++ b/Tests/RunCMake/GeneratorInstance/MissingInstanceToolchain-result.txt 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/CommandLine/E___run_iwyu-no----result.txt b/Tests/RunCMake/GeneratorInstance/NoInstance-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CommandLine/E___run_iwyu-no----result.txt +++ b/Tests/RunCMake/GeneratorInstance/NoInstance-result.txt 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/GetPrerequisites/RunCMakeTest.cmake b/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake new file mode 100644 index 0000000..3856c54 --- /dev/null +++ b/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake_command(TargetMissing ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TargetMissing.cmake) diff --git a/Tests/RunCMake/GetPrerequisites/TargetMissing-stderr.txt b/Tests/RunCMake/GetPrerequisites/TargetMissing-stderr.txt new file mode 100644 index 0000000..cffe5f8 --- /dev/null +++ b/Tests/RunCMake/GetPrerequisites/TargetMissing-stderr.txt @@ -0,0 +1,3 @@ +^warning: target 'does_not_exist' is not absolute\.\.\. +warning: target 'does_not_exist' does not exist\.\.\. +result_var='value;before;call'$ diff --git a/Tests/RunCMake/GetPrerequisites/TargetMissing.cmake b/Tests/RunCMake/GetPrerequisites/TargetMissing.cmake new file mode 100644 index 0000000..84fd32c --- /dev/null +++ b/Tests/RunCMake/GetPrerequisites/TargetMissing.cmake @@ -0,0 +1,4 @@ +include(GetPrerequisites) +set(result_var value before call) +get_prerequisites(does_not_exist result_var 0 0 "" "") +message("result_var='${result_var}'") diff --git a/Tests/RunCMake/GoogleTest/CMakeLists.txt b/Tests/RunCMake/GoogleTest/CMakeLists.txt new file mode 100644 index 0000000..dc92486 --- /dev/null +++ b/Tests/RunCMake/GoogleTest/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.6) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-result.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-stderr.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-stderr.txt new file mode 100644 index 0000000..55a4a7a --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-stderr.txt @@ -0,0 +1,2 @@ +Unable to find executable: timeout_test_NOT_BUILT +Errors while running CTest diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt new file mode 100644 index 0000000..5f7753d --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt @@ -0,0 +1,25 @@ +Test project .* + Start 1: TEST:basic\.case_foo!1 +1/8 Test #1: TEST:basic\.case_foo!1 \.+ +Passed +[0-9.]+ sec + Start 2: TEST:basic\.case_bar!1 +2/8 Test #2: TEST:basic\.case_bar!1 \.+ +Passed +[0-9.]+ sec + Start 3: TEST:basic\.disabled_case!1 +3/8 Test #3: TEST:basic\.disabled_case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 4: TEST:disabled\.case!1 +4/8 Test #4: TEST:disabled\.case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 5: TEST:typed/short\.case!1 +5/8 Test #5: TEST:typed/short\.case!1 \.+ +Passed +[0-9.]+ sec + Start 6: TEST:typed/float\.case!1 +6/8 Test #6: TEST:typed/float\.case!1 \.+ +Passed +[0-9.]+ sec + Start 7: TEST:value/test\.case/1!1 +7/8 Test #7: TEST:value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec + Start 8: TEST:value/test\.case/"foo"!1 +8/8 Test #8: TEST:value/test\.case/"foo"!1 \.+ +Passed +[0-9.]+ sec + +100% tests passed, 0 tests failed out of 6 + +Total Test time \(real\) = +[0-9.]+ sec + +The following tests did not run: +.*3 - TEST:basic\.disabled_case!1 \(Disabled\) +.*4 - TEST:disabled\.case!1 \(Disabled\) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt new file mode 100644 index 0000000..960c0b9 --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt @@ -0,0 +1,25 @@ +Test project .* + Start 9: TEST:basic\.case_foo!2 +1/8 Test #9: TEST:basic\.case_foo!2 \.+ +Passed +[0-9.]+ sec + Start 10: TEST:basic\.case_bar!2 +2/8 Test #10: TEST:basic\.case_bar!2 \.+ +Passed +[0-9.]+ sec + Start 11: TEST:basic\.disabled_case!2 +3/8 Test #11: TEST:basic\.disabled_case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 12: TEST:disabled\.case!2 +4/8 Test #12: TEST:disabled\.case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 13: TEST:typed/short\.case!2 +5/8 Test #13: TEST:typed/short\.case!2 \.+ +Passed +[0-9.]+ sec + Start 14: TEST:typed/float\.case!2 +6/8 Test #14: TEST:typed/float\.case!2 \.+ +Passed +[0-9.]+ sec + Start 15: TEST:value/test\.case/1!2 +7/8 Test #15: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec + Start 16: TEST:value/test\.case/"foo"!2 +8/8 Test #16: TEST:value/test\.case/"foo"!2 \.+ +Passed +[0-9.]+ sec + +100% tests passed, 0 tests failed out of 6 + +Total Test time \(real\) = +[0-9.]+ sec + +The following tests did not run: +.*11 - TEST:basic\.disabled_case!2 \(Disabled\) +.*12 - TEST:disabled\.case!2 \(Disabled\) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt b/Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-timeout-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-timeout-stdout.txt new file mode 100644 index 0000000..8464c80 --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-timeout-stdout.txt @@ -0,0 +1,7 @@ +( *|[0-9]+>)CMake Error at .*GoogleTestAddTests.cmake:[0-9]+ \(message\): +( *|[0-9]+>) Error running test executable. +?( *|[0-9]+>) +( *|[0-9]+>) Path: '.*timeout_test(\.exe)?' +( *|[0-9]+>) Result: Process terminated due to timeout +( *|[0-9]+>) Output: +( *|[0-9]+>) + diff --git a/Tests/RunCMake/GoogleTest/GoogleTest.cmake b/Tests/RunCMake/GoogleTest/GoogleTest.cmake new file mode 100644 index 0000000..5e4b8ef --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest.cmake @@ -0,0 +1,29 @@ +project(test_include_dirs) +include(CTest) +include(GoogleTest) + +enable_testing() + +add_executable(fake_gtest fake_gtest.cpp) + +gtest_discover_tests( + fake_gtest + TEST_PREFIX TEST: + TEST_SUFFIX !1 + EXTRA_ARGS how now "\"brown\" cow" + PROPERTIES LABELS TEST1 +) + +gtest_discover_tests( + fake_gtest + TEST_PREFIX TEST: + TEST_SUFFIX !2 + EXTRA_ARGS how now "\"brown\" cow" + PROPERTIES LABELS TEST2 +) + +add_executable(timeout_test timeout_test.cpp) + +gtest_discover_tests( + timeout_test +) diff --git a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake new file mode 100644 index 0000000..209e769 --- /dev/null +++ b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake @@ -0,0 +1,53 @@ +include(RunCMake) + +function(run_GoogleTest) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/GoogleTest-build) + set(RunCMake_TEST_NO_CLEAN 1) + if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) + endif() + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(GoogleTest) + + run_cmake_command(GoogleTest-build + ${CMAKE_COMMAND} + --build . + --config Debug + --target fake_gtest + ) + + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(GoogleTest-timeout + ${CMAKE_COMMAND} + --build . + --config Debug + --target timeout_test + ) + set(RunCMake_TEST_OUTPUT_MERGE 0) + + run_cmake_command(GoogleTest-test1 + ${CMAKE_CTEST_COMMAND} + -C Debug + -L TEST1 + --no-label-summary + ) + + run_cmake_command(GoogleTest-test2 + ${CMAKE_CTEST_COMMAND} + -C Debug + -L TEST2 + --no-label-summary + ) + + run_cmake_command(GoogleTest-test-missing + ${CMAKE_CTEST_COMMAND} + -C Debug + -R timeout + --no-label-summary + ) +endfunction() + +run_GoogleTest() diff --git a/Tests/RunCMake/GoogleTest/fake_gtest.cpp b/Tests/RunCMake/GoogleTest/fake_gtest.cpp new file mode 100644 index 0000000..f1bd7ef --- /dev/null +++ b/Tests/RunCMake/GoogleTest/fake_gtest.cpp @@ -0,0 +1,41 @@ +#include <iostream> +#include <string> + +int main(int argc, char** argv) +{ + // Note: GoogleTest.cmake doesn't actually depend on Google Test as such; + // it only requires that we produces output in the expected format when + // invoked with --gtest_list_tests. Thus, we fake that here. This allows us + // to test the module without actually needing Google Test. + if (argc > 1 && std::string(argv[1]) == "--gtest_list_tests") { + std::cout << "basic." << std::endl; + std::cout << " case_foo" << std::endl; + std::cout << " case_bar" << std::endl; + std::cout << " DISABLED_disabled_case" << std::endl; + std::cout << "DISABLED_disabled." << std::endl; + std::cout << " case" << std::endl; + std::cout << "typed/0. # TypeParam = short" << std::endl; + std::cout << " case" << std::endl; + std::cout << "typed/1. # TypeParam = float" << std::endl; + std::cout << " case" << std::endl; + std::cout << "value/test." << std::endl; + std::cout << " case/0 # GetParam() = 1" << std::endl; + std::cout << " case/1 # GetParam() = \"foo\"" << std::endl; + return 0; + } + + if (argc > 5) { + // Simple test of EXTRA_ARGS + if (std::string(argv[3]) == "how" && std::string(argv[4]) == "now" && + std::string(argv[5]) == "\"brown\" cow") { + return 0; + } + } + + // Print arguments for debugging, if we didn't get the expected arguments + for (int i = 1; i < argc; ++i) { + std::cerr << "arg[" << i << "]: '" << argv[i] << "'\n"; + } + + return 1; +} diff --git a/Tests/RunCMake/GoogleTest/timeout_test.cpp b/Tests/RunCMake/GoogleTest/timeout_test.cpp new file mode 100644 index 0000000..a8e5c1c --- /dev/null +++ b/Tests/RunCMake/GoogleTest/timeout_test.cpp @@ -0,0 +1,15 @@ +#if defined(_WIN32) +#include <windows.h> +#else +#include <unistd.h> +#endif + +int main() +{ +#if defined(_WIN32) + Sleep(10000); +#else + sleep(10); +#endif + return 0; +} diff --git a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-OLD-stderr.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-OLD-stderr.txt new file mode 100644 index 0000000..37747a1 --- /dev/null +++ b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-CMP0052-OLD-stderr.txt @@ -0,0 +1,8 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + The OLD behavior for policy CMP0052 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD.$ diff --git a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-OLD-stderr.txt b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-OLD-stderr.txt new file mode 100644 index 0000000..37747a1 --- /dev/null +++ b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-CMP0052-OLD-stderr.txt @@ -0,0 +1,8 @@ +^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): + The OLD behavior for policy CMP0052 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD.$ diff --git a/Tests/RunCMake/Make/IncludeRegexSubdir-check.cmake b/Tests/RunCMake/Make/IncludeRegexSubdir-check.cmake new file mode 100644 index 0000000..dbdf7be --- /dev/null +++ b/Tests/RunCMake/Make/IncludeRegexSubdir-check.cmake @@ -0,0 +1,4 @@ +include("${RunCMake_TEST_BINARY_DIR}/IncludeRegexSubdir/CMakeFiles/CMakeDirectoryInformation.cmake" OPTIONAL) +if(NOT CMAKE_C_INCLUDE_REGEX_SCAN STREQUAL "^custom_include_regex$") + set(RunCMake_TEST_FAILED "CMAKE_C_INCLUDE_REGEX_SCAN has unexpected value:\n \"${CMAKE_C_INCLUDE_REGEX_SCAN}\"") +endif() diff --git a/Tests/RunCMake/Make/IncludeRegexSubdir.cmake b/Tests/RunCMake/Make/IncludeRegexSubdir.cmake new file mode 100644 index 0000000..a7a93a0 --- /dev/null +++ b/Tests/RunCMake/Make/IncludeRegexSubdir.cmake @@ -0,0 +1,3 @@ +enable_language(C) +include_regular_expression("^custom_include_regex$") +add_subdirectory(IncludeRegexSubdir) diff --git a/Tests/RunCMake/Make/IncludeRegexSubdir/CMakeLists.txt b/Tests/RunCMake/Make/IncludeRegexSubdir/CMakeLists.txt new file mode 100644 index 0000000..e712aea --- /dev/null +++ b/Tests/RunCMake/Make/IncludeRegexSubdir/CMakeLists.txt @@ -0,0 +1 @@ +# We only need this directory to be processed. No targets needed. diff --git a/Tests/RunCMake/Make/RunCMakeTest.cmake b/Tests/RunCMake/Make/RunCMakeTest.cmake index 869d11e..3b2b8f5 100644 --- a/Tests/RunCMake/Make/RunCMakeTest.cmake +++ b/Tests/RunCMake/Make/RunCMakeTest.cmake @@ -17,3 +17,4 @@ run_TargetMessages(VAR-ON -DCMAKE_TARGET_MESSAGES=ON) run_TargetMessages(VAR-OFF -DCMAKE_TARGET_MESSAGES=OFF) run_cmake(CustomCommandDepfile-ERROR) +run_cmake(IncludeRegexSubdir) diff --git a/Tests/RunCMake/MultiLint/C-Build-stdout.txt b/Tests/RunCMake/MultiLint/C-Build-stdout.txt new file mode 100644 index 0000000..d10427e --- /dev/null +++ b/Tests/RunCMake/MultiLint/C-Build-stdout.txt @@ -0,0 +1,8 @@ +Warning: include-what-you-use reported diagnostics: +should add these lines: +* +#include <\.\.\.> ++ +.*Tests[/\]RunCMake[/\]MultiLint[/\]main\.c:0:0: warning: message \[checker\].* +Total errors found: 0 +.*Warning: cppcheck reported diagnostics.*error.*warning.*style.*performance.*information.* diff --git a/Tests/RunCMake/MultiLint/C-launch-Build-stdout.txt b/Tests/RunCMake/MultiLint/C-launch-Build-stdout.txt new file mode 100644 index 0000000..d10427e --- /dev/null +++ b/Tests/RunCMake/MultiLint/C-launch-Build-stdout.txt @@ -0,0 +1,8 @@ +Warning: include-what-you-use reported diagnostics: +should add these lines: +* +#include <\.\.\.> ++ +.*Tests[/\]RunCMake[/\]MultiLint[/\]main\.c:0:0: warning: message \[checker\].* +Total errors found: 0 +.*Warning: cppcheck reported diagnostics.*error.*warning.*style.*performance.*information.* diff --git a/Tests/RunCMake/MultiLint/C-launch.cmake b/Tests/RunCMake/MultiLint/C-launch.cmake new file mode 100644 index 0000000..e66ca20 --- /dev/null +++ b/Tests/RunCMake/MultiLint/C-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(C.cmake) diff --git a/Tests/RunCMake/MultiLint/C.cmake b/Tests/RunCMake/MultiLint/C.cmake new file mode 100644 index 0000000..495d6f0 --- /dev/null +++ b/Tests/RunCMake/MultiLint/C.cmake @@ -0,0 +1,6 @@ +enable_language(C) +set(CMAKE_C_INCLUDE_WHAT_YOU_USE "${PSEUDO_IWYU}" -some -args) +set(CMAKE_C_CLANG_TIDY "${PSEUDO_TIDY}" -some -args) +set(CMAKE_C_CPPLINT "${PSEUDO_CPPLINT}" --verbose=0 --linelength=80) +set(CMAKE_C_CPPCHECK "${PSEUDO_CPPCHECK}") +add_executable(main main.c) diff --git a/Tests/RunCMake/MultiLint/CMakeLists.txt b/Tests/RunCMake/MultiLint/CMakeLists.txt new file mode 100644 index 0000000..bf2ef15 --- /dev/null +++ b/Tests/RunCMake/MultiLint/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.10) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/MultiLint/CXX-Build-stdout.txt b/Tests/RunCMake/MultiLint/CXX-Build-stdout.txt new file mode 100644 index 0000000..aaf5fd7 --- /dev/null +++ b/Tests/RunCMake/MultiLint/CXX-Build-stdout.txt @@ -0,0 +1,8 @@ +Warning: include-what-you-use reported diagnostics: +should add these lines: +* +#include <\.\.\.> ++ +.*Tests[/\]RunCMake[/\]MultiLint[/\]main\.cxx:0:0: warning: message \[checker\].* +Total errors found: 0 +.*Warning: cppcheck reported diagnostics.*error.*warning.*style.*performance.*information.* diff --git a/Tests/RunCMake/MultiLint/CXX-launch-Build-stdout.txt b/Tests/RunCMake/MultiLint/CXX-launch-Build-stdout.txt new file mode 100644 index 0000000..aaf5fd7 --- /dev/null +++ b/Tests/RunCMake/MultiLint/CXX-launch-Build-stdout.txt @@ -0,0 +1,8 @@ +Warning: include-what-you-use reported diagnostics: +should add these lines: +* +#include <\.\.\.> ++ +.*Tests[/\]RunCMake[/\]MultiLint[/\]main\.cxx:0:0: warning: message \[checker\].* +Total errors found: 0 +.*Warning: cppcheck reported diagnostics.*error.*warning.*style.*performance.*information.* diff --git a/Tests/RunCMake/MultiLint/CXX-launch.cmake b/Tests/RunCMake/MultiLint/CXX-launch.cmake new file mode 100644 index 0000000..3002c9d --- /dev/null +++ b/Tests/RunCMake/MultiLint/CXX-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(CXX.cmake) diff --git a/Tests/RunCMake/MultiLint/CXX.cmake b/Tests/RunCMake/MultiLint/CXX.cmake new file mode 100644 index 0000000..dc30146 --- /dev/null +++ b/Tests/RunCMake/MultiLint/CXX.cmake @@ -0,0 +1,6 @@ +enable_language(CXX) +set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "${PSEUDO_IWYU}" -some -args) +set(CMAKE_CXX_CLANG_TIDY "${PSEUDO_TIDY}" -some -args) +set(CMAKE_CXX_CPPLINT "${PSEUDO_CPPLINT}" --verbose=0 --linelength=80) +set(CMAKE_CXX_CPPCHECK "${PSEUDO_CPPCHECK}") +add_executable(main main.cxx) diff --git a/Tests/RunCMake/MultiLint/RunCMakeTest.cmake b/Tests/RunCMake/MultiLint/RunCMakeTest.cmake new file mode 100644 index 0000000..afd98fd --- /dev/null +++ b/Tests/RunCMake/MultiLint/RunCMakeTest.cmake @@ -0,0 +1,27 @@ +include(RunCMake) + +set(RunCMake_TEST_OPTIONS + "-DPSEUDO_CPPCHECK=${PSEUDO_CPPCHECK}" + "-DPSEUDO_CPPLINT=${PSEUDO_CPPLINT}" + "-DPSEUDO_IWYU=${PSEUDO_IWYU}" + "-DPSEUDO_TIDY=${PSEUDO_TIDY}" + ) + +function(run_multilint lang) + # Use a single build tree for tests without cleaning. + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${lang}-build") + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${lang}) + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(${lang}-Build ${CMAKE_COMMAND} --build .) +endfunction() + +run_multilint(C) +run_multilint(CXX) + +if(NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") + run_multilint(C-launch) + run_multilint(CXX-launch) +endif() diff --git a/Tests/RunCMake/MultiLint/main.c b/Tests/RunCMake/MultiLint/main.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/RunCMake/MultiLint/main.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/MultiLint/main.cxx b/Tests/RunCMake/MultiLint/main.cxx new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/RunCMake/MultiLint/main.cxx @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt index 8809f89..d5ee4f9 100644 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt @@ -1,6 +1,6 @@ CMake Error at LinkObjRHS1.cmake:3 \(target_link_libraries\): Target "AnObjLib" of type OBJECT_LIBRARY may not be linked into another - target. One may link only to STATIC or SHARED libraries, or to executables - with the ENABLE_EXPORTS property set. + target. One may link only to INTERFACE, STATIC or SHARED libraries, or to + executables with the ENABLE_EXPORTS property set. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/README.rst b/Tests/RunCMake/README.rst index 4aae4ae..08b51d9 100644 --- a/Tests/RunCMake/README.rst +++ b/Tests/RunCMake/README.rst @@ -47,11 +47,11 @@ but do not actually build anything. To add a test: containing expected test results: ``<SubTest>-result.txt`` - Process result expected if not "0" + Regex matching expected process result, if not ``0`` ``<SubTest>-stdout.txt`` Regex matching expected stdout content ``<SubTest>-stderr.txt`` - Regex matching expected stderr content, if not "^$" + Regex matching expected stderr content, if not ``^$`` ``<SubTest>-check.cmake`` Custom result check. 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/RuntimePath/RunCMakeTest.cmake b/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake index a9a7f05..3f238f2 100644 --- a/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake +++ b/Tests/RunCMake/RuntimePath/RunCMakeTest.cmake @@ -5,7 +5,7 @@ function(run_SymlinkImplicit) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SymlinkImplicit-build) set(RunCMake_TEST_NO_CLEAN 1) - if(RunCMake_GENERATOR MATCHES "Make|Ninja") + if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) endif() file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") diff --git a/Tests/RunCMake/SourceProperties/CMakeLists.txt b/Tests/RunCMake/SourceProperties/CMakeLists.txt new file mode 100644 index 0000000..a17c8cd --- /dev/null +++ b/Tests/RunCMake/SourceProperties/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} C) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CommandLine/E___run_iwyu-bad-iwyu-result.txt b/Tests/RunCMake/SourceProperties/RelativeIncludeDir-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CommandLine/E___run_iwyu-bad-iwyu-result.txt +++ b/Tests/RunCMake/SourceProperties/RelativeIncludeDir-result.txt diff --git a/Tests/RunCMake/SourceProperties/RelativeIncludeDir-stderr.txt b/Tests/RunCMake/SourceProperties/RelativeIncludeDir-stderr.txt new file mode 100644 index 0000000..cf146c2 --- /dev/null +++ b/Tests/RunCMake/SourceProperties/RelativeIncludeDir-stderr.txt @@ -0,0 +1,4 @@ +CMake Error in CMakeLists.txt: + Found relative path while evaluating include directories of "empty.c": + + "relative" diff --git a/Tests/RunCMake/SourceProperties/RelativeIncludeDir.cmake b/Tests/RunCMake/SourceProperties/RelativeIncludeDir.cmake new file mode 100644 index 0000000..08dffa8 --- /dev/null +++ b/Tests/RunCMake/SourceProperties/RelativeIncludeDir.cmake @@ -0,0 +1,4 @@ + +set_property (SOURCE empty.c PROPERTY INCLUDE_DIRECTORIES "relative") + +add_library (somelib empty.c) diff --git a/Tests/RunCMake/SourceProperties/RunCMakeTest.cmake b/Tests/RunCMake/SourceProperties/RunCMakeTest.cmake new file mode 100644 index 0000000..0982153 --- /dev/null +++ b/Tests/RunCMake/SourceProperties/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(RelativeIncludeDir) diff --git a/Tests/RunCMake/SourceProperties/empty.c b/Tests/RunCMake/SourceProperties/empty.c new file mode 100644 index 0000000..a9ec102 --- /dev/null +++ b/Tests/RunCMake/SourceProperties/empty.c @@ -0,0 +1,5 @@ + +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/Syntax/.gitattributes b/Tests/RunCMake/Syntax/.gitattributes index 35a9eaf..79af285 100644 --- a/Tests/RunCMake/Syntax/.gitattributes +++ b/Tests/RunCMake/Syntax/.gitattributes @@ -1,3 +1,3 @@ CommandTabs.cmake whitespace=-tab-in-indent -StringCRLF.cmake whitespace=cr-at-eol -crlf -BracketCRLF.cmake whitespace=cr-at-eol -crlf +StringCRLF.cmake eol=crlf +BracketCRLF.cmake eol=crlf diff --git a/Tests/RunCMake/Syntax/BracketCRLF.cmake b/Tests/RunCMake/Syntax/BracketCRLF.cmake index bda0e17..2ea6df2 100644 --- a/Tests/RunCMake/Syntax/BracketCRLF.cmake +++ b/Tests/RunCMake/Syntax/BracketCRLF.cmake @@ -1,8 +1,8 @@ -if([[
-]] STREQUAL "" AND
-[[a
-b]] STREQUAL "a\nb")
- message("CRLF->LF worked")
-else()
- message(FATAL_ERROR "CRLF->LF failed")
-endif()
+if([[ +]] STREQUAL "" AND +[[a +b]] STREQUAL "a\nb") + message("CRLF->LF worked") +else() + message(FATAL_ERROR "CRLF->LF failed") +endif() diff --git a/Tests/RunCMake/Syntax/CMP0053-At-OLD-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-At-OLD-stderr.txt index acfa30a..0dde1bc 100644 --- a/Tests/RunCMake/Syntax/CMP0053-At-OLD-stderr.txt +++ b/Tests/RunCMake/Syntax/CMP0053-At-OLD-stderr.txt @@ -1 +1,12 @@ -^-->wrong<--$ +^CMake Deprecation Warning at CMP0053-At-OLD.cmake:1 \(cmake_policy\): + The OLD behavior for policy CMP0053 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +-->wrong<--$ diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt b/Tests/RunCMake/Syntax/NullTerminatedArgument-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt +++ b/Tests/RunCMake/Syntax/NullTerminatedArgument-result.txt diff --git a/Tests/RunCMake/Syntax/NullTerminatedArgument-stderr.txt b/Tests/RunCMake/Syntax/NullTerminatedArgument-stderr.txt new file mode 100644 index 0000000..f26754e --- /dev/null +++ b/Tests/RunCMake/Syntax/NullTerminatedArgument-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at NullTerminatedArgument.cmake:1: + Parse error. Function missing ending "\)". Instead found bad character + with text "". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/NullTerminatedArgument.cmake b/Tests/RunCMake/Syntax/NullTerminatedArgument.cmake Binary files differnew file mode 100644 index 0000000..c82aceb --- /dev/null +++ b/Tests/RunCMake/Syntax/NullTerminatedArgument.cmake diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake index d1fbb16..628df91 100644 --- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake +++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake @@ -55,6 +55,7 @@ run_cmake(BracketNoSpace5) run_cmake(Escape1) run_cmake(Escape2) run_cmake(EscapeCharsAllowed) +run_cmake(NullTerminatedArgument) include("${RunCMake_SOURCE_DIR}/EscapeCharsDisallowed.cmake") run_cmake(ParenNoSpace0) run_cmake(ParenNoSpace1) diff --git a/Tests/RunCMake/Syntax/StringCRLF.cmake b/Tests/RunCMake/Syntax/StringCRLF.cmake index d20cfea..14aad31 100644 --- a/Tests/RunCMake/Syntax/StringCRLF.cmake +++ b/Tests/RunCMake/Syntax/StringCRLF.cmake @@ -1,6 +1,6 @@ -if("a
-b" STREQUAL "a\nb")
- message("CRLF->LF worked")
-else()
- message(FATAL_ERROR "CRLF->LF failed")
-endif()
+if("a +b" STREQUAL "a\nb") + message("CRLF->LF worked") +else() + message(FATAL_ERROR "CRLF->LF failed") +endif() 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/COMPILE_LANGUAGE-genex/CompileOptions-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName-result.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName-stderr.txt new file mode 100644 index 0000000..6e89104 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName-stderr.txt @@ -0,0 +1,50 @@ +^(CMake Error at BadInvalidName1/CMakeLists.txt:2 \(include_directories\): + Error evaluating generator expression: + + \$<TARGET_PROPERTY:Invali/dTarget,INCLUDE_DIRECTORIES> + + Target name not supported. ++)+(CMake Error at BadInvalidName2/CMakeLists.txt:2 \(include_directories\): + Error evaluating generator expression: + + \$<TARGET_PROPERTY:Invali/dTarget,Invali/dProperty> + + Target name and property name not supported. ++)+(CMake Error at BadInvalidName3/CMakeLists.txt:2 \(include_directories\): + Error evaluating generator expression: + + \$<TARGET_PROPERTY:Invali/dProperty> + + Property name not supported. ++)+(CMake Error at BadInvalidName4/CMakeLists.txt:2 \(include_directories\): + Error evaluating generator expression: + + \$<TARGET_PROPERTY:BadInvalidName4,Invali/dProperty> + + Property name not supported. ++)+(CMake Error at BadInvalidName5/CMakeLists.txt:2 \(include_directories\): + Error evaluating generator expression: + + \$<TARGET_PROPERTY:,> + + \$<TARGET_PROPERTY:tgt,prop> expression requires a non-empty target name and + property name. ++)+(CMake Error at BadInvalidName6/CMakeLists.txt:2 \(include_directories\): + Error evaluating generator expression: + + \$<TARGET_PROPERTY:,ValidProperty> + + \$<TARGET_PROPERTY:tgt,prop> expression requires a non-empty target name. ++)+(CMake Error at BadInvalidName7/CMakeLists.txt:2 \(include_directories\): + Error evaluating generator expression: + + \$<TARGET_PROPERTY:BadInvalidName7,> + + \$<TARGET_PROPERTY:...> expression requires a non-empty property name. ++)+(CMake Error at BadInvalidName8/CMakeLists.txt:2 \(include_directories\): + Error evaluating generator expression: + + \$<TARGET_PROPERTY:> + + \$<TARGET_PROPERTY:...> expression requires a non-empty property name. +*)+$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName.cmake new file mode 100644 index 0000000..5f083e2 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName.cmake @@ -0,0 +1,8 @@ +add_subdirectory(BadInvalidName1) +add_subdirectory(BadInvalidName2) +add_subdirectory(BadInvalidName3) +add_subdirectory(BadInvalidName4) +add_subdirectory(BadInvalidName5) +add_subdirectory(BadInvalidName6) +add_subdirectory(BadInvalidName7) +add_subdirectory(BadInvalidName8) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1-stderr.txt deleted file mode 100644 index 9c146e0..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1-stderr.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at BadInvalidName1.cmake:7 \(include_directories\): - Error evaluating generator expression: - - \$<TARGET_PROPERTY:Invali/dTarget,INCLUDE_DIRECTORIES> - - Target name not supported. -Call Stack \(most recent call first\): - CMakeLists.txt:8 \(include\) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1.cmake deleted file mode 100644 index d5f661d..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1.cmake +++ /dev/null @@ -1,7 +0,0 @@ - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "int main(int, char **) { return 0; }\n") - -add_executable(TargetPropertyGeneratorExpressions - "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") -include_directories("$<TARGET_PROPERTY:Invali/dTarget,INCLUDE_DIRECTORIES>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1/CMakeLists.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1/CMakeLists.txt new file mode 100644 index 0000000..13e1de7 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName1/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(BadInvalidName1 ../main.cpp) +include_directories("$<TARGET_PROPERTY:Invali/dTarget,INCLUDE_DIRECTORIES>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2-stderr.txt deleted file mode 100644 index 451888c..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2-stderr.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at BadInvalidName2.cmake:7 \(include_directories\): - Error evaluating generator expression: - - \$<TARGET_PROPERTY:Invali/dTarget,Invali/dProperty> - - Target name and property name not supported. -Call Stack \(most recent call first\): - CMakeLists.txt:8 \(include\)$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2.cmake deleted file mode 100644 index 6e4c1d0..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2.cmake +++ /dev/null @@ -1,7 +0,0 @@ - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "int main(int, char **) { return 0; }\n") - -add_executable(TargetPropertyGeneratorExpressions - "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") -include_directories("$<TARGET_PROPERTY:Invali/dTarget,Invali/dProperty>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2/CMakeLists.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2/CMakeLists.txt new file mode 100644 index 0000000..4b78472 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName2/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(BadInvalidName2 ../main.cpp) +include_directories("$<TARGET_PROPERTY:Invali/dTarget,Invali/dProperty>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3-stderr.txt deleted file mode 100644 index 39692c4..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3-stderr.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at BadInvalidName3.cmake:7 \(include_directories\): - Error evaluating generator expression: - - \$<TARGET_PROPERTY:Invali/dProperty> - - Property name not supported. -Call Stack \(most recent call first\): - CMakeLists.txt:8 \(include\)$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3.cmake deleted file mode 100644 index 3f75aa3..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3.cmake +++ /dev/null @@ -1,7 +0,0 @@ - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "int main(int, char **) { return 0; }\n") - -add_executable(TargetPropertyGeneratorExpressions - "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") -include_directories("$<TARGET_PROPERTY:Invali/dProperty>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3/CMakeLists.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3/CMakeLists.txt new file mode 100644 index 0000000..516a049 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName3/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(BadInvalidName3 ../main.cpp) +include_directories("$<TARGET_PROPERTY:Invali/dProperty>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4-stderr.txt deleted file mode 100644 index c3aa1b1..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4-stderr.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at BadInvalidName4.cmake:9 \(include_directories\): - Error evaluating generator expression: - - \$<TARGET_PROPERTY:foo,Invali/dProperty> - - Property name not supported. -Call Stack \(most recent call first\): - CMakeLists.txt:8 \(include\)$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4.cmake deleted file mode 100644 index b616c31..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4.cmake +++ /dev/null @@ -1,9 +0,0 @@ - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "int main(int, char **) { return 0; }\n") - -add_executable(foo "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") - -add_executable(TargetPropertyGeneratorExpressions - "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") -include_directories("$<TARGET_PROPERTY:foo,Invali/dProperty>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4/CMakeLists.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4/CMakeLists.txt new file mode 100644 index 0000000..02f2a1a --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName4/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(BadInvalidName4 ../main.cpp) +include_directories("$<TARGET_PROPERTY:BadInvalidName4,Invali/dProperty>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5-stderr.txt deleted file mode 100644 index 1c6fad4..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5-stderr.txt +++ /dev/null @@ -1,9 +0,0 @@ -CMake Error at BadInvalidName5.cmake:7 \(include_directories\): - Error evaluating generator expression: - - \$<TARGET_PROPERTY:,> - - \$<TARGET_PROPERTY:tgt,prop> expression requires a non-empty target name and - property name. -Call Stack \(most recent call first\): - CMakeLists.txt:8 \(include\)$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5.cmake deleted file mode 100644 index 11cb6fa..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5.cmake +++ /dev/null @@ -1,7 +0,0 @@ - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "int main(int, char **) { return 0; }\n") - -add_executable(TargetPropertyGeneratorExpressions - "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") -include_directories("$<TARGET_PROPERTY:,>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5/CMakeLists.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5/CMakeLists.txt new file mode 100644 index 0000000..a653583 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName5/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(BadInvalidName5 ../main.cpp) +include_directories("$<TARGET_PROPERTY:,>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6-stderr.txt deleted file mode 100644 index 8b147dc..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6-stderr.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at BadInvalidName6.cmake:7 \(include_directories\): - Error evaluating generator expression: - - \$<TARGET_PROPERTY:,ValidProperty> - - \$<TARGET_PROPERTY:tgt,prop> expression requires a non-empty target name. -Call Stack \(most recent call first\): - CMakeLists.txt:8 \(include\)$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6.cmake deleted file mode 100644 index bf868a5..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6.cmake +++ /dev/null @@ -1,7 +0,0 @@ - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "int main(int, char **) { return 0; }\n") - -add_executable(TargetPropertyGeneratorExpressions - "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") -include_directories("$<TARGET_PROPERTY:,ValidProperty>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6/CMakeLists.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6/CMakeLists.txt new file mode 100644 index 0000000..614458e --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName6/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(BadInvalidName6 ../main.cpp) +include_directories("$<TARGET_PROPERTY:,ValidProperty>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7-stderr.txt deleted file mode 100644 index dad6bf8..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7-stderr.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at BadInvalidName7.cmake:9 \(include_directories\): - Error evaluating generator expression: - - \$<TARGET_PROPERTY:foo,> - - \$<TARGET_PROPERTY:...> expression requires a non-empty property name. -Call Stack \(most recent call first\): - CMakeLists.txt:8 \(include\)$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7.cmake deleted file mode 100644 index 36d1a79..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7.cmake +++ /dev/null @@ -1,9 +0,0 @@ - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "int main(int, char **) { return 0; }\n") - -add_executable(foo "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") - -add_executable(TargetPropertyGeneratorExpressions - "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") -include_directories("$<TARGET_PROPERTY:foo,>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7/CMakeLists.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7/CMakeLists.txt new file mode 100644 index 0000000..8a9fe80 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName7/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(BadInvalidName7 ../main.cpp) +include_directories("$<TARGET_PROPERTY:BadInvalidName7,>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8-stderr.txt deleted file mode 100644 index 4e8c14c..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8-stderr.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at BadInvalidName8.cmake:7 \(include_directories\): - Error evaluating generator expression: - - \$<TARGET_PROPERTY:> - - \$<TARGET_PROPERTY:...> expression requires a non-empty property name. -Call Stack \(most recent call first\): - CMakeLists.txt:8 \(include\)$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8.cmake deleted file mode 100644 index f059288..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8.cmake +++ /dev/null @@ -1,7 +0,0 @@ - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "int main(int, char **) { return 0; }\n") - -add_executable(TargetPropertyGeneratorExpressions - "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") -include_directories("$<TARGET_PROPERTY:>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8/CMakeLists.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8/CMakeLists.txt new file mode 100644 index 0000000..b228159 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName8/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(BadInvalidName8 ../main.cpp) +include_directories("$<TARGET_PROPERTY:>") diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference-result.txt diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference-stderr.txt new file mode 100644 index 0000000..f0f71ec --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference-stderr.txt @@ -0,0 +1,37 @@ +^(CMake Error: + Error evaluating generator expression: + + \$<TARGET_PROPERTY:INCLUDE_DIRECTORIES> + + Self reference on target "BadSelfReference1". ++)+(CMake Error: + Error evaluating generator expression: + + \$<TARGET_PROPERTY:INCLUDE_DIRECTORIES> + + Self reference on target "BadSelfReference2". ++)+(CMake Error: + Error evaluating generator expression: + + \$<TARGET_PROPERTY:BadSelfReference3,INCLUDE_DIRECTORIES> + + Self reference on target "BadSelfReference3". ++)+(CMake Error: + Error evaluating generator expression: + + \$<TARGET_PROPERTY:BadSelfReference4,INCLUDE_DIRECTORIES> + + Self reference on target "BadSelfReference4". ++)+(CMake Error: + Error evaluating generator expression: + + \$<TARGET_PROPERTY:COMPILE_DEFINITIONS> + + Self reference on target "BadSelfReference5". ++)+(CMake Error: + Error evaluating generator expression: + + \$<TARGET_PROPERTY:BadSelfReference6,COMPILE_DEFINITIONS> + + Self reference on target "BadSelfReference6". +*)+$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference.cmake new file mode 100644 index 0000000..5a99f7a --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference.cmake @@ -0,0 +1,6 @@ +add_subdirectory(BadSelfReference1) +add_subdirectory(BadSelfReference2) +add_subdirectory(BadSelfReference3) +add_subdirectory(BadSelfReference4) +add_subdirectory(BadSelfReference5) +add_subdirectory(BadSelfReference6) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1-stderr.txt deleted file mode 100644 index 75a729e..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error: - Error evaluating generator expression: - - \$<TARGET_PROPERTY:INCLUDE_DIRECTORIES> - - Self reference on target "TargetPropertyGeneratorExpressions". diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1.cmake deleted file mode 100644 index a85731e..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1.cmake +++ /dev/null @@ -1,7 +0,0 @@ - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "int main(int, char **) { return 0; }\n") - -add_executable(TargetPropertyGeneratorExpressions - "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") -include_directories("$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1/CMakeLists.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1/CMakeLists.txt new file mode 100644 index 0000000..30c27f5 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference1/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(BadSelfReference1 ../main.cpp) +include_directories("$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2-stderr.txt deleted file mode 100644 index 75a729e..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error: - Error evaluating generator expression: - - \$<TARGET_PROPERTY:INCLUDE_DIRECTORIES> - - Self reference on target "TargetPropertyGeneratorExpressions". diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2.cmake deleted file mode 100644 index f1459b8..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2.cmake +++ /dev/null @@ -1,9 +0,0 @@ - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "int main(int, char **) { return 0; }\n") - -add_executable(TargetPropertyGeneratorExpressions - "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") -set_property(TARGET TargetPropertyGeneratorExpressions PROPERTY - INCLUDE_DIRECTORIES "$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>" -) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2/CMakeLists.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2/CMakeLists.txt new file mode 100644 index 0000000..c2322f4 --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference2/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(BadSelfReference2 ../main.cpp) +set_property(TARGET BadSelfReference2 PROPERTY INCLUDE_DIRECTORIES "$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3-stderr.txt deleted file mode 100644 index f52a27d..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error: - Error evaluating generator expression: - - \$<TARGET_PROPERTY:TargetPropertyGeneratorExpressions,INCLUDE_DIRECTORIES> - - Self reference on target "TargetPropertyGeneratorExpressions". diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3.cmake deleted file mode 100644 index 433b730..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3.cmake +++ /dev/null @@ -1,8 +0,0 @@ - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "int main(int, char **) { return 0; }\n") - -add_executable(TargetPropertyGeneratorExpressions - "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") -include_directories( - "$<TARGET_PROPERTY:TargetPropertyGeneratorExpressions,INCLUDE_DIRECTORIES>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3/CMakeLists.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3/CMakeLists.txt new file mode 100644 index 0000000..3e6c30a --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference3/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(BadSelfReference3 ../main.cpp) +include_directories("$<TARGET_PROPERTY:BadSelfReference3,INCLUDE_DIRECTORIES>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4-stderr.txt deleted file mode 100644 index f52a27d..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error: - Error evaluating generator expression: - - \$<TARGET_PROPERTY:TargetPropertyGeneratorExpressions,INCLUDE_DIRECTORIES> - - Self reference on target "TargetPropertyGeneratorExpressions". diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4.cmake deleted file mode 100644 index 4b64459..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4.cmake +++ /dev/null @@ -1,10 +0,0 @@ - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "int main(int, char **) { return 0; }\n") - -add_executable(TargetPropertyGeneratorExpressions - "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") -set_property(TARGET TargetPropertyGeneratorExpressions PROPERTY -INCLUDE_DIRECTORIES - "$<TARGET_PROPERTY:TargetPropertyGeneratorExpressions,INCLUDE_DIRECTORIES>" -) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4/CMakeLists.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4/CMakeLists.txt new file mode 100644 index 0000000..f79727a --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference4/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(BadSelfReference4 ../main.cpp) +set_property(TARGET BadSelfReference4 PROPERTY INCLUDE_DIRECTORIES "$<TARGET_PROPERTY:BadSelfReference4,INCLUDE_DIRECTORIES>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5-stderr.txt deleted file mode 100644 index d8d12b5..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error: - Error evaluating generator expression: - - \$<TARGET_PROPERTY:COMPILE_DEFINITIONS> - - Self reference on target "TargetPropertyGeneratorExpressions". diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5.cmake deleted file mode 100644 index 74fff67..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5.cmake +++ /dev/null @@ -1,10 +0,0 @@ - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "int main(int, char **) { return 0; }\n") - -add_executable(TargetPropertyGeneratorExpressions - "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") -set_property(TARGET TargetPropertyGeneratorExpressions -PROPERTY - COMPILE_DEFINITIONS "$<TARGET_PROPERTY:COMPILE_DEFINITIONS>" -) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5/CMakeLists.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5/CMakeLists.txt new file mode 100644 index 0000000..c0badbf --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference5/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(BadSelfReference5 ../main.cpp) +set_property(TARGET BadSelfReference5 PROPERTY COMPILE_DEFINITIONS "$<TARGET_PROPERTY:COMPILE_DEFINITIONS>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6-stderr.txt deleted file mode 100644 index 0b1dd26..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error: - Error evaluating generator expression: - - \$<TARGET_PROPERTY:TargetPropertyGeneratorExpressions,COMPILE_DEFINITIONS> - - Self reference on target "TargetPropertyGeneratorExpressions". diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6.cmake deleted file mode 100644 index d6650d3..0000000 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6.cmake +++ /dev/null @@ -1,10 +0,0 @@ - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "int main(int, char **) { return 0; }\n") - -add_executable(TargetPropertyGeneratorExpressions - "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") -set_property(TARGET TargetPropertyGeneratorExpressions PROPERTY -COMPILE_DEFINITIONS - "$<TARGET_PROPERTY:TargetPropertyGeneratorExpressions,COMPILE_DEFINITIONS>" -) diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6/CMakeLists.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6/CMakeLists.txt new file mode 100644 index 0000000..fcb6b3c --- /dev/null +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference6/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(BadSelfReference6 ../main.cpp) +set_property(TARGET BadSelfReference6 PROPERTY COMPILE_DEFINITIONS "$<TARGET_PROPERTY:BadSelfReference6,COMPILE_DEFINITIONS>") diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake b/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake index 645a57d..4294e9f 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/RunCMakeTest.cmake @@ -1,20 +1,8 @@ include(RunCMake) -run_cmake(BadSelfReference1) -run_cmake(BadSelfReference2) -run_cmake(BadSelfReference3) -run_cmake(BadSelfReference4) -run_cmake(BadSelfReference5) -run_cmake(BadSelfReference6) +run_cmake(BadSelfReference) run_cmake(BadNonTarget) -run_cmake(BadInvalidName1) -run_cmake(BadInvalidName2) -run_cmake(BadInvalidName3) -run_cmake(BadInvalidName4) -run_cmake(BadInvalidName5) -run_cmake(BadInvalidName6) -run_cmake(BadInvalidName7) -run_cmake(BadInvalidName8) +run_cmake(BadInvalidName) run_cmake(LinkImplementationCycle1) run_cmake(LinkImplementationCycle2) run_cmake(LinkImplementationCycle3) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp b/Tests/RunCMake/TargetPropertyGeneratorExpressions/main.cpp index 766b775..f8b643a 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/main.cpp @@ -1,4 +1,3 @@ - int main() { return 0; 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-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/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 6e7c2f3..7100b31 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -5,3 +5,4 @@ run_cmake(VsCustomProps) run_cmake(VsDebuggerWorkingDir) run_cmake(VsCSharpCustomTags) run_cmake(VsCSharpReferenceProps) +run_cmake(VsCSharpWithoutSources) diff --git a/Tests/RunCMake/VS10Project/VsCSharpWithoutSources-check.cmake b/Tests/RunCMake/VS10Project/VsCSharpWithoutSources-check.cmake new file mode 100644 index 0000000..90ae7c3 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCSharpWithoutSources-check.cmake @@ -0,0 +1,5 @@ +set(csProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.csproj") +if(NOT EXISTS "${csProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${csProjectFile} does not exist.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsCSharpWithoutSources.cmake b/Tests/RunCMake/VS10Project/VsCSharpWithoutSources.cmake new file mode 100644 index 0000000..5fdeaa0 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsCSharpWithoutSources.cmake @@ -0,0 +1,7 @@ +enable_language(CSharp) + +add_library(foo SHARED + "${CMAKE_CURRENT_LIST_FILE}") + +set_target_properties(foo PROPERTIES + LINKER_LANGUAGE CSharp) diff --git a/Tests/RunCMake/XcodeProject/DeploymentTarget.c b/Tests/RunCMake/XcodeProject/DeploymentTarget.c new file mode 100644 index 0000000..51af046 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/DeploymentTarget.c @@ -0,0 +1,26 @@ +#include <Availability.h> +#include <TargetConditionals.h> + +#if TARGET_OS_OSX +#if __MAC_OS_X_VERSION_MIN_REQUIRED != __MAC_10_11 +#error macOS deployment version mismatch +#endif +#elif TARGET_OS_IOS +#if __IPHONE_OS_VERSION_MIN_REQUIRED != __IPHONE_9_1 +#error iOS deployment version mismatch +#endif +#elif TARGET_OS_WATCH +#if __WATCH_OS_VERSION_MIN_REQUIRED != __WATCHOS_2_0 +#error watchOS deployment version mismatch +#endif +#elif TARGET_OS_TV +#if __TV_OS_VERSION_MIN_REQUIRED != __TVOS_9_0 +#error tvOS deployment version mismatch +#endif +#else +#error unknown OS +#endif + +void foo() +{ +} diff --git a/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake b/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake new file mode 100644 index 0000000..6281352 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.10) +project(DeploymentTarget C) + +# using Xcode 7.1 SDK versions for deployment targets + +if(SDK MATCHES iphone) + set(CMAKE_OSX_SYSROOT ${SDK}) + set(CMAKE_OSX_ARCHITECTURES "armv7;x86_64") + set(CMAKE_OSX_DEPLOYMENT_TARGET "9.1") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") +elseif(SDK MATCHES watch) + set(CMAKE_OSX_SYSROOT ${SDK}) + set(CMAKE_OSX_ARCHITECTURES "armv7k;i386") + set(CMAKE_OSX_DEPLOYMENT_TARGET "2.0") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +elseif(SDK MATCHES appletv) + set(CMAKE_OSX_SYSROOT ${SDK}) + set(CMAKE_OSX_DEPLOYMENT_TARGET "9.0") + set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +else() + set(CMAKE_OSX_SYSROOT ${SDK}) + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11") +endif() + +add_library(myFramework STATIC DeploymentTarget.c) +set_target_properties(myFramework PROPERTIES FRAMEWORK TRUE) diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceDefinitions-result.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceDefinitions-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceDefinitions-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceDefinitions-stderr.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceDefinitions-stderr.txt new file mode 100644 index 0000000..46a294d --- /dev/null +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceDefinitions-stderr.txt @@ -0,0 +1,8 @@ +^CMake Error in CMakeLists.txt: + Xcode does not support per-config per-source COMPILE_DEFINITIONS: + + \$<\$<CONFIG:Debug>:MYDEBUG> + + specified for source: + + .*/Tests/RunCMake/XcodeProject/main.c$ diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceDefinitions.cmake b/Tests/RunCMake/XcodeProject/PerConfigPerSourceDefinitions.cmake new file mode 100644 index 0000000..f9df55f --- /dev/null +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceDefinitions.cmake @@ -0,0 +1,3 @@ +enable_language(C) +add_executable(main main.c) +set_property(SOURCE main.c PROPERTY COMPILE_DEFINITIONS "$<$<CONFIG:Debug>:MYDEBUG>") diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-result.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-stderr.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-stderr.txt new file mode 100644 index 0000000..f9b8ee7 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-stderr.txt @@ -0,0 +1,8 @@ +^CMake Error in CMakeLists.txt: + Xcode does not support per-config per-source INCLUDE_DIRECTORIES: + + \$<\$<CONFIG:Debug>:MYDEBUG> + + specified for source: + + .*/Tests/RunCMake/XcodeProject/main.c$ diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs.cmake b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs.cmake new file mode 100644 index 0000000..4476c39 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs.cmake @@ -0,0 +1,3 @@ +enable_language(C) +add_executable(main main.c) +set_property(SOURCE main.c PROPERTY INCLUDE_DIRECTORIES "$<$<CONFIG:Debug>:MYDEBUG>") diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-result.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-stderr.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-stderr.txt new file mode 100644 index 0000000..bfca020 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-stderr.txt @@ -0,0 +1,8 @@ +^CMake Error in CMakeLists.txt: + Xcode does not support per-config per-source COMPILE_OPTIONS: + + \$<\$<CONFIG:Debug>:-DMYDEBUG> + + specified for source: + + .*/Tests/RunCMake/XcodeProject/main.c$ diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions.cmake b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions.cmake new file mode 100644 index 0000000..f8e8030 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions.cmake @@ -0,0 +1,3 @@ +enable_language(C) +add_executable(main main.c) +set_property(SOURCE main.c PROPERTY COMPILE_OPTIONS $<$<CONFIG:Debug>:-DMYDEBUG>) diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 5f4bdc3..64a07f0 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -1,9 +1,14 @@ include(RunCMake) +if(XCODE_VERSION VERSION_GREATER_EQUAL 9) + set(IOS_DEPLOYMENT_TARGET "-DCMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET=10") +endif() + run_cmake(XcodeFileType) run_cmake(XcodeAttributeLocation) run_cmake(XcodeAttributeGenex) run_cmake(XcodeAttributeGenexError) +run_cmake(XcodeGenerateTopLevelProjectOnly) run_cmake(XcodeObjectNeedsEscape) run_cmake(XcodeObjectNeedsQuote) run_cmake(XcodeOptimizationFlags) @@ -14,13 +19,18 @@ if (NOT XCODE_VERSION VERSION_LESS 6) endif() run_cmake(PerConfigPerSourceFlags) +run_cmake(PerConfigPerSourceOptions) +run_cmake(PerConfigPerSourceDefinitions) +run_cmake(PerConfigPerSourceIncludeDirs) # Use a single build tree for a few tests without cleaning. if(NOT XCODE_VERSION VERSION_LESS 5) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeInstallIOS-build) set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_BINARY_DIR}/ios_install") + set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_BINARY_DIR}/ios_install" + "${IOS_DEPLOYMENT_TARGET}") file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") @@ -53,7 +63,8 @@ if(NOT XCODE_VERSION VERSION_LESS 5) set(RunCMake_TEST_NO_CLEAN 1) set(RunCMake_TEST_OPTIONS "-DTEST_IOS=ON" - "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install" + "${IOS_DEPLOYMENT_TARGET}") file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") @@ -117,7 +128,8 @@ if(NOT XCODE_VERSION VERSION_LESS 6) set(RunCMake_TEST_NO_CLEAN 1) set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install" - "-DCMAKE_IOS_INSTALL_COMBINED=YES") + "-DCMAKE_IOS_INSTALL_COMBINED=YES" + "${IOS_DEPLOYMENT_TARGET}") file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") @@ -135,7 +147,8 @@ if(NOT XCODE_VERSION VERSION_LESS 6) set(RunCMake_TEST_NO_CLEAN 1) set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install" - "-DCMAKE_IOS_INSTALL_COMBINED=YES") + "-DCMAKE_IOS_INSTALL_COMBINED=YES" + "${IOS_DEPLOYMENT_TARGET}") file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") @@ -153,7 +166,8 @@ if(NOT XCODE_VERSION VERSION_LESS 6) set(RunCMake_TEST_NO_CLEAN 1) set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install" - "-DCMAKE_IOS_INSTALL_COMBINED=YES") + "-DCMAKE_IOS_INSTALL_COMBINED=YES" + "${IOS_DEPLOYMENT_TARGET}") file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") @@ -170,6 +184,7 @@ endif() if(NOT XCODE_VERSION VERSION_LESS 5) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeMultiplatform-build) set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS "${IOS_DEPLOYMENT_TARGET}") file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") @@ -203,3 +218,21 @@ endfunction() if(NOT XCODE_VERSION VERSION_LESS 7) XcodeSchemaGeneration() endif() + +if(XCODE_VERSION VERSION_GREATER_EQUAL 8) + function(deploymeny_target_test SDK) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DeploymentTarget-${SDK}-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS "-DSDK=${SDK}") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(DeploymentTarget) + run_cmake_command(DeploymentTarget-${SDK} ${CMAKE_COMMAND} --build .) + endfunction() + + foreach(SDK macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator) + deploymeny_target_test(${SDK}) + endforeach() +endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake index 0b854d8..5d19ee8 100644 --- a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake @@ -3,6 +3,9 @@ cmake_minimum_required(VERSION 3.3) enable_language(C) +# due to lack of toolchain file it might point to running macOS version +unset(CMAKE_OSX_DEPLOYMENT_TARGET CACHE) + if(TEST_IOS) set(CMAKE_OSX_SYSROOT iphoneos) set(CMAKE_OSX_ARCHITECTURES "armv7") 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/XcodeIOSInstallCombined.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake index fc830b1..d7f3920 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.3) project(IOSInstallCombined CXX) +# due to lack of toolchain file it might point to running macOS version +unset(CMAKE_OSX_DEPLOYMENT_TARGET CACHE) + set(CMAKE_OSX_SYSROOT iphoneos) set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake index b47d3a5..28ab883 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.3) project(XcodeIOSInstallCombinedPrune CXX) +# due to lack of toolchain file it might point to running macOS version +unset(CMAKE_OSX_DEPLOYMENT_TARGET CACHE) + set(CMAKE_OSX_SYSROOT iphoneos) set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake index 4b5e7ce..5e7961a 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.3) project(XcodeIOSInstallCombinedSingleArch CXX) +# due to lack of toolchain file it might point to running macOS version +unset(CMAKE_OSX_DEPLOYMENT_TARGET CACHE) + set(CMAKE_OSX_SYSROOT iphoneos) set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") 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_custom_command/RemoveEmptyCommands-check.cmake b/Tests/RunCMake/add_custom_command/RemoveEmptyCommands-check.cmake new file mode 100644 index 0000000..b297044 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/RemoveEmptyCommands-check.cmake @@ -0,0 +1,63 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/exe.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(inGroup FALSE) +set(inCommand FALSE) + +set(expected_Debug + "cmd_1 cmd_1_arg" + "cmd_1_dbg cmd_1_dbg_arg" + "cmd_2_dbg cmd_2_dbg_arg" + "cmd_3_dbg cmd_3_dbg_arg") + +set(expected_Release + "cmd_1 cmd_1_arg" + "cmd_3_rel cmd_3_rel_arg") + +# extract build events +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<ItemDefinitionGroup Condition=.*Configuration.*Platform.*>$") + set(inGroup TRUE) + string(REGEX MATCH "=='(.*)\\|(.*)'" out ${line}) + set(config ${CMAKE_MATCH_1}) + elseif(line MATCHES "^ *</ItemDefinitionGroup>$") + set(inGroup FALSE) + elseif(inGroup) + if(line MATCHES "^ *<Command>.*$") + set(inCommand TRUE) + string(REGEX MATCH "<Command>(.*)" cmd ${line}) + set(currentCommand ${CMAKE_MATCH_1}) + elseif(line MATCHES "^(.*)</Command>$") + string(REGEX MATCH "(.*)</Command>" cmd ${line}) + list(APPEND currentCommand ${CMAKE_MATCH_1}) + set(command_${config} ${currentCommand}) + set(inCommand FALSE) + elseif(inCommand) + list(APPEND currentCommand ${line}) + endif() + endif() +endforeach() + +foreach(config "Debug" "Release") + set(currentName command_${config}) + set(expectedName expected_${config}) + set(strippedCommand "") + if(DEFINED ${currentName}) + foreach(v ${${currentName}}) + if(${v} MATCHES "cmd_") + list(APPEND strippedCommand ${v}) + endif() + endforeach() + if(NOT "${strippedCommand}" STREQUAL + "${${expectedName}}") + message(" - ${strippedCommand}") + message(" + ${${expectedName}}") + set(RunCMake_TEST_FAILED "build event command does not match") + return() + endif() + endif() +endforeach() diff --git a/Tests/RunCMake/add_custom_command/RemoveEmptyCommands.cmake b/Tests/RunCMake/add_custom_command/RemoveEmptyCommands.cmake new file mode 100644 index 0000000..eb190cc --- /dev/null +++ b/Tests/RunCMake/add_custom_command/RemoveEmptyCommands.cmake @@ -0,0 +1,22 @@ +enable_language(CXX) + +# reduce number of configuration types +set(CMAKE_CONFIGURATION_TYPES "Debug" "Release") + +set(main_file "${CMAKE_BINARY_DIR}/main.cpp") +file(WRITE "${main_file}" "test") +add_executable(exe "${main_file}") + +# add one command for all and one for debug only +add_custom_command(TARGET exe + COMMAND "cmd_1" "cmd_1_arg" + COMMAND $<$<CONFIG:Debug>:cmd_1_dbg> $<$<CONFIG:Debug>:cmd_1_dbg_arg>) + +# add command for debug only +add_custom_command(TARGET exe + COMMAND $<$<CONFIG:Debug>:cmd_2_dbg> $<$<CONFIG:Debug>:cmd_2_dbg_arg>) + +# add separate commands for configurations +add_custom_command(TARGET exe + COMMAND $<$<CONFIG:Debug>:cmd_3_dbg> $<$<CONFIG:Debug>:cmd_3_dbg_arg> + COMMAND $<$<CONFIG:Release>:cmd_3_rel> $<$<CONFIG:Release>:cmd_3_rel_arg>) diff --git a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake index 397c63d..c12e5aa 100644 --- a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake @@ -10,3 +10,7 @@ run_cmake(SourceByproducts) run_cmake(SourceUsesTerminal) run_cmake(TargetImported) run_cmake(TargetNotInDir) + +if(${RunCMake_GENERATOR} MATCHES "Visual Studio ([^89]|[89][0-9])") + run_cmake(RemoveEmptyCommands) +endif() diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt b/Tests/RunCMake/add_executable/CMakeLists.txt index ef2163c..ef2163c 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt +++ b/Tests/RunCMake/add_executable/CMakeLists.txt diff --git a/Tests/RunCMake/add_executable/NoSources-result.txt b/Tests/RunCMake/add_executable/NoSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_executable/NoSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_executable/NoSources-stderr.txt b/Tests/RunCMake/add_executable/NoSources-stderr.txt new file mode 100644 index 0000000..4fcfd49 --- /dev/null +++ b/Tests/RunCMake/add_executable/NoSources-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoSources.cmake:[0-9]+ \(add_executable\): + No SOURCES given to target: TestExeWithoutSources +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_executable/NoSources.cmake b/Tests/RunCMake/add_executable/NoSources.cmake new file mode 100644 index 0000000..563564a --- /dev/null +++ b/Tests/RunCMake/add_executable/NoSources.cmake @@ -0,0 +1 @@ +add_executable(TestExeWithoutSources) diff --git a/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-result.txt b/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-stderr.txt new file mode 100644 index 0000000..5561daa --- /dev/null +++ b/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoSourcesButLinkObjects.cmake:[0-9]+ \(add_executable\): + 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.cmake b/Tests/RunCMake/add_executable/NoSourcesButLinkObjects.cmake new file mode 100644 index 0000000..d0f2093 --- /dev/null +++ b/Tests/RunCMake/add_executable/NoSourcesButLinkObjects.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_executable(TestExeWithoutSources) +target_link_libraries(TestExeWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_executable/OnlyObjectSources.cmake b/Tests/RunCMake/add_executable/OnlyObjectSources.cmake new file mode 100644 index 0000000..1c90e9a --- /dev/null +++ b/Tests/RunCMake/add_executable/OnlyObjectSources.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_executable(TestExeWithoutSources) +target_sources(TestExeWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_executable/RunCMakeTest.cmake b/Tests/RunCMake/add_executable/RunCMakeTest.cmake new file mode 100644 index 0000000..88916b7 --- /dev/null +++ b/Tests/RunCMake/add_executable/RunCMakeTest.cmake @@ -0,0 +1,7 @@ +include(RunCMake) + +run_cmake(NoSources) +run_cmake(OnlyObjectSources) +if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]") + run_cmake(NoSourcesButLinkObjects) +endif() diff --git a/Tests/RunCMake/add_executable/test.cpp b/Tests/RunCMake/add_executable/test.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/add_executable/test.cpp diff --git a/Tests/RunCMake/add_library/CMakeLists.txt b/Tests/RunCMake/add_library/CMakeLists.txt new file mode 100644 index 0000000..ef2163c --- /dev/null +++ b/Tests/RunCMake/add_library/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/add_library/INTERFACEwithNoSources.cmake b/Tests/RunCMake/add_library/INTERFACEwithNoSources.cmake new file mode 100644 index 0000000..79188f3 --- /dev/null +++ b/Tests/RunCMake/add_library/INTERFACEwithNoSources.cmake @@ -0,0 +1 @@ +add_library(TestInterfaceLibWithoutSources INTERFACE) diff --git a/Tests/RunCMake/add_library/INTERFACEwithNoSourcesButLinkObjects.cmake b/Tests/RunCMake/add_library/INTERFACEwithNoSourcesButLinkObjects.cmake new file mode 100644 index 0000000..53a48f0 --- /dev/null +++ b/Tests/RunCMake/add_library/INTERFACEwithNoSourcesButLinkObjects.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestInterfaceLibWithoutSources INTERFACE) +target_link_libraries(TestInterfaceLibWithoutSources INTERFACE $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/INTERFACEwithOnlyObjectSources.cmake b/Tests/RunCMake/add_library/INTERFACEwithOnlyObjectSources.cmake new file mode 100644 index 0000000..86fab1d --- /dev/null +++ b/Tests/RunCMake/add_library/INTERFACEwithOnlyObjectSources.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestInterfaceLibWithoutSources INTERFACE) +target_sources(TestInterfaceLibWithoutSources INTERFACE $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/MODULEwithNoSources-result.txt b/Tests/RunCMake/add_library/MODULEwithNoSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/MODULEwithNoSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt b/Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt new file mode 100644 index 0000000..41da381 --- /dev/null +++ b/Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt @@ -0,0 +1,4 @@ +^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/MODULEwithNoSources.cmake b/Tests/RunCMake/add_library/MODULEwithNoSources.cmake new file mode 100644 index 0000000..5df5033 --- /dev/null +++ b/Tests/RunCMake/add_library/MODULEwithNoSources.cmake @@ -0,0 +1 @@ +add_library(TestModuleLibWithoutSources MODULE) diff --git a/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-result.txt b/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt new file mode 100644 index 0000000..67dd87c --- /dev/null +++ b/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt @@ -0,0 +1,4 @@ +^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/MODULEwithNoSourcesButLinkObjects.cmake b/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects.cmake new file mode 100644 index 0000000..f9d00de --- /dev/null +++ b/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestModuleLibWithoutSources MODULE) +target_link_libraries(TestModuleLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/MODULEwithOnlyObjectSources.cmake b/Tests/RunCMake/add_library/MODULEwithOnlyObjectSources.cmake new file mode 100644 index 0000000..187481a --- /dev/null +++ b/Tests/RunCMake/add_library/MODULEwithOnlyObjectSources.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestModuleLibWithoutSources MODULE) +target_sources(TestModuleLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSources-result.txt b/Tests/RunCMake/add_library/OBJECTwithNoSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/OBJECTwithNoSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt new file mode 100644 index 0000000..20d3a8a --- /dev/null +++ b/Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt @@ -0,0 +1,4 @@ +^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/OBJECTwithNoSources.cmake b/Tests/RunCMake/add_library/OBJECTwithNoSources.cmake new file mode 100644 index 0000000..742e829 --- /dev/null +++ b/Tests/RunCMake/add_library/OBJECTwithNoSources.cmake @@ -0,0 +1 @@ +add_library(TestObjectLibWithoutSources OBJECT) diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-result.txt b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt new file mode 100644 index 0000000..cd6f1e0 --- /dev/null +++ b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt @@ -0,0 +1,5 @@ +^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\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects.cmake b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects.cmake new file mode 100644 index 0000000..6b4b55f --- /dev/null +++ b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestObjectLibWithoutSources OBJECT) +target_link_libraries(TestObjectLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-result.txt b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt new file mode 100644 index 0000000..77a72f1 --- /dev/null +++ b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt @@ -0,0 +1,16 @@ +^CMake Error at OBJECTwithOnlyObjectSources.cmake:[0-9]+ \(add_library\): + OBJECT library \"TestObjectLibWithoutSources\" contains: + + [^ +]*test(\.cpp)?\.o(bj)? + + but may contain only sources that compile, header files, and other files + that would not affect linking of a normal library. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at OBJECTwithOnlyObjectSources.cmake:[0-9]+ \(add_library\): + Only executables and non-OBJECT libraries may reference target objects. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources.cmake b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources.cmake new file mode 100644 index 0000000..ff75a8c --- /dev/null +++ b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestObjectLibWithoutSources OBJECT) +target_sources(TestObjectLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/RunCMakeTest.cmake b/Tests/RunCMake/add_library/RunCMakeTest.cmake new file mode 100644 index 0000000..0ba6216 --- /dev/null +++ b/Tests/RunCMake/add_library/RunCMakeTest.cmake @@ -0,0 +1,24 @@ +include(RunCMake) + +run_cmake(INTERFACEwithNoSources) +run_cmake(OBJECTwithNoSources) +run_cmake(STATICwithNoSources) +run_cmake(SHAREDwithNoSources) +run_cmake(MODULEwithNoSources) +run_cmake(UNKNOWNwithNoSources) + +run_cmake(INTERFACEwithOnlyObjectSources) +run_cmake(OBJECTwithOnlyObjectSources) +run_cmake(STATICwithOnlyObjectSources) +run_cmake(SHAREDwithOnlyObjectSources) +run_cmake(MODULEwithOnlyObjectSources) +run_cmake(UNKNOWNwithOnlyObjectSources) + +if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]") + run_cmake(INTERFACEwithNoSourcesButLinkObjects) + run_cmake(OBJECTwithNoSourcesButLinkObjects) + run_cmake(STATICwithNoSourcesButLinkObjects) + run_cmake(SHAREDwithNoSourcesButLinkObjects) + run_cmake(MODULEwithNoSourcesButLinkObjects) + run_cmake(UNKNOWNwithNoSourcesButLinkObjects) +endif() diff --git a/Tests/RunCMake/add_library/SHAREDwithNoSources-result.txt b/Tests/RunCMake/add_library/SHAREDwithNoSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/SHAREDwithNoSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt b/Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt new file mode 100644 index 0000000..5cedd62 --- /dev/null +++ b/Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt @@ -0,0 +1,4 @@ +^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/SHAREDwithNoSources.cmake b/Tests/RunCMake/add_library/SHAREDwithNoSources.cmake new file mode 100644 index 0000000..e147b44 --- /dev/null +++ b/Tests/RunCMake/add_library/SHAREDwithNoSources.cmake @@ -0,0 +1 @@ +add_library(TestSharedLibWithoutSources SHARED) diff --git a/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-result.txt b/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt new file mode 100644 index 0000000..d621e76 --- /dev/null +++ b/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt @@ -0,0 +1,4 @@ +^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/SHAREDwithNoSourcesButLinkObjects.cmake b/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects.cmake new file mode 100644 index 0000000..5e3c270 --- /dev/null +++ b/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestSharedLibWithoutSources SHARED) +target_link_libraries(TestSharedLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/SHAREDwithOnlyObjectSources.cmake b/Tests/RunCMake/add_library/SHAREDwithOnlyObjectSources.cmake new file mode 100644 index 0000000..09281b0 --- /dev/null +++ b/Tests/RunCMake/add_library/SHAREDwithOnlyObjectSources.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestSharedLibWithoutSources SHARED) +target_sources(TestSharedLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/STATICwithNoSources-result.txt b/Tests/RunCMake/add_library/STATICwithNoSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/STATICwithNoSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/STATICwithNoSources-stderr.txt b/Tests/RunCMake/add_library/STATICwithNoSources-stderr.txt new file mode 100644 index 0000000..10b2112 --- /dev/null +++ b/Tests/RunCMake/add_library/STATICwithNoSources-stderr.txt @@ -0,0 +1,4 @@ +^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/STATICwithNoSources.cmake b/Tests/RunCMake/add_library/STATICwithNoSources.cmake new file mode 100644 index 0000000..94a2d9a --- /dev/null +++ b/Tests/RunCMake/add_library/STATICwithNoSources.cmake @@ -0,0 +1 @@ +add_library(TestStaticLibWithoutSources STATIC) diff --git a/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-result.txt b/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt new file mode 100644 index 0000000..33c23b2 --- /dev/null +++ b/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt @@ -0,0 +1,4 @@ +^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/STATICwithNoSourcesButLinkObjects.cmake b/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects.cmake new file mode 100644 index 0000000..b6e137f --- /dev/null +++ b/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestStaticLibWithoutSources STATIC) +target_link_libraries(TestStaticLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/STATICwithOnlyObjectSources.cmake b/Tests/RunCMake/add_library/STATICwithOnlyObjectSources.cmake new file mode 100644 index 0000000..74a8947 --- /dev/null +++ b/Tests/RunCMake/add_library/STATICwithOnlyObjectSources.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestStaticLibWithoutSources STATIC) +target_sources(TestStaticLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/UNKNOWNwithNoSources.cmake b/Tests/RunCMake/add_library/UNKNOWNwithNoSources.cmake new file mode 100644 index 0000000..dc5d777 --- /dev/null +++ b/Tests/RunCMake/add_library/UNKNOWNwithNoSources.cmake @@ -0,0 +1 @@ +add_library(TestUnknownLibWithoutSources UNKNOWN IMPORTED) diff --git a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake b/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake new file mode 100644 index 0000000..a977d42 --- /dev/null +++ b/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestUnknownLibWithoutSources UNKNOWN IMPORTED) +target_link_libraries(TestUnknownLibWithoutSources INTERFACE $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources-result.txt b/Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources-stderr.txt new file mode 100644 index 0000000..e332281 --- /dev/null +++ b/Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at UNKNOWNwithOnlyObjectSources.cmake:[0-9]+ \(target_sources\): + target_sources called with non-compilable target type +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources.cmake b/Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources.cmake new file mode 100644 index 0000000..604e339 --- /dev/null +++ b/Tests/RunCMake/add_library/UNKNOWNwithOnlyObjectSources.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(ObjectLibDependency OBJECT test.cpp) + +add_library(TestUnknownLibWithoutSources UNKNOWN IMPORTED) +target_sources(TestUnknownLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/add_library/test.cpp b/Tests/RunCMake/add_library/test.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/add_library/test.cpp 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/ctest_fixtures/CMakeLists.txt.in b/Tests/RunCMake/ctest_fixtures/CMakeLists.txt.in index 5cb0b4e..6b11cff 100644 --- a/Tests/RunCMake/ctest_fixtures/CMakeLists.txt.in +++ b/Tests/RunCMake/ctest_fixtures/CMakeLists.txt.in @@ -27,7 +27,11 @@ passTest(two) # 6 passTest(cleanupBar) # 7 passTest(three) # 8 failTest(setupFails) # 9 -passTest(wontRun) # 10 + +# Special case, test executable always missing to verify fixture dependencies +# are checked before existence of test executable to be run +add_test(NAME wontRun COMMAND iDoNotExist) # 10 + passTest(cyclicSetup) # 11 passTest(cyclicCleanup) # 12 passTest(cleanupUnused) # 13 diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/CTestConfigCTestScript-stdout.txt b/Tests/RunCMake/ctest_labels_for_subprojects/CTestConfigCTestScript-stdout.txt index ae00e51..05b484d 100644 --- a/Tests/RunCMake/ctest_labels_for_subprojects/CTestConfigCTestScript-stdout.txt +++ b/Tests/RunCMake/ctest_labels_for_subprojects/CTestConfigCTestScript-stdout.txt @@ -1,7 +1,10 @@ 17% tests passed, 5 tests failed out of 6 + Subproject Time Summary: -MyExperimentalFeature += +[0-9.]+ sec \(5 tests\) -MyProductionCode += +[0-9.]+ sec \(1 test\) +MyExperimentalFeature += +[0-9.]+ sec\*proc \(5 tests\) +MyProductionCode += +[0-9.]+ sec\*proc \(1 test\) ++ +Label Time Summary: +NotASubproject += +[0-9.]+ sec\*proc \(6 tests\) + Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariable-stdout.txt b/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariable-stdout.txt index ae00e51..05b484d 100644 --- a/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariable-stdout.txt +++ b/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariable-stdout.txt @@ -1,7 +1,10 @@ 17% tests passed, 5 tests failed out of 6 + Subproject Time Summary: -MyExperimentalFeature += +[0-9.]+ sec \(5 tests\) -MyProductionCode += +[0-9.]+ sec \(1 test\) +MyExperimentalFeature += +[0-9.]+ sec\*proc \(5 tests\) +MyProductionCode += +[0-9.]+ sec\*proc \(1 test\) ++ +Label Time Summary: +NotASubproject += +[0-9.]+ sec\*proc \(6 tests\) + Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-stdout.txt b/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-stdout.txt index a78a99a..c2c1bc7 100644 --- a/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-stdout.txt +++ b/Tests/RunCMake/ctest_labels_for_subprojects/CTestScriptVariableCommandLine-stdout.txt @@ -1,6 +1,9 @@ 0% tests passed, 1 tests failed out of 1 + Subproject Time Summary: -MyThirdPartyDependency += +[0-9.]+ sec \(1 test\) +MyThirdPartyDependency += +[0-9.]+ sec\*proc \(1 test\) ++ +Label Time Summary: +NotASubproject += +[0-9.]+ sec\*proc \(1 test\) + Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCMakeLists-stdout.txt b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCMakeLists-stdout.txt index b5d76a9..3567a92 100644 --- a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCMakeLists-stdout.txt +++ b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCMakeLists-stdout.txt @@ -1,6 +1,6 @@ 50% tests passed, 1 tests failed out of 2 + Subproject Time Summary: -MySubproject += +[0-9.]+ sec \(2 tests\) +MySubproject += +[0-9.]+ sec\*proc \(2 tests\) + Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfig-stdout.txt b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfig-stdout.txt index 01851fd..3a71022 100644 --- a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfig-stdout.txt +++ b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfig-stdout.txt @@ -1,6 +1,9 @@ 67% tests passed, 1 tests failed out of 3 + Subproject Time Summary: -MySubproject += +[0-9.]+ sec \(2 tests\) +MySubproject += +[0-9.]+ sec\*proc \(2 tests\) ++ +Label Time Summary: +NotASubproject += +[0-9.]+ sec\*proc \(1 test\) + Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfigNoSummary-stdout.txt b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfigNoSummary-stdout.txt index 0209bfe..1146bfe 100644 --- a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfigNoSummary-stdout.txt +++ b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCTestConfigNoSummary-stdout.txt @@ -1,7 +1,6 @@ 67% tests passed, 1 tests failed out of 3 + Label Time Summary: -MySubproject += +[0-9.]+ sec \(2 tests\) -NotASubproject += +[0-9.]+ sec \(1 test\) +NotASubproject += +[0-9.]+ sec\*proc \(1 test\) + Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCommandLine-stdout.txt b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCommandLine-stdout.txt index b5d76a9..3567a92 100644 --- a/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCommandLine-stdout.txt +++ b/Tests/RunCMake/ctest_labels_for_subprojects/ModuleVariableCommandLine-stdout.txt @@ -1,6 +1,6 @@ 50% tests passed, 1 tests failed out of 2 + Subproject Time Summary: -MySubproject += +[0-9.]+ sec \(2 tests\) +MySubproject += +[0-9.]+ sec\*proc \(2 tests\) + Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/ctest_start/FunctionScope-stdout.txt b/Tests/RunCMake/ctest_start/FunctionScope-stdout.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/ctest_start/FunctionScope-stdout.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/ctest_start/RunCMakeTest.cmake b/Tests/RunCMake/ctest_start/RunCMakeTest.cmake index d630a79..bf47256 100644 --- a/Tests/RunCMake/ctest_start/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_start/RunCMakeTest.cmake @@ -11,6 +11,8 @@ run_ctest_start(StartQuiet Experimental QUIET) run_ctest_start(ConfigInSource Experimental) +run_ctest_start(FunctionScope Experimental QUIET) + function(run_ConfigInBuild) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ConfigInBuild-build) set(RunCMake_TEST_NO_CLEAN 1) diff --git a/Tests/RunCMake/ctest_start/test.cmake.in b/Tests/RunCMake/ctest_start/test.cmake.in index 21e3fad..0a27942 100644 --- a/Tests/RunCMake/ctest_start/test.cmake.in +++ b/Tests/RunCMake/ctest_start/test.cmake.in @@ -9,5 +9,13 @@ set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +function(setup_tests) + ctest_start(${ctest_start_args}) +endfunction() + set(ctest_start_args "@CASE_CTEST_START_ARGS@") -ctest_start(${ctest_start_args}) +if("@CASE_NAME@" STREQUAL "FunctionScope") + setup_tests() +else() + ctest_start(${ctest_start_args}) +endif() diff --git a/Tests/RunCMake/execute_process/EncodingUTF-8-stderr.txt b/Tests/RunCMake/execute_process/EncodingUTF-8-stderr.txt new file mode 100644 index 0000000..0ac68de --- /dev/null +++ b/Tests/RunCMake/execute_process/EncodingUTF-8-stderr.txt @@ -0,0 +1 @@ +यूनिकोड είναι very здорово! diff --git a/Tests/RunCMake/execute_process/RunCMakeTest.cmake b/Tests/RunCMake/execute_process/RunCMakeTest.cmake index 83589bb..cb40b40 100644 --- a/Tests/RunCMake/execute_process/RunCMakeTest.cmake +++ b/Tests/RunCMake/execute_process/RunCMakeTest.cmake @@ -10,6 +10,7 @@ run_cmake_command(MergeOutputVars ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/Mer run_cmake(EncodingMissing) if(TEST_ENCODING_EXE) run_cmake_command(EncodingUTF8 ${CMAKE_COMMAND} -DTEST_ENCODING=UTF8 -DTEST_ENCODING_EXE=${TEST_ENCODING_EXE} -P ${RunCMake_SOURCE_DIR}/Encoding.cmake) + run_cmake_command(EncodingUTF-8 ${CMAKE_COMMAND} -DTEST_ENCODING=UTF-8 -DTEST_ENCODING_EXE=${TEST_ENCODING_EXE} -P ${RunCMake_SOURCE_DIR}/Encoding.cmake) endif() if(EXIT_CODE_EXE) 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/find_package/PackageRoot-stderr.txt b/Tests/RunCMake/find_package/PackageRoot-stderr.txt index 409fa89..2ec324a 100644 --- a/Tests/RunCMake/find_package/PackageRoot-stderr.txt +++ b/Tests/RunCMake/find_package/PackageRoot-stderr.txt @@ -1,383 +1,43 @@ +---------- Foo_ROOT : ENV{Foo_ROOT} : + +find_package\(Foo\) FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND FOO_TEST_FILE_ZOT :FOO_TEST_FILE_ZOT-NOTFOUND FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND FOO_TEST_PATH_ZOT :FOO_TEST_PATH_ZOT-NOTFOUND FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND -Foo_ROOT : -ENV{Foo_ROOT} : -Bar_ROOT : -ENV{Bar_ROOT} : -FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND -FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND -FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND -BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND -BAR_TEST_FILE_BAR :BAR_TEST_FILE_BAR-NOTFOUND -BAR_TEST_FILE_ZOT :BAR_TEST_FILE_ZOT-NOTFOUND -BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND -BAR_TEST_PATH_BAR :BAR_TEST_PATH_BAR-NOTFOUND -BAR_TEST_PATH_ZOT :BAR_TEST_PATH_ZOT-NOTFOUND -BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND -BAR_TEST_PROG_BAR :BAR_TEST_PROG_BAR-NOTFOUND - -Foo_ROOT :.*/PackageRoot/foo/cmake_root -ENV{Foo_ROOT} : -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe - -Foo_ROOT :.*/PackageRoot/foo/cmake_root -ENV{Foo_ROOT} : -Bar_ROOT : -ENV{Bar_ROOT} : -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe -BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -BAR_TEST_FILE_BAR :.*/PackageRoot/foo/cmake_root/include/bar.h -BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -BAR_TEST_PATH_BAR :.*/PackageRoot/foo/cmake_root/include -BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe -BAR_TEST_PROG_BAR :.*/PackageRoot/foo/cmake_root/bin/bar.exe - -Foo_ROOT : -ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h -FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include -FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe - -Foo_ROOT : -ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root -Bar_ROOT : -ENV{Bar_ROOT} : -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe -BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h -BAR_TEST_FILE_BAR :.*/PackageRoot/foo/env_root/include/bar.h -BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include -BAR_TEST_PATH_BAR :.*/PackageRoot/foo/env_root/include -BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe -BAR_TEST_PROG_BAR :.*/PackageRoot/foo/env_root/bin/bar.exe - -Foo_ROOT :.*/PackageRoot/foo/cmake_root -ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe - -Foo_ROOT :.*/PackageRoot/foo/cmake_root -ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root -Bar_ROOT : -ENV{Bar_ROOT} : -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe -BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -BAR_TEST_FILE_BAR :.*/PackageRoot/foo/cmake_root/include/bar.h -BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -BAR_TEST_PATH_BAR :.*/PackageRoot/foo/cmake_root/include -BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe -BAR_TEST_PROG_BAR :.*/PackageRoot/foo/cmake_root/bin/bar.exe - -Foo_ROOT : -ENV{Foo_ROOT} : -FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND -FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND -FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND - -Foo_ROOT : +---------- +Foo_ROOT :<base>/foo/cmake_root ENV{Foo_ROOT} : -Bar_ROOT :.*/PackageRoot/bar/cmake_root -ENV{Bar_ROOT} : -FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND -FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND -FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND -BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND -BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h -BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND -BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include -BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND -BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe -Foo_ROOT : -ENV{Foo_ROOT} : -FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND -FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND -FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND +find_package\(Foo\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +---------- Foo_ROOT : -ENV{Foo_ROOT} : -Bar_ROOT : -ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root -FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND -FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND -FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND -BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND -BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h -BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND -BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include -BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND -BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe +ENV{Foo_ROOT} :<base>/foo/env_root -Foo_ROOT : -ENV{Foo_ROOT} : -FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND -FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND -FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND - -Foo_ROOT : -ENV{Foo_ROOT} : -Bar_ROOT :.*/PackageRoot/bar/cmake_root -ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root -FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND -FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND -FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND -BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND -BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h -BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND -BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include -BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND -BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe - -Foo_ROOT :.*/PackageRoot/foo/cmake_root -ENV{Foo_ROOT} : -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe - -Foo_ROOT :.*/PackageRoot/foo/cmake_root -ENV{Foo_ROOT} : -Bar_ROOT :.*/PackageRoot/bar/cmake_root -ENV{Bar_ROOT} : -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe -BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h -BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include -BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe -BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe - -Foo_ROOT : -ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h -FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include -FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe - -Foo_ROOT : -ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root -Bar_ROOT :.*/PackageRoot/bar/cmake_root -ENV{Bar_ROOT} : -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe -BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h -BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h -BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include -BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include -BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe -BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe - -Foo_ROOT :.*/PackageRoot/foo/cmake_root -ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe - -Foo_ROOT :.*/PackageRoot/foo/cmake_root -ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root -Bar_ROOT :.*/PackageRoot/bar/cmake_root -ENV{Bar_ROOT} : -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe -BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h -BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include -BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe -BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe - -Foo_ROOT :.*/PackageRoot/foo/cmake_root -ENV{Foo_ROOT} : -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe - -Foo_ROOT :.*/PackageRoot/foo/cmake_root -ENV{Foo_ROOT} : -Bar_ROOT : -ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe -BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h -BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include -BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe -BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe - -Foo_ROOT : -ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h -FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include -FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe - -Foo_ROOT : -ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root -Bar_ROOT : -ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe -BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h -BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h -BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include -BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include -BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe -BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe - -Foo_ROOT :.*/PackageRoot/foo/cmake_root -ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe - -Foo_ROOT :.*/PackageRoot/foo/cmake_root -ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root -Bar_ROOT : -ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe -BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h -BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include -BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe -BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe - -Foo_ROOT :.*/PackageRoot/foo/cmake_root -ENV{Foo_ROOT} : -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe - -Foo_ROOT :.*/PackageRoot/foo/cmake_root -ENV{Foo_ROOT} : -Bar_ROOT :.*/PackageRoot/bar/cmake_root -ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe -BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h -BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include -BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe -BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe - -Foo_ROOT : -ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h -FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include -FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe - -Foo_ROOT : -ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root -Bar_ROOT :.*/PackageRoot/bar/cmake_root -ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe -BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h -BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h -BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include -BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include -BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe -BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe +find_package\(Foo\) +FOO_TEST_FILE_FOO :<base>/foo/env_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/env_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/env_root/include +FOO_TEST_PATH_ZOT :<base>/foo/env_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/env_root/bin/foo.exe -Foo_ROOT :.*/PackageRoot/foo/cmake_root -ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} :<base>/foo/env_root -Foo_ROOT :.*/PackageRoot/foo/cmake_root -ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root -Bar_ROOT :.*/PackageRoot/bar/cmake_root -ENV{Bar_ROOT} :.*/PackageRoot/bar/env_root -FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe -BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h -BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h -BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h -BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include -BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include -BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot -BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe -BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe +find_package\(Foo\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe diff --git a/Tests/RunCMake/find_package/PackageRoot.cmake b/Tests/RunCMake/find_package/PackageRoot.cmake index 421c243..4c4f4c2 100644 --- a/Tests/RunCMake/find_package/PackageRoot.cmake +++ b/Tests/RunCMake/find_package/PackageRoot.cmake @@ -1,77 +1,43 @@ +set(__UNDOCUMENTED_CMAKE_FIND_PACKAGE_ROOT 1) cmake_policy(SET CMP0057 NEW) list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) +function(PrintPath label path) + string(REPLACE "${PackageRoot_BASE}" "<base>" out "${path}") + message("${label}${out}") +endfunction() + macro(CleanUpPackageRootTest) unset(Foo_ROOT) unset(ENV{Foo_ROOT}) - unset(Bar_ROOT) - unset(ENV{Bar_ROOT}) unset(FOO_TEST_FILE_FOO) + unset(FOO_TEST_FILE_ZOT) unset(FOO_TEST_PATH_FOO) + unset(FOO_TEST_PATH_ZOT) unset(FOO_TEST_PROG_FOO) - unset(BAR_TEST_FILE_FOO) - unset(BAR_TEST_FILE_BAR) - unset(BAR_TEST_PATH_FOO) - unset(BAR_TEST_PATH_BAR) - unset(BAR_TEST_PROG_FOO) - unset(BAR_TEST_PROG_BAR) unset(FOO_TEST_FILE_FOO CACHE) + unset(FOO_TEST_FILE_ZOT CACHE) unset(FOO_TEST_PATH_FOO CACHE) + unset(FOO_TEST_PATH_ZOT CACHE) unset(FOO_TEST_PROG_FOO CACHE) - unset(BAR_TEST_FILE_FOO CACHE) - unset(BAR_TEST_FILE_BAR CACHE) - unset(BAR_TEST_PATH_FOO CACHE) - unset(BAR_TEST_PATH_BAR CACHE) - unset(BAR_TEST_PROG_FOO CACHE) - unset(BAR_TEST_PROG_BAR CACHE) endmacro() macro(RunPackageRootTest) - set(orig_foo_cmake_root ${Foo_ROOT}) - set(orig_foo_env_root $ENV{Foo_ROOT}) - set(orig_bar_cmake_root ${Bar_ROOT}) - set(orig_bar_env_root $ENV{Bar_ROOT}) - - find_package(Foo) - message("Foo_ROOT :${Foo_ROOT}") - message("ENV{Foo_ROOT} :$ENV{Foo_ROOT}") - message("FOO_TEST_FILE_FOO :${FOO_TEST_FILE_FOO}") - message("FOO_TEST_FILE_ZOT :${FOO_TEST_FILE_ZOT}") - message("FOO_TEST_PATH_FOO :${FOO_TEST_PATH_FOO}") - message("FOO_TEST_PATH_ZOT :${FOO_TEST_PATH_ZOT}") - message("FOO_TEST_PROG_FOO :${FOO_TEST_PROG_FOO}") - CleanUpPackageRootTest() + message("----------") + PrintPath("Foo_ROOT :" "${Foo_ROOT}") + PrintPath("ENV{Foo_ROOT} :" "$ENV{Foo_ROOT}") message("") - set(Foo_ROOT ${orig_foo_cmake_root}) - set(ENV{Foo_ROOT} ${orig_foo_env_root}) - set(Bar_ROOT ${orig_bar_cmake_root}) - set(ENV{Bar_ROOT} ${orig_bar_env_root}) - - find_package(Foo COMPONENTS Bar) - message("Foo_ROOT :${Foo_ROOT}") - message("ENV{Foo_ROOT} :$ENV{Foo_ROOT}") - message("Bar_ROOT :${Bar_ROOT}") - message("ENV{Bar_ROOT} :$ENV{Bar_ROOT}") - message("FOO_TEST_FILE_FOO :${FOO_TEST_FILE_FOO}") - message("FOO_TEST_PATH_FOO :${FOO_TEST_PATH_FOO}") - message("FOO_TEST_PROG_FOO :${FOO_TEST_PROG_FOO}") - message("BAR_TEST_FILE_FOO :${BAR_TEST_FILE_FOO}") - message("BAR_TEST_FILE_BAR :${BAR_TEST_FILE_BAR}") - message("BAR_TEST_FILE_ZOT :${BAR_TEST_FILE_ZOT}") - message("BAR_TEST_PATH_FOO :${BAR_TEST_PATH_FOO}") - message("BAR_TEST_PATH_BAR :${BAR_TEST_PATH_BAR}") - message("BAR_TEST_PATH_ZOT :${BAR_TEST_PATH_ZOT}") - message("BAR_TEST_PROG_FOO :${BAR_TEST_PROG_FOO}") - message("BAR_TEST_PROG_BAR :${BAR_TEST_PROG_BAR}") + find_package(Foo) + message("find_package(Foo)") + PrintPath("FOO_TEST_FILE_FOO :" "${FOO_TEST_FILE_FOO}") + PrintPath("FOO_TEST_FILE_ZOT :" "${FOO_TEST_FILE_ZOT}") + PrintPath("FOO_TEST_PATH_FOO :" "${FOO_TEST_PATH_FOO}") + PrintPath("FOO_TEST_PATH_ZOT :" "${FOO_TEST_PATH_ZOT}") + PrintPath("FOO_TEST_PROG_FOO :" "${FOO_TEST_PROG_FOO}") CleanUpPackageRootTest() message("") - - unset(orig_foo_cmake_root) - unset(orig_foo_env_root) - unset(orig_bar_cmake_root) - unset(orig_bar_env_root) endmacro() RunPackageRootTest() @@ -85,63 +51,3 @@ RunPackageRootTest() set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root) RunPackageRootTest() - -## - -set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) -RunPackageRootTest() - -set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) -RunPackageRootTest() - -set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) -set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) -RunPackageRootTest() - -## - -set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) -set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) -RunPackageRootTest() - -set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root) -set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) -RunPackageRootTest() - -set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) -set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root) -set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) -RunPackageRootTest() - -## - -set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) -set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) -RunPackageRootTest() - -set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root) -set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) -RunPackageRootTest() - -set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) -set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root) -set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) -RunPackageRootTest() - -## - -set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) -set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) -set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) -RunPackageRootTest() - -set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root) -set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) -set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) -RunPackageRootTest() - -set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) -set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root) -set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) -set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) -RunPackageRootTest() diff --git a/Tests/RunCMake/find_package/PackageRoot/BarConfig.cmake b/Tests/RunCMake/find_package/PackageRoot/BarConfig.cmake new file mode 100644 index 0000000..9eaf386 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/BarConfig.cmake @@ -0,0 +1,9 @@ +set(BAR_CMAKE_FILE ${CMAKE_CURRENT_LIST_FILE} CACHE FILEPATH "") +find_file(BAR_TEST_FILE_FOO foo.h) +find_file(BAR_TEST_FILE_BAR bar.h) +find_file(BAR_TEST_FILE_ZOT zot.h PATH_SUFFIXES zot) +find_path(BAR_TEST_PATH_FOO foo.h) +find_path(BAR_TEST_PATH_BAR bar.h) +find_path(BAR_TEST_PATH_ZOT zot.h PATH_SUFFIXES zot) +find_program(BAR_TEST_PROG_FOO foo.exe) +find_program(BAR_TEST_PROG_BAR bar.exe) diff --git a/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake b/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake index 72774a7..9eaf386 100644 --- a/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake +++ b/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake @@ -1,3 +1,4 @@ +set(BAR_CMAKE_FILE ${CMAKE_CURRENT_LIST_FILE} CACHE FILEPATH "") find_file(BAR_TEST_FILE_FOO foo.h) find_file(BAR_TEST_FILE_BAR bar.h) find_file(BAR_TEST_FILE_ZOT zot.h PATH_SUFFIXES zot) diff --git a/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake b/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake index e160a1d..b929c2a 100644 --- a/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake +++ b/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake @@ -4,6 +4,8 @@ find_path(FOO_TEST_PATH_FOO foo.h) find_path(FOO_TEST_PATH_ZOT zot.h PATH_SUFFIXES zot) find_program(FOO_TEST_PROG_FOO foo.exe) -if ("Bar" IN_LIST Foo_FIND_COMPONENTS) +if ("BarModule" IN_LIST Foo_FIND_COMPONENTS) find_package(Bar) +elseif ("BarConfig" IN_LIST Foo_FIND_COMPONENTS) + find_package(Bar CONFIG) endif () diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/cmake/BarConfig.cmake b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/cmake/BarConfig.cmake new file mode 100644 index 0000000..9eaf386 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/cmake/BarConfig.cmake @@ -0,0 +1,9 @@ +set(BAR_CMAKE_FILE ${CMAKE_CURRENT_LIST_FILE} CACHE FILEPATH "") +find_file(BAR_TEST_FILE_FOO foo.h) +find_file(BAR_TEST_FILE_BAR bar.h) +find_file(BAR_TEST_FILE_ZOT zot.h PATH_SUFFIXES zot) +find_path(BAR_TEST_PATH_FOO foo.h) +find_path(BAR_TEST_PATH_BAR bar.h) +find_path(BAR_TEST_PATH_ZOT zot.h PATH_SUFFIXES zot) +find_program(BAR_TEST_PROG_FOO foo.exe) +find_program(BAR_TEST_PROG_BAR bar.exe) diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/env_root/cmake/BarConfig.cmake b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/cmake/BarConfig.cmake new file mode 100644 index 0000000..9eaf386 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/cmake/BarConfig.cmake @@ -0,0 +1,9 @@ +set(BAR_CMAKE_FILE ${CMAKE_CURRENT_LIST_FILE} CACHE FILEPATH "") +find_file(BAR_TEST_FILE_FOO foo.h) +find_file(BAR_TEST_FILE_BAR bar.h) +find_file(BAR_TEST_FILE_ZOT zot.h PATH_SUFFIXES zot) +find_path(BAR_TEST_PATH_FOO foo.h) +find_path(BAR_TEST_PATH_BAR bar.h) +find_path(BAR_TEST_PATH_ZOT zot.h PATH_SUFFIXES zot) +find_program(BAR_TEST_PROG_FOO foo.exe) +find_program(BAR_TEST_PROG_BAR bar.exe) diff --git a/Tests/RunCMake/find_package/PackageRootNestedConfig-stderr.txt b/Tests/RunCMake/find_package/PackageRootNestedConfig-stderr.txt new file mode 100644 index 0000000..b3ee104 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRootNestedConfig-stderr.txt @@ -0,0 +1,298 @@ +---------- +Foo_ROOT : +ENV{Foo_ROOT} : +Bar_DIR : +Bar_ROOT : +ENV{Bar_ROOT} : + +find_package\(Foo COMPONENTS BarConfig\) +FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND +FOO_TEST_FILE_ZOT :FOO_TEST_FILE_ZOT-NOTFOUND +FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND +FOO_TEST_PATH_ZOT :FOO_TEST_PATH_ZOT-NOTFOUND +FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND +BAR_CMAKE_FILE : +BAR_TEST_FILE_FOO : +BAR_TEST_FILE_BAR : +BAR_TEST_FILE_ZOT : +BAR_TEST_PATH_FOO : +BAR_TEST_PATH_BAR : +BAR_TEST_PATH_ZOT : +BAR_TEST_PROG_FOO : +BAR_TEST_PROG_BAR : + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} : +Bar_DIR : +Bar_ROOT : +ENV{Bar_ROOT} : + +find_package\(Foo COMPONENTS BarConfig\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/foo/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/foo/cmake_root/include +BAR_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/foo/cmake_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} : +Bar_DIR : +Bar_ROOT :<base>/bar/cmake_root +ENV{Bar_ROOT} : + +find_package\(Foo COMPONENTS BarConfig\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include +BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} : +Bar_DIR : +Bar_ROOT : +ENV{Bar_ROOT} :<base>/bar/env_root + +find_package\(Foo COMPONENTS BarConfig\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/bar/env_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/bar/env_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/bar/env_root/include +BAR_TEST_PATH_ZOT :<base>/bar/env_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/bar/env_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} : +Bar_DIR : +Bar_ROOT :<base>/bar/cmake_root +ENV{Bar_ROOT} :<base>/bar/env_root + +find_package\(Foo COMPONENTS BarConfig\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include +BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} :<base>/foo/cmake_root +Bar_DIR : +Bar_ROOT : +ENV{Bar_ROOT} : + +find_package\(Foo COMPONENTS BarConfig\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/foo/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/foo/cmake_root/include +BAR_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/foo/cmake_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} :<base>/foo/cmake_root +Bar_DIR : +Bar_ROOT :<base>/bar/cmake_root +ENV{Bar_ROOT} : + +find_package\(Foo COMPONENTS BarConfig\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include +BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} :<base>/foo/cmake_root +Bar_DIR : +Bar_ROOT : +ENV{Bar_ROOT} :<base>/bar/env_root + +find_package\(Foo COMPONENTS BarConfig\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/bar/env_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/bar/env_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/bar/env_root/include +BAR_TEST_PATH_ZOT :<base>/bar/env_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/bar/env_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} :<base>/foo/cmake_root +Bar_DIR : +Bar_ROOT :<base>/bar/cmake_root +ENV{Bar_ROOT} :<base>/bar/env_root + +find_package\(Foo COMPONENTS BarConfig\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include +BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} :<base>/foo/cmake_root +Bar_DIR : +Bar_ROOT : +ENV{Bar_ROOT} : + +find_package\(Foo COMPONENTS BarConfig\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/foo/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/foo/cmake_root/include +BAR_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/foo/cmake_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} :<base>/foo/cmake_root +Bar_DIR : +Bar_ROOT :<base>/bar/cmake_root +ENV{Bar_ROOT} : + +find_package\(Foo COMPONENTS BarConfig\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include +BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} :<base>/foo/cmake_root +Bar_DIR : +Bar_ROOT : +ENV{Bar_ROOT} :<base>/bar/env_root + +find_package\(Foo COMPONENTS BarConfig\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/bar/env_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/bar/env_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/bar/env_root/include +BAR_TEST_PATH_ZOT :<base>/bar/env_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/bar/env_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} :<base>/foo/cmake_root +Bar_DIR : +Bar_ROOT :<base>/bar/cmake_root +ENV{Bar_ROOT} :<base>/bar/env_root + +find_package\(Foo COMPONENTS BarConfig\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include +BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe diff --git a/Tests/RunCMake/find_package/PackageRootNestedConfig.cmake b/Tests/RunCMake/find_package/PackageRootNestedConfig.cmake new file mode 100644 index 0000000..ba06c09 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRootNestedConfig.cmake @@ -0,0 +1,141 @@ +set(__UNDOCUMENTED_CMAKE_FIND_PACKAGE_ROOT 1) +cmake_policy(SET CMP0057 NEW) +list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) +set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) + +function(PrintPath label path) + string(REPLACE "${PackageRoot_BASE}" "<base>" out "${path}") + message("${label}${out}") +endfunction() + +macro(CleanUpPackageRootTest) + unset(Foo_ROOT) + unset(ENV{Foo_ROOT}) + unset(Bar_DIR) + unset(BAR_CMAKE_FILE) + unset(Bar_ROOT) + unset(ENV{Bar_ROOT}) + unset(FOO_TEST_FILE_FOO) + unset(FOO_TEST_FILE_ZOT) + unset(FOO_TEST_PATH_FOO) + unset(FOO_TEST_PATH_ZOT) + unset(FOO_TEST_PROG_FOO) + unset(BAR_TEST_FILE_FOO) + unset(BAR_TEST_FILE_BAR) + unset(BAR_TEST_FILE_ZOT) + unset(BAR_TEST_PATH_FOO) + unset(BAR_TEST_PATH_BAR) + unset(BAR_TEST_PATH_ZOT) + unset(BAR_TEST_PROG_FOO) + unset(BAR_TEST_PROG_BAR) + unset(Bar_DIR CACHE) + unset(BAR_CMAKE_FILE CACHE) + unset(FOO_TEST_FILE_FOO CACHE) + unset(FOO_TEST_FILE_ZOT CACHE) + unset(FOO_TEST_PATH_FOO CACHE) + unset(FOO_TEST_PATH_ZOT CACHE) + unset(FOO_TEST_PROG_FOO CACHE) + unset(BAR_TEST_FILE_FOO CACHE) + unset(BAR_TEST_FILE_BAR CACHE) + unset(BAR_TEST_FILE_ZOT CACHE) + unset(BAR_TEST_PATH_FOO CACHE) + unset(BAR_TEST_PATH_BAR CACHE) + unset(BAR_TEST_PATH_ZOT CACHE) + unset(BAR_TEST_PROG_FOO CACHE) + unset(BAR_TEST_PROG_BAR CACHE) +endmacro() + +macro(RunPackageRootTest) + message("----------") + PrintPath("Foo_ROOT :" "${Foo_ROOT}") + PrintPath("ENV{Foo_ROOT} :" "$ENV{Foo_ROOT}") + PrintPath("Bar_DIR :" "${Bar_DIR}") + PrintPath("Bar_ROOT :" "${Bar_ROOT}") + PrintPath("ENV{Bar_ROOT} :" "$ENV{Bar_ROOT}") + message("") + + find_package(Foo COMPONENTS BarConfig) + message("find_package(Foo COMPONENTS BarConfig)") + PrintPath("FOO_TEST_FILE_FOO :" "${FOO_TEST_FILE_FOO}") + PrintPath("FOO_TEST_FILE_ZOT :" "${FOO_TEST_FILE_ZOT}") + PrintPath("FOO_TEST_PATH_FOO :" "${FOO_TEST_PATH_FOO}") + PrintPath("FOO_TEST_PATH_ZOT :" "${FOO_TEST_PATH_ZOT}") + PrintPath("FOO_TEST_PROG_FOO :" "${FOO_TEST_PROG_FOO}") + PrintPath("BAR_CMAKE_FILE :" "${BAR_CMAKE_FILE}") + PrintPath("BAR_TEST_FILE_FOO :" "${BAR_TEST_FILE_FOO}") + PrintPath("BAR_TEST_FILE_BAR :" "${BAR_TEST_FILE_BAR}") + PrintPath("BAR_TEST_FILE_ZOT :" "${BAR_TEST_FILE_ZOT}") + PrintPath("BAR_TEST_PATH_FOO :" "${BAR_TEST_PATH_FOO}") + PrintPath("BAR_TEST_PATH_BAR :" "${BAR_TEST_PATH_BAR}") + PrintPath("BAR_TEST_PATH_ZOT :" "${BAR_TEST_PATH_ZOT}") + PrintPath("BAR_TEST_PROG_FOO :" "${BAR_TEST_PROG_FOO}") + PrintPath("BAR_TEST_PROG_BAR :" "${BAR_TEST_PROG_BAR}") + CleanUpPackageRootTest() + message("") +endmacro() + +# + +RunPackageRootTest() + +# + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() + +# + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root) +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root) +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() + +# + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root) +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root) +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() diff --git a/Tests/RunCMake/find_package/PackageRootNestedModule-stderr.txt b/Tests/RunCMake/find_package/PackageRootNestedModule-stderr.txt new file mode 100644 index 0000000..0ca2bdd --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRootNestedModule-stderr.txt @@ -0,0 +1,298 @@ +---------- +Foo_ROOT : +ENV{Foo_ROOT} : +Bar_DIR : +Bar_ROOT : +ENV{Bar_ROOT} : + +find_package\(Foo COMPONENTS BarModule\) +FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND +FOO_TEST_FILE_ZOT :FOO_TEST_FILE_ZOT-NOTFOUND +FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND +FOO_TEST_PATH_ZOT :FOO_TEST_PATH_ZOT-NOTFOUND +FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND +BAR_CMAKE_FILE :<base>/FindBar.cmake +BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND +BAR_TEST_FILE_BAR :BAR_TEST_FILE_BAR-NOTFOUND +BAR_TEST_FILE_ZOT :BAR_TEST_FILE_ZOT-NOTFOUND +BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND +BAR_TEST_PATH_BAR :BAR_TEST_PATH_BAR-NOTFOUND +BAR_TEST_PATH_ZOT :BAR_TEST_PATH_ZOT-NOTFOUND +BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND +BAR_TEST_PROG_BAR :BAR_TEST_PROG_BAR-NOTFOUND + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} : +Bar_DIR : +Bar_ROOT : +ENV{Bar_ROOT} : + +find_package\(Foo COMPONENTS BarModule\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/FindBar.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/foo/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/foo/cmake_root/include +BAR_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/foo/cmake_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} : +Bar_DIR : +Bar_ROOT :<base>/bar/cmake_root +ENV{Bar_ROOT} : + +find_package\(Foo COMPONENTS BarModule\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/FindBar.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include +BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} : +Bar_DIR : +Bar_ROOT : +ENV{Bar_ROOT} :<base>/bar/env_root + +find_package\(Foo COMPONENTS BarModule\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/FindBar.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/bar/env_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/bar/env_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/bar/env_root/include +BAR_TEST_PATH_ZOT :<base>/bar/env_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/bar/env_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} : +Bar_DIR : +Bar_ROOT :<base>/bar/cmake_root +ENV{Bar_ROOT} :<base>/bar/env_root + +find_package\(Foo COMPONENTS BarModule\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/FindBar.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include +BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} :<base>/foo/cmake_root +Bar_DIR : +Bar_ROOT : +ENV{Bar_ROOT} : + +find_package\(Foo COMPONENTS BarModule\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/FindBar.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/foo/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/foo/cmake_root/include +BAR_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/foo/cmake_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} :<base>/foo/cmake_root +Bar_DIR : +Bar_ROOT :<base>/bar/cmake_root +ENV{Bar_ROOT} : + +find_package\(Foo COMPONENTS BarModule\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/FindBar.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include +BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} :<base>/foo/cmake_root +Bar_DIR : +Bar_ROOT : +ENV{Bar_ROOT} :<base>/bar/env_root + +find_package\(Foo COMPONENTS BarModule\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/FindBar.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/bar/env_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/bar/env_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/bar/env_root/include +BAR_TEST_PATH_ZOT :<base>/bar/env_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/bar/env_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} :<base>/foo/cmake_root +Bar_DIR : +Bar_ROOT :<base>/bar/cmake_root +ENV{Bar_ROOT} :<base>/bar/env_root + +find_package\(Foo COMPONENTS BarModule\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/FindBar.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include +BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} :<base>/foo/cmake_root +Bar_DIR : +Bar_ROOT : +ENV{Bar_ROOT} : + +find_package\(Foo COMPONENTS BarModule\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/FindBar.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/foo/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/foo/cmake_root/include +BAR_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/foo/cmake_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} :<base>/foo/cmake_root +Bar_DIR : +Bar_ROOT :<base>/bar/cmake_root +ENV{Bar_ROOT} : + +find_package\(Foo COMPONENTS BarModule\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/FindBar.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include +BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} :<base>/foo/cmake_root +Bar_DIR : +Bar_ROOT : +ENV{Bar_ROOT} :<base>/bar/env_root + +find_package\(Foo COMPONENTS BarModule\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/FindBar.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/bar/env_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/bar/env_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/bar/env_root/include +BAR_TEST_PATH_ZOT :<base>/bar/env_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/bar/env_root/bin/bar.exe + +---------- +Foo_ROOT :<base>/foo/cmake_root +ENV{Foo_ROOT} :<base>/foo/cmake_root +Bar_DIR : +Bar_ROOT :<base>/bar/cmake_root +ENV{Bar_ROOT} :<base>/bar/env_root + +find_package\(Foo COMPONENTS BarModule\) +FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h +FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include +FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot +FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_CMAKE_FILE :<base>/FindBar.cmake +BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h +BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h +BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h +BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include +BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include +BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot +BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe +BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe diff --git a/Tests/RunCMake/find_package/PackageRootNestedModule.cmake b/Tests/RunCMake/find_package/PackageRootNestedModule.cmake new file mode 100644 index 0000000..2795cd4 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRootNestedModule.cmake @@ -0,0 +1,141 @@ +set(__UNDOCUMENTED_CMAKE_FIND_PACKAGE_ROOT 1) +cmake_policy(SET CMP0057 NEW) +list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) +set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) + +function(PrintPath label path) + string(REPLACE "${PackageRoot_BASE}" "<base>" out "${path}") + message("${label}${out}") +endfunction() + +macro(CleanUpPackageRootTest) + unset(Foo_ROOT) + unset(ENV{Foo_ROOT}) + unset(Bar_DIR) + unset(BAR_CMAKE_FILE) + unset(Bar_ROOT) + unset(ENV{Bar_ROOT}) + unset(FOO_TEST_FILE_FOO) + unset(FOO_TEST_FILE_ZOT) + unset(FOO_TEST_PATH_FOO) + unset(FOO_TEST_PATH_ZOT) + unset(FOO_TEST_PROG_FOO) + unset(BAR_TEST_FILE_FOO) + unset(BAR_TEST_FILE_BAR) + unset(BAR_TEST_FILE_ZOT) + unset(BAR_TEST_PATH_FOO) + unset(BAR_TEST_PATH_BAR) + unset(BAR_TEST_PATH_ZOT) + unset(BAR_TEST_PROG_FOO) + unset(BAR_TEST_PROG_BAR) + unset(Bar_DIR CACHE) + unset(BAR_CMAKE_FILE CACHE) + unset(FOO_TEST_FILE_FOO CACHE) + unset(FOO_TEST_FILE_ZOT CACHE) + unset(FOO_TEST_PATH_FOO CACHE) + unset(FOO_TEST_PATH_ZOT CACHE) + unset(FOO_TEST_PROG_FOO CACHE) + unset(BAR_TEST_FILE_FOO CACHE) + unset(BAR_TEST_FILE_BAR CACHE) + unset(BAR_TEST_FILE_ZOT CACHE) + unset(BAR_TEST_PATH_FOO CACHE) + unset(BAR_TEST_PATH_BAR CACHE) + unset(BAR_TEST_PATH_ZOT CACHE) + unset(BAR_TEST_PROG_FOO CACHE) + unset(BAR_TEST_PROG_BAR CACHE) +endmacro() + +macro(RunPackageRootTest) + message("----------") + PrintPath("Foo_ROOT :" "${Foo_ROOT}") + PrintPath("ENV{Foo_ROOT} :" "$ENV{Foo_ROOT}") + PrintPath("Bar_DIR :" "${Bar_DIR}") + PrintPath("Bar_ROOT :" "${Bar_ROOT}") + PrintPath("ENV{Bar_ROOT} :" "$ENV{Bar_ROOT}") + message("") + + find_package(Foo COMPONENTS BarModule) + message("find_package(Foo COMPONENTS BarModule)") + PrintPath("FOO_TEST_FILE_FOO :" "${FOO_TEST_FILE_FOO}") + PrintPath("FOO_TEST_FILE_ZOT :" "${FOO_TEST_FILE_ZOT}") + PrintPath("FOO_TEST_PATH_FOO :" "${FOO_TEST_PATH_FOO}") + PrintPath("FOO_TEST_PATH_ZOT :" "${FOO_TEST_PATH_ZOT}") + PrintPath("FOO_TEST_PROG_FOO :" "${FOO_TEST_PROG_FOO}") + PrintPath("BAR_CMAKE_FILE :" "${BAR_CMAKE_FILE}") + PrintPath("BAR_TEST_FILE_FOO :" "${BAR_TEST_FILE_FOO}") + PrintPath("BAR_TEST_FILE_BAR :" "${BAR_TEST_FILE_BAR}") + PrintPath("BAR_TEST_FILE_ZOT :" "${BAR_TEST_FILE_ZOT}") + PrintPath("BAR_TEST_PATH_FOO :" "${BAR_TEST_PATH_FOO}") + PrintPath("BAR_TEST_PATH_BAR :" "${BAR_TEST_PATH_BAR}") + PrintPath("BAR_TEST_PATH_ZOT :" "${BAR_TEST_PATH_ZOT}") + PrintPath("BAR_TEST_PROG_FOO :" "${BAR_TEST_PROG_FOO}") + PrintPath("BAR_TEST_PROG_BAR :" "${BAR_TEST_PROG_BAR}") + CleanUpPackageRootTest() + message("") +endmacro() + +# + +RunPackageRootTest() + +# + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() + +# + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root) +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root) +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() + +# + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root) +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() + +set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) +set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root) +set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root) +set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root) +RunPackageRootTest() diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake index 7875db6..d548da0 100644 --- a/Tests/RunCMake/find_package/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake @@ -14,6 +14,8 @@ run_cmake(MissingConfigRequired) run_cmake(MissingConfigVersion) run_cmake(MixedModeOptions) run_cmake(PackageRoot) +run_cmake(PackageRootNestedConfig) +run_cmake(PackageRootNestedModule) run_cmake(PolicyPush) run_cmake(PolicyPop) run_cmake(SetFoundFALSE) diff --git a/Tests/RunCMake/foreach/BadRangeInFunction-result.txt b/Tests/RunCMake/foreach/BadRangeInFunction-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/foreach/BadRangeInFunction-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/foreach/BadRangeInFunction-stderr.txt b/Tests/RunCMake/foreach/BadRangeInFunction-stderr.txt new file mode 100644 index 0000000..e16a0f1 --- /dev/null +++ b/Tests/RunCMake/foreach/BadRangeInFunction-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at BadRangeInFunction.cmake:2 \(foreach\): + foreach called with incorrect range specification: start 2, stop 1, step 1 +Call Stack \(most recent call first\): + BadRangeInFunction.cmake:5 \(func\) + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/foreach/BadRangeInFunction.cmake b/Tests/RunCMake/foreach/BadRangeInFunction.cmake new file mode 100644 index 0000000..f51cbbf --- /dev/null +++ b/Tests/RunCMake/foreach/BadRangeInFunction.cmake @@ -0,0 +1,5 @@ +function(func) + foreach(bad_range RANGE 2 1 1) + endforeach() +endfunction() +func() diff --git a/Tests/RunCMake/foreach/CMakeLists.txt b/Tests/RunCMake/foreach/CMakeLists.txt new file mode 100644 index 0000000..bf2ef15 --- /dev/null +++ b/Tests/RunCMake/foreach/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.10) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/foreach/RunCMakeTest.cmake b/Tests/RunCMake/foreach/RunCMakeTest.cmake new file mode 100644 index 0000000..4b74cfe --- /dev/null +++ b/Tests/RunCMake/foreach/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(BadRangeInFunction) diff --git a/Tests/RunCMake/get_filename_component/KnownComponents.cmake b/Tests/RunCMake/get_filename_component/KnownComponents.cmake index 7dfb55d..ac77ac3 100644 --- a/Tests/RunCMake/get_filename_component/KnownComponents.cmake +++ b/Tests/RunCMake/get_filename_component/KnownComponents.cmake @@ -80,6 +80,17 @@ get_filename_component(test_program_name "/ arg1 arg2" PROGRAM check("PROGRAM with args output: name" "${test_program_name}" "/") check("PROGRAM with args output: args" "${test_program_args}" " arg1 arg2") +get_filename_component(test_program_name " " PROGRAM) +check("PROGRAM with just a space" "${test_program_name}" "") + +get_filename_component(test_program_name "${CMAKE_CURRENT_LIST_FILE}" PROGRAM) +check("PROGRAM specified explicitly without quoting" "${test_program_name}" "${CMAKE_CURRENT_LIST_FILE}") + +get_filename_component(test_program_name "\"${CMAKE_CURRENT_LIST_FILE}\" arg1 arg2" PROGRAM + PROGRAM_ARGS test_program_args) +check("PROGRAM specified explicitly with arguments: name" "${test_program_name}" "${CMAKE_CURRENT_LIST_FILE}") +check("PROGRAM specified explicitly with arguments: args" "${test_program_args}" " arg1 arg2") + list(APPEND non_cache_vars test_program_name) list(APPEND non_cache_vars test_program_args) diff --git a/Tests/RunCMake/get_property/RunCMakeTest.cmake b/Tests/RunCMake/get_property/RunCMakeTest.cmake index 017990f..06a0c67 100644 --- a/Tests/RunCMake/get_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/get_property/RunCMakeTest.cmake @@ -23,6 +23,10 @@ run_cmake(NoSource) run_cmake(NoProperty) run_cmake(NoCache) +# Since we are testing the GENERATOR_IS_MULTI_CONFIG property itself, +# don't rely on RunCMake_GENERATOR_IS_MULTI_CONFIG being set correctly +# and instead explicitly check for a match against those generators we +# expect to be multi-config if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode") run_cmake(IsMultiConfig) else() diff --git a/Tests/RunCMake/get_property/source_properties-stderr.txt b/Tests/RunCMake/get_property/source_properties-stderr.txt index 0a46f96..00a9b82 100644 --- a/Tests/RunCMake/get_property/source_properties-stderr.txt +++ b/Tests/RunCMake/get_property/source_properties-stderr.txt @@ -3,4 +3,10 @@ get_property: --><-- get_source_file_property: -->value<-- get_property: -->value<-- get_source_file_property: -->NOTFOUND<-- -get_property: --><--$ +get_property: --><-- +get_source_file_property: -->value<-- +get_property: -->value<-- +get_source_file_property: -->NOTFOUND<-- +get_property: --><-- +get_source_file_property: -->value<-- +get_property: -->value<--$ diff --git a/Tests/RunCMake/get_property/source_properties.cmake b/Tests/RunCMake/get_property/source_properties.cmake index 263ffe1..12d2d07 100644 --- a/Tests/RunCMake/get_property/source_properties.cmake +++ b/Tests/RunCMake/get_property/source_properties.cmake @@ -13,3 +13,13 @@ set_source_files_properties(file.c PROPERTIES empty "" custom value) check_source_file_property(file.c empty) check_source_file_property(file.c custom) check_source_file_property(file.c noexist) + +# Test strange legacy behavior in which the order in which source files are +# first accessed affects how properties are applied without an extension. +# See also issue #15208. +get_property(lang SOURCE ${CMAKE_CURRENT_BINARY_DIR}/file2.c PROPERTY LANGUAGE) +get_property(lang SOURCE ${CMAKE_CURRENT_BINARY_DIR}/file2.h PROPERTY LANGUAGE) +set_property(SOURCE file2 PROPERTY custom value) # set property without extension +check_source_file_property(file2 custom) # should have property +check_source_file_property(file2.h custom) # should not have property +check_source_file_property(file2.c custom) # should have property diff --git a/Tests/RunCMake/get_property/target_properties-stderr.txt b/Tests/RunCMake/get_property/target_properties-stderr.txt index 6b3c6ca..df7a2f1 100644 --- a/Tests/RunCMake/get_property/target_properties-stderr.txt +++ b/Tests/RunCMake/get_property/target_properties-stderr.txt @@ -7,4 +7,10 @@ get_property: --><-- get_target_property: -->(.*)/Tests/RunCMake/get_property<-- get_property: -->(.*)/Tests/RunCMake/get_property<-- get_target_property: -->(.*)/Tests/RunCMake/get_property/target_properties-build<-- -get_property: -->(.*)/Tests/RunCMake/get_property/target_properties-build<--$ +get_property: -->(.*)/Tests/RunCMake/get_property/target_properties-build<-- +get_target_property: -->FALSE<-- +get_property: -->FALSE<-- +get_target_property: -->FALSE<-- +get_property: -->FALSE<-- +get_target_property: -->TRUE<-- +get_property: -->TRUE<--$ diff --git a/Tests/RunCMake/get_property/target_properties.cmake b/Tests/RunCMake/get_property/target_properties.cmake index 9ff833a..321d5b5 100644 --- a/Tests/RunCMake/get_property/target_properties.cmake +++ b/Tests/RunCMake/get_property/target_properties.cmake @@ -16,3 +16,10 @@ check_target_property(tgt custom) check_target_property(tgt noexist) check_target_property(tgt SOURCE_DIR) check_target_property(tgt BINARY_DIR) + +add_library(imported_local_tgt SHARED IMPORTED) +add_library(imported_global_tgt SHARED IMPORTED GLOBAL) + +check_target_property(tgt IMPORTED_GLOBAL) +check_target_property(imported_local_tgt IMPORTED_GLOBAL) +check_target_property(imported_global_tgt IMPORTED_GLOBAL) diff --git a/Tests/RunCMake/interface_library/global-interface-stderr.txt b/Tests/RunCMake/interface_library/global-interface-stderr.txt index 24edd0f..23b45d9 100644 --- a/Tests/RunCMake/interface_library/global-interface-stderr.txt +++ b/Tests/RunCMake/interface_library/global-interface-stderr.txt @@ -3,7 +3,7 @@ CMake Error at global-interface.cmake:2 \(add_library\): GLOBAL - Tried extensions \.c \.C \.c\+\+ \.cc \.cpp \.cxx \.m \.M \.mm \.h \.hh \.h\+\+ \.hm \.hpp - \.hxx \.in \.txx + Tried extensions( \.[A-Za-z+]+| + )* Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) 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/interface_library/whitelist.cmake b/Tests/RunCMake/interface_library/whitelist.cmake index 98ef05c..bf64f01 100644 --- a/Tests/RunCMake/interface_library/whitelist.cmake +++ b/Tests/RunCMake/interface_library/whitelist.cmake @@ -4,3 +4,13 @@ add_library(iface INTERFACE) set_property(TARGET iface PROPERTY OUTPUT_NAME output) set_property(TARGET iface APPEND PROPERTY OUTPUT_NAME append) get_target_property(outname iface OUTPUT_NAME) + +# Properties starting with `_` are allowed. +set_property(TARGET iface PROPERTY "_custom_property" output) +set_property(TARGET iface APPEND PROPERTY "_custom_property" append) +get_target_property(outname iface "_custom_property") + +# Properties starting with a lowercase letter are allowed. +set_property(TARGET iface PROPERTY "custom_property" output) +set_property(TARGET iface APPEND PROPERTY "custom_property" append) +get_target_property(outname iface "custom_property") diff --git a/Tests/RunCMake/message/RunCMakeTest.cmake b/Tests/RunCMake/message/RunCMakeTest.cmake index 2346c86..24dad03 100644 --- a/Tests/RunCMake/message/RunCMakeTest.cmake +++ b/Tests/RunCMake/message/RunCMakeTest.cmake @@ -7,6 +7,6 @@ run_cmake(nomessage-internal-warning) run_cmake(warnmessage) # message command sets fatal occurred flag, so check each type of error -# seperately +# separately run_cmake(errormessage_deprecated) run_cmake(errormessage_dev) diff --git a/Tests/RunCMake/project/CMP0048-OLD-stderr.txt b/Tests/RunCMake/project/CMP0048-OLD-stderr.txt new file mode 100644 index 0000000..1fa70f8 --- /dev/null +++ b/Tests/RunCMake/project/CMP0048-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0048-OLD.cmake:1 \(cmake_policy\): + The OLD behavior for policy CMP0048 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/project/ProjectDescription2-stderr.txt b/Tests/RunCMake/project/ProjectDescription2-stderr.txt index 558e2df..c65a997 100644 --- a/Tests/RunCMake/project/ProjectDescription2-stderr.txt +++ b/Tests/RunCMake/project/ProjectDescription2-stderr.txt @@ -1 +1 @@ - DESCRITPION may be specified at most once. + DESCRIPTION may be specified at most once. diff --git a/Tests/RunCMake/pseudo_cppcheck.c b/Tests/RunCMake/pseudo_cppcheck.c new file mode 100644 index 0000000..8667e5e --- /dev/null +++ b/Tests/RunCMake/pseudo_cppcheck.c @@ -0,0 +1,32 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +int main(int argc, char* argv[]) +{ + int i; + for (i = 1; i < argc; ++i) { + if (strcmp(argv[i], "-bad") == 0) + if (strcmp(argv[i], "-bad") == 0) { + fprintf(stdout, "stdout from bad command line arg '-bad'\n"); + fprintf(stderr, "stderr from bad command line arg '-bad'\n"); + return 1; + } + } + fprintf(stderr, + "[/foo/bar.c:2]: (error) Array 'abc[10]' accessed at index 12," + " which is out of bounds.\n"); + fprintf(stderr, "[/foo/bar.c:2]: (warning) Member variable 'foo::bar' is " + "not initialized in the constructor.\n"); + fprintf(stderr, "[/foo/bar.c:2]: (style) C-style pointer casting.\n"); + fprintf(stderr, "[/foo/bar.c:2]: (performance) Variable 'm_message' is " + "assigned in constructor body. Consider performing " + "initialization in initialization list.\n"); + fprintf(stderr, "[/foo/bar.c:2]: (portability) scanf without field width " + "limits can crash with huge input data on some versions of " + "libc\n"); + fprintf(stderr, "[/foo/bar.c:2]: (information) cannot find all the include " + "files (use --check-config for details)\n"); + // we allow this to return 1 as we ignore it + return 1; +} diff --git a/Tests/RunCMake/set_property/IMPORTED_GLOBAL-result.txt b/Tests/RunCMake/set_property/IMPORTED_GLOBAL-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/set_property/IMPORTED_GLOBAL-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/set_property/IMPORTED_GLOBAL-stderr.txt b/Tests/RunCMake/set_property/IMPORTED_GLOBAL-stderr.txt new file mode 100644 index 0000000..f21b1de --- /dev/null +++ b/Tests/RunCMake/set_property/IMPORTED_GLOBAL-stderr.txt @@ -0,0 +1,61 @@ +^CMake Error at IMPORTED_GLOBAL.cmake:9 \(set_property\): + IMPORTED_GLOBAL property can't be set to FALSE on targets + \(\"ImportedGlobalTarget\"\) + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at IMPORTED_GLOBAL.cmake:16 \(set_property\): + IMPORTED_GLOBAL property can't be appended, only set on imported targets + \(\"ImportedGlobalTarget\"\) + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at IMPORTED_GLOBAL.cmake:26 \(set_property\): + IMPORTED_GLOBAL property can't be set to FALSE on targets + \(\"ImportedLocalTarget\"\) + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at IMPORTED_GLOBAL.cmake:32 \(set_property\): + IMPORTED_GLOBAL property can't be set on non-imported targets + \(\"NonImportedTarget\"\) + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at IMPORTED_GLOBAL/CMakeLists.txt:8 \(set_property\): + Attempt to promote imported target \"ImportedLocalTarget2\" to global scope + \(by setting IMPORTED_GLOBAL\) which is not built in this directory. + + +CMake Error in IMPORTED_GLOBAL/CMakeLists.txt: + IMPORTED_GLOBAL property can't be set to FALSE on targets + \(\"ImportedSubdirTarget1\"\) + + + +CMake Error at IMPORTED_GLOBAL.cmake:50 \(set_property\): + Attempt to promote imported target \"ImportedSubdirTarget1\" to global scope + \(by setting IMPORTED_GLOBAL\) which is not built in this directory. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error in IMPORTED_GLOBAL/CMakeLists.txt: + IMPORTED_GLOBAL property can't be set to FALSE on targets + \(\"ImportedSubdirTarget2\"\) + + + +CMake Error at IMPORTED_GLOBAL.cmake:52 \(set_property\): + Attempt to promote imported target \"ImportedSubdirTarget2\" to global scope + \(by setting IMPORTED_GLOBAL\) which is not built in this directory. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/set_property/IMPORTED_GLOBAL-stdout.txt b/Tests/RunCMake/set_property/IMPORTED_GLOBAL-stdout.txt new file mode 100644 index 0000000..c5f1d11 --- /dev/null +++ b/Tests/RunCMake/set_property/IMPORTED_GLOBAL-stdout.txt @@ -0,0 +1,17 @@ +-- ImportedGlobalTarget: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedGlobalTarget: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedGlobalTarget: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedGlobalTarget: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedGlobalTarget: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedLocalTarget: Target IMPORTED_GLOBAL is 'FALSE' +-- ImportedLocalTarget: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedLocalTarget: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedLocalTarget: Target IMPORTED_GLOBAL is 'TRUE' +-- NonImportedTarget: Target IMPORTED_GLOBAL is 'FALSE' +-- NonImportedTarget: Target IMPORTED_GLOBAL is 'FALSE' +-- ImportedLocalTarget2: Target IMPORTED_GLOBAL is 'FALSE' +-- ImportedLocalTarget2: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedSubdirTarget1: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedSubdirTarget2: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedSubdirTarget1: Target IMPORTED_GLOBAL is 'TRUE' +-- ImportedSubdirTarget2: Target IMPORTED_GLOBAL is 'TRUE' diff --git a/Tests/RunCMake/set_property/IMPORTED_GLOBAL.cmake b/Tests/RunCMake/set_property/IMPORTED_GLOBAL.cmake new file mode 100644 index 0000000..08308eb --- /dev/null +++ b/Tests/RunCMake/set_property/IMPORTED_GLOBAL.cmake @@ -0,0 +1,53 @@ +macro(print_property TARGET PROP) + get_property(val TARGET ${TARGET} PROPERTY ${PROP}) + message(STATUS "${TARGET}: Target ${PROP} is '${val}'") +endmacro() + +# Changing property on IMPORTED target created with `GLOBAL` option. +add_library(ImportedGlobalTarget SHARED IMPORTED GLOBAL) +print_property(ImportedGlobalTarget IMPORTED_GLOBAL) +set_property(TARGET ImportedGlobalTarget PROPERTY IMPORTED_GLOBAL FALSE) +print_property(ImportedGlobalTarget IMPORTED_GLOBAL) +set_property(TARGET ImportedGlobalTarget PROPERTY IMPORTED_GLOBAL TRUE) +print_property(ImportedGlobalTarget IMPORTED_GLOBAL) +set_property(TARGET ImportedGlobalTarget PROPERTY IMPORTED_GLOBAL TRUE) +print_property(ImportedGlobalTarget IMPORTED_GLOBAL) +# Appending property is never allowed! +set_property(TARGET ImportedGlobalTarget APPEND PROPERTY IMPORTED_GLOBAL TRUE) +print_property(ImportedGlobalTarget IMPORTED_GLOBAL) + +# Changing property on IMPORTED target created without `GLOBAL` option. +add_library(ImportedLocalTarget SHARED IMPORTED) +print_property(ImportedLocalTarget IMPORTED_GLOBAL) +set_property(TARGET ImportedLocalTarget PROPERTY IMPORTED_GLOBAL TRUE) +print_property(ImportedLocalTarget IMPORTED_GLOBAL) +set_property(TARGET ImportedLocalTarget PROPERTY IMPORTED_GLOBAL TRUE) +print_property(ImportedLocalTarget IMPORTED_GLOBAL) +set_property(TARGET ImportedLocalTarget PROPERTY IMPORTED_GLOBAL FALSE) +print_property(ImportedLocalTarget IMPORTED_GLOBAL) + +# Setting property on non-IMPORTED target is never allowed! +add_library(NonImportedTarget SHARED test.cpp) +print_property(NonImportedTarget IMPORTED_GLOBAL) +set_property(TARGET NonImportedTarget PROPERTY IMPORTED_GLOBAL TRUE) +print_property(NonImportedTarget IMPORTED_GLOBAL) + +# Local IMPORTED targets can only be promoted from same directory! +add_library(ImportedLocalTarget2 SHARED IMPORTED) +print_property(ImportedLocalTarget2 IMPORTED_GLOBAL) +add_subdirectory(IMPORTED_GLOBAL) +# Note: The value should not have changed. However, it does change because the +# check for the same directory comes after it was changed! (At least, that is +# not really bad because the generation will fail due to this error.) +print_property(ImportedLocalTarget2 IMPORTED_GLOBAL) + +# Global IMPORTED targets from subdir are always visible +# no matter how they became global. +print_property(ImportedSubdirTarget1 IMPORTED_GLOBAL) +print_property(ImportedSubdirTarget2 IMPORTED_GLOBAL) + +# Changing property on IMPORTED target from subdir is never possible. +set_property(TARGET ImportedSubdirTarget1 PROPERTY IMPORTED_GLOBAL FALSE) +print_property(ImportedSubdirTarget1 IMPORTED_GLOBAL) +set_property(TARGET ImportedSubdirTarget2 PROPERTY IMPORTED_GLOBAL FALSE) +print_property(ImportedSubdirTarget2 IMPORTED_GLOBAL) diff --git a/Tests/RunCMake/set_property/IMPORTED_GLOBAL/CMakeLists.txt b/Tests/RunCMake/set_property/IMPORTED_GLOBAL/CMakeLists.txt new file mode 100644 index 0000000..468bf78 --- /dev/null +++ b/Tests/RunCMake/set_property/IMPORTED_GLOBAL/CMakeLists.txt @@ -0,0 +1,8 @@ +add_library(ImportedSubdirTarget1 SHARED IMPORTED GLOBAL) +add_library(ImportedSubdirTarget2 SHARED IMPORTED) + +# Extend visibility of ImportedSubdirTarget2 to global scope. +set_property(TARGET ImportedSubdirTarget2 PROPERTY IMPORTED_GLOBAL TRUE) + +# Only targets from the same directory can be promoted. +set_property(TARGET ImportedLocalTarget2 PROPERTY IMPORTED_GLOBAL TRUE) diff --git a/Tests/RunCMake/set_property/RunCMakeTest.cmake b/Tests/RunCMake/set_property/RunCMakeTest.cmake index 1ddacee..5b5327d 100644 --- a/Tests/RunCMake/set_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/set_property/RunCMakeTest.cmake @@ -3,6 +3,7 @@ include(RunCMake) run_cmake(COMPILE_DEFINITIONS) run_cmake(COMPILE_FEATURES) run_cmake(COMPILE_OPTIONS) +run_cmake(IMPORTED_GLOBAL) run_cmake(INCLUDE_DIRECTORIES) run_cmake(LINK_LIBRARIES) run_cmake(SOURCES) diff --git a/Tests/RunCMake/set_property/test.cpp b/Tests/RunCMake/set_property/test.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/set_property/test.cpp diff --git a/Tests/RunCMake/string/Prepend.cmake b/Tests/RunCMake/string/Prepend.cmake new file mode 100644 index 0000000..8eaeebb --- /dev/null +++ b/Tests/RunCMake/string/Prepend.cmake @@ -0,0 +1,58 @@ +set(out) +string(PREPEND out) +if(DEFINED out) + message(FATAL_ERROR "\"string(PREPEND out)\" set out to \"${out}\"") +endif() + +set(out "") +string(PREPEND out) +if(NOT out STREQUAL "") + message(FATAL_ERROR "\"string(PREPEND out)\" set out to \"${out}\"") +endif() + +set(out x) +string(PREPEND out) +if(NOT out STREQUAL "x") + message(FATAL_ERROR "\"string(PREPEND out)\" set out to \"${out}\"") +endif() + + +set(out) +string(PREPEND out a) +if(NOT out STREQUAL "a") + message(FATAL_ERROR "\"string(PREPEND out a)\" set out to \"${out}\"") +endif() + +set(out "") +string(PREPEND out a) +if(NOT out STREQUAL "a") + message(FATAL_ERROR "\"string(PREPEND out a)\" set out to \"${out}\"") +endif() + +set(out x) +string(PREPEND out a) +if(NOT out STREQUAL "ax") + message(FATAL_ERROR "\"string(PREPEND out a)\" set out to \"${out}\"") +endif() + + +set(out x) +string(PREPEND out a "b") +if(NOT out STREQUAL "abx") + message(FATAL_ERROR "\"string(PREPEND out a \"b\")\" set out to \"${out}\"") +endif() + +set(b) +set(out x) +string(PREPEND out ${b}) +if(NOT out STREQUAL "x") + message(FATAL_ERROR "\"string(PREPEND out \${b})\" set out to \"${out}\"") +endif() + +set(b b) +set(out x) +string(PREPEND out a "${b}" [[ +${c}]]) +if(NOT out STREQUAL "ab\${c}x") + message(FATAL_ERROR "\"string(PREPEND out a \"\${b}\" [[\${c}]])\" set out to \"${out}\"") +endif() diff --git a/Tests/RunCMake/string/PrependNoArgs-result.txt b/Tests/RunCMake/string/PrependNoArgs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/PrependNoArgs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/PrependNoArgs-stderr.txt b/Tests/RunCMake/string/PrependNoArgs-stderr.txt new file mode 100644 index 0000000..8d433f9 --- /dev/null +++ b/Tests/RunCMake/string/PrependNoArgs-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at PrependNoArgs.cmake:1 \(string\): + string sub-command PREPEND requires at least one argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/string/PrependNoArgs.cmake b/Tests/RunCMake/string/PrependNoArgs.cmake new file mode 100644 index 0000000..f324f28 --- /dev/null +++ b/Tests/RunCMake/string/PrependNoArgs.cmake @@ -0,0 +1 @@ +string(PREPEND) diff --git a/Tests/RunCMake/string/RunCMakeTest.cmake b/Tests/RunCMake/string/RunCMakeTest.cmake index 32b61b5..513d1e3 100644 --- a/Tests/RunCMake/string/RunCMakeTest.cmake +++ b/Tests/RunCMake/string/RunCMakeTest.cmake @@ -3,6 +3,9 @@ include(RunCMake) run_cmake(Append) run_cmake(AppendNoArgs) +run_cmake(Prepend) +run_cmake(PrependNoArgs) + run_cmake(Concat) run_cmake(ConcatNoArgs) diff --git a/Tests/RunCMake/string/Timestamp-stderr.txt b/Tests/RunCMake/string/Timestamp-stderr.txt index 653974c..cd4dcb3 100644 --- a/Tests/RunCMake/string/Timestamp-stderr.txt +++ b/Tests/RunCMake/string/Timestamp-stderr.txt @@ -1 +1 @@ -RESULT=2005-08-07 23:19:49 Sun Aug 05 day=219 wd=0 week=32 %I=11 epoch=1123456789 +RESULT=2005-08-07 23:19:49 Sunday=Sun August=Aug 05 day=219 wd=0 week=32 %I=11 epoch=1123456789 diff --git a/Tests/RunCMake/string/Timestamp.cmake b/Tests/RunCMake/string/Timestamp.cmake index d242039..cba258d 100644 --- a/Tests/RunCMake/string/Timestamp.cmake +++ b/Tests/RunCMake/string/Timestamp.cmake @@ -1,3 +1,3 @@ set(ENV{SOURCE_DATE_EPOCH} "1123456789") -string(TIMESTAMP RESULT "%Y-%m-%d %H:%M:%S %a %b %y day=%j wd=%w week=%U %%I=%I epoch=%s" UTC) +string(TIMESTAMP RESULT "%Y-%m-%d %H:%M:%S %A=%a %B=%b %y day=%j wd=%w week=%U %%I=%I epoch=%s" UTC) message("RESULT=${RESULT}") 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/MixedSignature-stderr.txt b/Tests/RunCMake/target_link_libraries/MixedSignature-stderr.txt index a0c66db..c6237f4 100644 --- a/Tests/RunCMake/target_link_libraries/MixedSignature-stderr.txt +++ b/Tests/RunCMake/target_link_libraries/MixedSignature-stderr.txt @@ -1,5 +1,5 @@ CMake Error at MixedSignature.cmake:6 \(target_link_libraries\): - The PUBLIC or PRIVATE option must appear as the second argument, just after - the target name. + The INTERFACE, PUBLIC or PRIVATE option must appear as the second argument, + just after the target name. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake index 1466fbf..97b0888 100644 --- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake @@ -4,9 +4,12 @@ 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) run_cmake(SharedDepNotTarget) run_cmake(StaticPrivateDepNotExported) run_cmake(StaticPrivateDepNotTarget) +run_cmake(UNKNOWN-IMPORTED-GLOBAL) diff --git a/Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake b/Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake new file mode 100644 index 0000000..f52fa30 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake @@ -0,0 +1,4 @@ +enable_language(C) +add_library(UnknownImportedGlobal UNKNOWN IMPORTED GLOBAL) +add_library(mylib empty.c) +target_link_libraries(mylib UnknownImportedGlobal) diff --git a/Tests/RunCMake/test_include_dirs/RunCMakeTest.cmake b/Tests/RunCMake/test_include_dirs/RunCMakeTest.cmake index d1633e4..72056ae 100644 --- a/Tests/RunCMake/test_include_dirs/RunCMakeTest.cmake +++ b/Tests/RunCMake/test_include_dirs/RunCMakeTest.cmake @@ -4,7 +4,7 @@ function(run_TID) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TID-build) set(RunCMake_TEST_NO_CLEAN 1) - if(RunCMake_GENERATOR MATCHES "Make|Ninja") + if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) endif() file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") diff --git a/Tests/RunCMake/variable_watch/ModifyWatchInCallback.cmake b/Tests/RunCMake/variable_watch/ModifyWatchInCallback.cmake new file mode 100644 index 0000000..1dee837 --- /dev/null +++ b/Tests/RunCMake/variable_watch/ModifyWatchInCallback.cmake @@ -0,0 +1,17 @@ +function (watch2) + +endfunction () + +function (watch1) + variable_watch(watched watch2) + variable_watch(watched watch2) + variable_watch(watched watch2) + variable_watch(watched watch2) + variable_watch(watched watch2) + variable_watch(watched watch2) +endfunction () + +variable_watch(watched watch1) +variable_watch(watched watch2) + +set(access "${watched}") diff --git a/Tests/RunCMake/variable_watch/RunCMakeTest.cmake b/Tests/RunCMake/variable_watch/RunCMakeTest.cmake index 9becb4c..2fa6275 100644 --- a/Tests/RunCMake/variable_watch/RunCMakeTest.cmake +++ b/Tests/RunCMake/variable_watch/RunCMakeTest.cmake @@ -3,3 +3,4 @@ include(RunCMake) run_cmake(ModifiedAccess) run_cmake(NoWatcher) run_cmake(WatchTwice) +run_cmake(ModifyWatchInCallback) |