diff options
Diffstat (limited to 'Tests/RunCMake')
420 files changed, 5519 insertions, 336 deletions
diff --git a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake index 01eac91..e4fdb4a 100644 --- a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake +++ b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake @@ -3,15 +3,15 @@ enable_language(C) add_custom_command( OUTPUT topcc.c - DEPFILE topcc.c.d - COMMAND ${CMAKE_COMMAND} -DOUTFILE=${CMAKE_CURRENT_BINARY_DIR}/topcc.c -DINFILE=topccdep.txt -DDEPFILE=topcc.c.d -P "${CMAKE_CURRENT_LIST_DIR}/WriteDepfile.cmake" + DEPFILE topcc_$<CONFIG>.c.d + COMMAND ${CMAKE_COMMAND} -DOUTFILE=${CMAKE_CURRENT_BINARY_DIR}/topcc.c -DINFILE=topccdep.txt -DDEPFILE=topcc_$<CONFIG>.c.d -P "${CMAKE_CURRENT_LIST_DIR}/WriteDepfile.cmake" ) add_custom_target(topcc ALL DEPENDS topcc.c) add_custom_command( OUTPUT topexe.c - DEPFILE ${CMAKE_CURRENT_BINARY_DIR}/topexe.c.d - COMMAND ${CMAKE_COMMAND} -DOUTFILE=topexe.c "-DINFILE=${CMAKE_CURRENT_BINARY_DIR}/topexedep.txt" -DDEPFILE=topexe.c.d -P "${CMAKE_CURRENT_LIST_DIR}/WriteDepfile.cmake" + DEPFILE ${CMAKE_CURRENT_BINARY_DIR}/topexe_$<CONFIG>.c.d + COMMAND ${CMAKE_COMMAND} -DOUTFILE=topexe.c "-DINFILE=${CMAKE_CURRENT_BINARY_DIR}/topexedep.txt" -DDEPFILE=topexe_$<CONFIG>.c.d -P "${CMAKE_CURRENT_LIST_DIR}/WriteDepfile.cmake" ) add_executable(topexe "${CMAKE_CURRENT_BINARY_DIR}/topexe.c") diff --git a/Tests/RunCMake/BuildDepends/CustomCommandUnityBuild.cmake b/Tests/RunCMake/BuildDepends/CustomCommandUnityBuild.cmake new file mode 100644 index 0000000..22e7f27 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/CustomCommandUnityBuild.cmake @@ -0,0 +1,19 @@ +enable_language(C) + +add_custom_command( + OUTPUT main.c + COMMAND ${CMAKE_COMMAND} -E copy main.c.in main.c + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/main.c.in + ) +add_executable(main main.c) +set_property(TARGET main PROPERTY UNITY_BUILD ON) + +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " +set(check_pairs + \"$<TARGET_FILE:main>|${CMAKE_CURRENT_BINARY_DIR}/main.c.in\" + \"$<TARGET_FILE:main>|${CMAKE_CURRENT_BINARY_DIR}/main.c\" + ) +set(check_exes + \"$<TARGET_FILE:main>\" + ) +") diff --git a/Tests/RunCMake/BuildDepends/CustomCommandUnityBuild.step1.cmake b/Tests/RunCMake/BuildDepends/CustomCommandUnityBuild.step1.cmake new file mode 100644 index 0000000..87576eb --- /dev/null +++ b/Tests/RunCMake/BuildDepends/CustomCommandUnityBuild.step1.cmake @@ -0,0 +1,3 @@ +file(WRITE "${RunCMake_TEST_BINARY_DIR}/main.c.in" [[ +int main(void) { return 1; } +]]) diff --git a/Tests/RunCMake/BuildDepends/CustomCommandUnityBuild.step2.cmake b/Tests/RunCMake/BuildDepends/CustomCommandUnityBuild.step2.cmake new file mode 100644 index 0000000..69b21b8 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/CustomCommandUnityBuild.step2.cmake @@ -0,0 +1,3 @@ +file(WRITE "${RunCMake_TEST_BINARY_DIR}/main.c.in" [[ +int main(void) { return 2; } +]]) diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index 6232634..0a80580 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -1,5 +1,22 @@ include(RunCMake) +if(RunCMake_GENERATOR MATCHES "Ninja") + # Detect ninja version so we know what tests can be supported. + execute_process( + COMMAND "${RunCMake_MAKE_PROGRAM}" --version + OUTPUT_VARIABLE ninja_out + ERROR_VARIABLE ninja_out + RESULT_VARIABLE ninja_res + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(ninja_res EQUAL 0 AND "x${ninja_out}" MATCHES "^x[0-9]+\\.[0-9]+") + set(ninja_version "${ninja_out}") + message(STATUS "ninja version: ${ninja_version}") + else() + message(FATAL_ERROR "'ninja --version' reported:\n${ninja_out}") + endif() +endif() + if(RunCMake_GENERATOR STREQUAL "Borland Makefiles" OR RunCMake_GENERATOR STREQUAL "Watcom WMake") set(fs_delay 3) @@ -155,7 +172,7 @@ if (RunCMake_GENERATOR MATCHES "Makefiles") run_cmake(CustomCommandDependencies-BadArgs) endif() -if(RunCMake_GENERATOR MATCHES "Make|Ninja") +if(RunCMake_GENERATOR MATCHES "Make|Ninja|Xcode") unset(run_BuildDepends_skip_step_3) run_BuildDepends(CustomCommandDepfile) set(run_BuildDepends_skip_step_3 1) @@ -164,3 +181,11 @@ endif() if(RunCMake_GENERATOR MATCHES "Make") run_BuildDepends(MakeDependencies) endif() + +if(RunCMake_GENERATOR MATCHES "^Visual Studio 9 " OR + (RunCMake_GENERATOR MATCHES "Ninja" AND ninja_version VERSION_LESS 1.7)) + # This build tool misses the dependency. + set(run_BuildDepends_skip_step_2 1) +endif() +run_BuildDepends(CustomCommandUnityBuild) +unset(run_BuildDepends_skip_step_2) diff --git a/Tests/RunCMake/BundleUtilities/CMP0080-COMMAND-OLD-stderr.txt b/Tests/RunCMake/BundleUtilities/CMP0080-COMMAND-OLD-stderr.txt new file mode 100644 index 0000000..31a0207 --- /dev/null +++ b/Tests/RunCMake/BundleUtilities/CMP0080-COMMAND-OLD-stderr.txt @@ -0,0 +1,9 @@ +^CMake Deprecation Warning at [^ +]*/Tests/RunCMake/BundleUtilities/CMP0080-COMMAND.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0080 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/BundleUtilities/CMP0080-OLD-stderr.txt b/Tests/RunCMake/BundleUtilities/CMP0080-OLD-stderr.txt new file mode 100644 index 0000000..2ff5d60 --- /dev/null +++ b/Tests/RunCMake/BundleUtilities/CMP0080-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0080-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0080 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:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMP0041/RunCMakeTest.cmake b/Tests/RunCMake/CMP0041/RunCMakeTest.cmake index e7f27a1..f47bb2e 100644 --- a/Tests/RunCMake/CMP0041/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0041/RunCMakeTest.cmake @@ -6,6 +6,10 @@ set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/NotDefa run_cmake(CMP0041-OLD) run_cmake(CMP0041-NEW) run_cmake(CMP0041-WARN) + +# Protect tests from running inside the default install prefix. +set(RunCMake_TEST_OPTIONS "--install-prefix ${RunCMake_BINARY_DIR}/NotDefaultPrefix") + run_cmake(CMP0041-tid-OLD) run_cmake(CMP0041-tid-NEW) run_cmake(CMP0041-tid-WARN) diff --git a/Tests/RunCMake/CMP0081/CMP0081-OLD-result.txt b/Tests/RunCMake/CMP0081/CMP0081-OLD-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/CMP0081/CMP0081-OLD-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CMP0081/CMP0081-OLD-stderr.txt b/Tests/RunCMake/CMP0081/CMP0081-OLD-stderr.txt new file mode 100644 index 0000000..ff339fa --- /dev/null +++ b/Tests/RunCMake/CMP0081/CMP0081-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0081-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0081 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:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-Common.cmake b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-Common.cmake new file mode 100644 index 0000000..5594be8 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-Common.cmake @@ -0,0 +1,8 @@ +set(listvar a b c d e) + +list(GET listvar + 18446744073709551616 # 2^64 + 2147483648 # 2^31 + 4294967296 # 2^32; errors out-of-range as -2147483643 due to underflow + out) +message("ERANGE: -->${out}<--") diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW-result.txt b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW-stderr.txt new file mode 100644 index 0000000..0166e14 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at CMP0121-ERANGE-Common.cmake:3 \(list\): + list index: 18446744073709551616 is not a valid index +Call Stack \(most recent call first\): + CMP0121-ERANGE-NEW.cmake:2 \(include\) + CMakeLists.txt:3 \(include\) + + +ERANGE: --><-- diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW.cmake b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW.cmake new file mode 100644 index 0000000..68e564d --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0121 NEW) +include(CMP0121-ERANGE-Common.cmake) diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD-result.txt b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD-stderr.txt new file mode 100644 index 0000000..5a03559 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at CMP0121-ERANGE-Common.cmake:3 \(list\): + list index: (-2147483643|2147483647) out of range \(-5, 4\) +Call Stack \(most recent call first\): + CMP0121-ERANGE-OLD.cmake:2 \(include\) + CMakeLists.txt:3 \(include\) + + +ERANGE: --><-- diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD.cmake b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD.cmake new file mode 100644 index 0000000..32f0b56 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0121 OLD) +include(CMP0121-ERANGE-Common.cmake) diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN-result.txt b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN-stderr.txt new file mode 100644 index 0000000..1e7b127 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN-stderr.txt @@ -0,0 +1,18 @@ +CMake Warning \(dev\) at CMP0121-ERANGE-Common.cmake:3 \(list\): + Policy CMP0121 is not set: The list\(\) command now validates parsing of + index arguments. Run "cmake --help-policy CMP0121" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + Invalid list index "18446744073709551616". +Call Stack \(most recent call first\): + CMP0121-ERANGE-WARN.cmake:2 \(include\) + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Error at CMP0121-ERANGE-Common.cmake:3 \(list\): + list index: (-2147483643|2147483647) out of range \(-5, 4\) +Call Stack \(most recent call first\): + CMP0121-ERANGE-WARN.cmake:2 \(include\) + CMakeLists.txt:3 \(include\) + + +ERANGE: --><-- diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN.cmake b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN.cmake new file mode 100644 index 0000000..9655290 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN.cmake @@ -0,0 +1,2 @@ + +include(CMP0121-ERANGE-Common.cmake) diff --git a/Tests/RunCMake/CMP0121/CMP0121-GET-Common.cmake b/Tests/RunCMake/CMP0121/CMP0121-GET-Common.cmake new file mode 100644 index 0000000..e4986f0 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-GET-Common.cmake @@ -0,0 +1,4 @@ +set(listvar a b c d e) + +list(GET listvar 0 2junk out) +message("GET: -->${out}<--") diff --git a/Tests/RunCMake/CMP0121/CMP0121-GET-NEW-result.txt b/Tests/RunCMake/CMP0121/CMP0121-GET-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-GET-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0121/CMP0121-GET-NEW-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-GET-NEW-stderr.txt new file mode 100644 index 0000000..d502b86 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-GET-NEW-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at CMP0121-GET-Common.cmake:3 \(list\): + list index: 2junk is not a valid index +Call Stack \(most recent call first\): + CMP0121-GET-NEW.cmake:2 \(include\) + CMakeLists.txt:3 \(include\) + + +GET: --><-- diff --git a/Tests/RunCMake/CMP0121/CMP0121-GET-NEW.cmake b/Tests/RunCMake/CMP0121/CMP0121-GET-NEW.cmake new file mode 100644 index 0000000..1ab054d --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-GET-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0121 NEW) +include(CMP0121-GET-Common.cmake) diff --git a/Tests/RunCMake/CMP0121/CMP0121-GET-OLD-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-GET-OLD-stderr.txt new file mode 100644 index 0000000..96375e9 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-GET-OLD-stderr.txt @@ -0,0 +1 @@ +GET: -->a;c<-- diff --git a/Tests/RunCMake/CMP0121/CMP0121-GET-OLD.cmake b/Tests/RunCMake/CMP0121/CMP0121-GET-OLD.cmake new file mode 100644 index 0000000..ef4526f --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-GET-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0121 OLD) +include(CMP0121-GET-Common.cmake) diff --git a/Tests/RunCMake/CMP0121/CMP0121-GET-WARN-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-GET-WARN-stderr.txt new file mode 100644 index 0000000..ecfad2c --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-GET-WARN-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) at CMP0121-GET-Common.cmake:3 \(list\): + Policy CMP0121 is not set: The list\(\) command now validates parsing of + index arguments. Run "cmake --help-policy CMP0121" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + Invalid list index "2junk". +Call Stack \(most recent call first\): + CMP0121-GET-WARN.cmake:2 \(include\) + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +GET: -->a;c<-- diff --git a/Tests/RunCMake/CMP0121/CMP0121-GET-WARN.cmake b/Tests/RunCMake/CMP0121/CMP0121-GET-WARN.cmake new file mode 100644 index 0000000..b08620b --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-GET-WARN.cmake @@ -0,0 +1,2 @@ + +include(CMP0121-GET-Common.cmake) diff --git a/Tests/RunCMake/CMP0121/CMP0121-INSERT-Common.cmake b/Tests/RunCMake/CMP0121/CMP0121-INSERT-Common.cmake new file mode 100644 index 0000000..4950881 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-INSERT-Common.cmake @@ -0,0 +1,4 @@ +set(listvar a b c d e) + +list(INSERT listvar junk2 new) +message("INSERT: -->${listvar}<--") diff --git a/Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW-result.txt b/Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW-stderr.txt new file mode 100644 index 0000000..2241962 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at CMP0121-INSERT-Common.cmake:3 \(list\): + list index: junk2 is not a valid index +Call Stack \(most recent call first\): + CMP0121-INSERT-NEW.cmake:2 \(include\) + CMakeLists.txt:3 \(include\) + + +INSERT: -->a;b;c;d;e<-- diff --git a/Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW.cmake b/Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW.cmake new file mode 100644 index 0000000..db627d1 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-INSERT-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0121 NEW) +include(CMP0121-INSERT-Common.cmake) diff --git a/Tests/RunCMake/CMP0121/CMP0121-INSERT-OLD-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-INSERT-OLD-stderr.txt new file mode 100644 index 0000000..52f34ad --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-INSERT-OLD-stderr.txt @@ -0,0 +1 @@ +INSERT: -->new;a;b;c;d;e<-- diff --git a/Tests/RunCMake/CMP0121/CMP0121-INSERT-OLD.cmake b/Tests/RunCMake/CMP0121/CMP0121-INSERT-OLD.cmake new file mode 100644 index 0000000..60364d7 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-INSERT-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0121 OLD) +include(CMP0121-INSERT-Common.cmake) diff --git a/Tests/RunCMake/CMP0121/CMP0121-INSERT-WARN-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-INSERT-WARN-stderr.txt new file mode 100644 index 0000000..5fa7d17 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-INSERT-WARN-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) at CMP0121-INSERT-Common.cmake:3 \(list\): + Policy CMP0121 is not set: The list\(\) command now validates parsing of + index arguments. Run "cmake --help-policy CMP0121" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + Invalid list index "junk2". +Call Stack \(most recent call first\): + CMP0121-INSERT-WARN.cmake:2 \(include\) + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +INSERT: -->new;a;b;c;d;e<-- diff --git a/Tests/RunCMake/CMP0121/CMP0121-INSERT-WARN.cmake b/Tests/RunCMake/CMP0121/CMP0121-INSERT-WARN.cmake new file mode 100644 index 0000000..55f13e2 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-INSERT-WARN.cmake @@ -0,0 +1,2 @@ + +include(CMP0121-INSERT-Common.cmake) diff --git a/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-Common.cmake b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-Common.cmake new file mode 100644 index 0000000..ec92387 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-Common.cmake @@ -0,0 +1,4 @@ +set(listvar a b c d e) + +list(REMOVE_AT listvar 0 invalid) +message("REMOVE_AT: -->${listvar}<--") diff --git a/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW-result.txt b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW-stderr.txt new file mode 100644 index 0000000..f17bafd --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at CMP0121-REMOVE_AT-Common.cmake:3 \(list\): + list index: invalid is not a valid index +Call Stack \(most recent call first\): + CMP0121-REMOVE_AT-NEW.cmake:2 \(include\) + CMakeLists.txt:3 \(include\) + + +REMOVE_AT: -->a;b;c;d;e<-- diff --git a/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW.cmake b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW.cmake new file mode 100644 index 0000000..d1f09e3 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0121 NEW) +include(CMP0121-REMOVE_AT-Common.cmake) diff --git a/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-OLD-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-OLD-stderr.txt new file mode 100644 index 0000000..09af1ae --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-OLD-stderr.txt @@ -0,0 +1 @@ +REMOVE_AT: -->b;c;d;e<-- diff --git a/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-OLD.cmake b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-OLD.cmake new file mode 100644 index 0000000..ac83226 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0121 OLD) +include(CMP0121-REMOVE_AT-Common.cmake) diff --git a/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-WARN-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-WARN-stderr.txt new file mode 100644 index 0000000..e2d47af --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-WARN-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) at CMP0121-REMOVE_AT-Common.cmake:3 \(list\): + Policy CMP0121 is not set: The list\(\) command now validates parsing of + index arguments. Run "cmake --help-policy CMP0121" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + Invalid list index "invalid". +Call Stack \(most recent call first\): + CMP0121-REMOVE_AT-WARN.cmake:2 \(include\) + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +REMOVE_AT: -->b;c;d;e<-- diff --git a/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-WARN.cmake b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-WARN.cmake new file mode 100644 index 0000000..2b4a824 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-REMOVE_AT-WARN.cmake @@ -0,0 +1,2 @@ + +include(CMP0121-REMOVE_AT-Common.cmake) diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-Common.cmake b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-Common.cmake new file mode 100644 index 0000000..93f46c5 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-Common.cmake @@ -0,0 +1,4 @@ +set(listvar a b c d e) + +list(SUBLIST listvar 0 invalid out) +message("SUBLIST-length: -->${out}<--") diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW-result.txt b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW-stderr.txt new file mode 100644 index 0000000..28bd362 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at CMP0121-SUBLIST-length-Common.cmake:3 \(list\): + list index: invalid is not a valid index +Call Stack \(most recent call first\): + CMP0121-SUBLIST-length-NEW.cmake:2 \(include\) + CMakeLists.txt:3 \(include\) + + +SUBLIST-length: --><-- diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW.cmake b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW.cmake new file mode 100644 index 0000000..c7875cb --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0121 NEW) +include(CMP0121-SUBLIST-length-Common.cmake) diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-OLD-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-OLD-stderr.txt new file mode 100644 index 0000000..00fcf07 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-OLD-stderr.txt @@ -0,0 +1 @@ +SUBLIST-length: --><-- diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-OLD.cmake b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-OLD.cmake new file mode 100644 index 0000000..e9b78ee --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0121 OLD) +include(CMP0121-SUBLIST-length-Common.cmake) diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-WARN-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-WARN-stderr.txt new file mode 100644 index 0000000..bd06c2f --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-WARN-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) at CMP0121-SUBLIST-length-Common.cmake:3 \(list\): + Policy CMP0121 is not set: The list\(\) command now validates parsing of + index arguments. Run "cmake --help-policy CMP0121" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + Invalid list index "invalid". +Call Stack \(most recent call first\): + CMP0121-SUBLIST-length-WARN.cmake:2 \(include\) + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +SUBLIST-length: --><-- diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-WARN.cmake b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-WARN.cmake new file mode 100644 index 0000000..27318bf --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-length-WARN.cmake @@ -0,0 +1,2 @@ + +include(CMP0121-SUBLIST-length-Common.cmake) diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-Common.cmake b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-Common.cmake new file mode 100644 index 0000000..33f57a3 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-Common.cmake @@ -0,0 +1,4 @@ +set(listvar a b c d e) + +list(SUBLIST listvar invalid 2 out) +message("SUBLIST-start: -->${out}<--") diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW-result.txt b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW-stderr.txt new file mode 100644 index 0000000..9819f95 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at CMP0121-SUBLIST-start-Common.cmake:3 \(list\): + list index: invalid is not a valid index +Call Stack \(most recent call first\): + CMP0121-SUBLIST-start-NEW.cmake:2 \(include\) + CMakeLists.txt:3 \(include\) + + +SUBLIST-start: --><-- diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW.cmake b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW.cmake new file mode 100644 index 0000000..3d676a3 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0121 NEW) +include(CMP0121-SUBLIST-start-Common.cmake) diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-OLD-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-OLD-stderr.txt new file mode 100644 index 0000000..8da2881 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-OLD-stderr.txt @@ -0,0 +1 @@ +SUBLIST-start: -->a;b<-- diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-OLD.cmake b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-OLD.cmake new file mode 100644 index 0000000..268f317 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0121 OLD) +include(CMP0121-SUBLIST-start-Common.cmake) diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-WARN-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-WARN-stderr.txt new file mode 100644 index 0000000..39d0e0e --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-WARN-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) at CMP0121-SUBLIST-start-Common.cmake:3 \(list\): + Policy CMP0121 is not set: The list\(\) command now validates parsing of + index arguments. Run "cmake --help-policy CMP0121" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + Invalid list index "invalid". +Call Stack \(most recent call first\): + CMP0121-SUBLIST-start-WARN.cmake:2 \(include\) + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +SUBLIST-start: -->a;b<-- diff --git a/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-WARN.cmake b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-WARN.cmake new file mode 100644 index 0000000..a407879 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMP0121-SUBLIST-start-WARN.cmake @@ -0,0 +1,2 @@ + +include(CMP0121-SUBLIST-start-Common.cmake) diff --git a/Tests/RunCMake/CMP0121/CMakeLists.txt b/Tests/RunCMake/CMP0121/CMakeLists.txt new file mode 100644 index 0000000..7cabeb6 --- /dev/null +++ b/Tests/RunCMake/CMP0121/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.20) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0121/RunCMakeTest.cmake b/Tests/RunCMake/CMP0121/RunCMakeTest.cmake new file mode 100644 index 0000000..1ed5b1a --- /dev/null +++ b/Tests/RunCMake/CMP0121/RunCMakeTest.cmake @@ -0,0 +1,7 @@ +include(RunCMake) + +foreach (subcommand IN ITEMS ERANGE GET INSERT REMOVE_AT SUBLIST-length SUBLIST-start) + run_cmake(CMP0121-${subcommand}-WARN) + run_cmake(CMP0121-${subcommand}-OLD) + run_cmake(CMP0121-${subcommand}-NEW) +endforeach () diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_file-Common.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_file-Common.cmake new file mode 100644 index 0000000..a85978b --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_file-Common.cmake @@ -0,0 +1,51 @@ + +find_file(RELATIVE_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_file(RELATIVE_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_file(ABSOLUTE_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_file(ABSOLUTE_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_file(NOTFOUND_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_file(NOTFOUND_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +file(WRITE "${CMAKE_BINARY_DIR}/${FILE_NAME}" "") +find_file(FILE_NAME NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_file(FILE_NAME_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +message("RELATIVE_PATH=${RELATIVE_PATH}") +message("RELATIVE_PATH_WITH_TYPE=${RELATIVE_PATH_WITH_TYPE}") + +message("ABSOLUTE_PATH=${ABSOLUTE_PATH}") +message("ABSOLUTE_PATH_WITH_TYPE=${ABSOLUTE_PATH_WITH_TYPE}") + +message("NOTFOUND_PATH=${NOTFOUND_PATH}") +message("NOTFOUND_PATH_WITH_TYPE=${NOTFOUND_PATH_WITH_TYPE}") + +message("FILE_NAME=${FILE_NAME}") +message("FILE_NAME_WITH_TYPE=${FILE_NAME_WITH_TYPE}") + + +set(RELATIVE_PATH_AND_LOCAL relative_local) +set(RELATIVE_PATH_WITH_TYPE_AND_LOCAL relative_local) +set(ABSOLUTE_PATH_AND_LOCAL /absolute_local) +set(ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL /absolute_local) +set(NOTFOUND_AND_LOCAL "${FILE_NAME}") +set(NOTFOUND_WITH_TYPE_AND_LOCAL "${FILE_NAME}") + +find_file(RELATIVE_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_file(RELATIVE_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_file(ABSOLUTE_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_file(ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_file(NOTFOUND_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_file(NOTFOUND_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +message("RELATIVE_PATH_AND_LOCAL=${RELATIVE_PATH_AND_LOCAL}") +message("RELATIVE_PATH_WITH_TYPE_AND_LOCAL=${RELATIVE_PATH_WITH_TYPE_AND_LOCAL}") + +message("ABSOLUTE_PATH_AND_LOCAL=${ABSOLUTE_PATH_AND_LOCAL}") +message("ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=${ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL}") + +message("NOTFOUND_PATH_AND_LOCAL=${NOTFOUND_PATH_AND_LOCAL}") +message("NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=${NOTFOUND_PATH_WITH_TYPE_AND_LOCAL}") diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_file-NEW-stderr.txt b/Tests/RunCMake/CMP0125/CMP0125-find_file-NEW-stderr.txt new file mode 100644 index 0000000..10f95bc --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_file-NEW-stderr.txt @@ -0,0 +1,14 @@ +RELATIVE_PATH=relative +RELATIVE_PATH_WITH_TYPE=relative +ABSOLUTE_PATH=/absolute +ABSOLUTE_PATH_WITH_TYPE=/absolute +NOTFOUND_PATH=/.+/CMP0125/file\.txt +NOTFOUND_PATH_WITH_TYPE=/.+/CMP0125/file\.txt +FILE_NAME=/.+/CMP0125/CMP0125-find_file-NEW-build/file2\.txt +FILE_NAME_WITH_TYPE=/.+/CMP0125/CMP0125-find_file-NEW-build/file2\.txt +RELATIVE_PATH_AND_LOCAL=relative_local +RELATIVE_PATH_WITH_TYPE_AND_LOCAL=relative_local +ABSOLUTE_PATH_AND_LOCAL=/absolute_local +ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=/absolute_local +NOTFOUND_PATH_AND_LOCAL=/.+/CMP0125/file.txt +NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=/.+/CMP0125/file.txt diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_file-NEW.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_file-NEW.cmake new file mode 100644 index 0000000..4f04834 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_file-NEW.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0125 NEW) + +include(CMP0125-find_file-Common.cmake) diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_file-OLD-stderr.txt b/Tests/RunCMake/CMP0125/CMP0125-find_file-OLD-stderr.txt new file mode 100644 index 0000000..5b25f92 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_file-OLD-stderr.txt @@ -0,0 +1,14 @@ +RELATIVE_PATH=/.+/CMP0125/CMP0125-find_file-OLD-build/relative +RELATIVE_PATH_WITH_TYPE=relative +ABSOLUTE_PATH=/absolute +ABSOLUTE_PATH_WITH_TYPE=/absolute +NOTFOUND_PATH=NOTFOUND +NOTFOUND_PATH_WITH_TYPE=/.+/CMP0125/file\.txt +FILE_NAME=/.+/CMP0125/CMP0125-find_file-OLD-build/file2\.txt +FILE_NAME_WITH_TYPE=file2\.txt +RELATIVE_PATH_AND_LOCAL=/.+/CMP0125/CMP0125-find_file-OLD-build/relative +RELATIVE_PATH_WITH_TYPE_AND_LOCAL=relative_local +ABSOLUTE_PATH_AND_LOCAL=/absolute +ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=/absolute_local +NOTFOUND_PATH_AND_LOCAL=NOTFOUND +NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=/.+/CMP0125/file\.txt diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_file-OLD.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_file-OLD.cmake new file mode 100644 index 0000000..21884b5 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_file-OLD.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0125 OLD) + +include(CMP0125-find_file-Common.cmake) diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_library-Common.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_library-Common.cmake new file mode 100644 index 0000000..d2bc006 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_library-Common.cmake @@ -0,0 +1,52 @@ + +find_library(RELATIVE_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_library(RELATIVE_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_library(ABSOLUTE_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_library(ABSOLUTE_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_library(NOTFOUND_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_library(NOTFOUND_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +file(WRITE "${CMAKE_BINARY_DIR}/${FILE_NAME}" "") +file(CHMOD "${CMAKE_BINARY_DIR}/${FILE_NAME}" PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE) +find_library(FILE_NAME NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_library(FILE_NAME_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +message("RELATIVE_PATH=${RELATIVE_PATH}") +message("RELATIVE_PATH_WITH_TYPE=${RELATIVE_PATH_WITH_TYPE}") + +message("ABSOLUTE_PATH=${ABSOLUTE_PATH}") +message("ABSOLUTE_PATH_WITH_TYPE=${ABSOLUTE_PATH_WITH_TYPE}") + +message("NOTFOUND_PATH=${NOTFOUND_PATH}") +message("NOTFOUND_PATH_WITH_TYPE=${NOTFOUND_PATH_WITH_TYPE}") + +message("FILE_NAME=${FILE_NAME}") +message("FILE_NAME_WITH_TYPE=${FILE_NAME_WITH_TYPE}") + + +set(RELATIVE_PATH_AND_LOCAL relative_local) +set(RELATIVE_PATH_WITH_TYPE_AND_LOCAL relative_local) +set(ABSOLUTE_PATH_AND_LOCAL /absolute_local) +set(ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL /absolute_local) +set(NOTFOUND_AND_LOCAL "${FILE_NAME}") +set(NOTFOUND_WITH_TYPE_AND_LOCAL "${FILE_NAME}") + +find_library(RELATIVE_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_library(RELATIVE_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_library(ABSOLUTE_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_library(ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_library(NOTFOUND_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_library(NOTFOUND_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +message("RELATIVE_PATH_AND_LOCAL=${RELATIVE_PATH_AND_LOCAL}") +message("RELATIVE_PATH_WITH_TYPE_AND_LOCAL=${RELATIVE_PATH_WITH_TYPE_AND_LOCAL}") + +message("ABSOLUTE_PATH_AND_LOCAL=${ABSOLUTE_PATH_AND_LOCAL}") +message("ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=${ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL}") + +message("NOTFOUND_PATH_AND_LOCAL=${NOTFOUND_PATH_AND_LOCAL}") +message("NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=${NOTFOUND_PATH_WITH_TYPE_AND_LOCAL}") diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_library-NEW-stderr.txt b/Tests/RunCMake/CMP0125/CMP0125-find_library-NEW-stderr.txt new file mode 100644 index 0000000..d180833 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_library-NEW-stderr.txt @@ -0,0 +1,14 @@ +RELATIVE_PATH=relative +RELATIVE_PATH_WITH_TYPE=relative +ABSOLUTE_PATH=/absolute +ABSOLUTE_PATH_WITH_TYPE=/absolute +NOTFOUND_PATH=/.+/CMP0125/libfile\.(so|dylib) +NOTFOUND_PATH_WITH_TYPE=/.+/CMP0125/libfile\.(so|dylib) +FILE_NAME=/.+/CMP0125/CMP0125-find_library-NEW-build/libfile2\.(so|dylib) +FILE_NAME_WITH_TYPE=/.+/CMP0125/CMP0125-find_library-NEW-build/libfile2\.(so|dylib) +RELATIVE_PATH_AND_LOCAL=relative_local +RELATIVE_PATH_WITH_TYPE_AND_LOCAL=relative_local +ABSOLUTE_PATH_AND_LOCAL=/absolute_local +ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=/absolute_local +NOTFOUND_PATH_AND_LOCAL=/.+/CMP0125/libfile.(so|dylib) +NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=/.+/CMP0125/libfile.(so|dylib) diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_library-NEW.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_library-NEW.cmake new file mode 100644 index 0000000..31f5441 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_library-NEW.cmake @@ -0,0 +1,6 @@ + +cmake_policy(SET CMP0125 NEW) + +enable_language(C) + +include(CMP0125-find_library-Common.cmake) diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_library-OLD-stderr.txt b/Tests/RunCMake/CMP0125/CMP0125-find_library-OLD-stderr.txt new file mode 100644 index 0000000..cd3af56 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_library-OLD-stderr.txt @@ -0,0 +1,14 @@ +RELATIVE_PATH=/.+/CMP0125/CMP0125-find_library-OLD-build/relative +RELATIVE_PATH_WITH_TYPE=relative +ABSOLUTE_PATH=/absolute +ABSOLUTE_PATH_WITH_TYPE=/absolute +NOTFOUND_PATH=NOTFOUND +NOTFOUND_PATH_WITH_TYPE=/.+/CMP0125/libfile\.(so|dylib) +FILE_NAME=/.+/CMP0125/CMP0125-find_library-OLD-build/libfile2\.(so|dylib) +FILE_NAME_WITH_TYPE=libfile2\.(so|dylib) +RELATIVE_PATH_AND_LOCAL=relative_local +RELATIVE_PATH_WITH_TYPE_AND_LOCAL=relative_local +ABSOLUTE_PATH_AND_LOCAL=/absolute_local +ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=/absolute_local +NOTFOUND_PATH_AND_LOCAL=/.+/CMP0125/libfile\.(so|dylib) +NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=/.+/CMP0125/libfile\.(so|dylib) diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_library-OLD.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_library-OLD.cmake new file mode 100644 index 0000000..1dc4a95 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_library-OLD.cmake @@ -0,0 +1,6 @@ + +cmake_policy(SET CMP0125 OLD) + +enable_language(C) + +include(CMP0125-find_library-Common.cmake) diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_path-Common.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_path-Common.cmake new file mode 100644 index 0000000..37680c2 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_path-Common.cmake @@ -0,0 +1,51 @@ + +find_path(RELATIVE_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_path(RELATIVE_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_path(ABSOLUTE_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_path(ABSOLUTE_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_path(NOTFOUND_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_path(NOTFOUND_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +file(WRITE "${CMAKE_BINARY_DIR}/${FILE_NAME}" "") +find_path(FILE_NAME NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_path(FILE_NAME_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +message("RELATIVE_PATH=${RELATIVE_PATH}") +message("RELATIVE_PATH_WITH_TYPE=${RELATIVE_PATH_WITH_TYPE}") + +message("ABSOLUTE_PATH=${ABSOLUTE_PATH}") +message("ABSOLUTE_PATH_WITH_TYPE=${ABSOLUTE_PATH_WITH_TYPE}") + +message("NOTFOUND_PATH=${NOTFOUND_PATH}") +message("NOTFOUND_PATH_WITH_TYPE=${NOTFOUND_PATH_WITH_TYPE}") + +message("FILE_NAME=${FILE_NAME}") +message("FILE_NAME_WITH_TYPE=${FILE_NAME_WITH_TYPE}") + + +set(RELATIVE_PATH_AND_LOCAL relative_local) +set(RELATIVE_PATH_WITH_TYPE_AND_LOCAL relative_local) +set(ABSOLUTE_PATH_AND_LOCAL /absolute_local) +set(ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL /absolute_local) +set(NOTFOUND_AND_LOCAL "${FILE_NAME}") +set(NOTFOUND_WITH_TYPE_AND_LOCAL "${FILE_NAME}") + +find_path(RELATIVE_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_path(RELATIVE_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_path(ABSOLUTE_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_path(ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_path(NOTFOUND_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_path(NOTFOUND_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +message("RELATIVE_PATH_AND_LOCAL=${RELATIVE_PATH_AND_LOCAL}") +message("RELATIVE_PATH_WITH_TYPE_AND_LOCAL=${RELATIVE_PATH_WITH_TYPE_AND_LOCAL}") + +message("ABSOLUTE_PATH_AND_LOCAL=${ABSOLUTE_PATH_AND_LOCAL}") +message("ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=${ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL}") + +message("NOTFOUND_PATH_AND_LOCAL=${NOTFOUND_PATH_AND_LOCAL}") +message("NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=${NOTFOUND_PATH_WITH_TYPE_AND_LOCAL}") diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_path-NEW-stderr.txt b/Tests/RunCMake/CMP0125/CMP0125-find_path-NEW-stderr.txt new file mode 100644 index 0000000..c3f0208 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_path-NEW-stderr.txt @@ -0,0 +1,14 @@ +RELATIVE_PATH=relative +RELATIVE_PATH_WITH_TYPE=relative +ABSOLUTE_PATH=/absolute +ABSOLUTE_PATH_WITH_TYPE=/absolute +NOTFOUND_PATH=/.+/CMP0125 +NOTFOUND_PATH_WITH_TYPE=/.+/CMP0125 +FILE_NAME=/.+/CMP0125/CMP0125-find_path-NEW-build/file2\.txt +FILE_NAME_WITH_TYPE=/.+/CMP0125/CMP0125-find_path-NEW-build/file2\.txt +RELATIVE_PATH_AND_LOCAL=relative_local +RELATIVE_PATH_WITH_TYPE_AND_LOCAL=relative_local +ABSOLUTE_PATH_AND_LOCAL=/absolute_local +ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=/absolute_local +NOTFOUND_PATH_AND_LOCAL=/.+/CMP0125 +NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=/.+/CMP0125 diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_path-NEW.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_path-NEW.cmake new file mode 100644 index 0000000..d6a8544 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_path-NEW.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0125 NEW) + +include(CMP0125-find_path-Common.cmake) diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_path-OLD-stderr.txt b/Tests/RunCMake/CMP0125/CMP0125-find_path-OLD-stderr.txt new file mode 100644 index 0000000..b84c869 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_path-OLD-stderr.txt @@ -0,0 +1,14 @@ +RELATIVE_PATH=/.+/CMP0125/CMP0125-find_path-OLD-build/relative +RELATIVE_PATH_WITH_TYPE=relative +ABSOLUTE_PATH=/absolute +ABSOLUTE_PATH_WITH_TYPE=/absolute +NOTFOUND_PATH=NOTFOUND +NOTFOUND_PATH_WITH_TYPE=/.+/CMP0125 +FILE_NAME=/.+/CMP0125/CMP0125-find_path-OLD-build/file2\.txt +FILE_NAME_WITH_TYPE=file2\.txt +RELATIVE_PATH_AND_LOCAL=/.+/CMP0125/CMP0125-find_path-OLD-build/relative +RELATIVE_PATH_WITH_TYPE_AND_LOCAL=relative_local +ABSOLUTE_PATH_AND_LOCAL=/absolute +ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=/absolute_local +NOTFOUND_PATH_AND_LOCAL=NOTFOUND +NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=/.+/CMP0125 diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_path-OLD.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_path-OLD.cmake new file mode 100644 index 0000000..2e98ded --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_path-OLD.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0125 OLD) + +include(CMP0125-find_path-Common.cmake) diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_program-Common.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_program-Common.cmake new file mode 100644 index 0000000..fee4c34 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_program-Common.cmake @@ -0,0 +1,52 @@ + +find_program(RELATIVE_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_program(RELATIVE_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_program(ABSOLUTE_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_program(ABSOLUTE_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_program(NOTFOUND_PATH NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_program(NOTFOUND_PATH_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +file(WRITE "${CMAKE_BINARY_DIR}/${FILE_NAME}" "") +file(CHMOD "${CMAKE_BINARY_DIR}/${FILE_NAME}" PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE) +find_program(FILE_NAME NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_program(FILE_NAME_WITH_TYPE NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +message("RELATIVE_PATH=${RELATIVE_PATH}") +message("RELATIVE_PATH_WITH_TYPE=${RELATIVE_PATH_WITH_TYPE}") + +message("ABSOLUTE_PATH=${ABSOLUTE_PATH}") +message("ABSOLUTE_PATH_WITH_TYPE=${ABSOLUTE_PATH_WITH_TYPE}") + +message("NOTFOUND_PATH=${NOTFOUND_PATH}") +message("NOTFOUND_PATH_WITH_TYPE=${NOTFOUND_PATH_WITH_TYPE}") + +message("FILE_NAME=${FILE_NAME}") +message("FILE_NAME_WITH_TYPE=${FILE_NAME_WITH_TYPE}") + + +set(RELATIVE_PATH_AND_LOCAL relative_local) +set(RELATIVE_PATH_WITH_TYPE_AND_LOCAL relative_local) +set(ABSOLUTE_PATH_AND_LOCAL /absolute_local) +set(ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL /absolute_local) +set(NOTFOUND_AND_LOCAL "${FILE_NAME}") +set(NOTFOUND_WITH_TYPE_AND_LOCAL "${FILE_NAME}") + +find_program(RELATIVE_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_program(RELATIVE_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_program(ABSOLUTE_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_program(ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +find_program(NOTFOUND_PATH_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) +find_program(NOTFOUND_PATH_WITH_TYPE_AND_LOCAL NAMES ${SEARCH_NAME} PATHS ${SEARCH_PATH}) + +message("RELATIVE_PATH_AND_LOCAL=${RELATIVE_PATH_AND_LOCAL}") +message("RELATIVE_PATH_WITH_TYPE_AND_LOCAL=${RELATIVE_PATH_WITH_TYPE_AND_LOCAL}") + +message("ABSOLUTE_PATH_AND_LOCAL=${ABSOLUTE_PATH_AND_LOCAL}") +message("ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=${ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL}") + +message("NOTFOUND_PATH_AND_LOCAL=${NOTFOUND_PATH_AND_LOCAL}") +message("NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=${NOTFOUND_PATH_WITH_TYPE_AND_LOCAL}") diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_program-NEW-stderr.txt b/Tests/RunCMake/CMP0125/CMP0125-find_program-NEW-stderr.txt new file mode 100644 index 0000000..62da5bf --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_program-NEW-stderr.txt @@ -0,0 +1,14 @@ +RELATIVE_PATH=relative +RELATIVE_PATH_WITH_TYPE=relative +ABSOLUTE_PATH=/absolute +ABSOLUTE_PATH_WITH_TYPE=/absolute +NOTFOUND_PATH=/.+/CMP0125/file\.txt +NOTFOUND_PATH_WITH_TYPE=/.+/CMP0125/file\.txt +FILE_NAME=/.+/CMP0125/CMP0125-find_program-NEW-build/file2\.txt +FILE_NAME_WITH_TYPE=/.+/CMP0125/CMP0125-find_program-NEW-build/file2\.txt +RELATIVE_PATH_AND_LOCAL=relative_local +RELATIVE_PATH_WITH_TYPE_AND_LOCAL=relative_local +ABSOLUTE_PATH_AND_LOCAL=/absolute_local +ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=/absolute_local +NOTFOUND_PATH_AND_LOCAL=/.+/CMP0125/file.txt +NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=/.+/CMP0125/file.txt diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_program-NEW.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_program-NEW.cmake new file mode 100644 index 0000000..c02f23b --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_program-NEW.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0125 NEW) + +include(CMP0125-find_program-Common.cmake) diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_program-OLD-stderr.txt b/Tests/RunCMake/CMP0125/CMP0125-find_program-OLD-stderr.txt new file mode 100644 index 0000000..a97fc07 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_program-OLD-stderr.txt @@ -0,0 +1,14 @@ +RELATIVE_PATH=/.+/CMP0125/CMP0125-find_program-OLD-build/relative +RELATIVE_PATH_WITH_TYPE=relative +ABSOLUTE_PATH=/absolute +ABSOLUTE_PATH_WITH_TYPE=/absolute +NOTFOUND_PATH=NOTFOUND +NOTFOUND_PATH_WITH_TYPE=/.+/CMP0125/file\.txt +FILE_NAME=/.+/CMP0125/CMP0125-find_program-OLD-build/file2\.txt +FILE_NAME_WITH_TYPE=file2\.txt +RELATIVE_PATH_AND_LOCAL=/.+/CMP0125/CMP0125-find_program-OLD-build/relative +RELATIVE_PATH_WITH_TYPE_AND_LOCAL=relative_local +ABSOLUTE_PATH_AND_LOCAL=/absolute +ABSOLUTE_PATH_WITH_TYPE_AND_LOCAL=/absolute_local +NOTFOUND_PATH_AND_LOCAL=NOTFOUND +NOTFOUND_PATH_WITH_TYPE_AND_LOCAL=/.+/CMP0125/file.txt diff --git a/Tests/RunCMake/CMP0125/CMP0125-find_program-OLD.cmake b/Tests/RunCMake/CMP0125/CMP0125-find_program-OLD.cmake new file mode 100644 index 0000000..6be8534 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMP0125-find_program-OLD.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0125 OLD) + +include(CMP0125-find_program-Common.cmake) diff --git a/Tests/RunCMake/CMP0125/CMakeLists.txt b/Tests/RunCMake/CMP0125/CMakeLists.txt new file mode 100644 index 0000000..7cabeb6 --- /dev/null +++ b/Tests/RunCMake/CMP0125/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.20) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0125/RunCMakeTest.cmake b/Tests/RunCMake/CMP0125/RunCMakeTest.cmake new file mode 100644 index 0000000..56d4c86 --- /dev/null +++ b/Tests/RunCMake/CMP0125/RunCMakeTest.cmake @@ -0,0 +1,36 @@ +include(RunCMake) + +file(WRITE "${RunCMake_BINARY_DIR}/file.txt" "") +file(CHMOD "${RunCMake_BINARY_DIR}/file.txt" PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE) + +set(options -DRELATIVE_PATH=relative -DABSOLUTE_PATH=/absolute + -DRELATIVE_PATH_WITH_TYPE:PATH=relative -DABSOLUTE_PATH_WITH_TYPE:PATH=/absolute + -DNOTFOUND_PATH=NOTFOUND -DNOTFOUND_PATH_WITH_TYPE:PATH=NOTFOUND + -DFILE_NAME=file2.txt -DFILE_NAME_WITH_TYPE:PATH=file2.txt + -DSEARCH_NAME=file.txt "-DSEARCH_PATH=${RunCMake_BINARY_DIR}" + -DRELATIVE_PATH_AND_LOCAL=relative -DABSOLUTE_PATH_AND_LOCAL=/absolute + -DRELATIVE_PATH_WITH_TYPE_AND_LOCAL:PATH=relative -DABSOLUTE_PATH_WITH_TYPE_AND_LOCAL:PATH=/absolute + -DNOTFOUND_PATH_AND_LOCAL=NOTFOUND -DNOTFOUND_PATH_WITH_TYPE_AND_LOCAL:PATH=NOTFOUND + -DFILE_NAME=file2.txt -DFILE_NAME_WITH_TYPE:PATH=file2.txt + -DSEARCH_NAME=file.txt "-DSEARCH_PATH=${RunCMake_BINARY_DIR}") + +run_cmake_with_options(CMP0125-find_file-OLD ${options}) +run_cmake_with_options(CMP0125-find_file-NEW ${options}) +run_cmake_with_options(CMP0125-find_path-OLD ${options}) +run_cmake_with_options(CMP0125-find_path-NEW ${options}) +run_cmake_with_options(CMP0125-find_program-OLD ${options}) +run_cmake_with_options(CMP0125-find_program-NEW ${options}) + + +file(WRITE "${RunCMake_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}file${CMAKE_SHARED_LIBRARY_SUFFIX}" "") +file(CHMOD "${RunCMake_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}file${CMAKE_SHARED_LIBRARY_SUFFIX}" PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE) + +set(options -DRELATIVE_PATH=relative -DABSOLUTE_PATH=/absolute + -DRELATIVE_PATH_WITH_TYPE:PATH=relative -DABSOLUTE_PATH_WITH_TYPE:PATH=/absolute + -DNOTFOUND_PATH=NOTFOUND -DNOTFOUND_PATH_WITH_TYPE:PATH=NOTFOUND + -DFILE_NAME=${CMAKE_SHARED_LIBRARY_PREFIX}file2${CMAKE_SHARED_LIBRARY_SUFFIX} + -DFILE_NAME_WITH_TYPE:PATH=${CMAKE_SHARED_LIBRARY_PREFIX}file2${CMAKE_SHARED_LIBRARY_SUFFIX} + -DSEARCH_NAME=file "-DSEARCH_PATH=${RunCMake_BINARY_DIR}") + +run_cmake_with_options(CMP0125-find_library-OLD ${options}) +run_cmake_with_options(CMP0125-find_library-NEW ${options}) diff --git a/Tests/RunCMake/CMP0126/CMP0126-NEW.cmake b/Tests/RunCMake/CMP0126/CMP0126-NEW.cmake new file mode 100644 index 0000000..2f8562b --- /dev/null +++ b/Tests/RunCMake/CMP0126/CMP0126-NEW.cmake @@ -0,0 +1,28 @@ + +# enforce policy CMP0125 to ensure predictable result of find_* commands +cmake_policy(SET CMP0125 NEW) + +cmake_policy(SET CMP0126 NEW) + +set(VAR 1) +set(VAR 2 CACHE STRING "") + +if (NOT VAR EQUAL 1) + message(FATAL_ERROR "normal variable does not exist anymore.") +endif() + + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/file.txt" "") +set(VAR file.txt) +set(VAR "" CACHE STRING "" FORCE) +set_property(CACHE VAR PROPERTY TYPE UNINITIALIZED) + +find_file(VAR NAMES file.txt PATHS "${CMAKE_CURRENT_BINARY_DIR}") + +unset(VAR CACHE) +if (NOT DEFINED VAR) + message(FATAL_ERROR "find_file: normal variable does not exist anymore.") +endif() +if (NOT VAR STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/file.txt") + message(FATAL_ERROR "find_file: failed to set normal variable.") +endif() diff --git a/Tests/RunCMake/CMP0126/CMP0126-NEW_CL.cmake b/Tests/RunCMake/CMP0126/CMP0126-NEW_CL.cmake new file mode 100644 index 0000000..cfaa1e3 --- /dev/null +++ b/Tests/RunCMake/CMP0126/CMP0126-NEW_CL.cmake @@ -0,0 +1,9 @@ + +cmake_policy(SET CMP0126 NEW) + +set(VAR 1) +set(VAR 2 CACHE STRING "") + +if (NOT VAR EQUAL 1) + message(FATAL_ERROR "normal variable does not exist anymore.") +endif() diff --git a/Tests/RunCMake/CMP0126/CMP0126-OLD.cmake b/Tests/RunCMake/CMP0126/CMP0126-OLD.cmake new file mode 100644 index 0000000..22a5037 --- /dev/null +++ b/Tests/RunCMake/CMP0126/CMP0126-OLD.cmake @@ -0,0 +1,25 @@ + +# enforce policy CMP0125 to ensure predictable result of find_* commands +cmake_policy(SET CMP0125 NEW) + +cmake_policy(SET CMP0126 OLD) + +set(VAR 1) +set(VAR 2 CACHE STRING "") + +if (VAR EQUAL 1) + message(FATAL_ERROR "normal variable still exist.") +endif() + + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/file.txt" "") +set(VAR file.txt) +set(VAR "" CACHE STRING "" FORCE) +set_property(CACHE VAR PROPERTY TYPE UNINITIALIZED) + +find_file(VAR NAMES file.txt PATHS "${CMAKE_CURRENT_BINARY_DIR}") + +unset(VAR CACHE) +if (DEFINED VAR) + message(FATAL_ERROR "find_file: normal variable still exist.") +endif() diff --git a/Tests/RunCMake/CMP0126/CMP0126-OLD_CL.cmake b/Tests/RunCMake/CMP0126/CMP0126-OLD_CL.cmake new file mode 100644 index 0000000..5d72a87 --- /dev/null +++ b/Tests/RunCMake/CMP0126/CMP0126-OLD_CL.cmake @@ -0,0 +1,9 @@ + +cmake_policy(SET CMP0126 OLD) + +set(VAR 1) +set(VAR 2 CACHE STRING "") + +if (NOT VAR EQUAL 3) + message(FATAL_ERROR "normal variable still exist.") +endif() diff --git a/Tests/RunCMake/CMP0126/CMakeLists.txt b/Tests/RunCMake/CMP0126/CMakeLists.txt new file mode 100644 index 0000000..7cabeb6 --- /dev/null +++ b/Tests/RunCMake/CMP0126/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.20) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0126/RunCMakeTest.cmake b/Tests/RunCMake/CMP0126/RunCMakeTest.cmake new file mode 100644 index 0000000..ae988f4 --- /dev/null +++ b/Tests/RunCMake/CMP0126/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +run_cmake(CMP0126-OLD) +run_cmake_with_options(CMP0126-OLD_CL -DVAR=3) +run_cmake(CMP0126-NEW) +run_cmake_with_options(CMP0126-NEW_CL -DVAR=3) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 78e0b6a..14a7fa3 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -29,6 +29,10 @@ macro(add_RunCMake_test test) ${TEST_ARGS} -P "${CMAKE_CURRENT_SOURCE_DIR}/${Test_Dir}/RunCMakeTest.cmake" ) + set_tests_properties("RunCMake.${test}" PROPERTIES LABELS "CMake;run") + if(${test} MATCHES ^CMP) + set_property(TEST "RunCMake.${test}" APPEND PROPERTY LABELS "policy") + endif() endmacro() function(add_RunCMake_test_group test types) @@ -131,6 +135,12 @@ if(CMAKE_GENERATOR MATCHES "Ninja") endif() add_RunCMake_test(CMP0118) add_RunCMake_test(CMP0119 -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) +add_RunCMake_test(CMP0121) +if (CMAKE_SYSTEM_NAME MATCHES "(Linux|Darwin)") + add_RunCMake_test(CMP0125 -DCMAKE_SHARED_LIBRARY_PREFIX=${CMAKE_SHARED_LIBRARY_PREFIX} + -DCMAKE_SHARED_LIBRARY_SUFFIX=${CMAKE_SHARED_LIBRARY_SUFFIX}) +endif() +add_RunCMake_test(CMP0126) # The test for Policy 65 requires the use of the # CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode @@ -160,7 +170,7 @@ if(CMAKE_GENERATOR MATCHES "Ninja") endif() add_RunCMake_test(Ninja) set(NinjaMultiConfig_ARGS - -DCYGWIN=${CYGWIN} + -DCYGWIN=${CYGWIN} -DMSYS=${MSYS} ) if(CMake_TEST_Qt5 AND Qt5Core_FOUND) list(APPEND NinjaMultiConfig_ARGS -DCMake_TEST_Qt5=1 -DQt5Core_DIR=${Qt5Core_DIR} -DCMAKE_TEST_Qt5Core_Version=${Qt5Core_VERSION}) @@ -262,6 +272,7 @@ add_RunCMake_test(GenEx-HOST_LINK) add_RunCMake_test(GenEx-DEVICE_LINK) add_RunCMake_test(GenEx-TARGET_FILE -DLINKER_SUPPORTS_PDB=${LINKER_SUPPORTS_PDB}) add_RunCMake_test(GenEx-GENEX_EVAL) +add_RunCMake_test(GenEx-TARGET_RUNTIME_DLLS) add_RunCMake_test(GeneratorExpression) add_RunCMake_test(GeneratorInstance) add_RunCMake_test(GeneratorPlatform) @@ -276,7 +287,7 @@ add_RunCMake_test(Graphviz) add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) add_RunCMake_test(LinkStatic) -if(CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang)$") +if(CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|Fujitsu|FujitsuClang)$") add_RunCMake_test(MetaCompileFeatures) endif() if(MSVC) @@ -340,7 +351,7 @@ add_RunCMake_test(export) add_RunCMake_test(cmake_language) add_RunCMake_test(cmake_minimum_required) add_RunCMake_test(cmake_parse_arguments) -add_RunCMake_test(cmake_path) +add_RunCMake_test(cmake_path -DMSYS=${MSYS}) add_RunCMake_test(continue) add_executable(color_warning color_warning.c) add_executable(fake_build_command fake_build_command.c) @@ -355,20 +366,22 @@ if(COVERAGE_COMMAND) endif() add_RunCMake_test(ctest_start) add_RunCMake_test(ctest_submit) -add_RunCMake_test(ctest_test) +add_RunCMake_test(ctest_test + -DIMAGE_DIR=${CMAKE_SOURCE_DIR}/Utilities/Sphinx/static +) add_RunCMake_test(ctest_disabled_test) add_RunCMake_test(ctest_skipped_test) add_RunCMake_test(ctest_update) add_RunCMake_test(ctest_upload) add_RunCMake_test(ctest_fixtures) -add_RunCMake_test(file) -add_RunCMake_test(file-CHMOD) +add_RunCMake_test(file -DMSYS=${MSYS}) +add_RunCMake_test(file-CHMOD -DMSYS=${MSYS}) if(HAVE_ELF_H OR CMAKE_SYSTEM_NAME STREQUAL "AIX") add_RunCMake_test(file-RPATH -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DHAVE_ELF_H=${HAVE_ELF_H}) endif() add_RunCMake_test(find_file) -add_RunCMake_test(find_library -DCYGWIN=${CYGWIN}) -add_RunCMake_test(find_package) +add_RunCMake_test(find_library -DCYGWIN=${CYGWIN} -DMSYS=${MSYS}) +add_RunCMake_test(find_package -DMSYS=${MSYS}) add_RunCMake_test(find_path) add_RunCMake_test(find_program -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) add_RunCMake_test(foreach) @@ -420,6 +433,15 @@ function(add_RunCMake_test_try_compile) set(CMAKE_C_STANDARD_DEFAULT "") endif() endif() + if(CMAKE_VERSION VERSION_LESS 3.20.20210225 AND "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang") + # Older CMake versions do not know about Clang MSVC compatibility mode + # standards. Approximate the logic from Clang-C.cmake. + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0) + set(CMAKE_C_STANDARD_DEFAULT 17) + elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.5.2) + set(CMAKE_C_STANDARD_DEFAULT 11) + endif() + endif() foreach(var CMAKE_SYSTEM_NAME CMAKE_C_COMPILER_ID @@ -497,7 +519,9 @@ else() message(STATUS "Could not find ctresalloc") endif() -if(NOT WIN32) +if(NOT WIN32 + AND NOT MSYS # FIXME: This works on CYGWIN but not on MSYS + ) add_RunCMake_test(SymlinkTrees) endif () @@ -539,7 +563,7 @@ endif() if(XCODE_VERSION) add_RunCMake_test(XcodeProject -DXCODE_VERSION=${XCODE_VERSION}) - add_RunCMake_test(XcodeProject-Embed) + add_RunCMake_test(XcodeProject-Embed -DXCODE_VERSION=${XCODE_VERSION}) # This test can take a very long time due to lots of combinations. # Use a long default timeout and provide an option to customize it. @@ -601,7 +625,8 @@ endif() add_executable(pseudo_llvm-rc pseudo_llvm-rc.c) -add_RunCMake_test(CommandLine -DLLVM_RC=$<TARGET_FILE:pseudo_llvm-rc> -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCYGWIN=${CYGWIN} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}) +add_RunCMake_test(CommandLine -DLLVM_RC=$<TARGET_FILE:pseudo_llvm-rc> -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} + -DCYGWIN=${CYGWIN} -DMSYS=${MSYS} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}) add_RunCMake_test(CommandLineTar) if(CMAKE_PLATFORM_NO_VERSIONED_SONAME OR (NOT CMAKE_SHARED_LIBRARY_SONAME_FLAG AND NOT CMAKE_SHARED_LIBRARY_SONAME_C_FLAG)) @@ -610,7 +635,7 @@ else() set(NO_NAMELINK 0) endif() -add_RunCMake_test(install -DNO_NAMELINK=${NO_NAMELINK} -DCYGWIN=${CYGWIN} +add_RunCMake_test(install -DNO_NAMELINK=${NO_NAMELINK} -DCYGWIN=${CYGWIN} -DMSYS=${MSYS} -DCMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN=${CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG=${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG} diff --git a/Tests/RunCMake/CMakePresets/ConditionFuture-result.txt b/Tests/RunCMake/CMakePresets/ConditionFuture-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ConditionFuture-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/ConditionFuture-stderr.txt b/Tests/RunCMake/CMakePresets/ConditionFuture-stderr.txt new file mode 100644 index 0000000..ea5f47f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ConditionFuture-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/ConditionFuture: File version must be 3 or higher for condition support$ diff --git a/Tests/RunCMake/CMakePresets/ConditionFuture.json.in b/Tests/RunCMake/CMakePresets/ConditionFuture.json.in new file mode 100644 index 0000000..9d4798b --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ConditionFuture.json.in @@ -0,0 +1,11 @@ +{ + "version": 2, + "configurePresets": [ + { + "name": "ConditionFuture", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "condition": true + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/Conditions.json.in b/Tests/RunCMake/CMakePresets/Conditions.json.in new file mode 100644 index 0000000..9c0c6bd --- /dev/null +++ b/Tests/RunCMake/CMakePresets/Conditions.json.in @@ -0,0 +1,406 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "Base", + "hidden": true, + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + }, + { + "name": "SimpleTrue", + "inherits": "Base", + "condition": true + }, + { + "name": "SimpleFalse", + "inherits": "Base", + "condition": false + }, + { + "name": "Null", + "inherits": "Base", + "condition": null + }, + { + "name": "ConstTrue", + "inherits": "Base", + "condition": { + "type": "const", + "value": true + } + }, + { + "name": "ConstFalse", + "inherits": "Base", + "condition": { + "type": "const", + "value": false + } + }, + { + "name": "EqualsTrue", + "inherits": "Base", + "condition": { + "type": "equals", + "lhs": "abc", + "rhs": "abc" + } + }, + { + "name": "EqualsFalse", + "inherits": "Base", + "condition": { + "type": "equals", + "lhs": "abc", + "rhs": "abcd" + } + }, + { + "name": "EqualsMacroLeft", + "inherits": "Base", + "condition": { + "type": "equals", + "lhs": "${presetName}", + "rhs": "EqualsMacroLeft" + } + }, + { + "name": "EqualsMacroRight", + "inherits": "Base", + "condition": { + "type": "equals", + "lhs": "EqualsMacroRight", + "rhs": "${presetName}" + } + }, + { + "name": "NotEqualsTrue", + "inherits": "Base", + "condition": { + "type": "notEquals", + "lhs": "abc", + "rhs": "abcd" + } + }, + { + "name": "NotEqualsFalse", + "inherits": "Base", + "condition": { + "type": "notEquals", + "lhs": "abc", + "rhs": "abc" + } + }, + { + "name": "InListTrue", + "inherits": "Base", + "condition": { + "type": "inList", + "string": "b", + "list": [ + "a", + "b", + "c" + ] + } + }, + { + "name": "InListFalse", + "inherits": "Base", + "condition": { + "type": "inList", + "string": "d", + "list": [ + "a", + "b", + "c" + ] + } + }, + { + "name": "InListMacroString", + "inherits": "Base", + "condition": { + "type": "inList", + "string": "${presetName}", + "list": [ + "InListMacroString", + "AnotherString" + ] + } + }, + { + "name": "InListMacroList", + "inherits": "Base", + "condition": { + "type": "inList", + "string": "InListMacroList", + "list": [ + "${presetName}", + "AnotherString" + ] + } + }, + { + "name": "InListShortCircuit", + "inherits": "Base", + "condition": { + "type": "inList", + "string": "a", + "list": [ + "a", + "${invalidMacro}" + ] + } + }, + { + "name": "NotInListTrue", + "inherits": "Base", + "condition": { + "type": "notInList", + "string": "d", + "list": [ + "a", + "b", + "c" + ] + } + }, + { + "name": "NotInListFalse", + "inherits": "Base", + "condition": { + "type": "notInList", + "string": "a", + "list": [ + "a", + "b", + "c" + ] + } + }, + { + "name": "MatchesTrue", + "inherits": "Base", + "condition": { + "type": "matches", + "string": "aaa", + "regex": "^a*$" + } + }, + { + "name": "MatchesFalse", + "inherits": "Base", + "condition": { + "type": "matches", + "string": "aab", + "regex": "^a*$" + } + }, + { + "name": "MatchesMacroString", + "inherits": "Base", + "condition": { + "type": "matches", + "string": "${presetName}", + "regex": "^Matches" + } + }, + { + "name": "MatchesMacroRegex", + "inherits": "Base", + "condition": { + "type": "matches", + "string": "stuff", + "regex": "$env{CONDITION_REGEX}" + }, + "environment": { + "CONDITION_REGEX": "^stuf*$" + } + }, + { + "name": "NotMatchesTrue", + "inherits": "Base", + "condition": { + "type": "notMatches", + "string": "aab", + "regex": "^a*$" + } + }, + { + "name": "NotMatchesFalse", + "inherits": "Base", + "condition": { + "type": "notMatches", + "string": "aaa", + "regex": "^a*$" + } + }, + { + "name": "AnyOfTrue1", + "inherits": "Base", + "condition": { + "type": "anyOf", + "conditions": [ + true, + false + ] + } + }, + { + "name": "AnyOfTrue2", + "inherits": "Base", + "condition": { + "type": "anyOf", + "conditions": [ + false, + true + ] + } + }, + { + "name": "AnyOfFalse", + "inherits": "Base", + "condition": { + "type": "anyOf", + "conditions": [ + false, + { + "type": "equals", + "lhs": "abc", + "rhs": "abcd" + } + ] + } + }, + { + "name": "AnyOfShortCircuit", + "inherits": "Base", + "condition": { + "type": "anyOf", + "conditions": [ + true, + { + "type": "equals", + "lhs": "${invalidMacro}", + "rhs": "" + } + ] + } + }, + { + "name": "AnyOfEmpty", + "inherits": "Base", + "condition": { + "type": "anyOf", + "conditions": [] + } + }, + { + "name": "AllOfTrue", + "inherits": "Base", + "condition": { + "type": "allOf", + "conditions": [ + true, + { + "type": "equals", + "lhs": "abc", + "rhs": "abc" + } + ] + } + }, + { + "name": "AllOfFalse1", + "inherits": "Base", + "condition": { + "type": "allOf", + "conditions": [ + false, + true + ] + } + }, + { + "name": "AllOfFalse2", + "inherits": "Base", + "condition": { + "type": "allOf", + "conditions": [ + true, + false + ] + } + }, + { + "name": "AllOfShortCircuit", + "inherits": "Base", + "condition": { + "type": "allOf", + "conditions": [ + false, + { + "type": "equals", + "lhs": "${invalidMacro}", + "rhs": "" + } + ] + } + }, + { + "name": "AllOfEmpty", + "inherits": "Base", + "condition": { + "type": "allOf", + "conditions": [] + } + }, + { + "name": "NotTrue", + "inherits": "Base", + "condition": { + "type": "not", + "condition": true + } + }, + { + "name": "NotFalse", + "inherits": "Base", + "condition": { + "type": "not", + "condition": false + } + }, + { + "name": "InheritanceBase", + "inherits": "Base", + "hidden": true, + "condition": { + "type": "equals", + "lhs": "${presetName}", + "rhs": "InheritanceChildTrue" + } + }, + { + "name": "InheritanceChildTrue", + "inherits": "InheritanceBase" + }, + { + "name": "InheritanceChildFalse", + "inherits": "InheritanceBase" + }, + { + "name": "InheritanceNull", + "inherits": "Null" + }, + { + "name": "InheritanceNullFalse", + "inherits": [ + "Null", + "SimpleFalse" + ] + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/FuturePresetInstallDirField-result.txt b/Tests/RunCMake/CMakePresets/FuturePresetInstallDirField-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/FuturePresetInstallDirField-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/FuturePresetInstallDirField-stderr.txt b/Tests/RunCMake/CMakePresets/FuturePresetInstallDirField-stderr.txt new file mode 100644 index 0000000..36123bd --- /dev/null +++ b/Tests/RunCMake/CMakePresets/FuturePresetInstallDirField-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/FuturePresetInstallDirField: File version must be 3 or higher for installDir preset support.$ diff --git a/Tests/RunCMake/CMakePresets/FuturePresetInstallDirField.json.in b/Tests/RunCMake/CMakePresets/FuturePresetInstallDirField.json.in new file mode 100644 index 0000000..2e5f7d5 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/FuturePresetInstallDirField.json.in @@ -0,0 +1,11 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "FuturePresetInstallDirField", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "installDir": "${sourceDir}/install" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/FuturePresetToolchainField-result.txt b/Tests/RunCMake/CMakePresets/FuturePresetToolchainField-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/FuturePresetToolchainField-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/FuturePresetToolchainField-stderr.txt b/Tests/RunCMake/CMakePresets/FuturePresetToolchainField-stderr.txt new file mode 100644 index 0000000..9382423 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/FuturePresetToolchainField-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/FuturePresetToolchainField: File version must be 3 or higher for toolchainFile preset support.$ diff --git a/Tests/RunCMake/CMakePresets/FuturePresetToolchainField.json.in b/Tests/RunCMake/CMakePresets/FuturePresetToolchainField.json.in new file mode 100644 index 0000000..646ee0f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/FuturePresetToolchainField.json.in @@ -0,0 +1,11 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "FuturePresetToolchainField", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "toolchainFile": "${sourceDir}/toolchain.cmake" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/GoodInstall.json.in b/Tests/RunCMake/CMakePresets/GoodInstall.json.in new file mode 100644 index 0000000..6287c65 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodInstall.json.in @@ -0,0 +1,30 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "GoodInstallDefault", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build/${presetName}", + "installDir": "${sourceDir}/build/install_dir1" + }, + { + "name": "GoodInstallInherit", + "inherits": "GoodInstallDefault", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": { + "type": "PATH", + "value": "${sourceDir}/build/bad_path" + } + } + }, + { + "name": "GoodInstallOverride", + "inherits": "GoodInstallInherit", + "installDir": "${sourceDir}/build/install_dir2" + }, + { + "name": "GoodInstallCommandLine", + "inherits": "GoodInstallOverride" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/GoodInstallCommandLine.cmake b/Tests/RunCMake/CMakePresets/GoodInstallCommandLine.cmake new file mode 100644 index 0000000..a4f6178 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodInstallCommandLine.cmake @@ -0,0 +1,3 @@ +include("${RunCMake_SOURCE_DIR}/TestVariable.cmake") + +test_variable("CMAKE_INSTALL_PREFIX" "PATH" "${RunCMake_SOURCE_DIR}/path/passed/on/command_line") diff --git a/Tests/RunCMake/CMakePresets/GoodInstallDefault.cmake b/Tests/RunCMake/CMakePresets/GoodInstallDefault.cmake new file mode 100644 index 0000000..656fda0 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodInstallDefault.cmake @@ -0,0 +1,3 @@ +include("${RunCMake_SOURCE_DIR}/TestVariable.cmake") + +test_variable("CMAKE_INSTALL_PREFIX" "PATH" "${CMAKE_SOURCE_DIR}/build/install_dir1") diff --git a/Tests/RunCMake/CMakePresets/GoodInstallInherit.cmake b/Tests/RunCMake/CMakePresets/GoodInstallInherit.cmake new file mode 100644 index 0000000..656fda0 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodInstallInherit.cmake @@ -0,0 +1,3 @@ +include("${RunCMake_SOURCE_DIR}/TestVariable.cmake") + +test_variable("CMAKE_INSTALL_PREFIX" "PATH" "${CMAKE_SOURCE_DIR}/build/install_dir1") diff --git a/Tests/RunCMake/CMakePresets/GoodInstallOverride.cmake b/Tests/RunCMake/CMakePresets/GoodInstallOverride.cmake new file mode 100644 index 0000000..3d12b07 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodInstallOverride.cmake @@ -0,0 +1,3 @@ +include("${RunCMake_SOURCE_DIR}/TestVariable.cmake") + +test_variable("CMAKE_INSTALL_PREFIX" "PATH" "${CMAKE_SOURCE_DIR}/build/install_dir2") diff --git a/Tests/RunCMake/CMakePresets/GoodToolchain.json.in b/Tests/RunCMake/CMakePresets/GoodToolchain.json.in new file mode 100644 index 0000000..69dafcf --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodToolchain.json.in @@ -0,0 +1,30 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "GoodToolchainDefault", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build/${presetName}", + "toolchainFile": "${sourceDir}/toolchain.cmake" + }, + { + "name": "GoodToolchainInherit", + "inherits": "GoodToolchainDefault", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": { + "type": "FILEPATH", + "value": "${sourceDir}/toolchain_bad.cmake" + } + } + }, + { + "name": "GoodToolchainOverride", + "inherits": "GoodToolchainInherit", + "toolchainFile": "override_toolchain.cmake" + }, + { + "name": "GoodToolchainCommandLine", + "inherits": "GoodToolchainOverride" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/GoodToolchainCommandLine.cmake b/Tests/RunCMake/CMakePresets/GoodToolchainCommandLine.cmake new file mode 100644 index 0000000..c37421c --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodToolchainCommandLine.cmake @@ -0,0 +1,3 @@ +include("${RunCMake_SOURCE_DIR}/TestVariable.cmake") + +test_variable("CMAKE_TOOLCHAIN_FILE" "FILEPATH" "${CMAKE_SOURCE_DIR}/cmd_line_toolchain.cmake") diff --git a/Tests/RunCMake/CMakePresets/GoodToolchainDefault.cmake b/Tests/RunCMake/CMakePresets/GoodToolchainDefault.cmake new file mode 100644 index 0000000..53c938b --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodToolchainDefault.cmake @@ -0,0 +1,3 @@ +include("${RunCMake_SOURCE_DIR}/TestVariable.cmake") + +test_variable("CMAKE_TOOLCHAIN_FILE" "FILEPATH" "${CMAKE_SOURCE_DIR}/toolchain.cmake") diff --git a/Tests/RunCMake/CMakePresets/GoodToolchainInherit.cmake b/Tests/RunCMake/CMakePresets/GoodToolchainInherit.cmake new file mode 100644 index 0000000..53c938b --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodToolchainInherit.cmake @@ -0,0 +1,3 @@ +include("${RunCMake_SOURCE_DIR}/TestVariable.cmake") + +test_variable("CMAKE_TOOLCHAIN_FILE" "FILEPATH" "${CMAKE_SOURCE_DIR}/toolchain.cmake") diff --git a/Tests/RunCMake/CMakePresets/GoodToolchainOverride.cmake b/Tests/RunCMake/CMakePresets/GoodToolchainOverride.cmake new file mode 100644 index 0000000..558134c --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodToolchainOverride.cmake @@ -0,0 +1,3 @@ +include("${RunCMake_SOURCE_DIR}/TestVariable.cmake") + +test_variable("CMAKE_TOOLCHAIN_FILE" "FILEPATH" "${CMAKE_SOURCE_DIR}/override_toolchain.cmake") diff --git a/Tests/RunCMake/CMakePresets/HostSystemName.cmake b/Tests/RunCMake/CMakePresets/HostSystemName.cmake new file mode 100644 index 0000000..dc0998a --- /dev/null +++ b/Tests/RunCMake/CMakePresets/HostSystemName.cmake @@ -0,0 +1,3 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(TEST_HOST_SYSTEM_NAME "" "${CMAKE_HOST_SYSTEM_NAME}") diff --git a/Tests/RunCMake/CMakePresets/HostSystemName.json.in b/Tests/RunCMake/CMakePresets/HostSystemName.json.in new file mode 100644 index 0000000..7fcd8c8 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/HostSystemName.json.in @@ -0,0 +1,13 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "HostSystemName", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "TEST_HOST_SYSTEM_NAME": "${hostSystemName}" + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/HostSystemNameFuture-result.txt b/Tests/RunCMake/CMakePresets/HostSystemNameFuture-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/HostSystemNameFuture-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/HostSystemNameFuture-stderr.txt b/Tests/RunCMake/CMakePresets/HostSystemNameFuture-stderr.txt new file mode 100644 index 0000000..7f4bb9a --- /dev/null +++ b/Tests/RunCMake/CMakePresets/HostSystemNameFuture-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/HostSystemNameFuture: Invalid macro expansion$ diff --git a/Tests/RunCMake/CMakePresets/HostSystemNameFuture.json.in b/Tests/RunCMake/CMakePresets/HostSystemNameFuture.json.in new file mode 100644 index 0000000..7a2f0aa --- /dev/null +++ b/Tests/RunCMake/CMakePresets/HostSystemNameFuture.json.in @@ -0,0 +1,13 @@ +{ + "version": 2, + "configurePresets": [ + { + "name": "HostSystemNameFuture", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "TEST_HOST_SYSTEM_NAME": "${hostSystemName}" + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/InvalidRegex-result.txt b/Tests/RunCMake/CMakePresets/InvalidRegex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidRegex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/InvalidRegex-stderr.txt b/Tests/RunCMake/CMakePresets/InvalidRegex-stderr.txt new file mode 100644 index 0000000..5b500e4 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidRegex-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/InvalidRegex: Invalid macro expansion$ diff --git a/Tests/RunCMake/CMakePresets/InvalidRegex.json.in b/Tests/RunCMake/CMakePresets/InvalidRegex.json.in new file mode 100644 index 0000000..69114d2 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/InvalidRegex.json.in @@ -0,0 +1,15 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "InvalidRegex", + "binaryDir": "${sourceDir}/build", + "generator": "@RunCMake_GENERATOR@", + "condition": { + "type": "matches", + "string": "a", + "regex": "+" + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/ListConditions-stdout.txt b/Tests/RunCMake/CMakePresets/ListConditions-stdout.txt new file mode 100644 index 0000000..91e0017 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/ListConditions-stdout.txt @@ -0,0 +1,26 @@ +Available configure presets: + + "SimpleTrue" + "Null" + "ConstTrue" + "EqualsTrue" + "EqualsMacroLeft" + "EqualsMacroRight" + "NotEqualsTrue" + "InListTrue" + "InListMacroString" + "InListMacroList" + "InListShortCircuit" + "NotInListTrue" + "MatchesTrue" + "MatchesMacroString" + "MatchesMacroRegex" + "NotMatchesTrue" + "AnyOfTrue1" + "AnyOfTrue2" + "AnyOfShortCircuit" + "AllOfTrue" + "AllOfEmpty" + "NotFalse" + "InheritanceChildTrue" + "InheritanceNull"$ diff --git a/Tests/RunCMake/CMakePresets/OptionalBinaryDirField.cmake b/Tests/RunCMake/CMakePresets/OptionalBinaryDirField.cmake new file mode 100644 index 0000000..49e7a25 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/OptionalBinaryDirField.cmake @@ -0,0 +1,3 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_BINARY_DIR "" "${CMAKE_SOURCE_DIR}/build") diff --git a/Tests/RunCMake/CMakePresets/OptionalBinaryDirField.json.in b/Tests/RunCMake/CMakePresets/OptionalBinaryDirField.json.in new file mode 100644 index 0000000..ee17a22 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/OptionalBinaryDirField.json.in @@ -0,0 +1,9 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "OptionalBinaryDirField", + "generator": "@RunCMake_GENERATOR@" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/OptionalGeneratorField.cmake b/Tests/RunCMake/CMakePresets/OptionalGeneratorField.cmake new file mode 100644 index 0000000..4319e72 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/OptionalGeneratorField.cmake @@ -0,0 +1,3 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_GENERATOR "" "${RunCMake_GENERATOR}") diff --git a/Tests/RunCMake/CMakePresets/OptionalGeneratorField.json.in b/Tests/RunCMake/CMakePresets/OptionalGeneratorField.json.in new file mode 100644 index 0000000..920d056 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/OptionalGeneratorField.json.in @@ -0,0 +1,9 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "OptionalGeneratorField", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake index dfc56ee..3b9806a 100644 --- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake @@ -11,14 +11,23 @@ set(RunCMake-check-file check.cmake) include("${RunCMake_SOURCE_DIR}/validate_schema.cmake") +function(reset_cmake_presets_directory name) + set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/${name}") + file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}") +endfunction() + function(run_cmake_presets name) set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/${name}") set(_source_arg "${RunCMake_TEST_SOURCE_DIR}") if(CMakePresets_SOURCE_ARG) set(_source_arg "${CMakePresets_SOURCE_ARG}") endif() - file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}") + + if(NOT RunCMake_TEST_SOURCE_DIR_NO_CLEAN) + file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}") + endif() configure_file("${RunCMake_SOURCE_DIR}/CMakeLists.txt.in" "${RunCMake_TEST_SOURCE_DIR}/CMakeLists.txt" @ONLY) if(NOT CMakePresets_FILE) @@ -94,6 +103,8 @@ run_cmake_presets(InvalidVariableValue) run_cmake_presets(ExtraRootField) run_cmake_presets(ExtraPresetField) run_cmake_presets(ExtraVariableField) +run_cmake_presets(FuturePresetInstallDirField) +run_cmake_presets(FuturePresetToolchainField) run_cmake_presets(InvalidPresetVendor) set(CMakePresets_SCHEMA_EXPECTED_RESULT 0) run_cmake_presets(DuplicatePresets) @@ -116,7 +127,10 @@ run_cmake_presets(NoSuchMacro) run_cmake_presets(EnvCycle) run_cmake_presets(EmptyEnv) run_cmake_presets(EmptyPenv) +run_cmake_presets(InvalidRegex) set(CMakePresets_SCHEMA_EXPECTED_RESULT 1) +run_cmake_presets(ConditionFuture) +run_cmake_presets(SubConditionNull) # Test cmakeMinimumRequired field run_cmake_presets(MinimumRequiredInvalid) @@ -181,6 +195,35 @@ run_cmake_presets(GoodInheritanceMulti) run_cmake_presets(GoodInheritanceMultiSecond) run_cmake_presets(GoodInheritanceMacro) +set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/GoodInstall.json.in") +run_cmake_presets(GoodInstallDefault) +run_cmake_presets(GoodInstallInherit) +run_cmake_presets(GoodInstallOverride) +run_cmake_presets(GoodInstallCommandLine "--install-prefix=${RunCMake_SOURCE_DIR}/path/passed/on/command_line") + +set(RunCMake_TEST_SOURCE_DIR_NO_CLEAN 1) +set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/GoodToolchain.json.in") + +reset_cmake_presets_directory(GoodToolchainInherit) +file(WRITE "${RunCMake_BINARY_DIR}/GoodToolchainDefault/toolchain.cmake" "") +run_cmake_presets(GoodToolchainDefault) + +reset_cmake_presets_directory(GoodToolchainInherit) +file(WRITE "${RunCMake_BINARY_DIR}/GoodToolchainInherit/toolchain.cmake" "") +run_cmake_presets(GoodToolchainInherit) + +reset_cmake_presets_directory(GoodToolchainOverride) +file(WRITE "${RunCMake_BINARY_DIR}/GoodToolchainOverride/override_toolchain.cmake" "") +run_cmake_presets(GoodToolchainOverride) + +reset_cmake_presets_directory(GoodToolchainCommandLine) +file(WRITE "${RunCMake_BINARY_DIR}/GoodToolchainCommandLine/cmd_line_toolchain.cmake" "") +run_cmake_presets(GoodToolchainCommandLine "--toolchain=${RunCMake_BINARY_DIR}/GoodToolchainCommandLine/cmd_line_toolchain.cmake") + +unset(RunCMake_TEST_SOURCE_DIR_NO_CLEAN) + + +set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/CMakePresets.json.in") # Test bad preset arguments run_cmake_presets(VendorMacro) run_cmake_presets(InvalidGenerator) @@ -253,9 +296,29 @@ set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/Debug.json.in") run_cmake_presets(NoDebug) run_cmake_presets(Debug) +# Test ${hostSystemName} macro +set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/HostSystemName.json.in") +run_cmake_presets(HostSystemName) +set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/HostSystemNameFuture.json.in") +run_cmake_presets(HostSystemNameFuture) + +# Test conditions +set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/Conditions.json.in") +run_cmake_presets(ListConditions --list-presets) +run_cmake_presets(SimpleTrue) +run_cmake_presets(SimpleFalse) +unset(CMakePresets_FILE) + +# Test optional generator and buildDir fields +run_cmake_presets(OptionalBinaryDirField -B "${RunCMake_BINARY_DIR}/OptionalBinaryDirField/build") +run_cmake_presets(OptionalGeneratorField -G "${RunCMake_GENERATOR}") + # Test the example from the documentation file(READ "${RunCMake_SOURCE_DIR}/../../../Help/manual/presets/example.json" _example) string(REPLACE "\"generator\": \"Ninja\"" "\"generator\": \"@RunCMake_GENERATOR@\"" _example "${_example}") +if(CMAKE_HOST_WIN32) + string(REPLACE [["PATH": "$env{HOME}/ninja/bin:$penv{PATH}"]] [["PATH": "$env{HOME}/ninja/bin;$penv{PATH}"]] _example "${_example}") +endif() file(WRITE "${RunCMake_BINARY_DIR}/example.json.in" "${_example}") set(CMakePresets_FILE "${RunCMake_BINARY_DIR}/example.json.in") run_cmake_presets(DocumentationExample --preset=default) diff --git a/Tests/RunCMake/CMakePresets/SimpleFalse-result.txt b/Tests/RunCMake/CMakePresets/SimpleFalse-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/SimpleFalse-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/SimpleFalse-stderr.txt b/Tests/RunCMake/CMakePresets/SimpleFalse-stderr.txt new file mode 100644 index 0000000..6a9a7de --- /dev/null +++ b/Tests/RunCMake/CMakePresets/SimpleFalse-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Could not use disabled preset "SimpleFalse"$ diff --git a/Tests/RunCMake/CMakePresets/SimpleTrue.cmake b/Tests/RunCMake/CMakePresets/SimpleTrue.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/SimpleTrue.cmake diff --git a/Tests/RunCMake/CMakePresets/SubConditionNull-result.txt b/Tests/RunCMake/CMakePresets/SubConditionNull-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/SubConditionNull-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/SubConditionNull-stderr.txt b/Tests/RunCMake/CMakePresets/SubConditionNull-stderr.txt new file mode 100644 index 0000000..42b74d6 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/SubConditionNull-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/SubConditionNull: Invalid preset condition$ diff --git a/Tests/RunCMake/CMakePresets/SubConditionNull.json.in b/Tests/RunCMake/CMakePresets/SubConditionNull.json.in new file mode 100644 index 0000000..eed3da6 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/SubConditionNull.json.in @@ -0,0 +1,14 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "SubConditionNull", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "condition": { + "type": "not", + "condition": null + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresetsBuild/Condition-build-disabled-result.txt b/Tests/RunCMake/CMakePresetsBuild/Condition-build-disabled-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresetsBuild/Condition-build-disabled-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresetsBuild/Condition-build-disabled-stderr.txt b/Tests/RunCMake/CMakePresetsBuild/Condition-build-disabled-stderr.txt new file mode 100644 index 0000000..c35f5d7 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsBuild/Condition-build-disabled-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Cannot use disabled build preset in [^ +]*/Tests/RunCMake/CMakePresetsBuild/Condition: "disabled"$ diff --git a/Tests/RunCMake/CMakePresetsBuild/Condition.cmake b/Tests/RunCMake/CMakePresetsBuild/Condition.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsBuild/Condition.cmake diff --git a/Tests/RunCMake/CMakePresetsBuild/Condition.json.in b/Tests/RunCMake/CMakePresetsBuild/Condition.json.in new file mode 100644 index 0000000..aaee96a --- /dev/null +++ b/Tests/RunCMake/CMakePresetsBuild/Condition.json.in @@ -0,0 +1,22 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "default", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ], + "buildPresets": [ + { + "name": "enabled", + "configurePreset": "default", + "condition": true + }, + { + "name": "disabled", + "configurePreset": "default", + "condition": false + } + ] +} diff --git a/Tests/RunCMake/CMakePresetsBuild/ConditionFuture-build-conditionFuture-result.txt b/Tests/RunCMake/CMakePresetsBuild/ConditionFuture-build-conditionFuture-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresetsBuild/ConditionFuture-build-conditionFuture-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresetsBuild/ConditionFuture-build-conditionFuture-stderr.txt b/Tests/RunCMake/CMakePresetsBuild/ConditionFuture-build-conditionFuture-stderr.txt new file mode 100644 index 0000000..f08f4c1 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsBuild/ConditionFuture-build-conditionFuture-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresetsBuild/ConditionFuture: File version must be 3 or higher for condition support$ diff --git a/Tests/RunCMake/CMakePresetsBuild/ConditionFuture.json.in b/Tests/RunCMake/CMakePresetsBuild/ConditionFuture.json.in new file mode 100644 index 0000000..2f3f7d8 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsBuild/ConditionFuture.json.in @@ -0,0 +1,17 @@ +{ + "version": 2, + "configurePresets": [ + { + "name": "default", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ], + "buildPresets": [ + { + "name": "conditionFuture", + "configurePreset": "default", + "condition": true + } + ] +} diff --git a/Tests/RunCMake/CMakePresetsBuild/ListPresets-build-x-stdout.txt b/Tests/RunCMake/CMakePresetsBuild/ListPresets-build-x-stdout.txt index 4d30707..2d362d4 100644 --- a/Tests/RunCMake/CMakePresetsBuild/ListPresets-build-x-stdout.txt +++ b/Tests/RunCMake/CMakePresetsBuild/ListPresets-build-x-stdout.txt @@ -1,5 +1,6 @@ -Available build presets: +^Available build presets: "build-default" - build-default displayName "empty" "display" - display displayName + "true"$ diff --git a/Tests/RunCMake/CMakePresetsBuild/ListPresets.json.in b/Tests/RunCMake/CMakePresetsBuild/ListPresets.json.in index 3f5e02c..26504d3 100644 --- a/Tests/RunCMake/CMakePresetsBuild/ListPresets.json.in +++ b/Tests/RunCMake/CMakePresetsBuild/ListPresets.json.in @@ -1,5 +1,5 @@ { - "version": 2, + "version": 3, "configurePresets": [ { "name": "default", @@ -26,6 +26,16 @@ { "name": "hidden", "hidden": true + }, + { + "name": "true", + "inherits": "build-default", + "condition": true + }, + { + "name": "false", + "inherits": "build-default", + "condition": false } ] } diff --git a/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake index 2559b12..afa22eb 100644 --- a/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake @@ -64,6 +64,7 @@ set(CMakePresets_SCHEMA_EXPECTED_RESULT 0) run_cmake_build_presets(Good "default;other" "build-other;withEnvironment;noEnvironment;macros;vendorObject") run_cmake_build_presets(InvalidConfigurePreset "default" "badConfigurePreset") +run_cmake_build_presets(Condition "default" "enabled;disabled") set(CMakePresetsBuild_BUILD_ONLY 1) run_cmake_build_presets(ListPresets "x" "x" "--list-presets") @@ -72,5 +73,6 @@ run_cmake_build_presets(Invalid "x" "hidden;vendorMacro") set(CMakePresets_SCHEMA_EXPECTED_RESULT 1) run_cmake_build_presets(PresetsUnsupported "x" "x") +run_cmake_build_presets(ConditionFuture "x" "conditionFuture") set(CMakePresets_SCHEMA_EXPECTED_RESULT 0) set(CMakePresetsBuild_BUILD_ONLY 0) diff --git a/Tests/RunCMake/CMakePresetsTest/Condition.json.in b/Tests/RunCMake/CMakePresetsTest/Condition.json.in new file mode 100644 index 0000000..0baf176 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsTest/Condition.json.in @@ -0,0 +1,22 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "default", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ], + "testPresets": [ + { + "name": "enabled", + "configurePreset": "default", + "condition": true + }, + { + "name": "disabled", + "configurePreset": "default", + "condition": false + } + ] +} diff --git a/Tests/RunCMake/CMakePresetsTest/ConditionFuture-test-x-result.txt b/Tests/RunCMake/CMakePresetsTest/ConditionFuture-test-x-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresetsTest/ConditionFuture-test-x-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresetsTest/ConditionFuture-test-x-stderr.txt b/Tests/RunCMake/CMakePresetsTest/ConditionFuture-test-x-stderr.txt new file mode 100644 index 0000000..b814bbb --- /dev/null +++ b/Tests/RunCMake/CMakePresetsTest/ConditionFuture-test-x-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresetsTest/ConditionFuture: File version must be 3 or higher for condition support$ diff --git a/Tests/RunCMake/CMakePresetsTest/ConditionFuture.json.in b/Tests/RunCMake/CMakePresetsTest/ConditionFuture.json.in new file mode 100644 index 0000000..4b9f33f --- /dev/null +++ b/Tests/RunCMake/CMakePresetsTest/ConditionFuture.json.in @@ -0,0 +1,17 @@ +{ + "version": 2, + "configurePresets": [ + { + "name": "default", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ], + "testPresets": [ + { + "name": "conditionFuture", + "configurePreset": "default", + "condition": true + } + ] +} diff --git a/Tests/RunCMake/CMakePresetsTest/ConditionListPresets-test-x-stdout.txt b/Tests/RunCMake/CMakePresetsTest/ConditionListPresets-test-x-stdout.txt new file mode 100644 index 0000000..11918e5 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsTest/ConditionListPresets-test-x-stdout.txt @@ -0,0 +1,3 @@ +^Available test presets: + + "enabled"$ diff --git a/Tests/RunCMake/CMakePresetsTest/ConditionRunTests-test-disabled-result.txt b/Tests/RunCMake/CMakePresetsTest/ConditionRunTests-test-disabled-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresetsTest/ConditionRunTests-test-disabled-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresetsTest/ConditionRunTests-test-disabled-stderr.txt b/Tests/RunCMake/CMakePresetsTest/ConditionRunTests-test-disabled-stderr.txt new file mode 100644 index 0000000..5db3b77 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsTest/ConditionRunTests-test-disabled-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Cannot use disabled test preset in [^ +]*/Tests/RunCMake/CMakePresetsTest/ConditionRunTests: "disabled"$ diff --git a/Tests/RunCMake/CMakePresetsTest/ConditionRunTests.cmake b/Tests/RunCMake/CMakePresetsTest/ConditionRunTests.cmake new file mode 100644 index 0000000..b29161e --- /dev/null +++ b/Tests/RunCMake/CMakePresetsTest/ConditionRunTests.cmake @@ -0,0 +1,2 @@ +enable_testing() +add_test(true ${CMAKE_COMMAND} -E true) diff --git a/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake index c93dff3..70d25d4 100644 --- a/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake @@ -90,6 +90,12 @@ run_cmake_test_presets(InvalidConfigurePreset "default" "" "badConfigurePreset") set(CMakePresetsTest_NO_CONFIGURE 1) set(CMakePresetsTest_FILE "${RunCMake_SOURCE_DIR}/Good.json.in") run_cmake_test_presets(ListPresets "" "" "x" "--list-presets") + +set(CMakePresetsTest_FILE "${RunCMake_SOURCE_DIR}/Condition.json.in") +run_cmake_test_presets(ConditionListPresets "" "" "x" "--list-presets") +unset(CMakePresetsTest_NO_CONFIGURE) +run_cmake_test_presets(ConditionRunTests "default" "" "enabled;disabled") +set(CMakePresetsTest_NO_CONFIGURE 1) unset(CMakePresetsTest_FILE) run_cmake_test_presets(NoConfigurePreset "" "" "noConfigurePreset") @@ -98,6 +104,7 @@ run_cmake_test_presets(Invalid "" "" "hidden;vendorMacro") set(CMakePresets_SCHEMA_EXPECTED_RESULT 1) run_cmake_test_presets(PresetsUnsupported "" "" "x") +run_cmake_test_presets(ConditionFuture "" "" "x") set(CMakePresets_SCHEMA_EXPECTED_RESULT 0) set(CMakePresetsTest_NO_CONFIGURE 0) diff --git a/Tests/RunCMake/CPack/RPM/Prerequirements.cmake b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake index 3416205..e95cd15 100644 --- a/Tests/RunCMake/CPack/RPM/Prerequirements.cmake +++ b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake @@ -13,4 +13,11 @@ function(get_test_prerequirements found_var config_file) "\nset(RPMBUILD_EXECUTABLE \"${RPMBUILD_EXECUTABLE}\")") set(${found_var} true PARENT_SCOPE) endif() + + # optional tool for some tests + find_program(OBJDUMP_EXECUTABLE objdump) + if(OBJDUMP_EXECUTABLE) + file(APPEND "${config_file}" + "\nset(OBJDUMP_EXECUTABLE \"${OBJDUMP_EXECUTABLE}\")") + endif() endfunction() diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 15bfb60..746ff8b 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -16,7 +16,7 @@ run_cpack_test(VERSION "RPM.VERSION;DEB.VERSION" false "MONOLITHIC;COMPONENT") run_cpack_test(EXTRA "DEB.EXTRA" false "COMPONENT") run_cpack_test_subtests(GENERATE_SHLIBS "soversion_not_zero;soversion_zero" "DEB.GENERATE_SHLIBS" true "COMPONENT") run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB.GENERATE_SHLIBS_LDCONFIG" true "COMPONENT") -run_cpack_test(INSTALL_SCRIPTS "RPM.INSTALL_SCRIPTS" false "COMPONENT") +run_cpack_test_subtests(INSTALL_SCRIPTS "default;single_debug_info;no_scripts;no_scripts_single_debug_info" "RPM.INSTALL_SCRIPTS" false "COMPONENT") run_cpack_test(LONG_FILENAMES "DEB.LONG_FILENAMES" false "MONOLITHIC") run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM.MAIN_COMPONENT" false "COMPONENT") run_cpack_test(MINIMAL "RPM.MINIMAL;DEB.MINIMAL;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External" false "MONOLITHIC;COMPONENT") @@ -37,6 +37,7 @@ unset(ENVIRONMENT) run_cpack_test(USER_FILELIST "RPM.USER_FILELIST" false "MONOLITHIC") run_cpack_test(MD5SUMS "DEB.MD5SUMS" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests(CPACK_INSTALL_SCRIPTS "singular;plural;both" "ZIP" false "MONOLITHIC") +run_cpack_test(CPACK_CUSTOM_INSTALL_VARIABLES "ZIP" false "MONOLITHIC") run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB.DEB_PACKAGE_VERSION_BACK_COMPATIBILITY" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests(EXTERNAL "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad;stage_and_package" "External" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests( diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake index 0ab545a..294b9e8 100644 --- a/Tests/RunCMake/CPack/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/VerifyResult.cmake @@ -29,8 +29,16 @@ file(READ "${bin_dir}/test_output.txt" output) file(READ "${bin_dir}/test_error.txt" error) file(READ "${config_file}" config_file_content) -set(output_error_message - "\nCPack output: '${output}'\nCPack error: '${error}';\nCPack result: '${PACKAGING_RESULT}';\nconfig file: '${config_file_content}'") +string(REPLACE "\n" "\n cpack-out> " cpack_out "\n${output}") +string(REPLACE "\n" "\n cpack-err> " cpack_err "\n${error}") +string(REPLACE "\n" "\n cpack-res> " cpack_res "\n${PACKAGING_RESULT}") +string(REPLACE "\n" "\n cpack-cfg> " cpack_cfg "\n${config_file_content}") +string(CONCAT output_error_message + "CPack output:${cpack_out}\n" + "CPack error:${cpack_err}\n" + "CPack result:${cpack_res}\n" + "CPack config file:${cpack_cfg}" + ) # generate default expected files data include("${src_dir}/tests/${RunCMake_TEST_FILE_PREFIX}/ExpectedFiles.cmake") @@ -74,22 +82,22 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0) string(REPLACE "\n" "\n actual> " msg_actual "\n${PACKAGE_CONTENT}") string(REPLACE "\n" "\n expect> " msg_expected "\n${EXPECTED_FILE_CONTENT_${file_no_}}") message(FATAL_ERROR - "Unexpected file content for file No. '${file_no_}'!\n" + "Unexpected file content for file ${file_no_}!\n" "The content was:${msg_actual}\n" "which does not match:${msg_expected}\n" "${output_error_message}") endif() elseif(foundFilescount_ EQUAL 0) message(FATAL_ERROR - "Found no files for file No. '${file_no_}'!" - " Globbing expression: '${EXPECTED_FILE_${file_no_}}'" + "Found no files for file ${file_no_}!\n" + "Globbing expression:\n '${EXPECTED_FILE_${file_no_}}'\n" "${output_error_message}") else() message(FATAL_ERROR - "Found more than one file for file No. '${file_no_}'!" - " Found files count '${foundFilesCount_}'." - " Files: '${FOUND_FILE_${file_no_}}'" - " Globbing expression: '${EXPECTED_FILE_${file_no_}}'" + "Found more than one file for file ${file_no_}!\n" + "Found files count '${foundFilesCount_}'.\n" + "Files:\n '${FOUND_FILE_${file_no_}}'\n" + "Globbing expression:\n '${EXPECTED_FILE_${file_no_}}'\n" "${output_error_message}") endif() endforeach() @@ -105,7 +113,8 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0) if(NOT foundFilesCount_ EQUAL allFoundFilesCount_) message(FATAL_ERROR - "Found more files than expected! Found files: '${allFoundFiles_}'" + "Found more files than expected!\n" + "Found files:\n '${allFoundFiles_}'\n" "${output_error_message}") endif() @@ -116,8 +125,9 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0) if(found_ EQUAL -1) message(FATAL_ERROR - "Expected files don't match found files! Found files:" - " '${allFoundFiles_}'" + "Expected files don't match found files!\n" + "Found files:\n" + " '${allFoundFiles_}'\n" "${output_error_message}") endif() endforeach() @@ -127,7 +137,7 @@ else() file(GLOB checkMissingFiles_ RELATIVE "${bin_dir}" "${missing_file_glob_}") if(checkMissingFiles_) - message(FATAL_ERROR "Unexpected files found: '${checkMissingFiles_}'" + message(FATAL_ERROR "Unexpected files found:\n '${checkMissingFiles_}'\n" "${output_error_message}") endif() endforeach() diff --git a/Tests/RunCMake/CPack/tests/CPACK_CUSTOM_INSTALL_VARIABLES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/CPACK_CUSTOM_INSTALL_VARIABLES/ExpectedFiles.cmake new file mode 100644 index 0000000..a05513b --- /dev/null +++ b/Tests/RunCMake/CPack/tests/CPACK_CUSTOM_INSTALL_VARIABLES/ExpectedFiles.cmake @@ -0,0 +1,7 @@ +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_CONTENT_1_LIST + "/foo" + "/foo/bar.txt" + "/foo/baz.txt" + "/foo/foo.txt" +) diff --git a/Tests/RunCMake/CPack/tests/CPACK_CUSTOM_INSTALL_VARIABLES/test.cmake b/Tests/RunCMake/CPack/tests/CPACK_CUSTOM_INSTALL_VARIABLES/test.cmake new file mode 100644 index 0000000..4a12f19 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/CPACK_CUSTOM_INSTALL_VARIABLES/test.cmake @@ -0,0 +1,7 @@ +set(CPACK_CUSTOM_INSTALL_VARIABLES "FOO=foo.txt" "BAR=bar.txt") + +install(CODE [[ + file(WRITE ${CMAKE_INSTALL_PREFIX}/foo/${FOO}) + file(WRITE ${CMAKE_INSTALL_PREFIX}/foo/${BAR}) + file(WRITE ${CMAKE_INSTALL_PREFIX}/foo/baz.txt) +]]) diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake index de38df9..5a87c44 100644 --- a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake @@ -1,5 +1,10 @@ +if(RunCMake_SUBTEST_SUFFIX MATCHES ".*single_debug_info") + set(EXPECTED_FILE_1 "install_scripts-0.1.1-1.*.rpm") +else() + set(EXPECTED_FILE_1_COMPONENT "foo") +endif() + set(EXPECTED_FILES_COUNT "2") -set(EXPECTED_FILE_1_COMPONENT "foo") set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") set(EXPECTED_FILE_2_COMPONENT "bar") set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-COMPONENT-no_scripts_single_debug_info-stderr.txt b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-COMPONENT-no_scripts_single_debug_info-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-COMPONENT-no_scripts_single_debug_info-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-COMPONENT-single_debug_info-stderr.txt b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-COMPONENT-single_debug_info-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-COMPONENT-single_debug_info-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake new file mode 100644 index 0000000..90cfe44 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake @@ -0,0 +1,11 @@ +function(get_test_prerequirements found_var config_file) + if(SUBTEST_SUFFIX MATCHES ".*single_debug_info") + include(${config_file}) + + if(OBJDUMP_EXECUTABLE) + set(${found_var} true PARENT_SCOPE) + endif() + else() + set(${found_var} true PARENT_SCOPE) + endif() +endfunction() diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/VerifyResult.cmake index 1a1e983..0c42d90 100644 --- a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/VerifyResult.cmake @@ -7,23 +7,34 @@ function(checkScripts_ FILE COMPARE_LIST) ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REPLACE "\n" ";" FILE_SCRIPTS_LIST_ "${FILE_SCRIPTS_}") + if(COMPARE_LIST STREQUAL "") + if(NOT FILE_SCRIPTS_ STREQUAL "") + message(FATAL_ERROR "No scripts were expected in '${FILE}'; file info: '${FILE_SCRIPTS_}'") + endif() + else() + string(REPLACE "\n" ";" FILE_SCRIPTS_LIST_ "${FILE_SCRIPTS_}") + + foreach(COMPARE_REGEX_ IN LISTS COMPARE_LIST) + unset(FOUND_) - foreach(COMPARE_REGEX_ IN LISTS COMPARE_LIST) - unset(FOUND_) + foreach(COMPARE_ IN LISTS FILE_SCRIPTS_LIST_) + if(COMPARE_ MATCHES "${COMPARE_REGEX_}") + set(FOUND_ true) + break() + endif() + endforeach() - foreach(COMPARE_ IN LISTS FILE_SCRIPTS_LIST_) - if(COMPARE_ MATCHES "${COMPARE_REGEX_}") - set(FOUND_ true) - break() + if(NOT FOUND_) + message(FATAL_ERROR "Missing scripts in '${FILE}'; file info: '${FILE_SCRIPTS_}'; missing: '${COMPARE_REGEX_}'") endif() endforeach() - - if(NOT FOUND_) - message(FATAL_ERROR "Missing scripts in '${FILE}'; file info: '${FILE_SCRIPTS_}'; missing: '${COMPARE_REGEX_}'") - endif() - endforeach() + endif() endfunction() -checkScripts_("${FOUND_FILE_1}" "echo \"pre install foo\";echo \"post install foo\";echo \"pre uninstall foo\";echo \"post uninstall foo\";echo \"pre trans foo\";echo \"post trans foo\"") -checkScripts_("${FOUND_FILE_2}" "echo \"pre install\";echo \"post install\";echo \"pre uninstall\";echo \"post uninstall\";echo \"pre trans\";echo \"post trans\"") +if(RunCMake_SUBTEST_SUFFIX MATCHES "no_scripts.*") + checkScripts_("${FOUND_FILE_1}" "") + checkScripts_("${FOUND_FILE_2}" "") +else() + checkScripts_("${FOUND_FILE_1}" "echo \"pre install foo\";echo \"post install foo\";echo \"pre uninstall foo\";echo \"post uninstall foo\";echo \"pre trans foo\";echo \"post trans foo\"") + checkScripts_("${FOUND_FILE_2}" "echo \"pre install\";echo \"post install\";echo \"pre uninstall\";echo \"post uninstall\";echo \"pre trans\";echo \"post trans\"") +endif() diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake index c200fa5..ce5db0c 100644 --- a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake +++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake @@ -1,60 +1,70 @@ if(GENERATOR_TYPE STREQUAL "RPM") - set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE - "${CMAKE_CURRENT_BINARY_DIR}/pre_install.sh") - set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE - "${CMAKE_CURRENT_BINARY_DIR}/post_install.sh") - set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE - "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall.sh") - set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE - "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall.sh") - set(CPACK_RPM_PRE_TRANS_SCRIPT_FILE - "${CMAKE_CURRENT_BINARY_DIR}/pre_trans.sh") - set(CPACK_RPM_POST_TRANS_SCRIPT_FILE - "${CMAKE_CURRENT_BINARY_DIR}/post_trans.sh") - - set(CPACK_RPM_foo_PRE_INSTALL_SCRIPT_FILE - "${CMAKE_CURRENT_BINARY_DIR}/pre_install_foo.sh") - set(CPACK_RPM_foo_POST_INSTALL_SCRIPT_FILE - "${CMAKE_CURRENT_BINARY_DIR}/post_install_foo.sh") - set(CPACK_RPM_foo_PRE_UNINSTALL_SCRIPT_FILE - "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall_foo.sh") - set(CPACK_RPM_foo_POST_UNINSTALL_SCRIPT_FILE - "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh") - set(CPACK_RPM_foo_PRE_TRANS_SCRIPT_FILE - "${CMAKE_CURRENT_BINARY_DIR}/pre_trans_foo.sh") - set(CPACK_RPM_foo_POST_TRANS_SCRIPT_FILE - "${CMAKE_CURRENT_BINARY_DIR}/post_trans_foo.sh") + if(RunCMake_SUBTEST_SUFFIX MATCHES ".*single_debug_info") + set(CPACK_RPM_MAIN_COMPONENT "foo") + set(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE ON) + set(CPACK_RPM_FOO_FILE_NAME "RPM-DEFAULT") + endif() endif() set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) -# default -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_install.sh" - "echo \"pre install\"\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_install.sh" - "echo \"post install\"\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall.sh" - "echo \"pre uninstall\"\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall.sh" - "echo \"post uninstall\"\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_trans.sh" - "echo \"pre trans\"\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_trans.sh" - "echo \"post trans\"\n") +if(NOT RunCMake_SUBTEST_SUFFIX MATCHES "no_scripts.*") + if(GENERATOR_TYPE STREQUAL "RPM") + set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/pre_install.sh") + set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/post_install.sh") + set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall.sh") + set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall.sh") + set(CPACK_RPM_PRE_TRANS_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/pre_trans.sh") + set(CPACK_RPM_POST_TRANS_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/post_trans.sh") + + set(CPACK_RPM_foo_PRE_INSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/pre_install_foo.sh") + set(CPACK_RPM_foo_POST_INSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/post_install_foo.sh") + set(CPACK_RPM_foo_PRE_UNINSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall_foo.sh") + set(CPACK_RPM_foo_POST_UNINSTALL_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh") + set(CPACK_RPM_foo_PRE_TRANS_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/pre_trans_foo.sh") + set(CPACK_RPM_foo_POST_TRANS_SCRIPT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/post_trans_foo.sh") + endif() -# specific -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_install_foo.sh" - "echo \"pre install foo\"\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_install_foo.sh" - "echo \"post install foo\"\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall_foo.sh" - "echo \"pre uninstall foo\"\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh" - "echo \"post uninstall foo\"\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_trans_foo.sh" - "echo \"pre trans foo\"\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_trans_foo.sh" - "echo \"post trans foo\"\n") + # default + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_install.sh" + "echo \"pre install\"\n") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_install.sh" + "echo \"post install\"\n") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall.sh" + "echo \"pre uninstall\"\n") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall.sh" + "echo \"post uninstall\"\n") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_trans.sh" + "echo \"pre trans\"\n") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_trans.sh" + "echo \"post trans\"\n") + + # specific + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_install_foo.sh" + "echo \"pre install foo\"\n") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_install_foo.sh" + "echo \"post install foo\"\n") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall_foo.sh" + "echo \"pre uninstall foo\"\n") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh" + "echo \"post uninstall foo\"\n") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_trans_foo.sh" + "echo \"pre trans foo\"\n") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_trans_foo.sh" + "echo \"post trans foo\"\n") +endif() install(FILES CMakeLists.txt DESTINATION foo COMPONENT foo) install(FILES CMakeLists.txt DESTINATION bar COMPONENT bar) diff --git a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake index 936e4ed..1dc7084 100644 --- a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake @@ -9,7 +9,7 @@ if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" OR RunCMake_SUBTEST_SUFFIX STREQUAL set(EXPECTED_FILE_2 "single_debuginfo*-headers.rpm") set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") set(EXPECTED_FILE_3 "single_debuginfo*-libs.rpm") - set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/libtest_lib.so") + set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/libtest_lib.so;/empty_dir") 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.*\.debug.*") diff --git a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/test.cmake b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/test.cmake index 60e9038..064539e 100644 --- a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/test.cmake +++ b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/test.cmake @@ -30,6 +30,9 @@ if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo") install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) install(TARGETS test_lib DESTINATION bas COMPONENT libs) + + # test that we correctly handle empty dir in non main component + install(DIRECTORY DESTINATION empty_dir COMPONENT libs) elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component" OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_no_debuginfo") set(CPACK_COMPONENTS_ALL applications) diff --git a/Tests/RunCMake/CPack/tests/THREADED_ALL/test.cmake b/Tests/RunCMake/CPack/tests/THREADED_ALL/test.cmake index 6f37201..af39e5f 100644 --- a/Tests/RunCMake/CPack/tests/THREADED_ALL/test.cmake +++ b/Tests/RunCMake/CPack/tests/THREADED_ALL/test.cmake @@ -1,6 +1,6 @@ install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) -set(CPACK_THREADS 0) +set(CPACK_THREADS "-4") if(PACKAGING_TYPE STREQUAL "COMPONENT") set(CPACK_COMPONENTS_ALL test) diff --git a/Tests/RunCMake/CPackSymlinks/RunCMakeTest.cmake b/Tests/RunCMake/CPackSymlinks/RunCMakeTest.cmake index 439d95e..5a8b7a0 100644 --- a/Tests/RunCMake/CPackSymlinks/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPackSymlinks/RunCMakeTest.cmake @@ -15,6 +15,7 @@ function(run_cpack_symlink_test) run_cmake_command(SrcSymlinksCPack ${CMAKE_CPACK_COMMAND} --config CPackSourceConfig.cmake ) + run_cmake_script(SrcSymlinksCheck) endfunction() run_cpack_symlink_test() diff --git a/Tests/RunCMake/CPackSymlinks/SrcSymlinksCheck.cmake b/Tests/RunCMake/CPackSymlinks/SrcSymlinksCheck.cmake new file mode 100644 index 0000000..0041c92 --- /dev/null +++ b/Tests/RunCMake/CPackSymlinks/SrcSymlinksCheck.cmake @@ -0,0 +1,21 @@ +set(dir ${CMAKE_CURRENT_SOURCE_DIR}) + +set(tarball ${dir}/SrcSymlinks-0.1-Source.tar.gz) +set(extrdir ${dir}/SrcSymlinks-0.1-Source) + +message(STATUS "Extracting ${tarball} in ${dir}...") +execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ${tarball} + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE output + WORKING_DIRECTORY ${dir}) +message(STATUS "result='${result}'") +message(STATUS "output='${output}'") + +if(NOT ${result} EQUAL 0) + message(FATAL_ERROR "Cannot unpack source tarball") +endif() + +if(NOT EXISTS ${extrdir}/dirlink/src.h) + message(FATAL_ERROR "${extrdir}/dirlink/src.h not found") +endif() diff --git a/Tests/RunCMake/CPackSymlinks/SrcSymlinksTar-stdout.txt b/Tests/RunCMake/CPackSymlinks/SrcSymlinksTar-stdout.txt index 24ad124..8b1ae57 100644 --- a/Tests/RunCMake/CPackSymlinks/SrcSymlinksTar-stdout.txt +++ b/Tests/RunCMake/CPackSymlinks/SrcSymlinksTar-stdout.txt @@ -1,7 +1,6 @@ -^x CMakeLists.txt -x cygwin/ -x cygwin/build.sh -x cygwin/setup.patch +^x build.sh +x CMakeLists.txt +x dirlink x include/ x include/src.h x link.h diff --git a/Tests/RunCMake/CPackSymlinks/testcpacksym.tar b/Tests/RunCMake/CPackSymlinks/testcpacksym.tar Binary files differindex a44c656..c24af48 100644 --- a/Tests/RunCMake/CPackSymlinks/testcpacksym.tar +++ b/Tests/RunCMake/CPackSymlinks/testcpacksym.tar diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 6cf1476..afec011 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -202,7 +202,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}) + run_cmake_command(${name} ${CMAKE_CTEST_COMMAND} -VV -j2 --test-load ${load}) endfunction() # Tests for the --test-load feature of ctest @@ -397,3 +397,22 @@ function(run_testDir) run_cmake_command(testDir ${CMAKE_CTEST_COMMAND} --test-dir "${RunCMake_TEST_BINARY_DIR}/sub") endfunction() run_testDir() + +# Test --output-junit +function(run_output_junit) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/output-junit) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " +add_test(test1 \"${CMAKE_COMMAND}\" -E false) +add_test(test2 \"${CMAKE_COMMAND}\" -E echo \"hello world\") +add_test(test3 \"${CMAKE_COMMAND}\" -E true) +set_tests_properties(test3 PROPERTIES DISABLED \"ON\") +add_test(test4 \"${CMAKE_COMMAND}/doesnt_exist\") +add_test(test5 \"${CMAKE_COMMAND}\" -E echo \"please skip\") +set_tests_properties(test5 PROPERTIES SKIP_REGULAR_EXPRESSION \"please skip\") +") + run_cmake_command(output-junit ${CMAKE_CTEST_COMMAND} --output-junit "${RunCMake_TEST_BINARY_DIR}/junit.xml") +endfunction() +run_output_junit() diff --git a/Tests/RunCMake/CTestCommandLine/output-junit-check.cmake b/Tests/RunCMake/CTestCommandLine/output-junit-check.cmake new file mode 100644 index 0000000..b270fdf --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/output-junit-check.cmake @@ -0,0 +1,36 @@ +file(GLOB junit_xml_file "${RunCMake_TEST_BINARY_DIR}/junit.xml") +if(junit_xml_file) + file(READ "${junit_xml_file}" junit_xml LIMIT 4096) + if(NOT "${junit_xml}" MATCHES "tests=\"5\"") + set(RunCMake_TEST_FAILED "tests=\"5\" not found when expected") + endif() + if(NOT "${junit_xml}" MATCHES "failures=\"1\"") + set(RunCMake_TEST_FAILED "failures=\"1\" not found when expected") + endif() + if(NOT "${junit_xml}" MATCHES "disabled=\"1\"") + set(RunCMake_TEST_FAILED "disabled=\"1\" not found when expected") + endif() + if(NOT "${junit_xml}" MATCHES "skipped=\"2\"") + set(RunCMake_TEST_FAILED "skipped=\"2\" not found when expected") + endif() + if(NOT "${junit_xml}" MATCHES "<system-out>hello world") + set(RunCMake_TEST_FAILED "<system-out>hello world not found when expected") + endif() + if(NOT "${junit_xml}" MATCHES "<system-out>Disabled") + set(RunCMake_TEST_FAILED "<system-out>Disabled not found when expected") + endif() + if(NOT "${junit_xml}" MATCHES "<skipped message=\"Unable to find executable\"/>") + set(RunCMake_TEST_FAILED "<skipped message=\"Unable to find executable\"/> not found when expected") + endif() + if(NOT "${junit_xml}" MATCHES "<system-out>Unable to find executable:") + set(RunCMake_TEST_FAILED "<system-out>Unable to find executable: not found when expected") + endif() + if(NOT "${junit_xml}" MATCHES "<skipped message=\"SKIP_REGULAR_EXPRESSION_MATCHED\"/>") + set(RunCMake_TEST_FAILED "<skipped message=\"SKIP_REGULAR_EXPRESSION_MATCHED\"/> not found when expected") + endif() + if(NOT "${junit_xml}" MATCHES "<system-out>please skip") + set(RunCMake_TEST_FAILED "<system-out>please skip not found when expected") + endif() +else() + set(RunCMake_TEST_FAILED "junit.xml not found") +endif() diff --git a/Tests/RunCMake/CTestCommandLine/output-junit-result.txt b/Tests/RunCMake/CTestCommandLine/output-junit-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/output-junit-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/CTestCommandLine/output-junit-stderr.txt b/Tests/RunCMake/CTestCommandLine/output-junit-stderr.txt new file mode 100644 index 0000000..ce30dc8 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/output-junit-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: .*doesnt_exist diff --git a/Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt index 7ee3dae..5101985 100644 --- a/Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt +++ b/Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt @@ -1,7 +1,20 @@ -^Test project .*/Tests/RunCMake/CTestCommandLine/TestLoad +Test project [^ +]*/Tests/RunCMake/CTestCommandLine/TestLoad( +[^*][^ +]*)* +test 1 Start 1: TestLoad1 ++( +[^*][^ +]*)* +test 2 Start 2: TestLoad2 -1/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec ++( +[^*][^ +]*)* +1/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec( +[^*][^ +]*)* 2/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec + 100% tests passed, 0 tests failed out of 2 diff --git a/Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt index 7ee3dae..5101985 100644 --- a/Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt +++ b/Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt @@ -1,7 +1,20 @@ -^Test project .*/Tests/RunCMake/CTestCommandLine/TestLoad +Test project [^ +]*/Tests/RunCMake/CTestCommandLine/TestLoad( +[^*][^ +]*)* +test 1 Start 1: TestLoad1 ++( +[^*][^ +]*)* +test 2 Start 2: TestLoad2 -1/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec ++( +[^*][^ +]*)* +1/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec( +[^*][^ +]*)* 2/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec + 100% tests passed, 0 tests failed out of 2 diff --git a/Tests/RunCMake/CTestCommandLine/test-load-wait-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-wait-stdout.txt index 11a768a..db7d7f3 100644 --- a/Tests/RunCMake/CTestCommandLine/test-load-wait-stdout.txt +++ b/Tests/RunCMake/CTestCommandLine/test-load-wait-stdout.txt @@ -1,8 +1,21 @@ -^Test project .*/Tests/RunCMake/CTestCommandLine/TestLoad +Test project [^ +]*/Tests/RunCMake/CTestCommandLine/TestLoad( +[^*][^ +]*)* \*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 3, Smallest test TestLoad[1-2] requires 1\*\*\*\*\* +test 1 Start 1: TestLoad1 ++( +[^*][^ +]*)* +test 2 Start 2: TestLoad2 -1/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec ++( +[^*][^ +]*)* +1/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec( +[^*][^ +]*)* 2/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec + 100% tests passed, 0 tests failed out of 2 diff --git a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt index c76c92d..3df3e52 100644 --- a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt +++ b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt @@ -1 +1 @@ -^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":2}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]},{"kind":"toolchains","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":false,"version":{.*}}$ +^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":3}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]},{"kind":"toolchains","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":false,"version":{.*}}$ diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-stderr.txt b/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-stderr.txt index 21e60ee..63a10d8 100644 --- a/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-stderr.txt +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-no-directory-stderr.txt @@ -1 +1 @@ -^CMake Error: failed to create link .* no such file or directory +^CMake Error: failed to create link '[^']+': [A-Za-z] diff --git a/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-prereq-check.cmake b/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-prereq-check.cmake index 5b97aec..d92554a 100644 --- a/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-prereq-check.cmake +++ b/Tests/RunCMake/CommandLine/E_create_hardlink-unresolved-symlink-prereq-check.cmake @@ -1,3 +1,3 @@ -if(${actual_stderr_var} MATCHES "operation not permitted") +if(${actual_stderr_var} MATCHES "A required privilege is not held by the client") unset(msg) endif() diff --git a/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake b/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake index 5df5f2f..43573bf 100644 --- a/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake +++ b/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake @@ -1,4 +1,4 @@ -if(${actual_stderr_var} MATCHES "operation not permitted") +if(${actual_stderr_var} MATCHES "A required privilege is not held by the client") unset(msg) else() if(NOT IS_SYMLINK ${RunCMake_TEST_BINARY_DIR}/L) diff --git a/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake b/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake index d37df01..639c223 100644 --- a/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake +++ b/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake @@ -1,4 +1,4 @@ -if(${actual_stderr_var} MATCHES "operation not permitted") +if(${actual_stderr_var} MATCHES "A required privilege is not held by the client") unset(msg) else() if(NOT IS_DIRECTORY ${RunCMake_TEST_BINARY_DIR}/L) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index caf3c88..2eb8784 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -69,6 +69,8 @@ run_cmake_command(build-bad-dir run_cmake_command(build-bad-generator ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-generator) +run_cmake_command(install-prefix-no-arg ${CMAKE_COMMAND} -B DummyBuildDir --install-prefix) + run_cmake_command(install-no-dir ${CMAKE_COMMAND} --install) run_cmake_command(install-bad-dir @@ -162,6 +164,29 @@ project(ExplicitDirsMissing LANGUAGES NONE) endfunction() run_ExplicitDirs() +function(run_Toolchain) + set(RunCMake_TEST_NO_SOURCE_DIR 1) + set(source_dir ${RunCMake_SOURCE_DIR}/Toolchain) + + run_cmake_with_options(toolchain-no-arg -S ${source_dir} --toolchain=) + run_cmake_with_options(toolchain-valid-abs-path -S ${source_dir} --toolchain "${source_dir}/toolchain.cmake") + run_cmake_with_options(toolchain-valid-rel-src-path -S ${source_dir} --toolchain=toolchain.cmake) + + set(RunCMake_TEST_NO_CLEAN 1) + set(binary_dir ${RunCMake_BINARY_DIR}/Toolchain-build) + set(RunCMake_TEST_BINARY_DIR "${binary_dir}") + file(REMOVE_RECURSE "${binary_dir}") + + # Test that we both search the binary dir for toolchain files, and it takes + # precedence over source dir + file(WRITE ${binary_dir}/toolchain.cmake [=[ +set(CMAKE_SYSTEM_NAME Linux) +set(toolchain_file binary_dir) +]=]) + run_cmake_with_options(toolchain-valid-rel-build-path ${CMAKE_COMMAND} -S ${source_dir} -B ${binary_dir} --toolchain toolchain.cmake) +endfunction() +run_Toolchain() + function(run_BuildDir) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BuildDir-build) @@ -346,7 +371,7 @@ run_cmake_command(E_create_symlink-missing-dir # These tests are special on Windows since it will only fail if the user # running the test does not have the priveldge to create symlinks. If this # happens we clear the msg in the -check.cmake and say that the test passes -set(RunCMake_DEFAULT_stderr "(operation not permitted)?") +set(RunCMake_DEFAULT_stderr "(A required privilege is not held by the client)?") set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/E_create_symlink-broken-build) set(RunCMake_TEST_NO_CLEAN 1) @@ -390,7 +415,7 @@ run_cmake_command(E_create_hardlink-no-directory #On Windows, if the user does not have sufficient privileges #don't fail this test -set(RunCMake_DEFAULT_stderr "(operation not permitted)?") +set(RunCMake_DEFAULT_stderr "(A required privilege is not held by the client)?") run_cmake_command(E_create_hardlink-unresolved-symlink-prereq ${CMAKE_COMMAND} -E create_symlink ${dir}/1 ${dir}/1-symlink ) @@ -549,7 +574,7 @@ file(MAKE_DIRECTORY ${out}) run_cmake_command(E_cat_non_existing_file ${CMAKE_COMMAND} -E cat ${out}/non-existing-file.txt) -if(UNIX) +if(UNIX AND NOT MSYS) # test non readable file only if not root execute_process( COMMAND id -u $ENV{USER} @@ -788,7 +813,7 @@ function(reject_fifo) run_cmake_command(reject_fifo ${BASH_EXECUTABLE} -c ${BASH_COMMAND_ARGUMENT}) endif() endfunction() -if(CMAKE_HOST_UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "CYGWIN") +if(CMAKE_HOST_UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "CYGWIN" AND NOT CMAKE_SYSTEM_NAME STREQUAL "MSYS") reject_fifo() run_cmake_command(closed_stdin sh -c "\"${CMAKE_COMMAND}\" --version <&-") run_cmake_command(closed_stdout sh -c "\"${CMAKE_COMMAND}\" --version >&-") diff --git a/Tests/RunCMake/CommandLine/Toolchain/CMakeLists.txt b/Tests/RunCMake/CommandLine/Toolchain/CMakeLists.txt new file mode 100644 index 0000000..80d42b8 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Toolchain/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.20) +project(Toolchain LANGUAGES NONE) +message(FATAL_ERROR "${toolchain_file}") diff --git a/Tests/RunCMake/CommandLine/Toolchain/toolchain.cmake b/Tests/RunCMake/CommandLine/Toolchain/toolchain.cmake new file mode 100644 index 0000000..719556c --- /dev/null +++ b/Tests/RunCMake/CommandLine/Toolchain/toolchain.cmake @@ -0,0 +1,2 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(toolchain_file source_dir) diff --git a/Tests/RunCMake/CommandLine/build-invalid-target-syntax-stderr.txt b/Tests/RunCMake/CommandLine/build-invalid-target-syntax-stderr.txt index 5fe2539..fa3adc8 100644 --- a/Tests/RunCMake/CommandLine/build-invalid-target-syntax-stderr.txt +++ b/Tests/RunCMake/CommandLine/build-invalid-target-syntax-stderr.txt @@ -1,2 +1 @@ -^CMake Error: '--target=invalid' is invalid syntax for --target -Usage: cmake --build \[<dir> \| --preset <preset>\] \[options\] \[-- \[native-options\]\] +^Error: could not load cache diff --git a/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-stderr.txt b/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-stderr.txt index d69338a..e4ad6b2 100644 --- a/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-stderr.txt +++ b/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-stderr.txt @@ -1,2 +1,2 @@ -^CMake Error: '--targetinvalid' is invalid syntax for --target +^Unknown argument --targetinvalid Usage: cmake --build \[<dir> \| --preset <preset>\] \[options\] \[-- \[native-options\]\] diff --git a/Tests/RunCMake/CommandLine/install-prefix-no-arg-result.txt b/Tests/RunCMake/CommandLine/install-prefix-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-prefix-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/install-prefix-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/install-prefix-no-arg-stderr.txt new file mode 100644 index 0000000..a464c70 --- /dev/null +++ b/Tests/RunCMake/CommandLine/install-prefix-no-arg-stderr.txt @@ -0,0 +1 @@ +^CMake Error: No install directory specified for --install-prefix diff --git a/Tests/RunCMake/CommandLine/toolchain-no-arg-result.txt b/Tests/RunCMake/CommandLine/toolchain-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/toolchain-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/toolchain-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/toolchain-no-arg-stderr.txt new file mode 100644 index 0000000..2fec517 --- /dev/null +++ b/Tests/RunCMake/CommandLine/toolchain-no-arg-stderr.txt @@ -0,0 +1 @@ +^CMake Error: No file specified for --toolchain diff --git a/Tests/RunCMake/CommandLine/toolchain-valid-abs-path-result.txt b/Tests/RunCMake/CommandLine/toolchain-valid-abs-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/toolchain-valid-abs-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/toolchain-valid-abs-path-stderr.txt b/Tests/RunCMake/CommandLine/toolchain-valid-abs-path-stderr.txt new file mode 100644 index 0000000..21d5db6 --- /dev/null +++ b/Tests/RunCMake/CommandLine/toolchain-valid-abs-path-stderr.txt @@ -0,0 +1 @@ +^CMake Error.*source_dir diff --git a/Tests/RunCMake/CommandLine/toolchain-valid-rel-build-path-result.txt b/Tests/RunCMake/CommandLine/toolchain-valid-rel-build-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/toolchain-valid-rel-build-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/toolchain-valid-rel-build-path-stderr.txt b/Tests/RunCMake/CommandLine/toolchain-valid-rel-build-path-stderr.txt new file mode 100644 index 0000000..1980051 --- /dev/null +++ b/Tests/RunCMake/CommandLine/toolchain-valid-rel-build-path-stderr.txt @@ -0,0 +1 @@ +^CMake Error.*binary_dir diff --git a/Tests/RunCMake/CommandLine/toolchain-valid-rel-src-path-result.txt b/Tests/RunCMake/CommandLine/toolchain-valid-rel-src-path-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/toolchain-valid-rel-src-path-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/toolchain-valid-rel-src-path-stderr.txt b/Tests/RunCMake/CommandLine/toolchain-valid-rel-src-path-stderr.txt new file mode 100644 index 0000000..21d5db6 --- /dev/null +++ b/Tests/RunCMake/CommandLine/toolchain-valid-rel-src-path-stderr.txt @@ -0,0 +1 @@ +^CMake Error.*source_dir diff --git a/Tests/RunCMake/ExcludeFromAll/RunCMakeTest.cmake b/Tests/RunCMake/ExcludeFromAll/RunCMakeTest.cmake index 2b4fc89..3876ceb 100644 --- a/Tests/RunCMake/ExcludeFromAll/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExcludeFromAll/RunCMakeTest.cmake @@ -13,7 +13,7 @@ function(run_single_config_test label config exclude_from_all_value expectation) run_cmake_command(${case}-build ${CMAKE_COMMAND} --build . --config ${config}) endfunction() -run_single_config_test("explictly not excluded" Debug 0 "should_exist") +run_single_config_test("explicitly not excluded" Debug 0 "should_exist") run_single_config_test("excluded" Debug 1 "should_not_exist") if(RunCMake_GENERATOR MATCHES "^(Xcode|Visual Studio)") diff --git a/Tests/RunCMake/ExternalProject/MultiCommand.cmake b/Tests/RunCMake/ExternalProject/MultiCommand.cmake index dbf67eb..0849658 100644 --- a/Tests/RunCMake/ExternalProject/MultiCommand.cmake +++ b/Tests/RunCMake/ExternalProject/MultiCommand.cmake @@ -1,6 +1,6 @@ include(ExternalProject) -# Verify COMMAND keyword is recognised after various *_COMMAND options +# Verify COMMAND keyword is recognized after various *_COMMAND options ExternalProject_Add(multiCommand DOWNLOAD_COMMAND "${CMAKE_COMMAND}" -E echo "download 1" COMMAND "${CMAKE_COMMAND}" -E echo "download 2" diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateful-check.cmake b/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateful-check.cmake index fb78e87..91cdf7c 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateful-check.cmake +++ b/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateful-check.cmake @@ -4,6 +4,7 @@ set(expect query/client-foo/query.json reply reply/codemodel-v2-[0-9a-f]+\\.json + .* reply/index-[0-9.T-]+\\.json .* ) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateless-check.cmake b/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateless-check.cmake index 7c6a35a..9aa9e4a 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateless-check.cmake +++ b/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateless-check.cmake @@ -4,6 +4,7 @@ set(expect query/client-foo/codemodel-v2 reply reply/codemodel-v2-[0-9a-f]+\\.json + .* reply/index-[0-9.T-]+\\.json .* ) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-SharedStateless-check.cmake b/Tests/RunCMake/FileAPI/codemodel-v2-SharedStateless-check.cmake index cc2f31b..43d1a0b 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-SharedStateless-check.cmake +++ b/Tests/RunCMake/FileAPI/codemodel-v2-SharedStateless-check.cmake @@ -3,6 +3,7 @@ set(expect query/codemodel-v2 reply reply/codemodel-v2-[0-9a-f]+\\.json + .* reply/index-[0-9.T-]+\\.json .* ) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py index df2410a..b9a1fbf 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py +++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py @@ -12,7 +12,7 @@ def read_codemodel_json_data(filename): def check_objects(o, g): assert is_list(o) assert len(o) == 1 - check_index_object(o[0], "codemodel", 2, 2, check_object_codemodel(g)) + check_index_object(o[0], "codemodel", 2, 3, check_object_codemodel(g)) def check_backtrace(t, b, backtrace): btg = t["backtraceGraph"] @@ -55,7 +55,7 @@ def check_backtraces(t, actual, expected): def check_directory(c): def _check(actual, expected): assert is_dict(actual) - expected_keys = ["build", "source", "projectIndex"] + expected_keys = ["build", "jsonFile", "source", "projectIndex"] assert matches(actual["build"], expected["build"]) assert is_int(actual["projectIndex"]) @@ -92,10 +92,103 @@ def check_directory(c): assert sorted(actual.keys()) == sorted(expected_keys) + assert is_string(actual["jsonFile"]) + filepath = os.path.join(reply_dir, actual["jsonFile"]) + with open(filepath) as f: + d = json.load(f) + + assert is_dict(d) + assert sorted(d.keys()) == ["backtraceGraph", "installers", "paths"] + + assert is_string(d["paths"]["source"], actual["source"]) + assert is_string(d["paths"]["build"], actual["build"]) + + check_backtrace_graph(d["backtraceGraph"]) + + assert is_list(d["installers"]) + assert len(d["installers"]) == len(expected["installers"]) + for a, e in zip(d["installers"], expected["installers"]): + assert is_dict(a) + expected_keys = ["component", "type"] + + assert is_string(a["component"], e["component"]) + assert is_string(a["type"], e["type"]) + + if e["destination"] is not None: + expected_keys.append("destination") + assert is_string(a["destination"], e["destination"]) + + if e["paths"] is not None: + expected_keys.append("paths") + assert is_list(a["paths"]) + assert len(a["paths"]) == len(e["paths"]) + + for ap, ep in zip(a["paths"], e["paths"]): + if is_string(ep): + assert matches(ap, ep) + else: + assert is_dict(ap) + assert sorted(ap.keys()) == ["from", "to"] + assert matches(ap["from"], ep["from"]) + assert matches(ap["to"], ep["to"]) + + if e["isExcludeFromAll"] is not None: + expected_keys.append("isExcludeFromAll") + assert is_bool(a["isExcludeFromAll"], e["isExcludeFromAll"]) + + if e["isForAllComponents"] is not None: + expected_keys.append("isForAllComponents") + assert is_bool(a["isForAllComponents"], e["isForAllComponents"]) + + if e["isOptional"] is not None: + expected_keys.append("isOptional") + assert is_bool(a["isOptional"], e["isOptional"]) + + if e["targetId"] is not None: + expected_keys.append("targetId") + assert matches(a["targetId"], e["targetId"]) + + if e["targetIndex"] is not None: + expected_keys.append("targetIndex") + assert is_int(a["targetIndex"]) + assert c["targets"][a["targetIndex"]]["name"] == e["targetIndex"] + + if e["targetIsImportLibrary"] is not None: + expected_keys.append("targetIsImportLibrary") + assert is_bool(a["targetIsImportLibrary"], e["targetIsImportLibrary"]) + + if e["targetInstallNamelink"] is not None: + expected_keys.append("targetInstallNamelink") + assert is_string(a["targetInstallNamelink"], e["targetInstallNamelink"]) + + if e["exportName"] is not None: + expected_keys.append("exportName") + assert is_string(a["exportName"], e["exportName"]) + + if e["exportTargets"] is not None: + expected_keys.append("exportTargets") + assert is_list(a["exportTargets"]) + assert len(a["exportTargets"]) == len(e["exportTargets"]) + for at, et in zip(a["exportTargets"], e["exportTargets"]): + assert is_dict(at) + assert sorted(at.keys()) == ["id", "index"] + assert matches(at["id"], et["id"]) + assert is_int(at["index"]) + assert c["targets"][at["index"]]["name"] == et["index"] + + if e["scriptFile"] is not None: + expected_keys.append("scriptFile") + assert is_string(a["scriptFile"], e["scriptFile"]) + + if e["backtrace"] is not None: + expected_keys.append("backtrace") + check_backtrace(d, a["backtrace"], e["backtrace"]) + + assert sorted(a.keys()) == sorted(expected_keys) + return _check -def check_target_backtrace_graph(t): - btg = t["backtraceGraph"] +def check_backtrace_graph(btg): assert is_dict(btg) assert sorted(btg.keys()) == ["commands", "files", "nodes"] assert is_list(btg["commands"]) @@ -148,7 +241,7 @@ def check_target(c): assert is_string(obj["name"], expected["name"]) assert matches(obj["id"], expected["id"]) assert is_string(obj["type"], expected["type"]) - check_target_backtrace_graph(obj) + check_backtrace_graph(obj["backtraceGraph"]) assert is_dict(obj["paths"]) assert sorted(obj["paths"].keys()) == ["build", "source"] @@ -543,6 +636,20 @@ def gen_check_directories(c, g): for e in expected: e["targetIds"] = filter_list(lambda t: not matches(t, "^\\^(ALL_BUILD|ZERO_CHECK)"), e["targetIds"]) + if sys.platform in ("win32", "cygwin", "msys") or "aix" in sys.platform: + for e in expected: + e["installers"] = list(filter(lambda i: i["targetInstallNamelink"] is None or i["targetInstallNamelink"] == "skip", e["installers"])) + for i in e["installers"]: + i["targetInstallNamelink"] = None + + if sys.platform not in ("win32", "cygwin", "msys"): + for e in expected: + e["installers"] = list(filter(lambda i: "_dllExtra" not in i or not i["_dllExtra"], e["installers"])) + if "aix" not in sys.platform: + for i in e["installers"]: + if "pathsNamelink" in i: + i["paths"] = i["pathsNamelink"] + return expected def check_directories(c, g): @@ -705,6 +812,13 @@ def gen_check_targets(c, g, inSource): if sys.platform not in ("win32", "cygwin", "msys"): for e in expected: e["artifacts"] = filter_list(lambda a: not a["_dllExtra"], e["artifacts"]) + if e["install"] is not None: + e["install"]["destinations"] = filter_list(lambda d: "_dllExtra" not in d or not d["_dllExtra"], e["install"]["destinations"]) + + else: + for e in expected: + if e["install"] is not None: + e["install"]["destinations"] = filter_list(lambda d: "_namelink" not in d or not d["_namelink"], e["install"]["destinations"]) if "aix" not in sys.platform: for e in expected: diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json index 9f0c48a..6514910 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json @@ -11,5 +11,6 @@ ], "projectName": "Alias", "minimumCMakeVersion": "3.12", - "hasInstallRule": null + "hasInstallRule": null, + "installers": [] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json index afd41f3..c89e4f9 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json @@ -11,5 +11,6 @@ ], "projectName": "Custom", "minimumCMakeVersion": "3.12", - "hasInstallRule": null + "hasInstallRule": null, + "installers": [] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json index a51b6eb..7168306 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json @@ -17,5 +17,6 @@ ], "projectName": "Cxx", "minimumCMakeVersion": "3.12", - "hasInstallRule": null + "hasInstallRule": null, + "installers": [] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json index afbd43a..8509f08 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json @@ -8,5 +8,6 @@ "targetIds": null, "projectName": "codemodel-v2", "minimumCMakeVersion": "3.12", - "hasInstallRule": null + "hasInstallRule": null, + "installers": [] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json index 3737ad5..27184cd 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json @@ -6,5 +6,6 @@ "targetIds": null, "projectName": "codemodel-v2", "minimumCMakeVersion": "3.12", - "hasInstallRule": null + "hasInstallRule": null, + "installers": [] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json index 521e3c7..6d2952d 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json @@ -10,5 +10,71 @@ ], "projectName": "External", "minimumCMakeVersion": "3.12", - "hasInstallRule": null + "hasInstallRule": true, + "installers": [ + { + "component": "Unspecified", + "type": "directory", + "destination": "dir3", + "paths": [ + "^.*/Tests/RunCMake/FileAPIExternalSource/\\.$" + ], + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": null, + "targetId": null, + "targetIndex": null, + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": 15, + "command": "install", + "hasParent": true + }, + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "component": "Unspecified", + "type": "directory", + "destination": "dir4", + "paths": [ + "^.*/Tests/RunCMake/FileAPIExternalSource$" + ], + "isExcludeFromAll": true, + "isForAllComponents": null, + "isOptional": null, + "targetId": null, + "targetIndex": null, + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "backtrace": [ + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": 16, + "command": "install", + "hasParent": true + }, + { + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json index a41b79b..d127274 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json @@ -14,5 +14,6 @@ ], "projectName": "Imported", "minimumCMakeVersion": "3.12", - "hasInstallRule": null + "hasInstallRule": null, + "installers": [] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json index b10d496..90664dc 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json @@ -10,5 +10,6 @@ ], "projectName": "Interface", "minimumCMakeVersion": "3.12", - "hasInstallRule": null + "hasInstallRule": null, + "installers": [] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/object.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/object.json index 1e647ad..44bc725 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/object.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/object.json @@ -13,5 +13,71 @@ ], "projectName": "Object", "minimumCMakeVersion": "3.13", - "hasInstallRule": true + "hasInstallRule": true, + "installers": [ + { + "component": "Unspecified", + "type": "target", + "destination": "bin", + "paths": [ + "^object/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?c_object_exe(\\.exe)?$" + ], + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": null, + "targetId": "^c_object_exe::@5ed5358f70faf8d8af7a$", + "targetIndex": "c_object_exe", + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": 13, + "command": "install", + "hasParent": true + }, + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "component": "Unspecified", + "type": "target", + "destination": "bin", + "paths": [ + "^object/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?cxx_object_exe(\\.exe)?$" + ], + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": null, + "targetId": "^cxx_object_exe::@5ed5358f70faf8d8af7a$", + "targetIndex": "cxx_object_exe", + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": 13, + "command": "install", + "hasParent": true + }, + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json index 736d1f5..99287fb 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json @@ -25,5 +25,603 @@ ], "projectName": "codemodel-v2", "minimumCMakeVersion": "3.12", - "hasInstallRule": true + "hasInstallRule": true, + "installers": [ + { + "component": "Tools", + "type": "target", + "destination": "bin", + "paths": [ + "^cxx/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?cxx_exe(\\.exe)?$" + ], + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": null, + "targetId": "^cxx_exe::@a56b12a3f5c0529fb296$", + "targetIndex": "cxx_exe", + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 38, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "component": "Unspecified", + "type": "target", + "destination": "lib", + "paths": [ + "^((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib)?c_shared_lib\\.(lib|dll\\.a)$" + ], + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": null, + "targetId": "^c_shared_lib::@6890427a1f51a3e7e1df$", + "targetIndex": "c_shared_lib", + "targetIsImportLibrary": true, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "_dllExtra": true, + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 41, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "component": "Unspecified", + "type": "target", + "destination": "lib", + "paths": [ + "^lib/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib|cyg|msys-)?c_shared_lib(-1)?\\.(dll|so)$" + ], + "pathsNamelink": [ + "^lib/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib)?c_shared_lib\\.(so\\.1\\.2\\.3|1\\.2\\.3\\.dylib)$", + "^lib/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib)?c_shared_lib\\.(so\\.1|1\\.dylib)$" + ], + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": null, + "targetId": "^c_shared_lib::@6890427a1f51a3e7e1df$", + "targetIndex": "c_shared_lib", + "targetIsImportLibrary": null, + "targetInstallNamelink": "skip", + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 41, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "component": "Unspecified", + "type": "target", + "destination": "lib", + "paths": [ + "^cxx/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib)?cxx_shared_lib\\.(lib|dll\\.a)$" + ], + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": null, + "targetId": "^cxx_shared_lib::@a56b12a3f5c0529fb296$", + "targetIndex": "cxx_shared_lib", + "targetIsImportLibrary": true, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "_dllExtra": true, + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 41, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "component": "Unspecified", + "type": "target", + "destination": "lib", + "paths": [ + "^cxx/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib|cyg|msys-)?cxx_shared_lib\\.(dll|so|dylib)$" + ], + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": null, + "targetId": "^cxx_shared_lib::@a56b12a3f5c0529fb296$", + "targetIndex": "cxx_shared_lib", + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 41, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "component": "Unspecified", + "type": "target", + "destination": "lib", + "paths": [ + "^lib/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib)?c_shared_lib\\.(dll|so|dylib)$" + ], + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": null, + "targetId": "^c_shared_lib::@6890427a1f51a3e7e1df$", + "targetIndex": "c_shared_lib", + "targetIsImportLibrary": null, + "targetInstallNamelink": "only", + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 46, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "component": "Unspecified", + "type": "file", + "destination": "include", + "paths": [ + { + "from": "^empty\\.h$", + "to": "^empty-renamed\\.h$" + } + ], + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": true, + "targetId": null, + "targetIndex": null, + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 48, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "component": "Unspecified", + "type": "file", + "destination": "include", + "paths": [ + "^codemodel-v2\\.cmake$", + "^empty\\.h$" + ], + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": null, + "targetId": null, + "targetIndex": null, + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 49, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "component": "Unspecified", + "type": "directory", + "destination": "dir1", + "paths": [ + "^\\.$", + "^dir$", + { + "from": "^cxx$", + "to": "^\\.$" + } + ], + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": true, + "targetId": null, + "targetIndex": null, + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 50, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "component": "Unspecified", + "type": "directory", + "destination": "dir2", + "paths": [ + { + "from": "^\\.$", + "to": "^FileAPI$" + }, + "^dir$", + { + "from": "^cxx$", + "to": "^\\.$" + } + ], + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": null, + "targetId": null, + "targetIndex": null, + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 51, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "component": "Unspecified", + "type": "export", + "destination": "lib/cmake/foo", + "paths": [ + "^CMakeFiles/Export/lib/cmake/foo/FooTargets\\.cmake$" + ], + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": null, + "targetId": null, + "targetIndex": null, + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": "FooTargets", + "exportTargets": [ + { + "id": "^cxx_exe::@a56b12a3f5c0529fb296$", + "index": "cxx_exe" + } + ], + "scriptFile": null, + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 52, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "component": "Unspecified", + "type": "script", + "destination": null, + "paths": null, + "isExcludeFromAll": null, + "isForAllComponents": null, + "isOptional": null, + "targetId": null, + "targetIndex": null, + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": "InstallScript.cmake", + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 53, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "component": "Unspecified", + "type": "code", + "destination": null, + "paths": null, + "isExcludeFromAll": null, + "isForAllComponents": true, + "isOptional": null, + "targetId": null, + "targetIndex": null, + "targetIsImportLibrary": null, + "targetInstallNamelink": null, + "exportName": null, + "exportTargets": null, + "scriptFile": null, + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 54, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ] } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json index 176a857..e3a8d0b 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json @@ -90,10 +90,10 @@ } ], "folder": null, - "nameOnDisk": "^(lib|cyg)?c_shared_lib\\.(so|dylib|dll)$", + "nameOnDisk": "^(lib|cyg|msys-)?c_shared_lib(-1)?\\.(so|dylib|dll)$", "artifacts": [ { - "path": "^lib/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg)?c_shared_lib\\.(so|dylib|dll)$", + "path": "^lib/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg|msys-)?c_shared_lib(-1)?\\.(so|dylib|dll)$", "_dllExtra": false }, { @@ -101,13 +101,106 @@ "_dllExtra": true }, { - "path": "^lib/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg)?c_shared_lib\\.pdb$", + "path": "^lib/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg|msys-)?c_shared_lib(-1)?\\.pdb$", "_dllExtra": true } ], "build": "^\\.$", "source": "^\\.$", - "install": null, + "install": { + "prefix": "^(/usr/local|[A-Za-z]:.*/codemodel-v2)$", + "destinations": [ + { + "path": "lib", + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 41, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "lib", + "_dllExtra": true, + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 41, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "lib", + "_namelink": true, + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 46, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ] + }, "link": { "language": "C", "lto": true, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json index 171a4f5..73e8e12 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json @@ -66,10 +66,10 @@ } ], "folder": null, - "nameOnDisk": "^(lib|cyg)?cxx_shared_lib\\.(so|dylib|dll)$", + "nameOnDisk": "^(lib|cyg|msys-)?cxx_shared_lib\\.(so|dylib|dll)$", "artifacts": [ { - "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg)?cxx_shared_lib\\.(so|dylib|dll)$", + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg|msys-)?cxx_shared_lib\\.(so|dylib|dll)$", "_dllExtra": false }, { @@ -77,13 +77,106 @@ "_dllExtra": true }, { - "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg)?cxx_shared_lib\\.pdb$", + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg|msys-)?cxx_shared_lib\\.pdb$", "_dllExtra": true } ], "build": "^cxx$", "source": "^cxx$", - "install": null, + "install": { + "prefix": "^(/usr/local|[A-Za-z]:.*/codemodel-v2)$", + "destinations": [ + { + "path": "lib", + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 41, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "lib", + "_dllExtra": true, + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 41, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + }, + { + "path": "lib", + "_namelink": true, + "backtrace": [ + { + "file": "^codemodel-v2\\.cmake$", + "line": 46, + "command": "install", + "hasParent": true + }, + { + "file": "^codemodel-v2\\.cmake$", + "line": null, + "command": null, + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": 3, + "command": "include", + "hasParent": true + }, + { + "file": "^CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ] + }, "link": { "language": "CXX", "lto": null, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2.cmake b/Tests/RunCMake/FileAPI/codemodel-v2.cmake index 2405954..da928eb 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2.cmake +++ b/Tests/RunCMake/FileAPI/codemodel-v2.cmake @@ -35,4 +35,20 @@ if(_ipo) file(WRITE "${CMAKE_BINARY_DIR}/ipo_enabled.txt" "") endif() -install(TARGETS cxx_exe) +install(TARGETS cxx_exe COMPONENT Tools EXPORT FooTargets) + +set_target_properties(c_shared_lib PROPERTIES VERSION 1.2.3 SOVERSION 1) +install(TARGETS c_shared_lib cxx_shared_lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION lib + LIBRARY DESTINATION lib NAMELINK_SKIP + ) +install(TARGETS c_shared_lib cxx_shared_lib LIBRARY NAMELINK_ONLY) + +install(FILES empty.h TYPE INCLUDE RENAME empty-renamed.h OPTIONAL) +install(FILES codemodel-v2.cmake empty.h DESTINATION include) +install(DIRECTORY . dir cxx/ OPTIONAL DESTINATION dir1) +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/dir" "${CMAKE_CURRENT_SOURCE_DIR}/cxx/" DESTINATION dir2) +install(EXPORT FooTargets DESTINATION lib/cmake/foo) +install(SCRIPT InstallScript.cmake) +install(CODE "message(foo)" ALL_COMPONENTS) diff --git a/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt b/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt index 76235f5..95c803f 100644 --- a/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt +++ b/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt @@ -16,7 +16,7 @@ target_link_libraries(cxx_static_exe PRIVATE cxx_static_lib) target_compile_options(cxx_exe PUBLIC TargetCompileOptions) target_link_options(cxx_exe PUBLIC TargetLinkOptions) -target_link_directories(cxx_exe PUBLIC "${CMAKE_BINARY_DIR}/TargetLinkDir") +target_link_directories(cxx_exe PUBLIC "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/TargetLinkDir>") target_precompile_headers(cxx_exe PUBLIC ../empty.h) diff --git a/Tests/RunCMake/FileAPIExternalSource/CMakeLists.txt b/Tests/RunCMake/FileAPIExternalSource/CMakeLists.txt index b3ca660..2865864 100644 --- a/Tests/RunCMake/FileAPIExternalSource/CMakeLists.txt +++ b/Tests/RunCMake/FileAPIExternalSource/CMakeLists.txt @@ -11,3 +11,6 @@ set_property(SOURCE empty.c PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY target_include_directories(generated_exe SYSTEM PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") target_compile_definitions(generated_exe PRIVATE GENERATED_EXE=1 -DTGT_DUMMY) set_source_files_properties(empty.c PROPERTIES COMPILE_OPTIONS SRC_COMPILE_OPTIONS_DUMMY) + +install(DIRECTORY . DESTINATION dir3) +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} EXCLUDE_FROM_ALL DESTINATION dir4) diff --git a/Tests/RunCMake/File_Generate/CustomFilePermissions.cmake b/Tests/RunCMake/File_Generate/CustomFilePermissions.cmake index 0000ef9..a5e66dc 100644 --- a/Tests/RunCMake/File_Generate/CustomFilePermissions.cmake +++ b/Tests/RunCMake/File_Generate/CustomFilePermissions.cmake @@ -11,5 +11,6 @@ file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$<LOWER_CASE:$<CONFIG>>/custom add_custom_target(checkCustomFilePermissions ALL COMMAND ${CMAKE_COMMAND} -DgeneratedFile=${CMAKE_CURRENT_BINARY_DIR}/$<LOWER_CASE:$<CONFIG>>/customfilepermissions.txt + -DMSYS=${MSYS} -P "${CMAKE_CURRENT_SOURCE_DIR}/CustomFilePermissionsVerify.cmake" ) diff --git a/Tests/RunCMake/File_Generate/CustomFilePermissionsVerify.cmake b/Tests/RunCMake/File_Generate/CustomFilePermissionsVerify.cmake index a87e916..2ef3281 100644 --- a/Tests/RunCMake/File_Generate/CustomFilePermissionsVerify.cmake +++ b/Tests/RunCMake/File_Generate/CustomFilePermissionsVerify.cmake @@ -2,7 +2,7 @@ if(NOT EXISTS "${generatedFile}") message(SEND_ERROR "Missing file:\n ${generatedFile}") endif() -if (UNIX) +if (UNIX AND NOT MSYS) find_program(STAT_EXECUTABLE NAMES stat) if(NOT STAT_EXECUTABLE) return() diff --git a/Tests/RunCMake/File_Generate/NoSourcePermissionsVerify.cmake b/Tests/RunCMake/File_Generate/NoSourcePermissionsVerify.cmake index 7981ccc..5e5b16a 100644 --- a/Tests/RunCMake/File_Generate/NoSourcePermissionsVerify.cmake +++ b/Tests/RunCMake/File_Generate/NoSourcePermissionsVerify.cmake @@ -2,7 +2,7 @@ if(NOT EXISTS "${generatedFile}") message(SEND_ERROR "Missing generated file:\n ${generatedFile}") endif() -if (UNIX) +if (UNIX AND NOT MSYS) find_program(STAT_EXECUTABLE NAMES stat) if(NOT STAT_EXECUTABLE) return() diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt b/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt index 4c2e35f..4d7370c 100644 --- a/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt +++ b/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt @@ -3,7 +3,7 @@ CMake Error at OutputNameMatchesObjects.cmake:[0-9]+ \(file\): \$<TARGET_OBJECTS:foo> - Objects of target "foo" referenced but is not an allowed library types - \(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT\). + Objects of target "foo" referenced but is not one of the allowed target + types \(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT\). Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/Framework/ImportedFrameworkTest-build-stdout.txt b/Tests/RunCMake/Framework/ImportedFrameworkTest-build-stdout.txt new file mode 100644 index 0000000..bd75ccd --- /dev/null +++ b/Tests/RunCMake/Framework/ImportedFrameworkTest-build-stdout.txt @@ -0,0 +1 @@ +xxx/no/exist/fw\.framework/Versions/A/fwxxx diff --git a/Tests/RunCMake/Framework/ImportedFrameworkTest.cmake b/Tests/RunCMake/Framework/ImportedFrameworkTest.cmake new file mode 100644 index 0000000..42edaea --- /dev/null +++ b/Tests/RunCMake/Framework/ImportedFrameworkTest.cmake @@ -0,0 +1,10 @@ +add_library(fw SHARED IMPORTED) +set_target_properties(fw PROPERTIES + FRAMEWORK TRUE + IMPORTED_LOCATION "/no/exist/fw.framework/Versions/A/fw" + IMPORTED_SONAME "@rpath/fw.framework/Versions/A/fw" + ) + +add_custom_target(print_fw ALL COMMAND + ${CMAKE_COMMAND} -E echo "xxx$<TARGET_SONAME_FILE:fw>xxx" + ) diff --git a/Tests/RunCMake/Framework/RunCMakeTest.cmake b/Tests/RunCMake/Framework/RunCMakeTest.cmake index 6ee61a3..36eaf5c 100644 --- a/Tests/RunCMake/Framework/RunCMakeTest.cmake +++ b/Tests/RunCMake/Framework/RunCMakeTest.cmake @@ -81,3 +81,15 @@ function(framework_multi_config_postfix_test) endfunction() framework_multi_config_postfix_test() + +function(imported_framework_test) + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/ImportedFrameworkTest-build") + set(RunCMake_TEST_NO_CLEAN 1) + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(ImportedFrameworkTest) + run_cmake_command(ImportedFrameworkTest-build ${CMAKE_COMMAND} --build .) +endfunction() + +imported_framework_test() diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-imported-target.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-imported-target.cmake index 40f7c66..7eec527 100644 --- a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-imported-target.cmake +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-imported-target.cmake @@ -58,8 +58,8 @@ set_property (TARGET static3 PROPERTY ARCHIVE_OUTPUT_NAME static3_archive) string (APPEND GENERATE_CONTENT [[ check_value ("TARGET_FILE_BASE_NAME executable all properties" "$<TARGET_FILE_BASE_NAME:exec3>" "exec3_runtime") -check_value ("TARGET_FILE_BASE_NAME shared all properties" "$<TARGET_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_runtime,shared3_library>") -check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_archive,shared3_library>") +check_value ("TARGET_FILE_BASE_NAME shared all properties" "$<TARGET_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN$<SEMICOLON>MSYS>,shared3_runtime,shared3_library>") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN$<SEMICOLON>MSYS>,shared3_archive,shared3_library>") check_value ("TARGET_FILE_BASE_NAME static all properties" "$<TARGET_FILE_BASE_NAME:static3>" "static3_archive") check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:static3>" "static3_archive") ]]) @@ -95,8 +95,8 @@ set_property (TARGET static4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) string (APPEND GENERATE_CONTENT [[ check_value ("TARGET_FILE_BASE_NAME executable all properties + postfix" "$<TARGET_FILE_BASE_NAME:exec4>" "exec4_runtime_postfix") -check_value ("TARGET_FILE_BASE_NAME shared all properties + postfix" "$<TARGET_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_runtime,shared4_library>_postfix") -check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_archive,shared4_library>_postfix") +check_value ("TARGET_FILE_BASE_NAME shared all properties + postfix" "$<TARGET_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN$<SEMICOLON>MSYS>,shared4_runtime,shared4_library>_postfix") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN$<SEMICOLON>MSYS>,shared4_archive,shared4_library>_postfix") check_value ("TARGET_FILE_BASE_NAME static all properties + postfix" "$<TARGET_FILE_BASE_NAME:static4>" "static4_archive_postfix") check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:static4>" "static4_archive_postfix") ]]) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME.cmake index f88d710..1963244 100644 --- a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME.cmake +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME.cmake @@ -72,8 +72,8 @@ set_property (TARGET static3 PROPERTY PDB_NAME static3_pdb) string (APPEND GENERATE_CONTENT [[ check_value ("TARGET_FILE_BASE_NAME executable all properties" "$<TARGET_FILE_BASE_NAME:exec3>" "exec3_runtime") -check_value ("TARGET_FILE_BASE_NAME shared all properties" "$<TARGET_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_runtime,shared3_library>") -check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_archive,shared3_library>") +check_value ("TARGET_FILE_BASE_NAME shared all properties" "$<TARGET_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN$<SEMICOLON>MSYS>,shared3_runtime,shared3_library>") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN$<SEMICOLON>MSYS>,shared3_archive,shared3_library>") check_value ("TARGET_FILE_BASE_NAME static all properties" "$<TARGET_FILE_BASE_NAME:static3>" "static3_archive") check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:static3>" "static3_archive") ]]) @@ -118,8 +118,8 @@ set_property (TARGET static4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) string (APPEND GENERATE_CONTENT [[ check_value ("TARGET_FILE_BASE_NAME executable all properties + postfix" "$<TARGET_FILE_BASE_NAME:exec4>" "exec4_runtime_postfix") -check_value ("TARGET_FILE_BASE_NAME shared all properties + postfix" "$<TARGET_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_runtime,shared4_library>_postfix") -check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_archive,shared4_library>_postfix") +check_value ("TARGET_FILE_BASE_NAME shared all properties + postfix" "$<TARGET_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN$<SEMICOLON>MSYS>,shared4_runtime,shared4_library>_postfix") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN$<SEMICOLON>MSYS>,shared4_archive,shared4_library>_postfix") check_value ("TARGET_FILE_BASE_NAME static all properties + postfix" "$<TARGET_FILE_BASE_NAME:static4>" "static4_archive_postfix") check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:static4>" "static4_archive_postfix") ]]) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-imported-target.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-imported-target.cmake index f52776e..cc9cd5a 100644 --- a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-imported-target.cmake +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-imported-target.cmake @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.14) enable_language (C) -set (win_platforms Windows CYGWIN) +set (win_platforms Windows CYGWIN MSYS) set (GENERATE_CONTENT [[ macro (CHECK_VALUE test_msg value expected) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX.cmake index bef7bbf..edfb40c 100644 --- a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX.cmake +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX.cmake @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.14) enable_language (C) -set (win_platforms Windows CYGWIN) +set (win_platforms Windows CYGWIN MSYS) set (GENERATE_CONTENT [[ macro (CHECK_VALUE test_msg value expected) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-imported-target.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-imported-target.cmake index cefeb86..3ee42a5 100644 --- a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-imported-target.cmake +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-imported-target.cmake @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.14) enable_language (C) -set (win_platforms Windows CYGWIN) +set (win_platforms Windows CYGWIN MSYS) set (GENERATE_CONTENT [[ macro (CHECK_VALUE test_msg value expected) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX.cmake index 39e39fd..1fe75d9 100644 --- a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX.cmake +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX.cmake @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.14) enable_language (C) -set (win_platforms Windows CYGWIN) +set (win_platforms Windows CYGWIN MSYS) set (GENERATE_CONTENT [[ macro (CHECK_VALUE test_msg value expected) diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/CMakeLists.txt new file mode 100644 index 0000000..ab1a20c --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.19) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/RunCMakeTest.cmake new file mode 100644 index 0000000..edc495c --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/RunCMakeTest.cmake @@ -0,0 +1,7 @@ +include(RunCMake) + +run_cmake(TARGET_RUNTIME_DLLS) +run_cmake(TARGET_RUNTIME_DLLS-static) +run_cmake(TARGET_RUNTIME_DLLS-target_link_libraries) +run_cmake(TARGET_RUNTIME_DLLS-target_link_libraries-cycle1) +run_cmake(TARGET_RUNTIME_DLLS-target_link_libraries-cycle2) diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-check.cmake b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-check.cmake new file mode 100644 index 0000000..e19598e --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-check.cmake @@ -0,0 +1,15 @@ +function(check_genex expected actual) + if(NOT expected STREQUAL actual) + string(APPEND RunCMake_TEST_FAILED "Expected DLLs:\n") + foreach(dll IN LISTS expected) + string(APPEND RunCMake_TEST_FAILED " ${dll}\n") + endforeach() + string(APPEND RunCMake_TEST_FAILED "Actual DLLs:\n") + foreach(dll IN LISTS actual) + string(APPEND RunCMake_TEST_FAILED " ${dll}\n") + endforeach() + endif() + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) +endfunction() + +include("${RunCMake_TEST_BINARY_DIR}/dlls.cmake") diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static-result.txt b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static-stderr.txt b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static-stderr.txt new file mode 100644 index 0000000..7ce588a --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TARGET_RUNTIME_DLLS-static\.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<TARGET_RUNTIME_DLLS:static> + + Objects of target "static" referenced but is not one of the allowed target + types \(EXECUTABLE, SHARED, MODULE\)\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static.cmake b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static.cmake new file mode 100644 index 0000000..dc900dd --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-static.cmake @@ -0,0 +1,9 @@ +enable_language(C) + +add_library(static STATIC static.c) +set(condition) +get_property(multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(multi_config) + set(condition CONDITION "$<CONFIG:Debug>") +endif() +file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/dlls.txt" CONTENT "$<TARGET_RUNTIME_DLLS:static>" ${condition}) diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1-result.txt b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1-stderr.txt b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1-stderr.txt new file mode 100644 index 0000000..8cfcf7e --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at TARGET_RUNTIME_DLLS-target_link_libraries-cycle1\.cmake:[0-9]+ \(add_library\): + The SOURCES of "lib1" use a generator expression that depends on the + SOURCES themselves\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1.cmake b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1.cmake new file mode 100644 index 0000000..f19e9e6 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle1.cmake @@ -0,0 +1,4 @@ +enable_language(C) + +add_library(lib1 SHARED lib1.c) +target_link_libraries(lib1 PRIVATE $<TARGET_RUNTIME_DLLS:lib1>) diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2-result.txt b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2-stderr.txt b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2-stderr.txt new file mode 100644 index 0000000..bacbf63 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at TARGET_RUNTIME_DLLS-target_link_libraries-cycle2\.cmake:[0-9]+ \(add_library\): + The SOURCES of "(lib1|lib2)" use a generator expression that depends on the + SOURCES themselves\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2.cmake b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2.cmake new file mode 100644 index 0000000..7d035bd --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries-cycle2.cmake @@ -0,0 +1,6 @@ +enable_language(C) + +add_library(lib1 SHARED lib1.c) +add_library(lib2 SHARED lib2.c) +target_link_libraries(lib1 PRIVATE $<TARGET_RUNTIME_DLLS:lib2>) +target_link_libraries(lib2 PRIVATE $<TARGET_RUNTIME_DLLS:lib1>) diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries.cmake b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries.cmake new file mode 100644 index 0000000..f44dbf4 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS-target_link_libraries.cmake @@ -0,0 +1,5 @@ +enable_language(C) + +add_library(lib1 SHARED lib1.c) +add_library(lib2 SHARED lib2.c) +target_link_libraries(lib1 PRIVATE $<TARGET_RUNTIME_DLLS:lib2>) diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS.cmake b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS.cmake new file mode 100644 index 0000000..806f0b6 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/TARGET_RUNTIME_DLLS.cmake @@ -0,0 +1,37 @@ +enable_language(C) + +add_executable(exe main.c) +add_library(lib1 SHARED lib1.c) +add_library(lib2 SHARED lib2.c) +add_library(lib3 SHARED lib3.c) +add_library(static STATIC static.c) +add_library(imported SHARED IMPORTED) +set_property(TARGET imported PROPERTY IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/imported.dll") +set_property(TARGET imported PROPERTY IMPORTED_IMPLIB "${CMAKE_SOURCE_DIR}/imported.lib") +add_library(imported2 SHARED IMPORTED) +if(NOT WIN32 AND NOT CYGWIN) + set_property(TARGET imported2 PROPERTY IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/imported2.dll") +endif() +set_property(TARGET imported2 PROPERTY IMPORTED_IMPLIB "${CMAKE_SOURCE_DIR}/imported2.lib") + +target_link_libraries(exe PRIVATE lib1 static imported imported2) +target_link_libraries(lib1 PRIVATE lib2) +target_link_libraries(lib1 INTERFACE lib3) + +set(expected_dlls "") +if(WIN32 OR CYGWIN) + set(expected_dlls + "$<TARGET_FILE:lib1>" + "$<TARGET_FILE:imported>" + "$<TARGET_FILE:lib3>" + "$<TARGET_FILE:lib2>" + ) +endif() + +set(content "check_genex(\"${expected_dlls}\" \"$<TARGET_RUNTIME_DLLS:exe>\")\n") +set(condition) +get_property(multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(multi_config) + set(condition CONDITION "$<CONFIG:Debug>") +endif() +file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/dlls.cmake" CONTENT "${content}" ${condition}) diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib1.c b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib1.c new file mode 100644 index 0000000..524b5b2 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib1.c @@ -0,0 +1,12 @@ +#ifdef _WIN32 +__declspec(dllimport) +#endif + extern void lib2(void); + +#ifdef _WIN32 +__declspec(dllexport) +#endif + void lib1(void) +{ + lib2(); +} diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib2.c b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib2.c new file mode 100644 index 0000000..e145117 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib2.c @@ -0,0 +1,6 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + void lib2(void) +{ +} diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib3.c b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib3.c new file mode 100644 index 0000000..5392f7a --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib3.c @@ -0,0 +1,6 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + void lib3(void) +{ +} diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/main.c b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/main.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/main.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/static.c b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/static.c new file mode 100644 index 0000000..7f5dab5 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/static.c @@ -0,0 +1,3 @@ +void static_func(void) +{ +} diff --git a/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp index dcaa4f2..2cfcd8d 100644 --- a/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp +++ b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp @@ -8,6 +8,14 @@ #include "libshared.h" #include "libstatic.h" +static void rtrim(std::string& str, char byte) +{ + size_t const size = str.size(); + if (size && str[size - 1] == byte) { + str.resize(size - 1); + } +} + void compare(const char* refName, const char* testName) { std::ifstream ref; @@ -31,16 +39,14 @@ void compare(const char* refName, const char* testName) // Some very old Borland runtimes (C++ Builder 5 WITHOUT Update 1) add a // trailing null to the string that we need to strip before testing for a // trailing space. - if (refLine.size() && refLine[refLine.size() - 1] == 0) { - refLine.resize(refLine.size() - 1); - } - if (testLine.size() && testLine[testLine.size() - 1] == 0) { - testLine.resize(testLine.size() - 1); - } + rtrim(refLine, 0); + rtrim(testLine, 0); // The reference files never have trailing spaces: - if (testLine.size() && testLine[testLine.size() - 1] == ' ') { - testLine.resize(testLine.size() - 1); - } + rtrim(testLine, ' '); + // Strip trailing CR. LF is not returned by getline, but CR is returned + // on some platforms. + rtrim(refLine, '\r'); + rtrim(testLine, '\r'); if (refLine != testLine) { std::cout << "Ref and test are not the same:\n Ref: \"" << refLine << "\"\n Test: \"" << testLine << "\"\n"; diff --git a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake index 27ede06..83e63f9 100644 --- a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake @@ -11,9 +11,9 @@ else() run_cmake(BadPlatform) endif() -set(RunCMake_GENERATOR_TOOLSET "") +set(RunCMake_GENERATOR_PLATFORM "") -set(RunCMake_TEST_OPTIONS -A "Extra Platform") +set(RunCMake_TEST_OPTIONS -A "Test Platform" -A "Extra Platform") run_cmake(TwoPlatforms) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetCustomFlagTableDir-result.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetCustomFlagTableDir-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetCustomFlagTableDir-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetCustomFlagTableDir-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetCustomFlagTableDir-stderr.txt new file mode 100644 index 0000000..d8b6c5e --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetCustomFlagTableDir-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + Visual Studio [^ +]* + + given toolset + + customFlagTableDir=does_not_exist + + that is not an absolute path to an existing directory.$ diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetCustomFlagTableDir.cmake b/Tests/RunCMake/GeneratorToolset/BadToolsetCustomFlagTableDir.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetCustomFlagTableDir.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt index 5e88e3b..ba7a8f3 100644 --- a/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetXcodeBuildSystem-stderr.txt @@ -7,4 +7,4 @@ CMake Error at CMakeLists.txt:[0-9]+ \(project\): buildsystem=bad - value is unkonwn. It must be '1' or '12'\.$ + value is unknown. It must be '1' or '12'\.$ diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index 5f12d79..faed8f7 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -1,5 +1,11 @@ include(RunCMake) +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012456]") + run_cmake(VsNormal) + include("${RunCMake_BINARY_DIR}/VsNormal-build/defaults.cmake" OPTIONAL) + message(STATUS "VsNormal: platform='${VsNormal_Platform}' toolset='${VsNormal_Toolset}'") +endif() + set(RunCMake_GENERATOR_TOOLSET "") run_cmake(NoToolset) @@ -12,8 +18,31 @@ if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012456]") run_cmake(TestToolsetCudaVersionOnly) set(RunCMake_GENERATOR_TOOLSET "cuda=0.0") run_cmake(TestToolsetCudaVersionOnly) - set(RunCMake_GENERATOR_TOOLSET "cuda=C:\\dummy\\cuda") + set(RunCMake_GENERATOR_TOOLSET "cuda=${CMAKE_CURRENT_BINARY_DIR}/CudaStandaloneToolset") run_cmake(TestToolsetCudaPathOnly) + set(RunCMake_GENERATOR_TOOLSET "cuda=${CMAKE_CURRENT_BINARY_DIR}/CudaStandaloneToolset") + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/CudaStandaloneToolset/CUDAVisualStudioIntegration") + run_cmake(TestToolsetCudaPathOnlyOldLayout) + file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/CudaStandaloneToolset") + if (VsNormal_Platform MATCHES "^(x64|Win32)$" AND + EXISTS "${CMAKE_ROOT}/Templates/MSBuild/FlagTables/${VsNormal_Toolset}_CL.json") + set(flagTableDir "${RunCMake_BINARY_DIR}/FlagTables") + file(READ "${CMAKE_ROOT}/Templates/MSBuild/FlagTables/${VsNormal_Toolset}_CL.json" flagTableContent) + string(REPLACE [["WX-"]] [["TESTWX-"]] flagTableContent "${flagTableContent}") + file(REMOVE_RECURSE "${flagTableDir}") + file(WRITE "${flagTableDir}/${VsNormal_Platform}_${VsNormal_Toolset}_CL.json" "${flagTableContent}") + set(RunCMake_GENERATOR_TOOLSET "${VsNormal_Toolset},customFlagTableDir=${flagTableDir}") + set(RunCMake_TEST_VARIANT_DESCRIPTION ":${VsNormal_Platform}_${VsNormal_Toolset}_CL.json") + run_cmake(TestToolsetCustomFlagTableDir) + file(REMOVE_RECURSE "${flagTableDir}") + file(WRITE "${flagTableDir}/${VsNormal_Platform}_CL.json" "${flagTableContent}") + set(RunCMake_GENERATOR_TOOLSET "${VsNormal_Toolset},customFlagTableDir=${flagTableDir}") + set(RunCMake_TEST_VARIANT_DESCRIPTION ":${VsNormal_Platform}_CL.json") + run_cmake(TestToolsetCustomFlagTableDir) + unset(RunCMake_TEST_VARIANT_DESCRIPTION) + set(RunCMake_GENERATOR_TOOLSET "${VsNormal_Toolset},customFlagTableDir=does_not_exist") + run_cmake(BadToolsetCustomFlagTableDir) + endif() if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[2456]") set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64") run_cmake(TestToolsetHostArchBoth) @@ -76,7 +105,7 @@ endif() set(RunCMake_GENERATOR_TOOLSET "") -set(RunCMake_TEST_OPTIONS -T "Extra Toolset") +set(RunCMake_TEST_OPTIONS -T "Test Toolset" -T "Extra Toolset") run_cmake(TwoToolsets) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-stderr.txt index b17745f..5236787 100644 --- a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-stderr.txt +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-stderr.txt @@ -5,8 +5,8 @@ CMake Error at CMakeLists.txt:[0-9]+ \(project\): given toolset - cuda=C:\\dummy\\cuda\\ + cuda=.*/Tests/RunCMake/CudaStandaloneToolset\\ cannot detect Visual Studio integration files in path - C:/dummy/cuda/CUDAVisualStudioIntegration/extras/visual_studio_integration/MSBuildExtensions + .*/Tests/RunCMake/CudaStandaloneToolset/extras/visual_studio_integration/MSBuildExtensions diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnlyOldLayout-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnlyOldLayout-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnlyOldLayout-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnlyOldLayout-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnlyOldLayout-stderr.txt new file mode 100644 index 0000000..3ce79f8 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnlyOldLayout-stderr.txt @@ -0,0 +1,12 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + Visual Studio .* + + given toolset + + cuda=.*/Tests/RunCMake/CudaStandaloneToolset\\ + + cannot detect Visual Studio integration files in path + + .*/Tests/RunCMake/CudaStandaloneToolset/CUDAVisualStudioIntegration/extras/visual_studio_integration/MSBuildExtensions diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnlyOldLayout.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnlyOldLayout.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnlyOldLayout.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCustomFlagTableDir-check.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetCustomFlagTableDir-check.cmake new file mode 100644 index 0000000..79752b1 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCustomFlagTableDir-check.cmake @@ -0,0 +1,24 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/main.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file\n ${vcProjectFile}\ndoes not exist.") + return() +endif() + +set(TreatWarningAsError_FOUND FALSE) +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<TreatWarningAsError>([^<>]*)</TreatWarningAsError>$") + set(TreatWarningAsError_FOUND TRUE) + set(expectedValue "false") + set(actualValue "${CMAKE_MATCH_1}") + if(NOT (${actualValue} STREQUAL ${expectedValue})) + set(RunCMake_TEST_FAILED "TreatWarningAsError \"${actualValue}\" differs from expected value \"${expectedValue}\".") + return() + endif() + endif() +endforeach() + +if(NOT TreatWarningAsError_FOUND) + set(RunCMake_TEST_FAILED "Property TreatWarningAsError not found in project file:\n ${vcProjectFile}.") + return() +endif() diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCustomFlagTableDir.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetCustomFlagTableDir.cmake new file mode 100644 index 0000000..91c6b44 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCustomFlagTableDir.cmake @@ -0,0 +1,3 @@ +enable_language(C) +string(APPEND CMAKE_C_FLAGS " -TESTWX-") +add_executable(main main.c) diff --git a/Tests/RunCMake/GeneratorToolset/VsNormal-stdout.txt b/Tests/RunCMake/GeneratorToolset/VsNormal-stdout.txt new file mode 100644 index 0000000..25fa3bf --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/VsNormal-stdout.txt @@ -0,0 +1,2 @@ +-- CMAKE_VS_PLATFORM_NAME='[^']+' +-- CMAKE_VS_PLATFORM_TOOLSET='v[0-9]+' diff --git a/Tests/RunCMake/GeneratorToolset/VsNormal.cmake b/Tests/RunCMake/GeneratorToolset/VsNormal.cmake new file mode 100644 index 0000000..e891708 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/VsNormal.cmake @@ -0,0 +1,6 @@ +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/defaults.cmake" "# VS Defaults +set(VsNormal_Platform [[${CMAKE_VS_PLATFORM_NAME}]]) +set(VsNormal_Toolset [[${CMAKE_VS_PLATFORM_TOOLSET}]]) +") +message(STATUS "CMAKE_VS_PLATFORM_NAME='${CMAKE_VS_PLATFORM_NAME}'") +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET='${CMAKE_VS_PLATFORM_TOOLSET}'") diff --git a/Tests/RunCMake/GeneratorToolset/main.c b/Tests/RunCMake/GeneratorToolset/main.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/main.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/GoogleTest/xml_output.cpp b/Tests/RunCMake/GoogleTest/xml_output.cpp index 82f0d02..743a472 100644 --- a/Tests/RunCMake/GoogleTest/xml_output.cpp +++ b/Tests/RunCMake/GoogleTest/xml_output.cpp @@ -5,7 +5,7 @@ int main(int argc, char** argv) { // Note: GoogleTestXML.cmake doesn't actually depend on Google Test as such; - // it only mimicks the output file creation using the path passed to this + // it only mimics the output file creation using the path passed to this // test without any content for (int i = 0; i < argc; i++) { std::string param(argv[i]); diff --git a/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake b/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake index 066c83e..c84e95e 100644 --- a/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake +++ b/Tests/RunCMake/IfacePaths/RunCMakeTest.cmake @@ -18,6 +18,9 @@ run_cmake(BinaryDirectoryInInterface) set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/DirInInstallPrefix/prefix") run_cmake(DirInInstallPrefix) +set(RunCMake_TEST_OPTIONS "--install-prefix=${RunCMake_BINARY_DIR}/DirInInstallPrefix/prefix") +run_cmake(DirInInstallPrefix) + configure_file( "${RunCMake_SOURCE_DIR}/CMakeLists.txt" "${RunCMake_BINARY_DIR}/copy/CMakeLists.txt" @@ -34,14 +37,13 @@ configure_file( COPYONLY ) set(RunCMake_TEST_OPTIONS - "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface/prefix" + "--install-prefix=${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface/prefix" "-DTEST_FILE=${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface.cmake" ) set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/copy") run_cmake(InstallInSrcDir) unset(RunCMake_TEST_SOURCE_DIR) -set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallInBinDir-build/prefix") set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallInBinDir-build/prefix" "-DTEST_FILE=${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface.cmake" @@ -77,7 +79,7 @@ foreach(policyStatus NEW OLD "") set(policySuffix -CMP0052-${policyStatus}) endif() set(RunCMake_TEST_OPTIONS - "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption} + "--install-prefix ${RunCMake_BINARY_DIR}/prefix" ${policyOption} "-DTEST_FILE=${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface.cmake" ) # Set the RunCMake_TEST_SOURCE_DIR here to the copy too. This is needed to run diff --git a/Tests/RunCMake/Ninja/CustomCommandDepfile-check.cmake b/Tests/RunCMake/Ninja/CustomCommandDepfile-check.cmake index 189de64..51f4f52 100644 --- a/Tests/RunCMake/Ninja/CustomCommandDepfile-check.cmake +++ b/Tests/RunCMake/Ninja/CustomCommandDepfile-check.cmake @@ -1,5 +1,10 @@ set(log "${RunCMake_BINARY_DIR}/CustomCommandDepfile-build/build.ninja") file(READ "${log}" build_file) + +set(RunCMake_TEST_FAILED) if(NOT "${build_file}" MATCHES "depfile = test\\.d") - set(RunCMake_TEST_FAILED "Log file:\n ${log}\ndoes not have expected line: depfile = test.d") + list(APPEND RunCMake_TEST_FAILED "Log file:\n ${log}\ndoes not have expected line: depfile = test.d") +endif() +if(NOT "${build_file}" MATCHES "depfile = test_Debug\\.d") + list(APPEND RunCMake_TEST_FAILED "\nLog file:\n ${log}\ndoes not have expected line: depfile = test_Debug.d") endif() diff --git a/Tests/RunCMake/Ninja/CustomCommandDepfile.cmake b/Tests/RunCMake/Ninja/CustomCommandDepfile.cmake index dbef2a5..0838d14 100644 --- a/Tests/RunCMake/Ninja/CustomCommandDepfile.cmake +++ b/Tests/RunCMake/Ninja/CustomCommandDepfile.cmake @@ -6,6 +6,17 @@ add_custom_command( WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" DEPFILE "test.d" ) -add_custom_target(copy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/hello.copy.c") + +add_custom_command( + OUTPUT hello.copy2.c + COMMAND "${CMAKE_COMMAND}" -E copy + "${CMAKE_CURRENT_SOURCE_DIR}/hello.c" + hello.copy2.c + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + DEPFILE "test_$<CONFIG>.d" + ) + +add_custom_target(copy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/hello.copy.c" + "${CMAKE_CURRENT_BINARY_DIR}/hello.copy2.c") include(CheckNoPrefixSubDir.cmake) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index 0c0619d..8c91b34 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -67,7 +67,7 @@ run_CMP0058(WARN-by) run_CMP0058(NEW-no) run_CMP0058(NEW-by) -run_cmake(CustomCommandDepfile) +run_cmake_with_options(CustomCommandDepfile -DCMAKE_BUILD_TYPE=Debug) run_cmake(CustomCommandJobPool) run_cmake(JobPoolUsesTerminal) @@ -163,12 +163,12 @@ run_LooseObjectDepends() function (run_AssumedSources) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AssumedSources-build) run_cmake(AssumedSources) - run_ninja("${RunCMake_TEST_BINARY_DIR}" "target.c") + run_ninja("${RunCMake_TEST_BINARY_DIR}" "${RunCMake_TEST_BINARY_DIR}/target.c") if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/target.c") message(FATAL_ERROR "Dependencies for an assumed source did not hook up properly for 'target.c'.") endif () - run_ninja("${RunCMake_TEST_BINARY_DIR}" "target-no-depends.c") + run_ninja("${RunCMake_TEST_BINARY_DIR}" "${RunCMake_TEST_BINARY_DIR}/target-no-depends.c") if (EXISTS "${RunCMake_TEST_BINARY_DIR}/target-no-depends.c") message(FATAL_ERROR "Dependencies for an assumed source were magically hooked up for 'target-no-depends.c'.") diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile-check.cmake index c595b10..a7837ca 100644 --- a/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile-check.cmake @@ -1,5 +1,10 @@ set(log "${RunCMake_BINARY_DIR}/CustomCommandDepfile-build/CMakeFiles/impl-Debug.ninja") file(READ "${log}" build_file) + +set(RunCMake_TEST_FAILED) if(NOT "${build_file}" MATCHES "depfile = test\\.d") - set(RunCMake_TEST_FAILED "Log file:\n ${log}\ndoes not have expected line: depfile = test.d") + list(APPEND RunCMake_TEST_FAILED "Log file:\n ${log}\ndoes not have expected line: depfile = test.d") +endif() +if(NOT "${build_file}" MATCHES "depfile = test_Debug\\.d") + list(APPEND RunCMake_TEST_FAILED "\nLog file:\n ${log}\ndoes not have expected line: depfile = test_Debug.d") endif() diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile.cmake index 1a42670..4f8c114 100644 --- a/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile.cmake @@ -6,4 +6,15 @@ add_custom_command( WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" DEPFILE "test.d" ) -add_custom_target(copy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/main.copy.c") + +add_custom_command( + OUTPUT main.copy2.c + COMMAND "${CMAKE_COMMAND}" -E copy + "${CMAKE_CURRENT_SOURCE_DIR}/main.c" + main.copy2.c + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + DEPFILE "test_$<CONFIG>.d" + ) + +add_custom_target(copy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/main.copy.c" + "${CMAKE_CURRENT_BINARY_DIR}/main.copy2.c") diff --git a/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt index 4dbd861..6a7c171 100644 --- a/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/BadSourceExpression3-stderr.txt @@ -3,7 +3,7 @@ CMake Error at BadSourceExpression3.cmake:2 \(add_library\): \$<TARGET_OBJECTS:NotObjLib> - Objects of target "NotObjLib" referenced but is not an allowed library - types \(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT\). + Objects of target "NotObjLib" referenced but is not one of the allowed + target types \(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT\). Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index ea94a5b..b4a57b2 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -23,10 +23,13 @@ function(run_cmake test) endif() string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} platform_name) + #remove all additional bits from cygwin/msys name if(platform_name MATCHES cygwin) - #remove all additional bits from cygwin name set(platform_name cygwin) endif() + if(platform_name MATCHES msys) + set(platform_name msys) + endif() foreach(o out err) if(RunCMake-std${o}-file AND EXISTS ${top_src}/${RunCMake-std${o}-file}) @@ -64,15 +67,6 @@ function(run_cmake test) else() include(${top_src}/${test}-prep.cmake OPTIONAL) endif() - if(NOT DEFINED RunCMake_TEST_OPTIONS) - set(RunCMake_TEST_OPTIONS "") - endif() - if(APPLE) - list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0025=NEW) - endif() - if(RunCMake_MAKE_PROGRAM) - list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}") - endif() if(RunCMake_TEST_OUTPUT_MERGE) set(actual_stderr_var actual_stdout) set(actual_stderr "") @@ -91,50 +85,51 @@ function(run_cmake test) else() set(maybe_input_file "") endif() - if(RunCMake_TEST_COMMAND) - if(NOT RunCMake_TEST_COMMAND_WORKING_DIRECTORY) - set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + if(NOT RunCMake_TEST_COMMAND) + if(NOT DEFINED RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_OPTIONS "") endif() - execute_process( - COMMAND ${RunCMake_TEST_COMMAND} - WORKING_DIRECTORY "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}" - OUTPUT_VARIABLE actual_stdout - ERROR_VARIABLE ${actual_stderr_var} - RESULT_VARIABLE actual_result - ENCODING UTF8 - ${maybe_timeout} - ${maybe_input_file} - ) - else() - if(RunCMake_GENERATOR_INSTANCE) - set(_D_CMAKE_GENERATOR_INSTANCE "-DCMAKE_GENERATOR_INSTANCE=${RunCMake_GENERATOR_INSTANCE}") - else() - set(_D_CMAKE_GENERATOR_INSTANCE "") + if(APPLE) + list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0025=NEW) + endif() + if(RunCMake_MAKE_PROGRAM) + list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}") endif() + set(RunCMake_TEST_COMMAND ${CMAKE_COMMAND}) if(NOT RunCMake_TEST_NO_SOURCE_DIR) - set(maybe_source_dir "${RunCMake_TEST_SOURCE_DIR}") - else() - set(maybe_source_dir "") + list(APPEND RunCMake_TEST_COMMAND "${RunCMake_TEST_SOURCE_DIR}") + endif() + list(APPEND RunCMake_TEST_COMMAND -G "${RunCMake_GENERATOR}") + if(RunCMake_GENERATOR_PLATFORM) + list(APPEND RunCMake_TEST_COMMAND -A "${RunCMake_GENERATOR_PLATFORM}") + endif() + if(RunCMake_GENERATOR_TOOLSET) + list(APPEND RunCMake_TEST_COMMAND -T "${RunCMake_GENERATOR_TOOLSET}") + endif() + if(RunCMake_GENERATOR_INSTANCE) + list(APPEND RunCMake_TEST_COMMAND "-DCMAKE_GENERATOR_INSTANCE=${RunCMake_GENERATOR_INSTANCE}") endif() - execute_process( - COMMAND ${CMAKE_COMMAND} - ${maybe_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} - WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" - OUTPUT_VARIABLE actual_stdout - ERROR_VARIABLE ${actual_stderr_var} - RESULT_VARIABLE actual_result - ENCODING UTF8 - ${maybe_timeout} - ${maybe_input_file} + list(APPEND RunCMake_TEST_COMMAND + -DRunCMake_TEST=${test} + --no-warn-unused-cli ) + else() + set(RunCMake_TEST_OPTIONS "") endif() + if(NOT RunCMake_TEST_COMMAND_WORKING_DIRECTORY) + set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + endif() + execute_process( + COMMAND ${RunCMake_TEST_COMMAND} + ${RunCMake_TEST_OPTIONS} + WORKING_DIRECTORY "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}" + OUTPUT_VARIABLE actual_stdout + ERROR_VARIABLE ${actual_stderr_var} + RESULT_VARIABLE actual_result + ENCODING UTF8 + ${maybe_timeout} + ${maybe_input_file} + ) set(msg "") if(NOT "${actual_result}" MATCHES "${expect_result}") string(APPEND msg "Result is [${actual_result}], not [${expect_result}].\n") @@ -191,14 +186,18 @@ function(run_cmake test) if(RunCMake_TEST_FAILED) set(msg "${RunCMake_TEST_FAILED}\n${msg}") endif() - if(msg AND RunCMake_TEST_COMMAND) + if(msg) string(REPLACE ";" "\" \"" command "\"${RunCMake_TEST_COMMAND}\"") + if(RunCMake_TEST_OPTIONS) + string(REPLACE ";" "\" \"" options "\"${RunCMake_TEST_OPTIONS}\"") + string(APPEND command " ${options}") + endif() string(APPEND msg "Command was:\n command> ${command}\n") endif() if(msg) string(REGEX REPLACE "\n" "\n actual-out> " actual_out " actual-out> ${actual_stdout}") string(REGEX REPLACE "\n" "\n actual-err> " actual_err " actual-err> ${actual_stderr}") - message(SEND_ERROR "${test} - FAILED:\n" + message(SEND_ERROR "${test}${RunCMake_TEST_VARIANT_DESCRIPTION} - FAILED:\n" "${msg}" "${expect_out}" "Actual stdout:\n${actual_out}\n" @@ -206,7 +205,7 @@ function(run_cmake test) "Actual stderr:\n${actual_err}\n" ) else() - message(STATUS "${test} - PASSED") + message(STATUS "${test}${RunCMake_TEST_VARIANT_DESCRIPTION} - PASSED") endif() endfunction() diff --git a/Tests/RunCMake/RunCTest.cmake b/Tests/RunCMake/RunCTest.cmake index 98fdf20..59db395 100644 --- a/Tests/RunCMake/RunCTest.cmake +++ b/Tests/RunCMake/RunCTest.cmake @@ -11,10 +11,13 @@ function(run_ctest CASE_NAME) endif() configure_file(${RunCMake_SOURCE_DIR}/CMakeLists.txt.in ${RunCMake_BINARY_DIR}/${CASE_NAME}/CMakeLists.txt @ONLY) + if(NOT DEFINED RunCTest_VERBOSE_FLAG) + set(RunCTest_VERBOSE_FLAG "-V") + endif() run_cmake_command(${CASE_NAME} ${CMAKE_CTEST_COMMAND} -C Debug -S ${RunCMake_BINARY_DIR}/${CASE_NAME}/test.cmake - -V + ${RunCTest_VERBOSE_FLAG} --output-log ${RunCMake_BINARY_DIR}/${CASE_NAME}-build/testOutput.log --no-compress-output ${ARGN} diff --git a/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt b/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt index 77c4afd..9145a56 100644 --- a/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt +++ b/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt @@ -3,7 +3,7 @@ CMake Error at NotObjlibTarget.cmake:[0-9]+ \(file\): \$<TARGET_OBJECTS:IFaceLib> - Objects of target "IFaceLib" referenced but is not an allowed library types - \(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT\). + Objects of target "IFaceLib" referenced but is not one of the allowed + target types \(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT\). Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/ToolchainFile/LangVars-toolchain.cmake b/Tests/RunCMake/ToolchainFile/LangVars-toolchain.cmake new file mode 100644 index 0000000..be07dc3 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/LangVars-toolchain.cmake @@ -0,0 +1,2 @@ +set(C 1) +set(CXX 1) diff --git a/Tests/RunCMake/ToolchainFile/LangVars.cmake b/Tests/RunCMake/ToolchainFile/LangVars.cmake new file mode 100644 index 0000000..169e639 --- /dev/null +++ b/Tests/RunCMake/ToolchainFile/LangVars.cmake @@ -0,0 +1,7 @@ +foreach(test_language C CXX) + enable_language(${test_language}) + if(DEFINED CMAKE_${test_language}_STANDARD_DEFAULT + AND NOT CMAKE_${test_language}_COMPILE_FEATURES) + message(FATAL_ERROR "Compile features not found for ${test_language}") + endif() +endforeach() diff --git a/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake b/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake index 659523c..304c105 100644 --- a/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake +++ b/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake @@ -9,6 +9,7 @@ run_cmake_toolchain(CallEnableLanguage) run_cmake_toolchain(CallProject) run_cmake_toolchain(CheckLanguage) run_cmake_toolchain(FlagsInit) +run_cmake_toolchain(LangVars) run_cmake_toolchain(LinkFlagsInit) function(run_IncludeDirectories) diff --git a/Tests/RunCMake/UseSWIG/CMP0078-OLD-stderr.txt b/Tests/RunCMake/UseSWIG/CMP0078-OLD-stderr.txt new file mode 100644 index 0000000..2afdc4f --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0078-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0078-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0078 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:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/UseSWIG/CMP0122-NEW-check.cmake b/Tests/RunCMake/UseSWIG/CMP0122-NEW-check.cmake new file mode 100644 index 0000000..a26c278 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0122-NEW-check.cmake @@ -0,0 +1,10 @@ + +cmake_policy(VERSION 3.1) + +file(STRINGS "${RunCMake_TEST_BINARY_DIR}/CMP0122-library-name.txt" prefixes) + +list(GET prefixes 0 std_prefix) +list(GET prefixes 1 lib_prefix) +if (NOT std_prefix STREQUAL lib_prefix) + string (APPEND RunCMake_TEST_FAILED "\nFound prefix: '${lib_prefix}', expected: '${std_prefix}'.") +endif() diff --git a/Tests/RunCMake/UseSWIG/CMP0122-NEW.cmake b/Tests/RunCMake/UseSWIG/CMP0122-NEW.cmake new file mode 100644 index 0000000..fecb7db --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0122-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0122 NEW) +include(CMP0122-common.cmake) diff --git a/Tests/RunCMake/UseSWIG/CMP0122-OLD-check.cmake b/Tests/RunCMake/UseSWIG/CMP0122-OLD-check.cmake new file mode 100644 index 0000000..01657d0 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0122-OLD-check.cmake @@ -0,0 +1,10 @@ + +cmake_policy(VERSION 3.1) + +file(STRINGS "${RunCMake_TEST_BINARY_DIR}/CMP0122-library-name.txt" prefixes) + +list(GET prefixes 1 lib_prefix) +if (lib_prefix) + # prefix must be empty + string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix: '${lib_prefix}'.") +endif() diff --git a/Tests/RunCMake/UseSWIG/CMP0122-OLD.cmake b/Tests/RunCMake/UseSWIG/CMP0122-OLD.cmake new file mode 100644 index 0000000..a787b68 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0122-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0122 OLD) +include(CMP0122-common.cmake) diff --git a/Tests/RunCMake/UseSWIG/CMP0122-WARN-stderr.txt b/Tests/RunCMake/UseSWIG/CMP0122-WARN-stderr.txt new file mode 100644 index 0000000..37c4fbd --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0122-WARN-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning \(dev\) at .*/Modules/UseSWIG.cmake:[0-9]+ \(message\): + Policy CMP0122 is not set: UseSWIG use standard library name conventions + for csharp language\. Run "cmake --help-policy CMP0122" for policy details\. + Use the cmake_policy command to set the policy and suppress this warning\. + +Call Stack \(most recent call first\): + CMP0122-common.cmake:9 \(swig_add_library\) + CMP0122-WARN.cmake:1 \(include\) + CMakeLists.txt:3 \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\.$ diff --git a/Tests/RunCMake/UseSWIG/CMP0122-WARN.cmake b/Tests/RunCMake/UseSWIG/CMP0122-WARN.cmake new file mode 100644 index 0000000..5d571aa --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0122-WARN.cmake @@ -0,0 +1 @@ +include(CMP0122-common.cmake) diff --git a/Tests/RunCMake/UseSWIG/CMP0122-common.cmake b/Tests/RunCMake/UseSWIG/CMP0122-common.cmake new file mode 100644 index 0000000..be880ec --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0122-common.cmake @@ -0,0 +1,12 @@ + +cmake_policy(SET CMP0078 NEW) +cmake_policy(SET CMP0086 NEW) + +set(SWIG_EXECUTABLE "swig") +set(SWIG_DIR "/swig") +include(UseSWIG) + +swig_add_library(example LANGUAGE csharp TYPE SHARED SOURCES example.i) + +file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/CMP0122-library-name.txt" + CONTENT "${CMAKE_SHARED_LIBRARY_PREFIX}\n$<TARGET_FILE_PREFIX:example>\n") diff --git a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake index 6acf719..c7a118f 100644 --- a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake +++ b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake @@ -23,3 +23,7 @@ if (CMake_TEST_FindPython) run_cmake_target(CMP0086-NEW build example) endif() + +run_cmake(CMP0122-WARN) +run_cmake(CMP0122-OLD) +run_cmake(CMP0122-NEW) diff --git a/Tests/RunCMake/VS10Project/CSharpSourceGroup/cmake/AssemblyInfo.cs.in b/Tests/RunCMake/VS10Project/CSharpSourceGroup/cmake/AssemblyInfo.cs.in new file mode 100644 index 0000000..63e5a5c --- /dev/null +++ b/Tests/RunCMake/VS10Project/CSharpSourceGroup/cmake/AssemblyInfo.cs.in @@ -0,0 +1,18 @@ +using System.Reflection; +using System.Runtime.InteropServices; +using System.Windows; + +//General Information about an assembly is controlled through the following +//set of attributes. Change these attribute values to modify the information +//associated with an assembly. + +[assembly: AssemblyTitle("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/RunCMake/VS10Project/VsCsharpSourceGroup-check.cmake b/Tests/RunCMake/VS10Project/VsCsharpSourceGroup-check.cmake index 80d76e4..9c9409c 100644 --- a/Tests/RunCMake/VS10Project/VsCsharpSourceGroup-check.cmake +++ b/Tests/RunCMake/VS10Project/VsCsharpSourceGroup-check.cmake @@ -13,6 +13,7 @@ set(SOURCE_GROUPS_TO_FIND "CSharpSourceGroup\\\\nested\\\\baz\\.cs" "CSharpSourceGroup\\\\images\\\\empty\\.bmp" "VsCsharpSourceGroup\\.png" + "AssemblyInfo\\.cs" ) foreach(GROUP_NAME IN LISTS SOURCE_GROUPS_TO_FIND) diff --git a/Tests/RunCMake/VS10Project/VsCsharpSourceGroup.cmake b/Tests/RunCMake/VS10Project/VsCsharpSourceGroup.cmake index 510d712..b67868f 100644 --- a/Tests/RunCMake/VS10Project/VsCsharpSourceGroup.cmake +++ b/Tests/RunCMake/VS10Project/VsCsharpSourceGroup.cmake @@ -20,3 +20,11 @@ add_library(VsCsharpSourceGroup SHARED ${SRC_FILES} ${IMAGE_FILES} ${RESOURCE_FI source_group("CSharpSourceGroup" FILES ${CMAKE_CURRENT_SOURCE_DIR}/CSharpSourceGroup/foo.cs) source_group("CSharpSourceGroup/nested" FILES ${CMAKE_CURRENT_SOURCE_DIR}/CSharpSourceGroup/nested/baz.cs) source_group("Images" FILES ${IMAGE_FILES}) + +# Test covering CMake Issue 22104. +# Basically there should not be any link tags for files in the binary directory. +include(CSharpUtilities) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/CSharpSourceGroup/cmake/AssemblyInfo.cs.in" "Properties/AssemblyInfo.cs") + +target_sources(VsCsharpSourceGroup PRIVATE "Properties/AssemblyInfo.cs") +csharp_set_designer_cs_properties("Properties/AssemblyInfo.cs") diff --git a/Tests/RunCMake/WriteBasicConfigVersionFile/LeadingZeroes.cmake b/Tests/RunCMake/WriteBasicConfigVersionFile/LeadingZeroes.cmake new file mode 100644 index 0000000..9f4674c --- /dev/null +++ b/Tests/RunCMake/WriteBasicConfigVersionFile/LeadingZeroes.cmake @@ -0,0 +1,898 @@ +# Hard-code architecture for test without a real compiler. +set(CMAKE_SIZEOF_VOID_P 4) + +include(WriteBasicConfigVersionFile) + +set(COMPATIBILITIES AnyNewerVersion + SameMajorVersion + SameMinorVersion + ExactVersion + ) + +function(TEST_WRITE_BASIC_CONFIG_VERSION_FILE_PREPARE _version_installed) + set(_same_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}) + set(_no_CMAKE_SIZEOF_VOID_P "") + math(EXPR _diff_CMAKE_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P} + 1") + foreach(_compat ${COMPATIBILITIES}) + set(_pkg ${_compat}${_version_installed}) + string(REPLACE "." "" _pkg ${_pkg}) + set(_filename "${CMAKE_CURRENT_BINARY_DIR}/${_pkg}ConfigVersion.cmake") + set(_filename_novoid "${CMAKE_CURRENT_BINARY_DIR}/${_pkg}NoVoidConfigVersion.cmake") + set(_filename_diffvoid "${CMAKE_CURRENT_BINARY_DIR}/${_pkg}DiffVoidConfigVersion.cmake") + + set(CMAKE_SIZEOF_VOID_P ${_same_CMAKE_SIZEOF_VOID_P}) + write_basic_config_version_file("${_filename}" + VERSION ${_version_installed} + COMPATIBILITY ${_compat}) + + # Test that an empty CMAKE_SIZEOF_VOID_P is accepted: + set(CMAKE_SIZEOF_VOID_P ${_no_CMAKE_SIZEOF_VOID_P}) + write_basic_config_version_file("${_filename_novoid}" + VERSION ${_version_installed} + COMPATIBILITY ${_compat}) + + # Test that a different CMAKE_SIZEOF_VOID_P results in + # PACKAGE_VERSION_UNSUITABLE + set(CMAKE_SIZEOF_VOID_P ${_diff_CMAKE_SIZEOF_VOID_P}) + write_basic_config_version_file("${_filename_diffvoid}" + VERSION ${_version_installed} + COMPATIBILITY ${_compat}) + endforeach() +endfunction() + +macro(TEST_WRITE_BASIC_CONFIG_VERSION_FILE_CHECK _filename) + include("${_filename}") + + message(STATUS "_expected_compatible: ${_expected_compatible}") + message(STATUS "_expected_unsuitable: ${_expected_unsuitable}") + if(_expected_compatible AND NOT PACKAGE_VERSION_COMPATIBLE) + message(SEND_ERROR "Did not find package with version ${_version_installed} (${_version_requested} was requested)!") + elseif(NOT _expected_compatible AND PACKAGE_VERSION_COMPATIBLE) + message(SEND_ERROR "Found package with version ${_version_installed}, but ${_version_requested} was requested!") + endif() + + if(${_expected_unsuitable} AND NOT PACKAGE_VERSION_UNSUITABLE) + message(SEND_ERROR "PACKAGE_VERSION_UNSUITABLE set, although it should not be!") + elseif(NOT ${_expected_unsuitable} AND PACKAGE_VERSION_UNSUITABLE) + message(SEND_ERROR "PACKAGE_VERSION_UNSUITABLE not set, although it should be!") + endif() + + unset(PACKAGE_VERSION_COMPATIBLE) + unset(PACKAGE_VERSION_EXACT) + unset(PACKAGE_VERSION_UNSUITABLE) +endmacro() + +function(TEST_WRITE_BASIC_CONFIG_VERSION_FILE _version_installed + _version_requested + _expected_compatible_AnyNewerVersion + _expected_compatible_SameMajorVersion + _expected_compatible_SameMinorVersion + _expected_compatible_ExactVersion) + if("${_version_requested}" MATCHES [[^([0-9]+(\.[0-9]+)*)\.\.\.(<)?([0-9]+(\.[0-9]+)*)$]]) + set (_compatibilities ${COMPATIBILITIES}) + # ExactVersion must not be tested + list(POP_BACK _compatibilities) + set(PACKAGE_FIND_VERSION_RANGE TRUE) + set(PACKAGE_FIND_VERSION_RANGE_MIN INCLUDE) + if ("${CMAKE_MATCH_3}" STREQUAL "<") + set(PACKAGE_FIND_VERSION_RANGE_MAX EXCLUDE) + else() + set(PACKAGE_FIND_VERSION_RANGE_MAX INCLUDE) + endif() + set(PACKAGE_FIND_VERSION_MIN "${CMAKE_MATCH_1}") + set(PACKAGE_FIND_VERSION_MAX "${CMAKE_MATCH_4}") + if("${PACKAGE_FIND_VERSION_MIN}" MATCHES [[(^([0-9]+)(\.([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?)?)?$]]) + set(PACKAGE_FIND_VERSION_MIN_MAJOR "${CMAKE_MATCH_2}") + set(PACKAGE_FIND_VERSION_MIN_MINOR "${CMAKE_MATCH_4}") + set(PACKAGE_FIND_VERSION_MIN_PATCH "${CMAKE_MATCH_6}") + set(PACKAGE_FIND_VERSION_MIN_TWEAK "${CMAKE_MATCH_8}") + else() + message(FATAL_ERROR "_version_requested (${_version_requested}) should be a version range") + endif() + set(PACKAGE_FIND_VERSION "${PACKAGE_FIND_VERSION_MIN}") + set(PACKAGE_FIND_VERSION_MAJOR "${PACKAGE_FIND_VERSION_MIN_MAJOR}") + set(PACKAGE_FIND_VERSION_MINOR "${PACKAGE_FIND_VERSION_MIN_MINOR}") + set(PACKAGE_FIND_VERSION_PATCH "${PACKAGE_FIND_VERSION_MIN_PATCH}") + set(PACKAGE_FIND_VERSION_TWEAK "${PACKAGE_FIND_VERSION_MIN_TWEAK}") + if("${PACKAGE_FIND_VERSION_MAX}" MATCHES [[(^([0-9]+)(\.([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?)?)?$]]) + set(PACKAGE_FIND_VERSION_MAX_MAJOR "${CMAKE_MATCH_2}") + set(PACKAGE_FIND_VERSION_MAX_MINOR "${CMAKE_MATCH_4}") + set(PACKAGE_FIND_VERSION_MAX_PATCH "${CMAKE_MATCH_6}") + set(PACKAGE_FIND_VERSION_MAX_TWEAK "${CMAKE_MATCH_8}") + else() + message(FATAL_ERROR "_version_requested (${_version_requested}) should be a version range") + endif() + else() + set (_compatibilities ${COMPATIBILITIES}) + set(PACKAGE_FIND_VERSION ${_version_requested}) + if("${PACKAGE_FIND_VERSION}" MATCHES [[(^([0-9]+)(\.([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?)?)?$]]) + set(PACKAGE_FIND_VERSION_MAJOR "${CMAKE_MATCH_2}") + set(PACKAGE_FIND_VERSION_MINOR "${CMAKE_MATCH_4}") + set(PACKAGE_FIND_VERSION_PATCH "${CMAKE_MATCH_6}") + set(PACKAGE_FIND_VERSION_TWEAK "${CMAKE_MATCH_8}") + else() + message(FATAL_ERROR "_version_requested (${_version_requested}) should be a version number") + endif() + + endif() + + unset(PACKAGE_VERSION_COMPATIBLE) + unset(PACKAGE_VERSION_EXACT) + unset(PACKAGE_VERSION_UNSUITABLE) + + foreach(_compat ${_compatibilities}) + set(_pkg ${_compat}${_version_installed}) + string(REPLACE "." "" _pkg ${_pkg}) + set(_filename "${CMAKE_CURRENT_BINARY_DIR}/${_pkg}ConfigVersion.cmake") + set(_filename_novoid "${CMAKE_CURRENT_BINARY_DIR}/${_pkg}NoVoidConfigVersion.cmake") + set(_filename_diffvoid "${CMAKE_CURRENT_BINARY_DIR}/${_pkg}DiffVoidConfigVersion.cmake") + + set(_expected_compatible ${_expected_compatible_${_compat}}) + + # Test "normal" version + set(_expected_unsuitable 0) + message(STATUS "TEST write_basic_config_version_file(VERSION ${_version_installed} \ +COMPATIBILITY ${_compat}) vs. ${_version_requested} \ +(expected compatible = ${_expected_compatible}, unsuitable = ${_expected_unsuitable})") + test_write_basic_config_version_file_check("${_filename}") + + # test empty CMAKE_SIZEOF_VOID_P version: + set(_expected_unsuitable 0) + message(STATUS "TEST write_basic_config_version_file(VERSION ${_version_installed} \ +COMPATIBILITY ${_compat}) vs. ${_version_requested} (no CMAKE_SIZEOF_VOID_P) \ +(expected compatible = ${_expected_compatible}, unsuitable = ${_expected_unsuitable})") + test_write_basic_config_version_file_check("${_filename_novoid}") + + # test different CMAKE_SIZEOF_VOID_P version: + set(_expected_unsuitable 1) + message(STATUS "TEST write_basic_config_version_file(VERSION ${_version_installed} \ +COMPATIBILITY ${_compat}) vs. ${_version_requested} (different CMAKE_SIZEOF_VOID_P) \ +(expected compatible = ${_expected_compatible}, unsuitable = ${_expected_unsuitable})") + test_write_basic_config_version_file_check("${_filename_diffvoid}") + + endforeach() +endfunction() + + +test_write_basic_config_version_file_prepare(4) +test_write_basic_config_version_file_prepare(4.05) +test_write_basic_config_version_file_prepare(4.5.06) +test_write_basic_config_version_file_prepare(4.05.06.007) + +# AnyNewerVersion +# | SameMajorVersion +# | | SameMinorVersion +# | | | ExactVersion +# | | | | +test_write_basic_config_version_file(4.05 0 1 0 0 0) # Request 0 +test_write_basic_config_version_file(4.05 2 1 0 0 0) # Request [older major] +test_write_basic_config_version_file(4.05 4 1 1 0 0) # Request [same major] +test_write_basic_config_version_file(4.05 9 0 0 0 0) # Request [newer major] + +test_write_basic_config_version_file(4.05 0.0 1 0 0 0) # Request 0.0 +test_write_basic_config_version_file(4.05 0.2 1 0 0 0) # Request 0.[older minor] +test_write_basic_config_version_file(4.05 0.5 1 0 0 0) # Request 0.[same minor] +test_write_basic_config_version_file(4.05 0.9 1 0 0 0) # Request 0.[newer minor] +test_write_basic_config_version_file(4.05 2.0 1 0 0 0) # Request [older major].0 +test_write_basic_config_version_file(4.05 2.2 1 0 0 0) # Request [older major].[older minor] +test_write_basic_config_version_file(4.05 2.5 1 0 0 0) # Request [older major].[same minor] +test_write_basic_config_version_file(4.05 2.9 1 0 0 0) # Request [older major].[newer minor] +test_write_basic_config_version_file(4.05 4.0 1 1 0 0) # Request [same major].0 +test_write_basic_config_version_file(4.05 4.2 1 1 0 0) # Request [same major].[older minor] +test_write_basic_config_version_file(4.05 4.05 1 1 1 1) # Request [same major].[same minor] +test_write_basic_config_version_file(4.05 4.9 0 0 0 0) # Request [same major].[newer minor] +test_write_basic_config_version_file(4.05 9.0 0 0 0 0) # Request [newer major].0 +test_write_basic_config_version_file(4.05 9.1 0 0 0 0) # Request [newer major].[older minor] +test_write_basic_config_version_file(4.05 9.5 0 0 0 0) # Request [newer major].[same minor] +test_write_basic_config_version_file(4.05 9.9 0 0 0 0) # Request [newer major].[newer minor] + +test_write_basic_config_version_file(4.05 0.0.0 1 0 0 0) # Request 0.0.0 +test_write_basic_config_version_file(4.05 0.0.9 1 0 0 0) # Request 0.0.[newer patch] +test_write_basic_config_version_file(4.05 0.2.0 1 0 0 0) # Request 0.[older minor].0 +test_write_basic_config_version_file(4.05 0.2.9 1 0 0 0) # Request 0.[older minor].[newer patch] +test_write_basic_config_version_file(4.05 0.5.0 1 0 0 0) # Request 0.[same minor].0 +test_write_basic_config_version_file(4.05 0.5.9 1 0 0 0) # Request 0.[same minor].[newer patch] +test_write_basic_config_version_file(4.05 0.9.0 1 0 0 0) # Request 0.[newer minor].0 +test_write_basic_config_version_file(4.05 0.9.9 1 0 0 0) # Request 0.[newer minor].[newer patch] +test_write_basic_config_version_file(4.05 2.0.0 1 0 0 0) # Request [older major].0.0 +test_write_basic_config_version_file(4.05 2.0.9 1 0 0 0) # Request [older major].0.[newer patch] +test_write_basic_config_version_file(4.05 2.2.0 1 0 0 0) # Request [older major].[older minor].0 +test_write_basic_config_version_file(4.05 2.2.9 1 0 0 0) # Request [older major].[older minor].[newer patch] +test_write_basic_config_version_file(4.05 2.5.0 1 0 0 0) # Request [older major].[same minor].0 +test_write_basic_config_version_file(4.05 2.5.9 1 0 0 0) # Request [older major].[same minor].[newer patch] +test_write_basic_config_version_file(4.05 2.9.0 1 0 0 0) # Request [older major].[newer minor].0 +test_write_basic_config_version_file(4.05 2.9.9 1 0 0 0) # Request [older major].[newer minor].[newer patch] +test_write_basic_config_version_file(4.05 4.0.0 1 1 0 0) # Request [same major].0.0 +test_write_basic_config_version_file(4.05 4.0.9 1 1 0 0) # Request [same major].0.[newer patch] +test_write_basic_config_version_file(4.05 4.2.0 1 1 0 0) # Request [same major].[older minor].0 +test_write_basic_config_version_file(4.05 4.2.9 1 1 0 0) # Request [same major].[older minor].[newer patch] +test_write_basic_config_version_file(4.05 4.05.0 1 1 1 0) # Request [same major].[same minor].0 +test_write_basic_config_version_file(4.05 4.5.9 0 0 0 0) # Request [same major].[same minor].[newer patch] +test_write_basic_config_version_file(4.05 4.9.0 0 0 0 0) # Request [same major].[newer minor].0 +test_write_basic_config_version_file(4.05 4.9.9 0 0 0 0) # Request [same major].[newer minor].[newer patch] +test_write_basic_config_version_file(4.05 9.0.0 0 0 0 0) # Request [newer major].0.0 +test_write_basic_config_version_file(4.05 9.0.9 0 0 0 0) # Request [newer major].0.[newer patch] +test_write_basic_config_version_file(4.05 9.2.0 0 0 0 0) # Request [newer major].[older minor].0 +test_write_basic_config_version_file(4.05 9.2.9 0 0 0 0) # Request [newer major].[older minor].[newer patch] +test_write_basic_config_version_file(4.05 9.5.0 0 0 0 0) # Request [newer major].[same minor].0 +test_write_basic_config_version_file(4.05 9.5.9 0 0 0 0) # Request [newer major].[same minor].[newer patch] +test_write_basic_config_version_file(4.05 9.9.0 0 0 0 0) # Request [newer major].[newer minor].0 +test_write_basic_config_version_file(4.05 9.9.9 0 0 0 0) # Request [newer major].[newer minor].[newer patch] + +test_write_basic_config_version_file(4.05 0.0.0.0 1 0 0 0) # Request 0.0.0.0 +test_write_basic_config_version_file(4.05 0.0.0.9 1 0 0 0) # Request 0.0.0.[newer tweak] +test_write_basic_config_version_file(4.05 0.0.9.0 1 0 0 0) # Request 0.0.[newer patch].0 +test_write_basic_config_version_file(4.05 0.0.9.9 1 0 0 0) # Request 0.0.[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05 0.2.0.0 1 0 0 0) # Request 0.[older minor].0.0 +test_write_basic_config_version_file(4.05 0.2.0.9 1 0 0 0) # Request 0.[older minor].0.[newer tweak] +test_write_basic_config_version_file(4.05 0.2.9.0 1 0 0 0) # Request 0.[older minor].[newer patch].0 +test_write_basic_config_version_file(4.05 0.2.9.9 1 0 0 0) # Request 0.[older minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05 0.5.0.0 1 0 0 0) # Request 0.[same minor].0.0 +test_write_basic_config_version_file(4.05 0.5.0.9 1 0 0 0) # Request 0.[same minor].0.[newer tweak] +test_write_basic_config_version_file(4.05 0.5.9.0 1 0 0 0) # Request 0.[same minor].[newer patch].0 +test_write_basic_config_version_file(4.05 0.5.9.9 1 0 0 0) # Request 0.[same minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05 0.9.0.0 1 0 0 0) # Request 0.[newer minor].0.0 +test_write_basic_config_version_file(4.05 0.9.0.9 1 0 0 0) # Request 0.[newer minor].0.[newer tweak] +test_write_basic_config_version_file(4.05 0.9.9.0 1 0 0 0) # Request 0.[newer minor].[newer patch].0 +test_write_basic_config_version_file(4.05 0.9.9.9 1 0 0 0) # Request 0.[newer minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05 2.0.0.0 1 0 0 0) # Request [older major].0.0.0 +test_write_basic_config_version_file(4.05 2.0.0.9 1 0 0 0) # Request [older major].0.0.[newer tweak] +test_write_basic_config_version_file(4.05 2.0.9.0 1 0 0 0) # Request [older major].0.[newer patch].0 +test_write_basic_config_version_file(4.05 2.0.9.9 1 0 0 0) # Request [older major].0.[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05 2.2.0.0 1 0 0 0) # Request [older major].[older minor].0.0 +test_write_basic_config_version_file(4.05 2.2.0.9 1 0 0 0) # Request [older major].[older minor].0.[newer tweak] +test_write_basic_config_version_file(4.05 2.2.9.0 1 0 0 0) # Request [older major].[older minor].[newer patch].0 +test_write_basic_config_version_file(4.05 2.2.9.9 1 0 0 0) # Request [older major].[older minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05 2.5.0.0 1 0 0 0) # Request [older major].[same minor].0.0 +test_write_basic_config_version_file(4.05 2.5.0.9 1 0 0 0) # Request [older major].[same minor].0.[newer tweak] +test_write_basic_config_version_file(4.05 2.5.9.0 1 0 0 0) # Request [older major].[same minor].[newer patch].0 +test_write_basic_config_version_file(4.05 2.5.9.9 1 0 0 0) # Request [older major].[same minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05 2.9.0.0 1 0 0 0) # Request [older major].[newer minor].0.0 +test_write_basic_config_version_file(4.05 2.9.0.9 1 0 0 0) # Request [older major].[newer minor].0.[newer tweak] +test_write_basic_config_version_file(4.05 2.9.9.0 1 0 0 0) # Request [older major].[newer minor].[newer patch].0 +test_write_basic_config_version_file(4.05 2.9.9.9 1 0 0 0) # Request [older major].[newer minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05 4.0.0.0 1 1 0 0) # Request [same major].0.0.0 +test_write_basic_config_version_file(4.05 4.0.0.9 1 1 0 0) # Request [same major].0.0.[newer tweak] +test_write_basic_config_version_file(4.05 4.0.9.0 1 1 0 0) # Request [same major].0.[newer patch].0 +test_write_basic_config_version_file(4.05 4.0.9.9 1 1 0 0) # Request [same major].0.[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05 4.2.0.0 1 1 0 0) # Request [same major].[older minor].0.0 +test_write_basic_config_version_file(4.05 4.2.0.9 1 1 0 0) # Request [same major].[older minor].0.[newer tweak] +test_write_basic_config_version_file(4.05 4.2.9.0 1 1 0 0) # Request [same major].[older minor].[newer patch].0 +test_write_basic_config_version_file(4.05 4.2.9.9 1 1 0 0) # Request [same major].[older minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05 4.5.0.0 1 1 1 0) # Request [same major].[same minor].0.0 +test_write_basic_config_version_file(4.05 4.5.0.9 0 0 0 0) # Request [same major].[same minor].0.[newer tweak] +test_write_basic_config_version_file(4.05 4.5.9.0 0 0 0 0) # Request [same major].[same minor].[newer patch].0 +test_write_basic_config_version_file(4.05 4.5.9.9 0 0 0 0) # Request [same major].[same minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05 4.9.0.0 0 0 0 0) # Request [same major].[newer minor].0.0 +test_write_basic_config_version_file(4.05 4.9.0.9 0 0 0 0) # Request [same major].[newer minor].0.[newer tweak] +test_write_basic_config_version_file(4.05 4.9.9.0 0 0 0 0) # Request [same major].[newer minor].[newer patch].0 +test_write_basic_config_version_file(4.05 4.9.9.9 0 0 0 0) # Request [same major].[newer minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05 9.0.0.0 0 0 0 0) # Request [newer major].0.0.0 +test_write_basic_config_version_file(4.05 9.0.0.9 0 0 0 0) # Request [newer major].0.0.[newer tweak] +test_write_basic_config_version_file(4.05 9.0.9.0 0 0 0 0) # Request [newer major].0.[newer patch].0 +test_write_basic_config_version_file(4.05 9.0.9.9 0 0 0 0) # Request [newer major].0.[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05 9.2.0.0 0 0 0 0) # Request [newer major].[older minor].0.0 +test_write_basic_config_version_file(4.05 9.2.0.9 0 0 0 0) # Request [newer major].[older minor].0.[newer tweak] +test_write_basic_config_version_file(4.05 9.2.9.0 0 0 0 0) # Request [newer major].[older minor].[newer patch].0 +test_write_basic_config_version_file(4.05 9.2.9.9 0 0 0 0) # Request [newer major].[older minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05 9.5.0.0 0 0 0 0) # Request [newer major].[same minor].0.0 +test_write_basic_config_version_file(4.05 9.5.0.9 0 0 0 0) # Request [newer major].[same minor].0.[newer tweak] +test_write_basic_config_version_file(4.05 9.5.9.0 0 0 0 0) # Request [newer major].[same minor].[newer patch].0 +test_write_basic_config_version_file(4.05 9.5.9.9 0 0 0 0) # Request [newer major].[same minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05 9.9.0.0 0 0 0 0) # Request [newer major].[newer minor].0.0 +test_write_basic_config_version_file(4.05 9.9.0.9 0 0 0 0) # Request [newer major].[newer minor].0.[newer tweak] +test_write_basic_config_version_file(4.05 9.9.9.0 0 0 0 0) # Request [newer major].[newer minor].[newer patch].0 +test_write_basic_config_version_file(4.05 9.9.9.9 0 0 0 0) # Request [newer major].[newer minor].[newer patch].[newer tweak] + + +test_write_basic_config_version_file(4.5.06 0 1 0 0 0) # Request 0 +test_write_basic_config_version_file(4.5.06 2 1 0 0 0) # Request [older major] +test_write_basic_config_version_file(4.5.06 4 1 1 0 0) # Request [same major] +test_write_basic_config_version_file(4.5.06 9 0 0 0 0) # Request [newer major] + +test_write_basic_config_version_file(4.5.06 0.0 1 0 0 0) # Request 0.0 +test_write_basic_config_version_file(4.5.06 0.2 1 0 0 0) # Request 0.[older minor] +test_write_basic_config_version_file(4.5.06 0.5 1 0 0 0) # Request 0.[same minor] +test_write_basic_config_version_file(4.5.06 0.9 1 0 0 0) # Request 0.[newer minor] +test_write_basic_config_version_file(4.5.06 2.0 1 0 0 0) # Request [older major].0 +test_write_basic_config_version_file(4.5.06 2.2 1 0 0 0) # Request [older major].[older minor] +test_write_basic_config_version_file(4.5.06 2.5 1 0 0 0) # Request [older major].[same minor] +test_write_basic_config_version_file(4.5.06 2.9 1 0 0 0) # Request [older major].[newer minor] +test_write_basic_config_version_file(4.5.06 4.0 1 1 0 0) # Request [same major].0 +test_write_basic_config_version_file(4.5.06 4.2 1 1 0 0) # Request [same major].[older minor] +test_write_basic_config_version_file(4.5.06 4.5 1 1 1 0) # Request [same major].[same minor] +test_write_basic_config_version_file(4.5.06 4.9 0 0 0 0) # Request [same major].[newer minor] +test_write_basic_config_version_file(4.5.06 9.0 0 0 0 0) # Request [newer major].0 +test_write_basic_config_version_file(4.5.06 9.1 0 0 0 0) # Request [newer major].[older minor] +test_write_basic_config_version_file(4.5.06 9.5 0 0 0 0) # Request [newer major].[same minor] +test_write_basic_config_version_file(4.5.06 9.9 0 0 0 0) # Request [newer major].[newer minor] + +test_write_basic_config_version_file(4.5.06 0.0.0 1 0 0 0) # Request 0.0.0 +test_write_basic_config_version_file(4.5.06 0.0.2 1 0 0 0) # Request 0.0.[older patch] +test_write_basic_config_version_file(4.5.06 0.0.6 1 0 0 0) # Request 0.0.[same patch] +test_write_basic_config_version_file(4.5.06 0.0.9 1 0 0 0) # Request 0.0.[newer patch] +test_write_basic_config_version_file(4.5.06 0.2.0 1 0 0 0) # Request 0.[older minor].0 +test_write_basic_config_version_file(4.5.06 0.2.2 1 0 0 0) # Request 0.[older minor].[older patch] +test_write_basic_config_version_file(4.5.06 0.2.6 1 0 0 0) # Request 0.[older minor].[same patch] +test_write_basic_config_version_file(4.5.06 0.2.9 1 0 0 0) # Request 0.[older minor].[newer patch] +test_write_basic_config_version_file(4.5.06 0.5.0 1 0 0 0) # Request 0.[same minor].0 +test_write_basic_config_version_file(4.5.06 0.5.2 1 0 0 0) # Request 0.[same minor].[older patch] +test_write_basic_config_version_file(4.5.06 0.5.6 1 0 0 0) # Request 0.[same minor].[same patch] +test_write_basic_config_version_file(4.5.06 0.5.9 1 0 0 0) # Request 0.[same minor].[newer patch] +test_write_basic_config_version_file(4.5.06 0.9.0 1 0 0 0) # Request 0.[newer minor].0 +test_write_basic_config_version_file(4.5.06 0.9.2 1 0 0 0) # Request 0.[newer minor].[older patch] +test_write_basic_config_version_file(4.5.06 0.9.6 1 0 0 0) # Request 0.[newer minor].[same patch] +test_write_basic_config_version_file(4.5.06 0.9.9 1 0 0 0) # Request 0.[newer minor].[newer patch] +test_write_basic_config_version_file(4.5.06 2.0.0 1 0 0 0) # Request [older major].0.0 +test_write_basic_config_version_file(4.5.06 2.0.2 1 0 0 0) # Request [older major].0.[older patch] +test_write_basic_config_version_file(4.5.06 2.0.6 1 0 0 0) # Request [older major].0.[same patch] +test_write_basic_config_version_file(4.5.06 2.0.9 1 0 0 0) # Request [older major].0.[newer patch] +test_write_basic_config_version_file(4.5.06 2.2.0 1 0 0 0) # Request [older major].[older minor].0 +test_write_basic_config_version_file(4.5.06 2.2.2 1 0 0 0) # Request [older major].[older minor].[older patch] +test_write_basic_config_version_file(4.5.06 2.2.6 1 0 0 0) # Request [older major].[older minor].[same patch] +test_write_basic_config_version_file(4.5.06 2.2.9 1 0 0 0) # Request [older major].[older minor].[newer patch] +test_write_basic_config_version_file(4.5.06 2.5.0 1 0 0 0) # Request [older major].[same minor].0 +test_write_basic_config_version_file(4.5.06 2.5.2 1 0 0 0) # Request [older major].[same minor].[older patch] +test_write_basic_config_version_file(4.5.06 2.5.6 1 0 0 0) # Request [older major].[same minor].[same patch] +test_write_basic_config_version_file(4.5.06 2.5.9 1 0 0 0) # Request [older major].[same minor].[newer patch] +test_write_basic_config_version_file(4.5.06 2.9.0 1 0 0 0) # Request [older major].[newer minor].0 +test_write_basic_config_version_file(4.5.06 2.9.2 1 0 0 0) # Request [older major].[newer minor].[older patch] +test_write_basic_config_version_file(4.5.06 2.9.6 1 0 0 0) # Request [older major].[newer minor].[same patch] +test_write_basic_config_version_file(4.5.06 2.9.9 1 0 0 0) # Request [older major].[newer minor].[newer patch] +test_write_basic_config_version_file(4.5.06 4.0.0 1 1 0 0) # Request [same major].0.0 +test_write_basic_config_version_file(4.5.06 4.0.2 1 1 0 0) # Request [same major].0.[older patch] +test_write_basic_config_version_file(4.5.06 4.0.6 1 1 0 0) # Request [same major].0.[same patch] +test_write_basic_config_version_file(4.5.06 4.0.9 1 1 0 0) # Request [same major].0.[newer patch] +test_write_basic_config_version_file(4.5.06 4.2.0 1 1 0 0) # Request [same major].[older minor].0 +test_write_basic_config_version_file(4.5.06 4.2.2 1 1 0 0) # Request [same major].[older minor].[older patch] +test_write_basic_config_version_file(4.5.06 4.2.6 1 1 0 0) # Request [same major].[older minor].[same patch] +test_write_basic_config_version_file(4.5.06 4.2.9 1 1 0 0) # Request [same major].[older minor].[newer patch] +test_write_basic_config_version_file(4.5.06 4.5.0 1 1 1 0) # Request [same major].[same minor].0 +test_write_basic_config_version_file(4.5.06 4.5.2 1 1 1 0) # Request [same major].[same minor].[older patch] +test_write_basic_config_version_file(4.5.06 4.5.06 1 1 1 1) # Request [same major].[same minor].[same patch] +test_write_basic_config_version_file(4.5.06 4.5.9 0 0 0 0) # Request [same major].[same minor].[newer patch] +test_write_basic_config_version_file(4.5.06 4.9.0 0 0 0 0) # Request [same major].[newer minor].0 +test_write_basic_config_version_file(4.5.06 4.9.2 0 0 0 0) # Request [same major].[newer minor].[older patch] +test_write_basic_config_version_file(4.5.06 4.9.6 0 0 0 0) # Request [same major].[newer minor].[same patch] +test_write_basic_config_version_file(4.5.06 4.9.9 0 0 0 0) # Request [same major].[newer minor].[newer patch] +test_write_basic_config_version_file(4.5.06 9.0.0 0 0 0 0) # Request [newer major].0.0 +test_write_basic_config_version_file(4.5.06 9.0.2 0 0 0 0) # Request [newer major].0.[older patch] +test_write_basic_config_version_file(4.5.06 9.0.6 0 0 0 0) # Request [newer major].0.[same patch] +test_write_basic_config_version_file(4.5.06 9.0.9 0 0 0 0) # Request [newer major].0.[newer patch] +test_write_basic_config_version_file(4.5.06 9.2.0 0 0 0 0) # Request [newer major].[older minor].0 +test_write_basic_config_version_file(4.5.06 9.2.2 0 0 0 0) # Request [newer major].[older minor].[older patch] +test_write_basic_config_version_file(4.5.06 9.2.6 0 0 0 0) # Request [newer major].[older minor].[same patch] +test_write_basic_config_version_file(4.5.06 9.2.9 0 0 0 0) # Request [newer major].[older minor].[newer patch] +test_write_basic_config_version_file(4.5.06 9.5.0 0 0 0 0) # Request [newer major].[same minor].0 +test_write_basic_config_version_file(4.5.06 9.5.2 0 0 0 0) # Request [newer major].[same minor].[older patch] +test_write_basic_config_version_file(4.5.06 9.5.6 0 0 0 0) # Request [newer major].[same minor].[same patch] +test_write_basic_config_version_file(4.5.06 9.5.9 0 0 0 0) # Request [newer major].[same minor].[newer patch] +test_write_basic_config_version_file(4.5.06 9.9.0 0 0 0 0) # Request [newer major].[newer minor].0 +test_write_basic_config_version_file(4.5.06 9.9.2 0 0 0 0) # Request [newer major].[newer minor].[older patch] +test_write_basic_config_version_file(4.5.06 9.9.6 0 0 0 0) # Request [newer major].[newer minor].[same patch] +test_write_basic_config_version_file(4.5.06 9.9.9 0 0 0 0) # Request [newer major].[newer minor].[newer patch] + +test_write_basic_config_version_file(4.5.06 0.0.0.0 1 0 0 0) # Request 0.0.0.0 +test_write_basic_config_version_file(4.5.06 0.0.0.9 1 0 0 0) # Request 0.0.0.[newer tweak] +test_write_basic_config_version_file(4.5.06 0.0.2.0 1 0 0 0) # Request 0.0.[older patch].0 +test_write_basic_config_version_file(4.5.06 0.0.2.9 1 0 0 0) # Request 0.0.[older patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 0.0.6.0 1 0 0 0) # Request 0.0.[same patch].0 +test_write_basic_config_version_file(4.5.06 0.0.6.9 1 0 0 0) # Request 0.0.[same patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 0.0.9.0 1 0 0 0) # Request 0.0.[newer patch].0 +test_write_basic_config_version_file(4.5.06 0.0.9.9 1 0 0 0) # Request 0.0.[newer patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 0.2.0.0 1 0 0 0) # Request 0.[older minor].0.0 +test_write_basic_config_version_file(4.5.06 0.2.0.9 1 0 0 0) # Request 0.[older minor].0.[newer tweak] +test_write_basic_config_version_file(4.5.06 0.2.2.0 1 0 0 0) # Request 0.[older minor].[older patch].0 +test_write_basic_config_version_file(4.5.06 0.2.2.9 1 0 0 0) # Request 0.[older minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 0.2.6.0 1 0 0 0) # Request 0.[older minor].[same patch].0 +test_write_basic_config_version_file(4.5.06 0.2.6.9 1 0 0 0) # Request 0.[older minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 0.2.9.0 1 0 0 0) # Request 0.[older minor].[newer patch].0 +test_write_basic_config_version_file(4.5.06 0.2.9.9 1 0 0 0) # Request 0.[older minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 0.5.0.0 1 0 0 0) # Request 0.[same minor].0.0 +test_write_basic_config_version_file(4.5.06 0.5.0.9 1 0 0 0) # Request 0.[same minor].0.[newer tweak] +test_write_basic_config_version_file(4.5.06 0.5.2.0 1 0 0 0) # Request 0.[same minor].[older patch].0 +test_write_basic_config_version_file(4.5.06 0.5.2.9 1 0 0 0) # Request 0.[same minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 0.5.6.0 1 0 0 0) # Request 0.[same minor].[same patch].0 +test_write_basic_config_version_file(4.5.06 0.5.6.9 1 0 0 0) # Request 0.[same minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 0.5.9.0 1 0 0 0) # Request 0.[same minor].[newer patch].0 +test_write_basic_config_version_file(4.5.06 0.5.9.9 1 0 0 0) # Request 0.[same minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 0.9.0.0 1 0 0 0) # Request 0.[newer minor].0.0 +test_write_basic_config_version_file(4.5.06 0.9.0.9 1 0 0 0) # Request 0.[newer minor].0.[newer tweak] +test_write_basic_config_version_file(4.5.06 0.9.2.0 1 0 0 0) # Request 0.[newer minor].[older patch].0 +test_write_basic_config_version_file(4.5.06 0.9.2.9 1 0 0 0) # Request 0.[newer minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 0.9.6.0 1 0 0 0) # Request 0.[newer minor].[same patch].0 +test_write_basic_config_version_file(4.5.06 0.9.6.9 1 0 0 0) # Request 0.[newer minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 0.9.9.0 1 0 0 0) # Request 0.[newer minor].[newer patch].0 +test_write_basic_config_version_file(4.5.06 0.9.9.9 1 0 0 0) # Request 0.[newer minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 2.0.0.0 1 0 0 0) # Request [older major].0.0.0 +test_write_basic_config_version_file(4.5.06 2.0.0.9 1 0 0 0) # Request [older major].0.0.[newer tweak] +test_write_basic_config_version_file(4.5.06 2.0.2.0 1 0 0 0) # Request [older major].0.[older patch].0 +test_write_basic_config_version_file(4.5.06 2.0.2.9 1 0 0 0) # Request [older major].0.[older patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 2.0.6.0 1 0 0 0) # Request [older major].0.[same patch].0 +test_write_basic_config_version_file(4.5.06 2.0.6.9 1 0 0 0) # Request [older major].0.[same patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 2.0.9.0 1 0 0 0) # Request [older major].0.[newer patch].0 +test_write_basic_config_version_file(4.5.06 2.0.9.9 1 0 0 0) # Request [older major].0.[newer patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 2.2.0.0 1 0 0 0) # Request [older major].[older minor].0.0 +test_write_basic_config_version_file(4.5.06 2.2.0.9 1 0 0 0) # Request [older major].[older minor].0.[newer tweak] +test_write_basic_config_version_file(4.5.06 2.2.2.0 1 0 0 0) # Request [older major].[older minor].[older patch].0 +test_write_basic_config_version_file(4.5.06 2.2.2.9 1 0 0 0) # Request [older major].[older minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 2.2.6.0 1 0 0 0) # Request [older major].[older minor].[same patch].0 +test_write_basic_config_version_file(4.5.06 2.2.6.9 1 0 0 0) # Request [older major].[older minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 2.2.9.0 1 0 0 0) # Request [older major].[older minor].[newer patch].0 +test_write_basic_config_version_file(4.5.06 2.2.9.9 1 0 0 0) # Request [older major].[older minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 2.5.0.0 1 0 0 0) # Request [older major].[same minor].0.0 +test_write_basic_config_version_file(4.5.06 2.5.0.9 1 0 0 0) # Request [older major].[same minor].0.[newer tweak] +test_write_basic_config_version_file(4.5.06 2.5.2.0 1 0 0 0) # Request [older major].[same minor].[older patch].0 +test_write_basic_config_version_file(4.5.06 2.5.2.9 1 0 0 0) # Request [older major].[same minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 2.5.6.0 1 0 0 0) # Request [older major].[same minor].[same patch].0 +test_write_basic_config_version_file(4.5.06 2.5.6.9 1 0 0 0) # Request [older major].[same minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 2.5.9.0 1 0 0 0) # Request [older major].[same minor].[newer patch].0 +test_write_basic_config_version_file(4.5.06 2.5.9.9 1 0 0 0) # Request [older major].[same minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 2.9.0.0 1 0 0 0) # Request [older major].[newer minor].0.0 +test_write_basic_config_version_file(4.5.06 2.9.0.9 1 0 0 0) # Request [older major].[newer minor].0.[newer tweak] +test_write_basic_config_version_file(4.5.06 2.9.2.0 1 0 0 0) # Request [older major].[newer minor].[older patch].0 +test_write_basic_config_version_file(4.5.06 2.9.2.9 1 0 0 0) # Request [older major].[newer minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 2.9.6.0 1 0 0 0) # Request [older major].[newer minor].[same patch].0 +test_write_basic_config_version_file(4.5.06 2.9.6.9 1 0 0 0) # Request [older major].[newer minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 2.9.9.0 1 0 0 0) # Request [older major].[newer minor].[newer patch].0 +test_write_basic_config_version_file(4.5.06 2.9.9.9 1 0 0 0) # Request [older major].[newer minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 4.0.0.0 1 1 0 0) # Request [same major].0.0.0 +test_write_basic_config_version_file(4.5.06 4.0.0.9 1 1 0 0) # Request [same major].0.0.[newer tweak] +test_write_basic_config_version_file(4.5.06 4.0.2.0 1 1 0 0) # Request [same major].0.[older patch].0 +test_write_basic_config_version_file(4.5.06 4.0.2.9 1 1 0 0) # Request [same major].0.[older patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 4.0.6.0 1 1 0 0) # Request [same major].0.[same patch].0 +test_write_basic_config_version_file(4.5.06 4.0.6.9 1 1 0 0) # Request [same major].0.[same patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 4.0.9.0 1 1 0 0) # Request [same major].0.[newer patch].0 +test_write_basic_config_version_file(4.5.06 4.0.9.9 1 1 0 0) # Request [same major].0.[newer patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 4.2.0.0 1 1 0 0) # Request [same major].[older minor].0.0 +test_write_basic_config_version_file(4.5.06 4.2.0.9 1 1 0 0) # Request [same major].[older minor].0.[newer tweak] +test_write_basic_config_version_file(4.5.06 4.2.2.0 1 1 0 0) # Request [same major].[older minor].[older patch].0 +test_write_basic_config_version_file(4.5.06 4.2.2.9 1 1 0 0) # Request [same major].[older minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 4.2.6.0 1 1 0 0) # Request [same major].[older minor].[same patch].0 +test_write_basic_config_version_file(4.5.06 4.2.6.9 1 1 0 0) # Request [same major].[older minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 4.2.9.0 1 1 0 0) # Request [same major].[older minor].[newer patch].0 +test_write_basic_config_version_file(4.5.06 4.2.9.9 1 1 0 0) # Request [same major].[older minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 4.5.0.0 1 1 1 0) # Request [same major].[same minor].0.0 +test_write_basic_config_version_file(4.5.06 4.5.0.9 1 1 1 0) # Request [same major].[same minor].0.[newer tweak] +test_write_basic_config_version_file(4.5.06 4.5.2.0 1 1 1 0) # Request [same major].[same minor].[older patch].0 +test_write_basic_config_version_file(4.5.06 4.5.2.9 1 1 1 0) # Request [same major].[same minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 4.5.06.0 1 1 1 1) # Request [same major].[same minor].[same patch].0 +test_write_basic_config_version_file(4.5.06 4.5.06.9 0 0 0 1) # Request [same major].[same minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 4.5.9.0 0 0 0 0) # Request [same major].[same minor].[newer patch].0 +test_write_basic_config_version_file(4.5.06 4.5.9.9 0 0 0 0) # Request [same major].[same minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 4.9.0.0 0 0 0 0) # Request [same major].[newer minor].0.0 +test_write_basic_config_version_file(4.5.06 4.9.0.9 0 0 0 0) # Request [same major].[newer minor].0.[newer tweak] +test_write_basic_config_version_file(4.5.06 4.9.2.0 0 0 0 0) # Request [same major].[newer minor].[older patch].0 +test_write_basic_config_version_file(4.5.06 4.9.2.9 0 0 0 0) # Request [same major].[newer minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 4.9.6.0 0 0 0 0) # Request [same major].[newer minor].[same patch].0 +test_write_basic_config_version_file(4.5.06 4.9.6.9 0 0 0 0) # Request [same major].[newer minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 4.9.9.0 0 0 0 0) # Request [same major].[newer minor].[newer patch].0 +test_write_basic_config_version_file(4.5.06 4.9.9.9 0 0 0 0) # Request [same major].[newer minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 9.0.0.0 0 0 0 0) # Request [newer major].0.0.0 +test_write_basic_config_version_file(4.5.06 9.0.0.9 0 0 0 0) # Request [newer major].0.0.[newer tweak] +test_write_basic_config_version_file(4.5.06 9.0.2.0 0 0 0 0) # Request [newer major].0.[older patch].0 +test_write_basic_config_version_file(4.5.06 9.0.2.9 0 0 0 0) # Request [newer major].0.[older patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 9.0.6.0 0 0 0 0) # Request [newer major].0.[same patch].0 +test_write_basic_config_version_file(4.5.06 9.0.6.9 0 0 0 0) # Request [newer major].0.[same patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 9.0.9.0 0 0 0 0) # Request [newer major].0.[newer patch].0 +test_write_basic_config_version_file(4.5.06 9.0.9.9 0 0 0 0) # Request [newer major].0.[newer patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 9.2.0.0 0 0 0 0) # Request [newer major].[older minor].0.0 +test_write_basic_config_version_file(4.5.06 9.2.0.9 0 0 0 0) # Request [newer major].[older minor].0.[newer tweak] +test_write_basic_config_version_file(4.5.06 9.2.2.0 0 0 0 0) # Request [newer major].[older minor].[older patch].0 +test_write_basic_config_version_file(4.5.06 9.2.2.9 0 0 0 0) # Request [newer major].[older minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 9.2.6.0 0 0 0 0) # Request [newer major].[older minor].[same patch].0 +test_write_basic_config_version_file(4.5.06 9.2.6.9 0 0 0 0) # Request [newer major].[older minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 9.2.9.0 0 0 0 0) # Request [newer major].[older minor].[newer patch].0 +test_write_basic_config_version_file(4.5.06 9.2.9.9 0 0 0 0) # Request [newer major].[older minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 9.5.0.0 0 0 0 0) # Request [newer major].[same minor].0.0 +test_write_basic_config_version_file(4.5.06 9.5.0.9 0 0 0 0) # Request [newer major].[same minor].0.[newer tweak] +test_write_basic_config_version_file(4.5.06 9.5.2.0 0 0 0 0) # Request [newer major].[same minor].[older patch].0 +test_write_basic_config_version_file(4.5.06 9.5.2.9 0 0 0 0) # Request [newer major].[same minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 9.5.6.0 0 0 0 0) # Request [newer major].[same minor].[same patch].0 +test_write_basic_config_version_file(4.5.06 9.5.6.9 0 0 0 0) # Request [newer major].[same minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 9.5.9.0 0 0 0 0) # Request [newer major].[same minor].[newer patch].0 +test_write_basic_config_version_file(4.5.06 9.5.9.9 0 0 0 0) # Request [newer major].[same minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 9.9.0.0 0 0 0 0) # Request [newer major].[newer minor].0.0 +test_write_basic_config_version_file(4.5.06 9.9.0.9 0 0 0 0) # Request [newer major].[newer minor].0.[newer tweak] +test_write_basic_config_version_file(4.5.06 9.9.2.0 0 0 0 0) # Request [newer major].[newer minor].[older patch].0 +test_write_basic_config_version_file(4.5.06 9.9.2.9 0 0 0 0) # Request [newer major].[newer minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 9.9.6.0 0 0 0 0) # Request [newer major].[newer minor].[same patch].0 +test_write_basic_config_version_file(4.5.06 9.9.6.9 0 0 0 0) # Request [newer major].[newer minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.5.06 9.9.9.0 0 0 0 0) # Request [newer major].[newer minor].[newer patch].0 +test_write_basic_config_version_file(4.5.06 9.9.9.9 0 0 0 0) # Request [newer major].[newer minor].[newer patch].[newer tweak] + + +test_write_basic_config_version_file(4.05.06.007 0 1 0 0 0) # Request 0 +test_write_basic_config_version_file(4.05.06.007 2 1 0 0 0) # Request [older major] +test_write_basic_config_version_file(4.05.06.007 4 1 1 0 0) # Request [same major] +test_write_basic_config_version_file(4.05.06.007 9 0 0 0 0) # Request [newer major] + +test_write_basic_config_version_file(4.05.06.007 0.0 1 0 0 0) # Request 0.0 +test_write_basic_config_version_file(4.05.06.007 0.2 1 0 0 0) # Request 0.[older minor] +test_write_basic_config_version_file(4.05.06.007 0.5 1 0 0 0) # Request 0.[same minor] +test_write_basic_config_version_file(4.05.06.007 0.9 1 0 0 0) # Request 0.[newer minor] +test_write_basic_config_version_file(4.05.06.007 2.0 1 0 0 0) # Request [older major].0 +test_write_basic_config_version_file(4.05.06.007 2.2 1 0 0 0) # Request [older major].[older minor] +test_write_basic_config_version_file(4.05.06.007 2.5 1 0 0 0) # Request [older major].[same minor] +test_write_basic_config_version_file(4.05.06.007 2.9 1 0 0 0) # Request [older major].[newer minor] +test_write_basic_config_version_file(4.05.06.007 4.0 1 1 0 0) # Request [same major].0 +test_write_basic_config_version_file(4.05.06.007 4.2 1 1 0 0) # Request [same major].[older minor] +test_write_basic_config_version_file(4.05.06.007 4.5 1 1 1 0) # Request [same major].[same minor] +test_write_basic_config_version_file(4.05.06.007 4.9 0 0 0 0) # Request [same major].[newer minor] +test_write_basic_config_version_file(4.05.06.007 9.0 0 0 0 0) # Request [newer major].0 +test_write_basic_config_version_file(4.05.06.007 9.1 0 0 0 0) # Request [newer major].[older minor] +test_write_basic_config_version_file(4.05.06.007 9.5 0 0 0 0) # Request [newer major].[same minor] +test_write_basic_config_version_file(4.05.06.007 9.9 0 0 0 0) # Request [newer major].[newer minor] + +test_write_basic_config_version_file(4.05.06.007 0.0.0 1 0 0 0) # Request 0.0.0 +test_write_basic_config_version_file(4.05.06.007 0.0.2 1 0 0 0) # Request 0.0.[older patch] +test_write_basic_config_version_file(4.05.06.007 0.0.6 1 0 0 0) # Request 0.0.[same patch] +test_write_basic_config_version_file(4.05.06.007 0.0.9 1 0 0 0) # Request 0.0.[newer patch] +test_write_basic_config_version_file(4.05.06.007 0.2.0 1 0 0 0) # Request 0.[older minor].0 +test_write_basic_config_version_file(4.05.06.007 0.2.2 1 0 0 0) # Request 0.[older minor].[older patch] +test_write_basic_config_version_file(4.05.06.007 0.2.6 1 0 0 0) # Request 0.[older minor].[same patch] +test_write_basic_config_version_file(4.05.06.007 0.2.9 1 0 0 0) # Request 0.[older minor].[newer patch] +test_write_basic_config_version_file(4.05.06.007 0.5.0 1 0 0 0) # Request 0.[same minor].0 +test_write_basic_config_version_file(4.05.06.007 0.5.2 1 0 0 0) # Request 0.[same minor].[older patch] +test_write_basic_config_version_file(4.05.06.007 0.5.6 1 0 0 0) # Request 0.[same minor].[same patch] +test_write_basic_config_version_file(4.05.06.007 0.5.9 1 0 0 0) # Request 0.[same minor].[newer patch] +test_write_basic_config_version_file(4.05.06.007 0.9.0 1 0 0 0) # Request 0.[newer minor].0 +test_write_basic_config_version_file(4.05.06.007 0.9.2 1 0 0 0) # Request 0.[newer minor].[older patch] +test_write_basic_config_version_file(4.05.06.007 0.9.6 1 0 0 0) # Request 0.[newer minor].[same patch] +test_write_basic_config_version_file(4.05.06.007 0.9.9 1 0 0 0) # Request 0.[newer minor].[newer patch] +test_write_basic_config_version_file(4.05.06.007 2.0.0 1 0 0 0) # Request [older major].0.0 +test_write_basic_config_version_file(4.05.06.007 2.0.2 1 0 0 0) # Request [older major].0.[older patch] +test_write_basic_config_version_file(4.05.06.007 2.0.6 1 0 0 0) # Request [older major].0.[same patch] +test_write_basic_config_version_file(4.05.06.007 2.0.9 1 0 0 0) # Request [older major].0.[newer patch] +test_write_basic_config_version_file(4.05.06.007 2.2.0 1 0 0 0) # Request [older major].[older minor].0 +test_write_basic_config_version_file(4.05.06.007 2.2.2 1 0 0 0) # Request [older major].[older minor].[older patch] +test_write_basic_config_version_file(4.05.06.007 2.2.6 1 0 0 0) # Request [older major].[older minor].[same patch] +test_write_basic_config_version_file(4.05.06.007 2.2.9 1 0 0 0) # Request [older major].[older minor].[newer patch] +test_write_basic_config_version_file(4.05.06.007 2.5.0 1 0 0 0) # Request [older major].[same minor].0 +test_write_basic_config_version_file(4.05.06.007 2.5.2 1 0 0 0) # Request [older major].[same minor].[older patch] +test_write_basic_config_version_file(4.05.06.007 2.5.6 1 0 0 0) # Request [older major].[same minor].[same patch] +test_write_basic_config_version_file(4.05.06.007 2.5.9 1 0 0 0) # Request [older major].[same minor].[newer patch] +test_write_basic_config_version_file(4.05.06.007 2.9.0 1 0 0 0) # Request [older major].[newer minor].0 +test_write_basic_config_version_file(4.05.06.007 2.9.2 1 0 0 0) # Request [older major].[newer minor].[older patch] +test_write_basic_config_version_file(4.05.06.007 2.9.6 1 0 0 0) # Request [older major].[newer minor].[same patch] +test_write_basic_config_version_file(4.05.06.007 2.9.9 1 0 0 0) # Request [older major].[newer minor].[newer patch] +test_write_basic_config_version_file(4.05.06.007 4.0.0 1 1 0 0) # Request [same major].0.0 +test_write_basic_config_version_file(4.05.06.007 4.0.2 1 1 0 0) # Request [same major].0.[older patch] +test_write_basic_config_version_file(4.05.06.007 4.0.6 1 1 0 0) # Request [same major].0.[same patch] +test_write_basic_config_version_file(4.05.06.007 4.0.9 1 1 0 0) # Request [same major].0.[newer patch] +test_write_basic_config_version_file(4.05.06.007 4.2.0 1 1 0 0) # Request [same major].[older minor].0 +test_write_basic_config_version_file(4.05.06.007 4.2.2 1 1 0 0) # Request [same major].[older minor].[older patch] +test_write_basic_config_version_file(4.05.06.007 4.2.6 1 1 0 0) # Request [same major].[older minor].[same patch] +test_write_basic_config_version_file(4.05.06.007 4.2.9 1 1 0 0) # Request [same major].[older minor].[newer patch] +test_write_basic_config_version_file(4.05.06.007 4.5.0 1 1 1 0) # Request [same major].[same minor].0 +test_write_basic_config_version_file(4.05.06.007 4.5.2 1 1 1 0) # Request [same major].[same minor].[older patch] +test_write_basic_config_version_file(4.05.06.007 4.05.06 1 1 1 1) # Request [same major].[same minor].[same patch] +test_write_basic_config_version_file(4.05.06.007 4.5.9 0 0 0 0) # Request [same major].[same minor].[newer patch] +test_write_basic_config_version_file(4.05.06.007 4.9.0 0 0 0 0) # Request [same major].[newer minor].0 +test_write_basic_config_version_file(4.05.06.007 4.9.2 0 0 0 0) # Request [same major].[newer minor].[older patch] +test_write_basic_config_version_file(4.05.06.007 4.9.6 0 0 0 0) # Request [same major].[newer minor].[same patch] +test_write_basic_config_version_file(4.05.06.007 4.9.9 0 0 0 0) # Request [same major].[newer minor].[newer patch] +test_write_basic_config_version_file(4.05.06.007 9.0.0 0 0 0 0) # Request [newer major].0.0 +test_write_basic_config_version_file(4.05.06.007 9.0.2 0 0 0 0) # Request [newer major].0.[older patch] +test_write_basic_config_version_file(4.05.06.007 9.0.6 0 0 0 0) # Request [newer major].0.[same patch] +test_write_basic_config_version_file(4.05.06.007 9.0.9 0 0 0 0) # Request [newer major].0.[newer patch] +test_write_basic_config_version_file(4.05.06.007 9.2.0 0 0 0 0) # Request [newer major].[older minor].0 +test_write_basic_config_version_file(4.05.06.007 9.2.2 0 0 0 0) # Request [newer major].[older minor].[older patch] +test_write_basic_config_version_file(4.05.06.007 9.2.6 0 0 0 0) # Request [newer major].[older minor].[same patch] +test_write_basic_config_version_file(4.05.06.007 9.2.9 0 0 0 0) # Request [newer major].[older minor].[newer patch] +test_write_basic_config_version_file(4.05.06.007 9.5.0 0 0 0 0) # Request [newer major].[same minor].0 +test_write_basic_config_version_file(4.05.06.007 9.5.2 0 0 0 0) # Request [newer major].[same minor].[older patch] +test_write_basic_config_version_file(4.05.06.007 9.5.6 0 0 0 0) # Request [newer major].[same minor].[same patch] +test_write_basic_config_version_file(4.05.06.007 9.5.9 0 0 0 0) # Request [newer major].[same minor].[newer patch] +test_write_basic_config_version_file(4.05.06.007 9.9.0 0 0 0 0) # Request [newer major].[newer minor].0 +test_write_basic_config_version_file(4.05.06.007 9.9.2 0 0 0 0) # Request [newer major].[newer minor].[older patch] +test_write_basic_config_version_file(4.05.06.007 9.9.6 0 0 0 0) # Request [newer major].[newer minor].[same patch] +test_write_basic_config_version_file(4.05.06.007 9.9.9 0 0 0 0) # Request [newer major].[newer minor].[newer patch] + +test_write_basic_config_version_file(4.05.06.007 0.0.0.0 1 0 0 0) # Request 0.0.0.0 +test_write_basic_config_version_file(4.05.06.007 0.0.0.2 1 0 0 0) # Request 0.0.0.[older tweak] +test_write_basic_config_version_file(4.05.06.007 0.0.0.7 1 0 0 0) # Request 0.0.0.[same tweak] +test_write_basic_config_version_file(4.05.06.007 0.0.0.9 1 0 0 0) # Request 0.0.0.[newer tweak] +test_write_basic_config_version_file(4.05.06.007 0.0.2.0 1 0 0 0) # Request 0.0.[older patch].0 +test_write_basic_config_version_file(4.05.06.007 0.0.2.2 1 0 0 0) # Request 0.0.[older patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 0.0.2.7 1 0 0 0) # Request 0.0.[older patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 0.0.2.9 1 0 0 0) # Request 0.0.[older patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 0.0.6.0 1 0 0 0) # Request 0.0.[same patch].0 +test_write_basic_config_version_file(4.05.06.007 0.0.6.2 1 0 0 0) # Request 0.0.[same patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 0.0.6.7 1 0 0 0) # Request 0.0.[same patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 0.0.6.9 1 0 0 0) # Request 0.0.[same patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 0.0.9.0 1 0 0 0) # Request 0.0.[newer patch].0 +test_write_basic_config_version_file(4.05.06.007 0.0.9.2 1 0 0 0) # Request 0.0.[newer patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 0.0.9.7 1 0 0 0) # Request 0.0.[newer patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 0.0.9.9 1 0 0 0) # Request 0.0.[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 0.2.0.0 1 0 0 0) # Request 0.[older minor].0.0 +test_write_basic_config_version_file(4.05.06.007 0.2.0.2 1 0 0 0) # Request 0.[older minor].0.[older tweak] +test_write_basic_config_version_file(4.05.06.007 0.2.0.7 1 0 0 0) # Request 0.[older minor].0.[same tweak] +test_write_basic_config_version_file(4.05.06.007 0.2.0.9 1 0 0 0) # Request 0.[older minor].0.[newer tweak] +test_write_basic_config_version_file(4.05.06.007 0.2.2.0 1 0 0 0) # Request 0.[older minor].[older patch].0 +test_write_basic_config_version_file(4.05.06.007 0.2.2.2 1 0 0 0) # Request 0.[older minor].[older patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 0.2.2.7 1 0 0 0) # Request 0.[older minor].[older patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 0.2.2.9 1 0 0 0) # Request 0.[older minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 0.2.6.0 1 0 0 0) # Request 0.[older minor].[same patch].0 +test_write_basic_config_version_file(4.05.06.007 0.2.6.2 1 0 0 0) # Request 0.[older minor].[same patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 0.2.6.7 1 0 0 0) # Request 0.[older minor].[same patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 0.2.6.9 1 0 0 0) # Request 0.[older minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 0.2.9.0 1 0 0 0) # Request 0.[older minor].[newer patch].0 +test_write_basic_config_version_file(4.05.06.007 0.2.9.2 1 0 0 0) # Request 0.[older minor].[newer patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 0.2.9.7 1 0 0 0) # Request 0.[older minor].[newer patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 0.2.9.9 1 0 0 0) # Request 0.[older minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 0.5.0.0 1 0 0 0) # Request 0.[same minor].0.0 +test_write_basic_config_version_file(4.05.06.007 0.5.0.2 1 0 0 0) # Request 0.[same minor].0.[older tweak] +test_write_basic_config_version_file(4.05.06.007 0.5.0.7 1 0 0 0) # Request 0.[same minor].0.[same tweak] +test_write_basic_config_version_file(4.05.06.007 0.5.0.9 1 0 0 0) # Request 0.[same minor].0.[newer tweak] +test_write_basic_config_version_file(4.05.06.007 0.5.2.0 1 0 0 0) # Request 0.[same minor].[older patch].0 +test_write_basic_config_version_file(4.05.06.007 0.5.2.2 1 0 0 0) # Request 0.[same minor].[older patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 0.5.2.7 1 0 0 0) # Request 0.[same minor].[older patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 0.5.2.9 1 0 0 0) # Request 0.[same minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 0.5.6.0 1 0 0 0) # Request 0.[same minor].[same patch].0 +test_write_basic_config_version_file(4.05.06.007 0.5.6.2 1 0 0 0) # Request 0.[same minor].[same patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 0.5.6.7 1 0 0 0) # Request 0.[same minor].[same patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 0.5.6.9 1 0 0 0) # Request 0.[same minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 0.5.9.0 1 0 0 0) # Request 0.[same minor].[newer patch].0 +test_write_basic_config_version_file(4.05.06.007 0.5.9.2 1 0 0 0) # Request 0.[same minor].[newer patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 0.5.9.7 1 0 0 0) # Request 0.[same minor].[newer patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 0.5.9.9 1 0 0 0) # Request 0.[same minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 0.9.0.0 1 0 0 0) # Request 0.[newer minor].0.0 +test_write_basic_config_version_file(4.05.06.007 0.9.0.2 1 0 0 0) # Request 0.[newer minor].0.[older tweak] +test_write_basic_config_version_file(4.05.06.007 0.9.0.7 1 0 0 0) # Request 0.[newer minor].0.[same tweak] +test_write_basic_config_version_file(4.05.06.007 0.9.0.9 1 0 0 0) # Request 0.[newer minor].0.[newer tweak] +test_write_basic_config_version_file(4.05.06.007 0.9.2.0 1 0 0 0) # Request 0.[newer minor].[older patch].0 +test_write_basic_config_version_file(4.05.06.007 0.9.2.2 1 0 0 0) # Request 0.[newer minor].[older patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 0.9.2.7 1 0 0 0) # Request 0.[newer minor].[older patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 0.9.2.9 1 0 0 0) # Request 0.[newer minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 0.9.6.0 1 0 0 0) # Request 0.[newer minor].[same patch].0 +test_write_basic_config_version_file(4.05.06.007 0.9.6.2 1 0 0 0) # Request 0.[newer minor].[same patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 0.9.6.7 1 0 0 0) # Request 0.[newer minor].[same patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 0.9.6.9 1 0 0 0) # Request 0.[newer minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 0.9.9.0 1 0 0 0) # Request 0.[newer minor].[newer patch].0 +test_write_basic_config_version_file(4.05.06.007 0.9.9.2 1 0 0 0) # Request 0.[newer minor].[newer patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 0.9.9.7 1 0 0 0) # Request 0.[newer minor].[newer patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 0.9.9.9 1 0 0 0) # Request 0.[newer minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 2.0.0.0 1 0 0 0) # Request [older major].0.0.0 +test_write_basic_config_version_file(4.05.06.007 2.0.0.2 1 0 0 0) # Request [older major].0.0.[older tweak] +test_write_basic_config_version_file(4.05.06.007 2.0.0.7 1 0 0 0) # Request [older major].0.0.[same tweak] +test_write_basic_config_version_file(4.05.06.007 2.0.0.9 1 0 0 0) # Request [older major].0.0.[newer tweak] +test_write_basic_config_version_file(4.05.06.007 2.0.2.0 1 0 0 0) # Request [older major].0.[older patch].0 +test_write_basic_config_version_file(4.05.06.007 2.0.2.2 1 0 0 0) # Request [older major].0.[older patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 2.0.2.7 1 0 0 0) # Request [older major].0.[older patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 2.0.2.9 1 0 0 0) # Request [older major].0.[older patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 2.0.6.0 1 0 0 0) # Request [older major].0.[same patch].0 +test_write_basic_config_version_file(4.05.06.007 2.0.6.2 1 0 0 0) # Request [older major].0.[same patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 2.0.6.7 1 0 0 0) # Request [older major].0.[same patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 2.0.6.9 1 0 0 0) # Request [older major].0.[same patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 2.0.9.0 1 0 0 0) # Request [older major].0.[newer patch].0 +test_write_basic_config_version_file(4.05.06.007 2.0.9.2 1 0 0 0) # Request [older major].0.[newer patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 2.0.9.7 1 0 0 0) # Request [older major].0.[newer patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 2.0.9.9 1 0 0 0) # Request [older major].0.[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 2.2.0.0 1 0 0 0) # Request [older major].[older minor].0.0 +test_write_basic_config_version_file(4.05.06.007 2.2.0.2 1 0 0 0) # Request [older major].[older minor].0.[older tweak] +test_write_basic_config_version_file(4.05.06.007 2.2.0.7 1 0 0 0) # Request [older major].[older minor].0.[same tweak] +test_write_basic_config_version_file(4.05.06.007 2.2.0.9 1 0 0 0) # Request [older major].[older minor].0.[newer tweak] +test_write_basic_config_version_file(4.05.06.007 2.2.2.0 1 0 0 0) # Request [older major].[older minor].[older patch].0 +test_write_basic_config_version_file(4.05.06.007 2.2.2.2 1 0 0 0) # Request [older major].[older minor].[older patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 2.2.2.7 1 0 0 0) # Request [older major].[older minor].[older patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 2.2.2.9 1 0 0 0) # Request [older major].[older minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 2.2.6.0 1 0 0 0) # Request [older major].[older minor].[same patch].0 +test_write_basic_config_version_file(4.05.06.007 2.2.6.2 1 0 0 0) # Request [older major].[older minor].[same patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 2.2.6.7 1 0 0 0) # Request [older major].[older minor].[same patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 2.2.6.9 1 0 0 0) # Request [older major].[older minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 2.2.9.0 1 0 0 0) # Request [older major].[older minor].[newer patch].0 +test_write_basic_config_version_file(4.05.06.007 2.2.9.2 1 0 0 0) # Request [older major].[older minor].[newer patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 2.2.9.7 1 0 0 0) # Request [older major].[older minor].[newer patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 2.2.9.9 1 0 0 0) # Request [older major].[older minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 2.5.0.0 1 0 0 0) # Request [older major].[same minor].0.0 +test_write_basic_config_version_file(4.05.06.007 2.5.0.2 1 0 0 0) # Request [older major].[same minor].0.[older tweak] +test_write_basic_config_version_file(4.05.06.007 2.5.0.7 1 0 0 0) # Request [older major].[same minor].0.[same tweak] +test_write_basic_config_version_file(4.05.06.007 2.5.0.9 1 0 0 0) # Request [older major].[same minor].0.[newer tweak] +test_write_basic_config_version_file(4.05.06.007 2.5.2.0 1 0 0 0) # Request [older major].[same minor].[older patch].0 +test_write_basic_config_version_file(4.05.06.007 2.5.2.2 1 0 0 0) # Request [older major].[same minor].[older patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 2.5.2.7 1 0 0 0) # Request [older major].[same minor].[older patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 2.5.2.9 1 0 0 0) # Request [older major].[same minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 2.5.6.0 1 0 0 0) # Request [older major].[same minor].[same patch].0 +test_write_basic_config_version_file(4.05.06.007 2.5.6.2 1 0 0 0) # Request [older major].[same minor].[same patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 2.5.6.7 1 0 0 0) # Request [older major].[same minor].[same patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 2.5.6.9 1 0 0 0) # Request [older major].[same minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 2.5.9.0 1 0 0 0) # Request [older major].[same minor].[newer patch].0 +test_write_basic_config_version_file(4.05.06.007 2.5.9.2 1 0 0 0) # Request [older major].[same minor].[newer patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 2.5.9.7 1 0 0 0) # Request [older major].[same minor].[newer patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 2.5.9.9 1 0 0 0) # Request [older major].[same minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 2.9.0.0 1 0 0 0) # Request [older major].[newer minor].0.0 +test_write_basic_config_version_file(4.05.06.007 2.9.0.2 1 0 0 0) # Request [older major].[newer minor].0.[older tweak] +test_write_basic_config_version_file(4.05.06.007 2.9.0.7 1 0 0 0) # Request [older major].[newer minor].0.[same tweak] +test_write_basic_config_version_file(4.05.06.007 2.9.0.9 1 0 0 0) # Request [older major].[newer minor].0.[newer tweak] +test_write_basic_config_version_file(4.05.06.007 2.9.2.0 1 0 0 0) # Request [older major].[newer minor].[older patch].0 +test_write_basic_config_version_file(4.05.06.007 2.9.2.2 1 0 0 0) # Request [older major].[newer minor].[older patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 2.9.2.7 1 0 0 0) # Request [older major].[newer minor].[older patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 2.9.2.9 1 0 0 0) # Request [older major].[newer minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 2.9.6.0 1 0 0 0) # Request [older major].[newer minor].[same patch].0 +test_write_basic_config_version_file(4.05.06.007 2.9.6.2 1 0 0 0) # Request [older major].[newer minor].[same patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 2.9.6.7 1 0 0 0) # Request [older major].[newer minor].[same patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 2.9.6.9 1 0 0 0) # Request [older major].[newer minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 2.9.9.0 1 0 0 0) # Request [older major].[newer minor].[newer patch].0 +test_write_basic_config_version_file(4.05.06.007 2.9.9.2 1 0 0 0) # Request [older major].[newer minor].[newer patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 2.9.9.7 1 0 0 0) # Request [older major].[newer minor].[newer patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 2.9.9.9 1 0 0 0) # Request [older major].[newer minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 4.0.0.0 1 1 0 0) # Request [same major].0.0.0 +test_write_basic_config_version_file(4.05.06.007 4.0.0.2 1 1 0 0) # Request [same major].0.0.[older tweak] +test_write_basic_config_version_file(4.05.06.007 4.0.0.7 1 1 0 0) # Request [same major].0.0.[same tweak] +test_write_basic_config_version_file(4.05.06.007 4.0.0.9 1 1 0 0) # Request [same major].0.0.[newer tweak] +test_write_basic_config_version_file(4.05.06.007 4.0.2.0 1 1 0 0) # Request [same major].0.[older patch].0 +test_write_basic_config_version_file(4.05.06.007 4.0.2.2 1 1 0 0) # Request [same major].0.[older patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 4.0.2.7 1 1 0 0) # Request [same major].0.[older patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 4.0.2.9 1 1 0 0) # Request [same major].0.[older patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 4.0.6.0 1 1 0 0) # Request [same major].0.[same patch].0 +test_write_basic_config_version_file(4.05.06.007 4.0.6.2 1 1 0 0) # Request [same major].0.[same patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 4.0.6.7 1 1 0 0) # Request [same major].0.[same patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 4.0.6.9 1 1 0 0) # Request [same major].0.[same patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 4.0.9.0 1 1 0 0) # Request [same major].0.[newer patch].0 +test_write_basic_config_version_file(4.05.06.007 4.0.9.2 1 1 0 0) # Request [same major].0.[newer patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 4.0.9.7 1 1 0 0) # Request [same major].0.[newer patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 4.0.9.9 1 1 0 0) # Request [same major].0.[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 4.2.0.0 1 1 0 0) # Request [same major].[older minor].0.0 +test_write_basic_config_version_file(4.05.06.007 4.2.0.2 1 1 0 0) # Request [same major].[older minor].0.[older tweak] +test_write_basic_config_version_file(4.05.06.007 4.2.0.7 1 1 0 0) # Request [same major].[older minor].0.[same tweak] +test_write_basic_config_version_file(4.05.06.007 4.2.0.9 1 1 0 0) # Request [same major].[older minor].0.[newer tweak] +test_write_basic_config_version_file(4.05.06.007 4.2.2.0 1 1 0 0) # Request [same major].[older minor].[older patch].0 +test_write_basic_config_version_file(4.05.06.007 4.2.2.2 1 1 0 0) # Request [same major].[older minor].[older patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 4.2.2.7 1 1 0 0) # Request [same major].[older minor].[older patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 4.2.2.9 1 1 0 0) # Request [same major].[older minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 4.2.6.0 1 1 0 0) # Request [same major].[older minor].[same patch].0 +test_write_basic_config_version_file(4.05.06.007 4.2.6.2 1 1 0 0) # Request [same major].[older minor].[same patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 4.2.6.7 1 1 0 0) # Request [same major].[older minor].[same patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 4.2.6.9 1 1 0 0) # Request [same major].[older minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 4.2.9.0 1 1 0 0) # Request [same major].[older minor].[newer patch].0 +test_write_basic_config_version_file(4.05.06.007 4.2.9.2 1 1 0 0) # Request [same major].[older minor].[newer patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 4.2.9.7 1 1 0 0) # Request [same major].[older minor].[newer patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 4.2.9.9 1 1 0 0) # Request [same major].[older minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 4.5.0.0 1 1 1 0) # Request [same major].[same minor].0.0 +test_write_basic_config_version_file(4.05.06.007 4.5.0.2 1 1 1 0) # Request [same major].[same minor].0.[older tweak] +test_write_basic_config_version_file(4.05.06.007 4.5.0.7 1 1 1 0) # Request [same major].[same minor].0.[same tweak] +test_write_basic_config_version_file(4.05.06.007 4.5.0.9 1 1 1 0) # Request [same major].[same minor].0.[newer tweak] +test_write_basic_config_version_file(4.05.06.007 4.5.2.0 1 1 1 0) # Request [same major].[same minor].[older patch].0 +test_write_basic_config_version_file(4.05.06.007 4.5.2.2 1 1 1 0) # Request [same major].[same minor].[older patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 4.5.2.7 1 1 1 0) # Request [same major].[same minor].[older patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 4.5.2.9 1 1 1 0) # Request [same major].[same minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 4.05.06.007 1 1 1 1) # Request [same major].[same minor].[same patch].0 +test_write_basic_config_version_file(4.05.06.007 4.05.06.2 1 1 1 1) # Request [same major].[same minor].[same patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 4.05.06.7 1 1 1 1) # Request [same major].[same minor].[same patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 4.05.06.9 0 0 0 1) # Request [same major].[same minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 4.5.9.0 0 0 0 0) # Request [same major].[same minor].[newer patch].0 +test_write_basic_config_version_file(4.05.06.007 4.5.9.2 0 0 0 0) # Request [same major].[same minor].[newer patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 4.5.9.7 0 0 0 0) # Request [same major].[same minor].[newer patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 4.5.9.9 0 0 0 0) # Request [same major].[same minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 4.9.0.0 0 0 0 0) # Request [same major].[newer minor].0.0 +test_write_basic_config_version_file(4.05.06.007 4.9.0.2 0 0 0 0) # Request [same major].[newer minor].0.[older tweak] +test_write_basic_config_version_file(4.05.06.007 4.9.0.7 0 0 0 0) # Request [same major].[newer minor].0.[same tweak] +test_write_basic_config_version_file(4.05.06.007 4.9.0.9 0 0 0 0) # Request [same major].[newer minor].0.[newer tweak] +test_write_basic_config_version_file(4.05.06.007 4.9.2.0 0 0 0 0) # Request [same major].[newer minor].[older patch].0 +test_write_basic_config_version_file(4.05.06.007 4.9.2.2 0 0 0 0) # Request [same major].[newer minor].[older patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 4.9.2.7 0 0 0 0) # Request [same major].[newer minor].[older patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 4.9.2.9 0 0 0 0) # Request [same major].[newer minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 4.9.6.0 0 0 0 0) # Request [same major].[newer minor].[same patch].0 +test_write_basic_config_version_file(4.05.06.007 4.9.6.2 0 0 0 0) # Request [same major].[newer minor].[same patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 4.9.6.7 0 0 0 0) # Request [same major].[newer minor].[same patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 4.9.6.9 0 0 0 0) # Request [same major].[newer minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 4.9.9.0 0 0 0 0) # Request [same major].[newer minor].[newer patch].0 +test_write_basic_config_version_file(4.05.06.007 4.9.9.2 0 0 0 0) # Request [same major].[newer minor].[newer patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 4.9.9.7 0 0 0 0) # Request [same major].[newer minor].[newer patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 4.9.9.9 0 0 0 0) # Request [same major].[newer minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 9.0.0.0 0 0 0 0) # Request [newer major].0.0.0 +test_write_basic_config_version_file(4.05.06.007 9.0.0.2 0 0 0 0) # Request [newer major].0.0.[older tweak] +test_write_basic_config_version_file(4.05.06.007 9.0.0.7 0 0 0 0) # Request [newer major].0.0.[same tweak] +test_write_basic_config_version_file(4.05.06.007 9.0.0.9 0 0 0 0) # Request [newer major].0.0.[newer tweak] +test_write_basic_config_version_file(4.05.06.007 9.0.2.0 0 0 0 0) # Request [newer major].0.[older patch].0 +test_write_basic_config_version_file(4.05.06.007 9.0.2.2 0 0 0 0) # Request [newer major].0.[older patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 9.0.2.7 0 0 0 0) # Request [newer major].0.[older patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 9.0.2.9 0 0 0 0) # Request [newer major].0.[older patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 9.0.6.0 0 0 0 0) # Request [newer major].0.[same patch].0 +test_write_basic_config_version_file(4.05.06.007 9.0.6.2 0 0 0 0) # Request [newer major].0.[same patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 9.0.6.7 0 0 0 0) # Request [newer major].0.[same patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 9.0.6.9 0 0 0 0) # Request [newer major].0.[same patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 9.0.9.0 0 0 0 0) # Request [newer major].0.[newer patch].0 +test_write_basic_config_version_file(4.05.06.007 9.0.9.2 0 0 0 0) # Request [newer major].0.[newer patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 9.0.9.7 0 0 0 0) # Request [newer major].0.[newer patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 9.0.9.9 0 0 0 0) # Request [newer major].0.[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 9.2.0.0 0 0 0 0) # Request [newer major].[older minor].0.0 +test_write_basic_config_version_file(4.05.06.007 9.2.0.2 0 0 0 0) # Request [newer major].[older minor].0.[older tweak] +test_write_basic_config_version_file(4.05.06.007 9.2.0.7 0 0 0 0) # Request [newer major].[older minor].0.[same tweak] +test_write_basic_config_version_file(4.05.06.007 9.2.0.9 0 0 0 0) # Request [newer major].[older minor].0.[newer tweak] +test_write_basic_config_version_file(4.05.06.007 9.2.2.0 0 0 0 0) # Request [newer major].[older minor].[older patch].0 +test_write_basic_config_version_file(4.05.06.007 9.2.2.2 0 0 0 0) # Request [newer major].[older minor].[older patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 9.2.2.7 0 0 0 0) # Request [newer major].[older minor].[older patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 9.2.2.9 0 0 0 0) # Request [newer major].[older minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 9.2.6.0 0 0 0 0) # Request [newer major].[older minor].[same patch].0 +test_write_basic_config_version_file(4.05.06.007 9.2.6.2 0 0 0 0) # Request [newer major].[older minor].[same patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 9.2.6.7 0 0 0 0) # Request [newer major].[older minor].[same patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 9.2.6.9 0 0 0 0) # Request [newer major].[older minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 9.2.9.0 0 0 0 0) # Request [newer major].[older minor].[newer patch].0 +test_write_basic_config_version_file(4.05.06.007 9.2.9.2 0 0 0 0) # Request [newer major].[older minor].[newer patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 9.2.9.7 0 0 0 0) # Request [newer major].[older minor].[newer patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 9.2.9.9 0 0 0 0) # Request [newer major].[older minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 9.5.0.0 0 0 0 0) # Request [newer major].[same minor].0.0 +test_write_basic_config_version_file(4.05.06.007 9.5.0.2 0 0 0 0) # Request [newer major].[same minor].0.[older tweak] +test_write_basic_config_version_file(4.05.06.007 9.5.0.7 0 0 0 0) # Request [newer major].[same minor].0.[same tweak] +test_write_basic_config_version_file(4.05.06.007 9.5.0.9 0 0 0 0) # Request [newer major].[same minor].0.[newer tweak] +test_write_basic_config_version_file(4.05.06.007 9.5.2.0 0 0 0 0) # Request [newer major].[same minor].[older patch].0 +test_write_basic_config_version_file(4.05.06.007 9.5.2.2 0 0 0 0) # Request [newer major].[same minor].[older patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 9.5.2.7 0 0 0 0) # Request [newer major].[same minor].[older patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 9.5.2.9 0 0 0 0) # Request [newer major].[same minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 9.5.6.0 0 0 0 0) # Request [newer major].[same minor].[same patch].0 +test_write_basic_config_version_file(4.05.06.007 9.5.6.2 0 0 0 0) # Request [newer major].[same minor].[same patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 9.5.6.7 0 0 0 0) # Request [newer major].[same minor].[same patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 9.5.6.9 0 0 0 0) # Request [newer major].[same minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 9.5.9.0 0 0 0 0) # Request [newer major].[same minor].[newer patch].0 +test_write_basic_config_version_file(4.05.06.007 9.5.9.2 0 0 0 0) # Request [newer major].[same minor].[newer patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 9.5.9.7 0 0 0 0) # Request [newer major].[same minor].[newer patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 9.5.9.9 0 0 0 0) # Request [newer major].[same minor].[newer patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 9.9.0.0 0 0 0 0) # Request [newer major].[newer minor].0.0 +test_write_basic_config_version_file(4.05.06.007 9.9.0.2 0 0 0 0) # Request [newer major].[newer minor].0.[older tweak] +test_write_basic_config_version_file(4.05.06.007 9.9.0.7 0 0 0 0) # Request [newer major].[newer minor].0.[same tweak] +test_write_basic_config_version_file(4.05.06.007 9.9.0.9 0 0 0 0) # Request [newer major].[newer minor].0.[newer tweak] +test_write_basic_config_version_file(4.05.06.007 9.9.2.0 0 0 0 0) # Request [newer major].[newer minor].[older patch].0 +test_write_basic_config_version_file(4.05.06.007 9.9.2.2 0 0 0 0) # Request [newer major].[newer minor].[older patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 9.9.2.7 0 0 0 0) # Request [newer major].[newer minor].[older patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 9.9.2.9 0 0 0 0) # Request [newer major].[newer minor].[older patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 9.9.6.0 0 0 0 0) # Request [newer major].[newer minor].[same patch].0 +test_write_basic_config_version_file(4.05.06.007 9.9.6.2 0 0 0 0) # Request [newer major].[newer minor].[same patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 9.9.6.7 0 0 0 0) # Request [newer major].[newer minor].[same patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 9.9.6.9 0 0 0 0) # Request [newer major].[newer minor].[same patch].[newer tweak] +test_write_basic_config_version_file(4.05.06.007 9.9.9.0 0 0 0 0) # Request [newer major].[newer minor].[newer patch].0 +test_write_basic_config_version_file(4.05.06.007 9.9.9.2 0 0 0 0) # Request [newer major].[newer minor].[newer patch].[older tweak] +test_write_basic_config_version_file(4.05.06.007 9.9.9.7 0 0 0 0) # Request [newer major].[newer minor].[newer patch].[same tweak] +test_write_basic_config_version_file(4.05.06.007 9.9.9.9 0 0 0 0) # Request [newer major].[newer minor].[newer patch].[newer tweak] + +test_write_basic_config_version_file(4 0...5 1 0 0 0) +test_write_basic_config_version_file(4 2...5 1 0 0 0) +test_write_basic_config_version_file(4 2...4 1 0 0 0) +test_write_basic_config_version_file(4 4...<5 1 1 0 0) +test_write_basic_config_version_file(4 9...10 0 0 0 0) + +test_write_basic_config_version_file(4 0.1...5 1 0 0 0) +test_write_basic_config_version_file(4 2.1...5 1 0 0 0) +test_write_basic_config_version_file(4 2.8...5 1 0 0 0) +test_write_basic_config_version_file(4 2.1...4 1 0 0 0) +test_write_basic_config_version_file(4 2.8...4 1 0 0 0) +test_write_basic_config_version_file(4 4.0...<5 1 1 0 0) +test_write_basic_config_version_file(4 4.8...<5 0 0 0 0) +test_write_basic_config_version_file(4 4.1...5 0 0 0 0) +test_write_basic_config_version_file(4 4.8...5 0 0 0 0) +test_write_basic_config_version_file(4 9.1...10 0 0 0 0) +test_write_basic_config_version_file(4 9.8...10 0 0 0 0) + + +test_write_basic_config_version_file(4.05 0.1...5 1 0 0 0) +test_write_basic_config_version_file(4.05 2.1...5 1 0 0 0) +test_write_basic_config_version_file(4.05 2.8...5 1 0 0 0) +test_write_basic_config_version_file(4.05 2.1...4 0 0 0 0) +test_write_basic_config_version_file(4.05 2.8...4 0 0 0 0) +test_write_basic_config_version_file(4.05 2.8...4.8 1 0 0 0) +test_write_basic_config_version_file(4.05 4.1...<5 1 1 0 0) +test_write_basic_config_version_file(4.05 4.8...<5 0 0 0 0) +test_write_basic_config_version_file(4.05 4.5...4.5.8 1 1 1 0) +test_write_basic_config_version_file(4.05 4.5...<4.6 1 1 1 0) +test_write_basic_config_version_file(4.05 4.1...5 1 0 0 0) +test_write_basic_config_version_file(4.05 4.8...5 0 0 0 0) +test_write_basic_config_version_file(4.05 9.1...10 0 0 0 0) +test_write_basic_config_version_file(4.05 9.8...10 0 0 0 0) + + +test_write_basic_config_version_file(4.5.06 0.1...5 1 0 0 0) +test_write_basic_config_version_file(4.5.06 2.1...5 1 0 0 0) +test_write_basic_config_version_file(4.5.06 2.8...5 1 0 0 0) +test_write_basic_config_version_file(4.5.06 2.1...4 0 0 0 0) +test_write_basic_config_version_file(4.5.06 2.8...4 0 0 0 0) +test_write_basic_config_version_file(4.5.06 2.8...4.8 1 0 0 0) +test_write_basic_config_version_file(4.5.06 4.1...<5 1 1 0 0) +test_write_basic_config_version_file(4.5.06 4.8...<5 0 0 0 0) +test_write_basic_config_version_file(4.5.06 4.5...4.5.4 0 0 0 0) +test_write_basic_config_version_file(4.5.06 4.5...4.5.8 1 1 1 0) +test_write_basic_config_version_file(4.5.06 4.5...<4.6 1 1 1 0) +test_write_basic_config_version_file(4.5.06 4.1...5 1 0 0 0) +test_write_basic_config_version_file(4.5.06 4.8...5 0 0 0 0) +test_write_basic_config_version_file(4.5.06 9.1...10 0 0 0 0) +test_write_basic_config_version_file(4.5.06 9.8...10 0 0 0 0) diff --git a/Tests/RunCMake/WriteBasicConfigVersionFile/RunCMakeTest.cmake b/Tests/RunCMake/WriteBasicConfigVersionFile/RunCMakeTest.cmake index 5db33f7..8a9db15 100644 --- a/Tests/RunCMake/WriteBasicConfigVersionFile/RunCMakeTest.cmake +++ b/Tests/RunCMake/WriteBasicConfigVersionFile/RunCMakeTest.cmake @@ -2,3 +2,4 @@ include(RunCMake) run_cmake(All) run_cmake(ArchIndependent) +run_cmake(LeadingZeroes) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedAppExtensions-iOS-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedAppExtensions-iOS-check.cmake new file mode 100644 index 0000000..576be11 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedAppExtensions-iOS-check.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake) + +findAttribute(${test} "RemoveHeadersOnCopy" TRUE) +findAttribute(${test} "CodeSignOnCopy" FALSE) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedAppExtensions-iOS.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedAppExtensions-iOS.cmake new file mode 100644 index 0000000..839f842 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedAppExtensions-iOS.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/EmbedAppExtensions.cmake) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedAppExtensions-macOS-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedAppExtensions-macOS-check.cmake new file mode 100644 index 0000000..576be11 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedAppExtensions-macOS-check.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake) + +findAttribute(${test} "RemoveHeadersOnCopy" TRUE) +findAttribute(${test} "CodeSignOnCopy" FALSE) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedAppExtensions-macOS.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedAppExtensions-macOS.cmake new file mode 100644 index 0000000..839f842 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedAppExtensions-macOS.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/EmbedAppExtensions.cmake) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedAppExtensions.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedAppExtensions.cmake new file mode 100644 index 0000000..d7494ea --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedAppExtensions.cmake @@ -0,0 +1,21 @@ +add_library(app_extension MODULE Empty.txt) +set_target_properties(app_extension PROPERTIES + LINKER_LANGUAGE CXX + BUNDLE YES + XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO" + XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" + XCODE_ATTRIBUTE_ENABLE_BITCODE "NO" + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in" + MACOSX_BUNDLE_GUI_IDENTIFIER "com.example.app.app_extension" + XCODE_PRODUCT_TYPE "com.apple.product-type.app-extension" + XCODE_EXPLICIT_FILE_TYPE "wrapper.app-extension" +) + +add_executable(app MACOSX_BUNDLE main.m) +add_dependencies(app app_extension) +set_target_properties(app PROPERTIES + XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO" + XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" + XCODE_EMBED_APP_EXTENSIONS app_extension + MACOSX_BUNDLE_GUI_IDENTIFIER "com.example.app" +) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff-check.cmake index 9cc03b9..dbd3e87 100644 --- a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff-check.cmake +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff-check.cmake @@ -1,14 +1,4 @@ -function(findAttribute project attr) - execute_process( - COMMAND grep ${attr} ${RunCMake_TEST_BINARY_DIR}/${project}.xcodeproj/project.pbxproj - OUTPUT_VARIABLE output_var - RESULT_VARIABLE result_var - ) +include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake) - if(NOT result_var) - set(RunCMake_TEST_FAILED "${attr} attribute is set" PARENT_SCOPE) - endif() -endfunction() - -findAttribute(${test} "RemoveHeadersOnCopy") -findAttribute(${test} "CodeSignOnCopy") +findAttribute(${test} "RemoveHeadersOnCopy" FALSE) +findAttribute(${test} "CodeSignOnCopy" FALSE) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-check.cmake index 3f62640..0f57820 100644 --- a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-check.cmake +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-check.cmake @@ -1,14 +1,4 @@ -function(findAttribute project attr) - execute_process( - COMMAND grep ${attr} ${RunCMake_TEST_BINARY_DIR}/${project}.xcodeproj/project.pbxproj - OUTPUT_VARIABLE output_var - RESULT_VARIABLE result_var - ) +include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake) - if(result_var) - set(RunCMake_TEST_FAILED "${attr} attribute not set" PARENT_SCOPE) - endif() -endfunction() - -findAttribute(${test} "RemoveHeadersOnCopy") -findAttribute(${test} "CodeSignOnCopy") +findAttribute(${test} "RemoveHeadersOnCopy" TRUE) +findAttribute(${test} "CodeSignOnCopy" TRUE) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-check.cmake index 3f62640..0f57820 100644 --- a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-check.cmake +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-check.cmake @@ -1,14 +1,4 @@ -function(findAttribute project attr) - execute_process( - COMMAND grep ${attr} ${RunCMake_TEST_BINARY_DIR}/${project}.xcodeproj/project.pbxproj - OUTPUT_VARIABLE output_var - RESULT_VARIABLE result_var - ) +include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake) - if(result_var) - set(RunCMake_TEST_FAILED "${attr} attribute not set" PARENT_SCOPE) - endif() -endfunction() - -findAttribute(${test} "RemoveHeadersOnCopy") -findAttribute(${test} "CodeSignOnCopy") +findAttribute(${test} "RemoveHeadersOnCopy" TRUE) +findAttribute(${test} "CodeSignOnCopy" TRUE) diff --git a/Tests/RunCMake/XcodeProject-Embed/Empty.txt b/Tests/RunCMake/XcodeProject-Embed/Empty.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/Empty.txt diff --git a/Tests/RunCMake/XcodeProject-Embed/Info.plist.in b/Tests/RunCMake/XcodeProject-Embed/Info.plist.in new file mode 100644 index 0000000..a26f316 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/Info.plist.in @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>$(DEVELOPMENT_LANGUAGE)</string> + <key>CFBundleDisplayName</key> + <string>SomeExtension</string> + <key>CFBundleExecutable</key> + <string>$(EXECUTABLE_NAME)</string> + <key>CFBundleIdentifier</key> + <string>com.example.app.app_extension</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>app</string> + <key>CFBundlePackageType</key> + <string>XPC!</string> + <key>CFBundleShortVersionString</key> + <string>1.0.0</string> + <key>CFBundleVersion</key> + <string>1.0.0</string> + <key>NSExtension</key> + <dict> + <key>NSExtensionPointIdentifier</key> + <string>com.apple.widgetkit-extension</string> + <key>NSExtensionPrincipalClass</key> + <string>SomeExtensionBrowserViewController</string> + </dict> +</dict> +</plist> diff --git a/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake index 0dc1cf3..e94d084 100644 --- a/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake @@ -41,3 +41,34 @@ endfunction() TestFlagsOn(EmbedFrameworksFlagsOnNoSubdir) TestFlagsOn(EmbedFrameworksFlagsOnWithSubdir) + + +function(TestAppExtension platform) + set(testName EmbedAppExtensions-${platform}) + if(NOT platform STREQUAL "macOS") + set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=${platform}) + endif() + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${testName}-build) + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(${testName}) + run_cmake_command(${testName}-build + ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR} + --config Debug + --target app + ) +endfunction() + +# Isolate device tests from host architecture selection. +unset(ENV{CMAKE_OSX_ARCHITECTURES}) + +if(XCODE_VERSION VERSION_GREATER_EQUAL 8) + # The various flag on/off combinations are tested by the EmbedFrameworks... + # tests, so we don't duplicate all the combinations here. We only verify the + # defaults, which is to remove headers on copy, but not code sign. + TestAppExtension(macOS) + TestAppExtension(iOS) +endif() diff --git a/Tests/RunCMake/XcodeProject-Embed/findAttribute.cmake b/Tests/RunCMake/XcodeProject-Embed/findAttribute.cmake new file mode 100644 index 0000000..b1963e2 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/findAttribute.cmake @@ -0,0 +1,19 @@ +cmake_policy(VERSION 3.1...3.20) + +function(findAttribute project attr expectPresent) + execute_process( + COMMAND grep ${attr} ${RunCMake_TEST_BINARY_DIR}/${project}.xcodeproj/project.pbxproj + OUTPUT_VARIABLE output_var + RESULT_VARIABLE result_var + ) + + if(${expectPresent}) + if(result_var) + set(RunCMake_TEST_FAILED "${attr} attribute is not set" PARENT_SCOPE) + endif() + else() + if(NOT result_var) + set(RunCMake_TEST_FAILED "${attr} attribute is set" PARENT_SCOPE) + endif() + endif() +endfunction() diff --git a/Tests/RunCMake/XcodeProject/InheritedParameters-check.cmake b/Tests/RunCMake/XcodeProject/InheritedParameters-check.cmake new file mode 100644 index 0000000..4fe42ac --- /dev/null +++ b/Tests/RunCMake/XcodeProject/InheritedParameters-check.cmake @@ -0,0 +1,49 @@ +set(xcProjectFile "${RunCMake_TEST_BINARY_DIR}/InheritedParameters.xcodeproj/project.pbxproj") +if(NOT EXISTS "${xcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${xcProjectFile} does not exist.") + return() +endif() + +set(found_inherited_GCC_PREPROCESSOR_DEFINITIONS 1) +set(found_inherited_OTHER_CFLAGS 1) +set(found_inherited_OTHER_LDFLAGS 1) + +file(STRINGS "${xcProjectFile}" lines) +foreach(line IN LISTS lines) + + if(line MATCHES [[GCC_PREPROCESSOR_DEFINITIONS]]) + if(NOT line MATCHES [["\$\(inherited\)"]]) + string(APPEND relevant_lines " ${line}\n") + set(found_inherited_GCC_PREPROCESSOR_DEFINITIONS 0) + endif() + endif() + + if(line MATCHES [[OTHER_CFLAGS]]) + if(NOT line MATCHES [["\$\(inherited\)"]]) + string(APPEND relevant_lines " ${line}\n") + set(found_inherited_OTHER_CFLAGS 0) + endif() + endif() + + if(line MATCHES [[OTHER_LDFLAGS]]) + if(NOT line MATCHES [["\$\(inherited\)"]]) + string(APPEND relevant_lines " ${line}\n") + set(found_inherited_OTHER_LDFLAGS 0) + endif() + endif() + +endforeach() + +if(NOT found_inherited_GCC_PREPROCESSOR_DEFINITIONS) + string(APPEND RunCMake_TEST_FAILED "Found missing inherited value for GCC_PREPROCESSOR_DEFINITIONS in\n ${xcProjectFile}\n") +endif() +if(NOT found_inherited_OTHER_CFLAGS) + string(APPEND RunCMake_TEST_FAILED "Found missing inherited value for OTHER_CFLAGS in\n ${xcProjectFile}\n") +endif() +if(NOT found_inherited_OTHER_LDFLAGS) + string(APPEND RunCMake_TEST_FAILED "Found missing inherited value for OTHER_LDFLAGS in\n ${xcProjectFile}\n") +endif() + +if(RunCMake_TEST_FAILED) + string(APPEND RunCMake_TEST_FAILED "Relevant lines include\n${relevant_lines}") +endif() diff --git a/Tests/RunCMake/XcodeProject/InheritedParameters.cmake b/Tests/RunCMake/XcodeProject/InheritedParameters.cmake new file mode 100644 index 0000000..5b8ec71 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/InheritedParameters.cmake @@ -0,0 +1,8 @@ +enable_language(C) + +add_compile_definitions(TEST_INHERITTEST) +string(APPEND CMAKE_C_FLAGS " -DTESTFLAG=\\\"TEST_INHERITTEST\\\"") + +add_executable(inherit_test main.c) + +target_link_libraries(inherit_test PRIVATE "TEST_INHERITTEST") diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 8b03216..26714c4 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -4,6 +4,7 @@ run_cmake(ExplicitCMakeLists) run_cmake(ImplicitCMakeLists) run_cmake(InterfaceLibSources) run_cmake_with_options(SearchPaths -DCMAKE_CONFIGURATION_TYPES=Debug) +run_cmake(InheritedParameters) run_cmake(XcodeFileType) run_cmake(XcodeAttributeLocation) @@ -387,4 +388,30 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 8) XcodeRemoveExcessiveISystemSDK(iphoneos) XcodeRemoveExcessiveISystemSDK(iphonesimulator) endif() + +if (XCODE_VERSION VERSION_GREATER_EQUAL 7.3) + function(xctest_add_bundle_test SystemName SDK BuildSystemVersion ExpectedOutputDir) + set(RunCMake_TEST_BINARY_DIR + ${RunCMake_BINARY_DIR}/DeploymentTarget-${SystemName}-${SDK}-${BuildSystemVersion}-build) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_SYSTEM_NAME=${SystemName}" + "-DCMAKE_OSX_SYSROOT=${SDK}" + "-DTEST_EXPECTED_OUTPUT_DIR=${ExpectedOutputDir}") + unset(RunCMake_GENERATOR_TOOLSET) + if(BuildSystemVersion) + set(RunCMake_GENERATOR_TOOLSET "buildsystem=${BuildSystemVersion}") + endif() + run_cmake(XCTestAddBundle) + endfunction() + + if(XCODE_VERSION VERSION_GREATER_EQUAL 12) + xctest_add_bundle_test(Darwin macosx "1" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") + xctest_add_bundle_test(Darwin macosx "12" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") + xctest_add_bundle_test(iOS iphoneos "1" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") + xctest_add_bundle_test(iOS iphoneos "12" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>") + else() + xctest_add_bundle_test(Darwin macosx "" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") + xctest_add_bundle_test(iOS iphoneos "" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") + endif() +endif() # Please add macOS-only tests above before the device-specific tests. diff --git a/Tests/RunCMake/XcodeProject/XCTestAddBundle.cmake b/Tests/RunCMake/XcodeProject/XCTestAddBundle.cmake new file mode 100644 index 0000000..444c730 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XCTestAddBundle.cmake @@ -0,0 +1,17 @@ +enable_language(Swift) +find_package(XCTest REQUIRED) + +add_executable(TestedApp MACOSX_BUNDLE EXCLUDE_FROM_ALL foo.swift) + +xctest_add_bundle(TestingAppBundle TestedApp foo.swift) + +get_target_property(_lib_output_dir TestingAppBundle LIBRARY_OUTPUT_DIRECTORY) + +if (NOT DEFINED TEST_EXPECTED_OUTPUT_DIR) + message(FATAL_ERROR "Testing variable TEST_EXPECTED_OUTPUT_DIR is not set") +endif() + +if (NOT _lib_output_dir STREQUAL TEST_EXPECTED_OUTPUT_DIR) + message(SEND_ERROR "Property LIBRARY_OUTPUT_DIRECTORY is expected to be ${TEST_EXPECTED_OUTPUT_DIR} " + "but was ${_lib_output_dir}") +endif() diff --git a/Tests/RunCMake/add_executable/RunCMakeTest.cmake b/Tests/RunCMake/add_executable/RunCMakeTest.cmake index 88916b7..70a68f2 100644 --- a/Tests/RunCMake/add_executable/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_executable/RunCMakeTest.cmake @@ -2,6 +2,4 @@ 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() +run_cmake(NoSourcesButLinkObjects) diff --git a/Tests/RunCMake/add_library/RunCMakeTest.cmake b/Tests/RunCMake/add_library/RunCMakeTest.cmake index dfadb8f..3283625 100644 --- a/Tests/RunCMake/add_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_library/RunCMakeTest.cmake @@ -16,11 +16,9 @@ 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() +run_cmake(INTERFACEwithNoSourcesButLinkObjects) +run_cmake(OBJECTwithNoSourcesButLinkObjects) +run_cmake(STATICwithNoSourcesButLinkObjects) +run_cmake(SHAREDwithNoSourcesButLinkObjects) +run_cmake(MODULEwithNoSourcesButLinkObjects) +run_cmake(UNKNOWNwithNoSourcesButLinkObjects) diff --git a/Tests/RunCMake/build_command/ParallelLevel.cmake b/Tests/RunCMake/build_command/ParallelLevel.cmake new file mode 100644 index 0000000..1d1e525 --- /dev/null +++ b/Tests/RunCMake/build_command/ParallelLevel.cmake @@ -0,0 +1,5 @@ +cmake_policy(SET CMP0061 NEW) +build_command(cmd PARALLEL_LEVEL 1) +if(NOT cmd MATCHES [[ --parallel "1"]]) + message(FATAL_ERROR "Cannot find the --parallel flag") +endif() diff --git a/Tests/RunCMake/build_command/RunCMakeTest.cmake b/Tests/RunCMake/build_command/RunCMakeTest.cmake index c3bef4c..030db0b 100644 --- a/Tests/RunCMake/build_command/RunCMakeTest.cmake +++ b/Tests/RunCMake/build_command/RunCMakeTest.cmake @@ -14,3 +14,5 @@ if(RunCMake_GENERATOR MATCHES "Make") else() run_cmake(CMP0061-OLD-other) endif() + +run_cmake(ParallelLevel) diff --git a/Tests/RunCMake/cmake_language/defer_call_ids-stdout.txt b/Tests/RunCMake/cmake_language/defer_call_ids-stdout.txt index 2fd194d..674ff1d 100644 --- a/Tests/RunCMake/cmake_language/defer_call_ids-stdout.txt +++ b/Tests/RunCMake/cmake_language/defer_call_ids-stdout.txt @@ -5,7 +5,7 @@ -- Immediate Message: cancelCall='cmake_language;DEFER;CANCEL_CALL;toBeCancelled' -- Immediate Message: getCallIds2='cmake_language;DEFER;GET_CALL_IDS;ids' -- Immediate Message: messageIds2='cmake_language;EVAL;CODE;message\(STATUS "Deferred Message: ids='\${ids}'"\)' --- Immediate Message: toBeCancelled='message;STATUS;Cancelled Message' +-- Immediate Message: toBeCancelled='message;STATUS;Canceled Message' -- Immediate Message: message3='message;STATUS;Final Deferred Message' -- First Deferred Message -- Deferred Message: ids='messageIds1;cancelCall;getCallIds2;messageIds2;toBeCancelled;message3' diff --git a/Tests/RunCMake/cmake_language/defer_call_ids.cmake b/Tests/RunCMake/cmake_language/defer_call_ids.cmake index 2874894..fd5bc17 100644 --- a/Tests/RunCMake/cmake_language/defer_call_ids.cmake +++ b/Tests/RunCMake/cmake_language/defer_call_ids.cmake @@ -4,7 +4,7 @@ cmake_language(DEFER ID messageIds1 CALL cmake_language EVAL CODE [[message(STAT cmake_language(DEFER ID cancelCall CALL cmake_language DEFER CANCEL_CALL toBeCancelled) cmake_language(DEFER ID getCallIds2 CALL cmake_language DEFER GET_CALL_IDS ids) cmake_language(DEFER ID messageIds2 CALL cmake_language EVAL CODE [[message(STATUS "Deferred Message: ids='${ids}'")]]) -cmake_language(DEFER ID toBeCancelled CALL message STATUS "Cancelled Message") +cmake_language(DEFER ID toBeCancelled CALL message STATUS "Canceled Message") cmake_language(DEFER ID message3 CALL message STATUS "Final Deferred Message") cmake_language(DEFER GET_CALL_IDS ids) message(STATUS "Immediate Message: ids='${ids}'") diff --git a/Tests/RunCMake/configure_file/NoSourcePermissions.cmake b/Tests/RunCMake/configure_file/NoSourcePermissions.cmake index c6ad131..85533c4 100644 --- a/Tests/RunCMake/configure_file/NoSourcePermissions.cmake +++ b/Tests/RunCMake/configure_file/NoSourcePermissions.cmake @@ -1,7 +1,7 @@ configure_file(NoSourcePermissions.sh NoSourcePermissions.sh.out NO_SOURCE_PERMISSIONS) -if (UNIX) +if (UNIX AND NOT MSYS) execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/NoSourcePermissions.sh.out RESULT_VARIABLE result) if (result EQUAL "0") diff --git a/Tests/RunCMake/configure_file/SourcePermissions.cmake b/Tests/RunCMake/configure_file/SourcePermissions.cmake index c4d3d61..f8c506a 100644 --- a/Tests/RunCMake/configure_file/SourcePermissions.cmake +++ b/Tests/RunCMake/configure_file/SourcePermissions.cmake @@ -6,7 +6,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/sourcefile.txt WORLD_READ ) -if (CMAKE_HOST_UNIX) +if (CMAKE_HOST_UNIX AND NOT MSYS) find_program(STAT_EXECUTABLE NAMES stat) if(NOT STAT_EXECUTABLE) return() diff --git a/Tests/RunCMake/ctest_build/ParallelLevel-check.cmake b/Tests/RunCMake/ctest_build/ParallelLevel-check.cmake new file mode 100644 index 0000000..f45d2a2 --- /dev/null +++ b/Tests/RunCMake/ctest_build/ParallelLevel-check.cmake @@ -0,0 +1,11 @@ +file(GLOB build_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Build.xml") +if(build_xml_file) + file(STRINGS "${build_xml_file}" build_cmd LIMIT_COUNT 1 REGEX "<BuildCommand>") + if(NOT build_cmd MATCHES [[ --parallel "1"]]) + set(RunCMake_TEST_FAILED + "Build.xml does not have expected build command with --parallel flag" + ) + endif() +else() + set(RunCMake_TEST_FAILED "Build.xml not found") +endif() diff --git a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake index 072fbac..511cd71 100644 --- a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake @@ -10,6 +10,7 @@ function(run_ctest_build CASE_NAME) endfunction() run_ctest_build(BuildQuiet QUIET) +run_ctest_build(ParallelLevel PARALLEL_LEVEL 1) function(run_BuildFailure) set(CASE_CMAKELISTS_SUFFIX_CODE [[ diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stdout.txt b/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stdout.txt index b54220c..acda9e2 100644 --- a/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stdout.txt +++ b/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stdout.txt @@ -1,5 +1,12 @@ -Test project .*/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-build +Test project [^ +]*/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-build( +[^*][^ +]*)* +test 1 Start 1: RunCMakeVersion ++( +[^*][^ +]*)* 1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec + 100% tests passed, 0 tests failed out of 1 diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadPass-stdout.txt b/Tests/RunCMake/ctest_test/CTestTestLoadPass-stdout.txt index c221eed..4081f98 100644 --- a/Tests/RunCMake/ctest_test/CTestTestLoadPass-stdout.txt +++ b/Tests/RunCMake/ctest_test/CTestTestLoadPass-stdout.txt @@ -1,5 +1,12 @@ -Test project .*/Tests/RunCMake/ctest_test/CTestTestLoadPass-build +Test project [^ +]*/Tests/RunCMake/ctest_test/CTestTestLoadPass-build( +[^*][^ +]*)* +test 1 Start 1: RunCMakeVersion ++( +[^*][^ +]*)* 1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec + 100% tests passed, 0 tests failed out of 1 diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadWait-stdout.txt b/Tests/RunCMake/ctest_test/CTestTestLoadWait-stdout.txt index 2af3838..2f4468f 100644 --- a/Tests/RunCMake/ctest_test/CTestTestLoadWait-stdout.txt +++ b/Tests/RunCMake/ctest_test/CTestTestLoadWait-stdout.txt @@ -1,6 +1,13 @@ -Test project .*/Tests/RunCMake/ctest_test/CTestTestLoadWait-build +Test project [^ +]*/Tests/RunCMake/ctest_test/CTestTestLoadWait-build( +[^*][^ +]*)* \*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 4, Smallest test RunCMakeVersion requires 1\*\*\*\*\* +test 1 Start 1: RunCMakeVersion ++( +[^*][^ +]*)* 1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec + 100% tests passed, 0 tests failed out of 1 diff --git a/Tests/RunCMake/ctest_test/OutputJUnit-check.cmake b/Tests/RunCMake/ctest_test/OutputJUnit-check.cmake new file mode 100644 index 0000000..00310a4 --- /dev/null +++ b/Tests/RunCMake/ctest_test/OutputJUnit-check.cmake @@ -0,0 +1,24 @@ +file(GLOB junit_xml_file "${RunCMake_TEST_BINARY_DIR}/junit.xml") +if(junit_xml_file) + file(READ "${junit_xml_file}" junit_xml LIMIT 4096) + if(NOT "${junit_xml}" MATCHES "tests=\"1\"") + set(RunCMake_TEST_FAILED "tests=\"1\" not found when expected") + endif() + if(NOT "${junit_xml}" MATCHES "failures=\"0\"") + set(RunCMake_TEST_FAILED "failures=\"0\" not found when expected") + endif() + if(NOT "${junit_xml}" MATCHES "disabled=\"0\"") + set(RunCMake_TEST_FAILED "disabled=\"0\" not found when expected") + endif() + if(NOT "${junit_xml}" MATCHES "skipped=\"0\"") + set(RunCMake_TEST_FAILED "skipped=\"0\" not found when expected") + endif() + if(NOT "${junit_xml}" MATCHES "<testcase name=\"RunCMakeVersion\" classname=\"RunCMakeVersion\"") + set(RunCMake_TEST_FAILED "RunCMakeVersion not found when expected") + endif() + if(NOT "${junit_xml}" MATCHES "<system-out>cmake version") + set(RunCMake_TEST_FAILED "<system-out>cmake version not found when expected") + endif() +else() + set(RunCMake_TEST_FAILED "junit.xml not found") +endif() diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index b82335f..b559e89 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -18,6 +18,7 @@ run_ctest_test(TestQuiet QUIET) # # Spoof a load average value to make these tests more reliable. set(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING} 5) +set(RunCTest_VERBOSE_FLAG -VV) # Verify that new tests are started when the load average falls below # our threshold. @@ -53,6 +54,7 @@ run_ctest_test(TestLoadOrder TEST_LOAD "ERR4") unset(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING}) unset(CASE_CTEST_TEST_LOAD) +unset(RunCTest_VERBOSE_FLAG) function(run_TestChangeId) set(CASE_TEST_PREFIX_CODE [[ @@ -144,3 +146,22 @@ set_property(TEST RunCMakeVersion PROPERTY ENVIRONMENT "ENV1=env1;ENV2=env2") run_ctest(TestEnvironment) endfunction() run_environment() + +# test for OUTPUT_JUNIT +run_ctest_test(OutputJUnit OUTPUT_JUNIT junit.xml REPEAT UNTIL_FAIL:2) + +# Verify that extra measurements get reported. +function(run_measurements) + set(CASE_CMAKELISTS_SUFFIX_CODE [[ +add_test( + NAME double_measurement + COMMAND ${CMAKE_COMMAND} -E + echo <DartMeasurement type="numeric/double" name="my_custom_value">1.4847</DartMeasurement>) +add_test( + NAME img_measurement + COMMAND ${CMAKE_COMMAND} -E + echo <DartMeasurementFile name="TestImage" type="image/png">]] ${IMAGE_DIR}/cmake-logo-16.png [[</DartMeasurementFile>) + ]]) + run_ctest(TestMeasurements) +endfunction() +run_measurements() diff --git a/Tests/RunCMake/ctest_test/TestLoadInvalid-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadInvalid-stdout.txt index c4fd35b..8d21f91 100644 --- a/Tests/RunCMake/ctest_test/TestLoadInvalid-stdout.txt +++ b/Tests/RunCMake/ctest_test/TestLoadInvalid-stdout.txt @@ -1,5 +1,12 @@ -Test project .*/Tests/RunCMake/ctest_test/TestLoadInvalid-build +Test project [^ +]*/Tests/RunCMake/ctest_test/TestLoadInvalid-build( +[^*][^ +]*)* +test 1 Start 1: RunCMakeVersion ++( +[^*][^ +]*)* 1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec + 100% tests passed, 0 tests failed out of 1 diff --git a/Tests/RunCMake/ctest_test/TestLoadOrder-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadOrder-stdout.txt index 22da092..1ef5f5a 100644 --- a/Tests/RunCMake/ctest_test/TestLoadOrder-stdout.txt +++ b/Tests/RunCMake/ctest_test/TestLoadOrder-stdout.txt @@ -1,5 +1,12 @@ -Test project .*/Tests/RunCMake/ctest_test/TestLoadOrder-build +Test project [^ +]*/Tests/RunCMake/ctest_test/TestLoadOrder-build( +[^*][^ +]*)* +test 1 Start 1: RunCMakeVersion ++( +[^*][^ +]*)* 1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec + 100% tests passed, 0 tests failed out of 1 diff --git a/Tests/RunCMake/ctest_test/TestLoadPass-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadPass-stdout.txt index e5048f4..f3e7cd1 100644 --- a/Tests/RunCMake/ctest_test/TestLoadPass-stdout.txt +++ b/Tests/RunCMake/ctest_test/TestLoadPass-stdout.txt @@ -1,5 +1,12 @@ -Test project .*/Tests/RunCMake/ctest_test/TestLoadPass-build +Test project [^ +]*/Tests/RunCMake/ctest_test/TestLoadPass-build( +[^*][^ +]*)* +test 1 Start 1: RunCMakeVersion ++( +[^*][^ +]*)* 1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec + 100% tests passed, 0 tests failed out of 1 diff --git a/Tests/RunCMake/ctest_test/TestLoadWait-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadWait-stdout.txt index 07f4ed3..fc32958 100644 --- a/Tests/RunCMake/ctest_test/TestLoadWait-stdout.txt +++ b/Tests/RunCMake/ctest_test/TestLoadWait-stdout.txt @@ -1,6 +1,13 @@ -Test project .*/Tests/RunCMake/ctest_test/TestLoadWait-build +Test project [^ +]*/Tests/RunCMake/ctest_test/TestLoadWait-build( +[^*][^ +]*)* \*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 2, Smallest test RunCMakeVersion requires 1\*\*\*\*\* +test 1 Start 1: RunCMakeVersion ++( +[^*][^ +]*)* 1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec + 100% tests passed, 0 tests failed out of 1 diff --git a/Tests/RunCMake/ctest_test/TestMeasurements-check.cmake b/Tests/RunCMake/ctest_test/TestMeasurements-check.cmake new file mode 100644 index 0000000..9ff9447 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestMeasurements-check.cmake @@ -0,0 +1,17 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/TAG" _tag) +string(REGEX REPLACE "^([^\n]*)\n.*$" "\\1" _date "${_tag}") +file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/${_date}/Test.xml" _test_contents) + +# Check double measurement. +if(NOT _test_contents MATCHES [[NamedMeasurement type="numeric/double" name="my_custom_value"]]) + string(APPEND RunCMake_TEST_FAILED + "Could not find expected <NamedMeasurement> tag for type='numeric/double' in Test.xml") +endif() +if(NOT _test_contents MATCHES "<Value>1.4847</Value>") + string(APPEND RunCMake_TEST_FAILED "Could not find expected measurement value in Test.xml") +endif() +# Check img measurement. +if(NOT _test_contents MATCHES [[NamedMeasurement name="TestImage" type="image/png" encoding="base64"]]) + string(APPEND RunCMake_TEST_FAILED + "Could not find expected <NamedMeasurement> tag for type='image/png' in Test.xml") +endif() diff --git a/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake b/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake index c7bff15..18deb89 100644 --- a/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake +++ b/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake @@ -14,6 +14,6 @@ if(UNIX) OUTPUT_STRIP_TRAILING_WHITESPACE) endif() -if(NOT WIN32 AND NOT "${uid}" STREQUAL "0") +if(NOT WIN32 AND NOT MSYS AND NOT "${uid}" STREQUAL "0") run_cmake(CHMOD-write-only) endif() diff --git a/Tests/RunCMake/file/COPY_FILE-arg-missing-result.txt b/Tests/RunCMake/file/COPY_FILE-arg-missing-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-arg-missing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/COPY_FILE-arg-missing-stderr.txt b/Tests/RunCMake/file/COPY_FILE-arg-missing-stderr.txt new file mode 100644 index 0000000..2ba38b6 --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-arg-missing-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error at [^ +]*/Tests/RunCMake/file/COPY_FILE-arg-missing.cmake:1 \(file\): + file COPY_FILE must be called with at least two additional arguments diff --git a/Tests/RunCMake/file/COPY_FILE-arg-missing.cmake b/Tests/RunCMake/file/COPY_FILE-arg-missing.cmake new file mode 100644 index 0000000..0e56c38 --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-arg-missing.cmake @@ -0,0 +1 @@ +file(COPY_FILE "old") diff --git a/Tests/RunCMake/file/COPY_FILE-arg-unknown-result.txt b/Tests/RunCMake/file/COPY_FILE-arg-unknown-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-arg-unknown-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/COPY_FILE-arg-unknown-stderr.txt b/Tests/RunCMake/file/COPY_FILE-arg-unknown-stderr.txt new file mode 100644 index 0000000..e5ccd33 --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-arg-unknown-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at [^ +]*/Tests/RunCMake/file/COPY_FILE-arg-unknown.cmake:1 \(file\): + file COPY_FILE unknown argument: + + unknown$ diff --git a/Tests/RunCMake/file/COPY_FILE-arg-unknown.cmake b/Tests/RunCMake/file/COPY_FILE-arg-unknown.cmake new file mode 100644 index 0000000..835f39e --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-arg-unknown.cmake @@ -0,0 +1 @@ +file(COPY_FILE "old" "new" unknown) diff --git a/Tests/RunCMake/file/COPY_FILE-dir-to-file-capture-stdout.txt b/Tests/RunCMake/file/COPY_FILE-dir-to-file-capture-stdout.txt new file mode 100644 index 0000000..45b3d27 --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-dir-to-file-capture-stdout.txt @@ -0,0 +1 @@ +^-- file\(COPY_FILE\) failed with result: cannot copy a directory diff --git a/Tests/RunCMake/file/COPY_FILE-dir-to-file-capture.cmake b/Tests/RunCMake/file/COPY_FILE-dir-to-file-capture.cmake new file mode 100644 index 0000000..acec05a --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-dir-to-file-capture.cmake @@ -0,0 +1,8 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(MAKE_DIRECTORY "${oldname}") +file(COPY_FILE "${oldname}" "${newname}" RESULT result) +message(STATUS "file(COPY_FILE) failed with result: ${result}") +if(EXISTS "${newname}") + message(FATAL_ERROR "The new name exists:\n ${newname}") +endif() diff --git a/Tests/RunCMake/file/COPY_FILE-dir-to-file-fail-result.txt b/Tests/RunCMake/file/COPY_FILE-dir-to-file-fail-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-dir-to-file-fail-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/COPY_FILE-dir-to-file-fail-stderr.txt b/Tests/RunCMake/file/COPY_FILE-dir-to-file-fail-stderr.txt new file mode 100644 index 0000000..2fe8bec --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-dir-to-file-fail-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at [^ +]*/Tests/RunCMake/file/COPY_FILE-dir-to-file-fail.cmake:[0-9] \(file\): + file COPY_FILE cannot copy a directory + + [^ +]*/Tests/RunCMake/file/COPY_FILE-dir-to-file-fail-build/input diff --git a/Tests/RunCMake/file/COPY_FILE-dir-to-file-fail.cmake b/Tests/RunCMake/file/COPY_FILE-dir-to-file-fail.cmake new file mode 100644 index 0000000..a86ba8d --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-dir-to-file-fail.cmake @@ -0,0 +1,4 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(MAKE_DIRECTORY "${oldname}") +file(COPY_FILE "${oldname}" "${newname}") diff --git a/Tests/RunCMake/file/COPY_FILE-dirlink-to-file-capture-stdout.txt b/Tests/RunCMake/file/COPY_FILE-dirlink-to-file-capture-stdout.txt new file mode 100644 index 0000000..45b3d27 --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-dirlink-to-file-capture-stdout.txt @@ -0,0 +1 @@ +^-- file\(COPY_FILE\) failed with result: cannot copy a directory diff --git a/Tests/RunCMake/file/COPY_FILE-dirlink-to-file-capture.cmake b/Tests/RunCMake/file/COPY_FILE-dirlink-to-file-capture.cmake new file mode 100644 index 0000000..acec05a --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-dirlink-to-file-capture.cmake @@ -0,0 +1,8 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(MAKE_DIRECTORY "${oldname}") +file(COPY_FILE "${oldname}" "${newname}" RESULT result) +message(STATUS "file(COPY_FILE) failed with result: ${result}") +if(EXISTS "${newname}") + message(FATAL_ERROR "The new name exists:\n ${newname}") +endif() diff --git a/Tests/RunCMake/file/COPY_FILE-dirlink-to-file-fail-result.txt b/Tests/RunCMake/file/COPY_FILE-dirlink-to-file-fail-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-dirlink-to-file-fail-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/COPY_FILE-dirlink-to-file-fail-stderr.txt b/Tests/RunCMake/file/COPY_FILE-dirlink-to-file-fail-stderr.txt new file mode 100644 index 0000000..c58dc2c --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-dirlink-to-file-fail-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at [^ +]*/Tests/RunCMake/file/COPY_FILE-dirlink-to-file-fail.cmake:[0-9] \(file\): + file COPY_FILE cannot copy a directory + + [^ +]*/Tests/RunCMake/file/COPY_FILE-dirlink-to-file-fail-build/input diff --git a/Tests/RunCMake/file/COPY_FILE-dirlink-to-file-fail.cmake b/Tests/RunCMake/file/COPY_FILE-dirlink-to-file-fail.cmake new file mode 100644 index 0000000..a86ba8d --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-dirlink-to-file-fail.cmake @@ -0,0 +1,4 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(MAKE_DIRECTORY "${oldname}") +file(COPY_FILE "${oldname}" "${newname}") diff --git a/Tests/RunCMake/file/COPY_FILE-file-ONLY_IF_DIFFERENT-capture.cmake b/Tests/RunCMake/file/COPY_FILE-file-ONLY_IF_DIFFERENT-capture.cmake new file mode 100644 index 0000000..028220e --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-file-ONLY_IF_DIFFERENT-capture.cmake @@ -0,0 +1,9 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(WRITE "${oldname}" "") +file(MAKE_DIRECTORY "${newname}") +file(COPY_FILE "${oldname}" "${newname}" RESULT result ONLY_IF_DIFFERENT) +message(STATUS "file(COPY_FILE) failed with result: ${result}") +if(NOT EXISTS "${oldname}") + message(FATAL_ERROR "The old name still does not exist:\n ${oldname}") +endif() diff --git a/Tests/RunCMake/file/COPY_FILE-file-ONLY_IF_DIFFERENT-fail-result.txt b/Tests/RunCMake/file/COPY_FILE-file-ONLY_IF_DIFFERENT-fail-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-file-ONLY_IF_DIFFERENT-fail-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/COPY_FILE-file-ONLY_IF_DIFFERENT-fail-stderr.txt b/Tests/RunCMake/file/COPY_FILE-file-ONLY_IF_DIFFERENT-fail-stderr.txt new file mode 100644 index 0000000..fd5ceee --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-file-ONLY_IF_DIFFERENT-fail-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at [^ +]*/Tests/RunCMake/file/COPY_FILE-file-ONLY_IF_DIFFERENT-fail.cmake:[0-9] \(file\): + file COPY_FILE cannot copy to a directory + + [^ +]*/Tests/RunCMake/file/COPY_FILE-file-ONLY_IF_DIFFERENT-fail-build/output diff --git a/Tests/RunCMake/file/COPY_FILE-file-ONLY_IF_DIFFERENT-fail.cmake b/Tests/RunCMake/file/COPY_FILE-file-ONLY_IF_DIFFERENT-fail.cmake new file mode 100644 index 0000000..a56b4e7 --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-file-ONLY_IF_DIFFERENT-fail.cmake @@ -0,0 +1,5 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(WRITE "${oldname}" "") +file(MAKE_DIRECTORY "${newname}") +file(COPY_FILE "${oldname}" "${newname}" ONLY_IF_DIFFERENT) diff --git a/Tests/RunCMake/file/COPY_FILE-file-ONLY_IF_DIFFERENT-no-overwrite.cmake b/Tests/RunCMake/file/COPY_FILE-file-ONLY_IF_DIFFERENT-no-overwrite.cmake new file mode 100644 index 0000000..059a308 --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-file-ONLY_IF_DIFFERENT-no-overwrite.cmake @@ -0,0 +1,12 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(WRITE "${oldname}" "") +execute_process(COMMAND "${CMAKE_COMMAND} -E sleep 1") +file(WRITE "${newname}" "") +file(TIMESTAMP "${newname}" before_copy UTC) +file(COPY_FILE "${oldname}" "${newname}" RESULT result ONLY_IF_DIFFERENT) +file(TIMESTAMP "${newname}" after_copy UTC) +if (NOT before_copy STREQUAL after_copy) + message(FATAL_ERROR + "${newname} was modified even though ONLY_IF_DIFFERENT was specified") +endif () diff --git a/Tests/RunCMake/file/COPY_FILE-file-replace.cmake b/Tests/RunCMake/file/COPY_FILE-file-replace.cmake new file mode 100644 index 0000000..40e4290 --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-file-replace.cmake @@ -0,0 +1,9 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(WRITE "${oldname}" "a") +file(WRITE "${newname}" "b") +file(COPY_FILE "${oldname}" "${newname}") +file(READ "${newname}" new) +if(NOT "${new}" STREQUAL "a") + message(FATAL_ERROR "New name:\n ${newname}\ndoes not contain expected content 'a'.") +endif() diff --git a/Tests/RunCMake/file/COPY_FILE-file-to-dir-capture-stdout.txt b/Tests/RunCMake/file/COPY_FILE-file-to-dir-capture-stdout.txt new file mode 100644 index 0000000..24f969f --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-file-to-dir-capture-stdout.txt @@ -0,0 +1 @@ +^-- file\(COPY_FILE\) failed with result: cannot copy to a directory diff --git a/Tests/RunCMake/file/COPY_FILE-file-to-dir-capture.cmake b/Tests/RunCMake/file/COPY_FILE-file-to-dir-capture.cmake new file mode 100644 index 0000000..98621c6 --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-file-to-dir-capture.cmake @@ -0,0 +1,9 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(WRITE "${oldname}" "") +file(MAKE_DIRECTORY "${newname}") +file(COPY_FILE "${oldname}" "${newname}" RESULT result) +message(STATUS "file(COPY_FILE) failed with result: ${result}") +if(NOT EXISTS "${oldname}") + message(FATAL_ERROR "The old name does not exist:\n ${oldname}") +endif() diff --git a/Tests/RunCMake/file/COPY_FILE-file-to-dir-fail-result.txt b/Tests/RunCMake/file/COPY_FILE-file-to-dir-fail-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-file-to-dir-fail-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/COPY_FILE-file-to-dir-fail-stderr.txt b/Tests/RunCMake/file/COPY_FILE-file-to-dir-fail-stderr.txt new file mode 100644 index 0000000..ba2a027 --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-file-to-dir-fail-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at [^ +]*/Tests/RunCMake/file/COPY_FILE-file-to-dir-fail.cmake:[0-9] \(file\): + file COPY_FILE cannot copy to a directory + + [^ +]*/Tests/RunCMake/file/COPY_FILE-file-to-dir-fail-build/output diff --git a/Tests/RunCMake/file/COPY_FILE-file-to-dir-fail.cmake b/Tests/RunCMake/file/COPY_FILE-file-to-dir-fail.cmake new file mode 100644 index 0000000..c2628dd --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-file-to-dir-fail.cmake @@ -0,0 +1,5 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(WRITE "${oldname}" "") +file(MAKE_DIRECTORY "${newname}") +file(COPY_FILE "${oldname}" "${newname}") diff --git a/Tests/RunCMake/file/COPY_FILE-file-to-file.cmake b/Tests/RunCMake/file/COPY_FILE-file-to-file.cmake new file mode 100644 index 0000000..26b702a --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-file-to-file.cmake @@ -0,0 +1,10 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(WRITE "${oldname}" "") +file(COPY_FILE "${oldname}" "${newname}") +if(NOT EXISTS "${oldname}") + message(FATAL_ERROR "The old name does not exist:\n ${oldname}") +endif() +if(NOT EXISTS "${newname}") + message(FATAL_ERROR "The new name does not exist:\n ${newname}") +endif() diff --git a/Tests/RunCMake/file/COPY_FILE-link-to-file.cmake b/Tests/RunCMake/file/COPY_FILE-link-to-file.cmake new file mode 100644 index 0000000..93a0204 --- /dev/null +++ b/Tests/RunCMake/file/COPY_FILE-link-to-file.cmake @@ -0,0 +1,10 @@ +set(lnkname "${CMAKE_CURRENT_BINARY_DIR}/link") +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(WRITE "${lnkname}" "a") +file(CREATE_LINK "${lnkname}" "${oldname}") +file(COPY_FILE "${oldname}" "${newname}") +file(READ "${newname}" new) +if(NOT "${new}" STREQUAL "a") + message(FATAL_ERROR "New name:\n ${newname}\ndoes not contain expected content 'a'.") +endif() diff --git a/Tests/RunCMake/file/REAL_PATH.cmake b/Tests/RunCMake/file/REAL_PATH.cmake index be25706..0b5d3c0 100644 --- a/Tests/RunCMake/file/REAL_PATH.cmake +++ b/Tests/RunCMake/file/REAL_PATH.cmake @@ -1,14 +1,36 @@ -file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/test.txt") -file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/test.sym") -file(CREATE_LINK "test.txt" "${CMAKE_CURRENT_BINARY_DIR}/test.sym" SYMBOLIC) +if (NOT WIN32 OR CYGWIN) + file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/test.txt") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/test.sym") + file(CREATE_LINK "test.txt" "${CMAKE_CURRENT_BINARY_DIR}/test.sym" SYMBOLIC) -file(REAL_PATH "${CMAKE_CURRENT_BINARY_DIR}/test.sym" real_path) -if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/test.txt") - message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/test.txt\"") + file(REAL_PATH "${CMAKE_CURRENT_BINARY_DIR}/test.sym" real_path) + if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/test.txt") + message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/test.txt\"") + endif() + + file(REAL_PATH "test.sym" real_path BASE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") + if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/test.txt") + message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/test.txt\"") + endif() +endif() + + +If (WIN32) + cmake_path(SET HOME_DIR "$ENV{USERPROFILE}") + if (NOT HOME_DIR) + cmake_path(SET HOME_DIR "$ENV{HOME}") + endif() +else() + set(HOME_DIR "$ENV{HOME}") +endif() + +file(REAL_PATH "~" real_path EXPAND_TILDE) +if (NOT real_path STREQUAL "${HOME_DIR}") + message(SEND_ERROR "real path is \"${real_path}\", should be \"${HOME_DIR}\"") endif() -file(REAL_PATH "test.sym" real_path BASE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") -if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/test.txt") - message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/test.txt\"") +file(REAL_PATH "~/test.txt" real_path EXPAND_TILDE) +if (NOT real_path STREQUAL "${HOME_DIR}/test.txt") + message(SEND_ERROR "real path is \"${real_path}\", should be \"${HOME_DIR}/test.txt\"") endif() diff --git a/Tests/RunCMake/file/RENAME-arg-missing-result.txt b/Tests/RunCMake/file/RENAME-arg-missing-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/RENAME-arg-missing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/RENAME-arg-missing-stderr.txt b/Tests/RunCMake/file/RENAME-arg-missing-stderr.txt new file mode 100644 index 0000000..98d2961 --- /dev/null +++ b/Tests/RunCMake/file/RENAME-arg-missing-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error at [^ +]*/Tests/RunCMake/file/RENAME-arg-missing.cmake:1 \(file\): + file RENAME must be called with at least two additional arguments$ diff --git a/Tests/RunCMake/file/RENAME-arg-missing.cmake b/Tests/RunCMake/file/RENAME-arg-missing.cmake new file mode 100644 index 0000000..2358ce9 --- /dev/null +++ b/Tests/RunCMake/file/RENAME-arg-missing.cmake @@ -0,0 +1 @@ +file(RENAME "old") diff --git a/Tests/RunCMake/file/RENAME-arg-unknown-result.txt b/Tests/RunCMake/file/RENAME-arg-unknown-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/RENAME-arg-unknown-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/RENAME-arg-unknown-stderr.txt b/Tests/RunCMake/file/RENAME-arg-unknown-stderr.txt new file mode 100644 index 0000000..16edb25 --- /dev/null +++ b/Tests/RunCMake/file/RENAME-arg-unknown-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at [^ +]*/Tests/RunCMake/file/RENAME-arg-unknown.cmake:1 \(file\): + file RENAME unknown argument: + + unknown$ diff --git a/Tests/RunCMake/file/RENAME-arg-unknown.cmake b/Tests/RunCMake/file/RENAME-arg-unknown.cmake new file mode 100644 index 0000000..3110f70 --- /dev/null +++ b/Tests/RunCMake/file/RENAME-arg-unknown.cmake @@ -0,0 +1 @@ +file(RENAME "old" "new" unknown) diff --git a/Tests/RunCMake/file/RENAME-file-NO_REPLACE-capture-stdout.txt b/Tests/RunCMake/file/RENAME-file-NO_REPLACE-capture-stdout.txt new file mode 100644 index 0000000..a116330 --- /dev/null +++ b/Tests/RunCMake/file/RENAME-file-NO_REPLACE-capture-stdout.txt @@ -0,0 +1 @@ +^-- file\(RENAME\) failed with result: NO_REPLACE$ diff --git a/Tests/RunCMake/file/RENAME-file-NO_REPLACE-capture.cmake b/Tests/RunCMake/file/RENAME-file-NO_REPLACE-capture.cmake new file mode 100644 index 0000000..1ff4178 --- /dev/null +++ b/Tests/RunCMake/file/RENAME-file-NO_REPLACE-capture.cmake @@ -0,0 +1,9 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(WRITE "${oldname}" "a") +file(WRITE "${newname}" "b") +file(RENAME "${oldname}" "${newname}" NO_REPLACE RESULT result) +message(STATUS "file(RENAME) failed with result: ${result}") +if(NOT EXISTS "${oldname}") + message(FATAL_ERROR "The old name does not still exist:\n ${oldname}") +endif() diff --git a/Tests/RunCMake/file/RENAME-file-NO_REPLACE-fail-result.txt b/Tests/RunCMake/file/RENAME-file-NO_REPLACE-fail-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/RENAME-file-NO_REPLACE-fail-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/RENAME-file-NO_REPLACE-fail-stderr.txt b/Tests/RunCMake/file/RENAME-file-NO_REPLACE-fail-stderr.txt new file mode 100644 index 0000000..dd7294c --- /dev/null +++ b/Tests/RunCMake/file/RENAME-file-NO_REPLACE-fail-stderr.txt @@ -0,0 +1,13 @@ +^CMake Error at [^ +]*/Tests/RunCMake/file/RENAME-file-NO_REPLACE-fail.cmake:[0-9] \(file\): + file RENAME failed to rename + + [^ +]*/Tests/RunCMake/file/RENAME-file-NO_REPLACE-fail-build/input + + to + + [^ +]*/Tests/RunCMake/file/RENAME-file-NO_REPLACE-fail-build/output + + because: path not replaced$ diff --git a/Tests/RunCMake/file/RENAME-file-NO_REPLACE-fail.cmake b/Tests/RunCMake/file/RENAME-file-NO_REPLACE-fail.cmake new file mode 100644 index 0000000..c05dd63 --- /dev/null +++ b/Tests/RunCMake/file/RENAME-file-NO_REPLACE-fail.cmake @@ -0,0 +1,5 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(WRITE "${oldname}" "a") +file(WRITE "${newname}" "b") +file(RENAME "${oldname}" "${newname}" NO_REPLACE) diff --git a/Tests/RunCMake/file/RENAME-file-replace.cmake b/Tests/RunCMake/file/RENAME-file-replace.cmake new file mode 100644 index 0000000..efbfaed --- /dev/null +++ b/Tests/RunCMake/file/RENAME-file-replace.cmake @@ -0,0 +1,9 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(WRITE "${oldname}" "a") +file(WRITE "${newname}" "b") +file(RENAME "${oldname}" "${newname}") +file(READ "${newname}" new) +if(NOT "${new}" STREQUAL "a") + message(FATAL_ERROR "New name:\n ${newname}\ndoes not contain expected content 'a'.") +endif() diff --git a/Tests/RunCMake/file/RENAME-file-to-dir-capture-stdout.txt b/Tests/RunCMake/file/RENAME-file-to-dir-capture-stdout.txt new file mode 100644 index 0000000..0276a5f --- /dev/null +++ b/Tests/RunCMake/file/RENAME-file-to-dir-capture-stdout.txt @@ -0,0 +1 @@ +^-- file\(RENAME\) failed with result: [A-Za-z] diff --git a/Tests/RunCMake/file/RENAME-file-to-dir-capture.cmake b/Tests/RunCMake/file/RENAME-file-to-dir-capture.cmake new file mode 100644 index 0000000..4f817e8 --- /dev/null +++ b/Tests/RunCMake/file/RENAME-file-to-dir-capture.cmake @@ -0,0 +1,9 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(WRITE "${oldname}" "") +file(MAKE_DIRECTORY "${newname}") +file(RENAME "${oldname}" "${newname}" RESULT result) +message(STATUS "file(RENAME) failed with result: ${result}") +if(NOT EXISTS "${oldname}") + message(FATAL_ERROR "The old name does not still exist:\n ${oldname}") +endif() diff --git a/Tests/RunCMake/file/RENAME-file-to-dir-fail-result.txt b/Tests/RunCMake/file/RENAME-file-to-dir-fail-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/RENAME-file-to-dir-fail-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/RENAME-file-to-dir-fail-stderr.txt b/Tests/RunCMake/file/RENAME-file-to-dir-fail-stderr.txt new file mode 100644 index 0000000..e4dbc38 --- /dev/null +++ b/Tests/RunCMake/file/RENAME-file-to-dir-fail-stderr.txt @@ -0,0 +1,13 @@ +^CMake Error at [^ +]*/Tests/RunCMake/file/RENAME-file-to-dir-fail.cmake:[0-9] \(file\): + file RENAME failed to rename + + [^ +]*/Tests/RunCMake/file/RENAME-file-to-dir-fail-build/input + + to + + [^ +]*/Tests/RunCMake/file/RENAME-file-to-dir-fail-build/output + + because: [A-Za-z] diff --git a/Tests/RunCMake/file/RENAME-file-to-dir-fail.cmake b/Tests/RunCMake/file/RENAME-file-to-dir-fail.cmake new file mode 100644 index 0000000..61fa644 --- /dev/null +++ b/Tests/RunCMake/file/RENAME-file-to-dir-fail.cmake @@ -0,0 +1,5 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(WRITE "${oldname}" "") +file(MAKE_DIRECTORY "${newname}") +file(RENAME "${oldname}" "${newname}") diff --git a/Tests/RunCMake/file/RENAME-file-to-file.cmake b/Tests/RunCMake/file/RENAME-file-to-file.cmake new file mode 100644 index 0000000..dbc411be --- /dev/null +++ b/Tests/RunCMake/file/RENAME-file-to-file.cmake @@ -0,0 +1,10 @@ +set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input") +set(newname "${CMAKE_CURRENT_BINARY_DIR}/output") +file(WRITE "${oldname}" "") +file(RENAME "${oldname}" "${newname}") +if(EXISTS "${oldname}") + message(FATAL_ERROR "The old name still exists:\n ${oldname}") +endif() +if(NOT EXISTS "${newname}") + message(FATAL_ERROR "The new name does not exist:\n ${newname}") +endif() diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index 22813eb..9efd3f4 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -50,6 +50,30 @@ run_cmake(SIZE-error-does-not-exist) run_cmake(REMOVE-empty) +run_cmake_script(COPY_FILE-file-replace) +run_cmake_script(COPY_FILE-dir-to-file-capture) +run_cmake_script(COPY_FILE-dir-to-file-fail) +run_cmake_script(COPY_FILE-dirlink-to-file-capture) +run_cmake_script(COPY_FILE-dirlink-to-file-fail) +run_cmake_script(COPY_FILE-file-to-file) +run_cmake_script(COPY_FILE-file-to-dir-capture) +run_cmake_script(COPY_FILE-file-to-dir-fail) +run_cmake_script(COPY_FILE-file-ONLY_IF_DIFFERENT-capture) +run_cmake_script(COPY_FILE-file-ONLY_IF_DIFFERENT-fail) +run_cmake_script(COPY_FILE-file-ONLY_IF_DIFFERENT-no-overwrite) +run_cmake_script(COPY_FILE-link-to-file) +run_cmake_script(COPY_FILE-arg-missing) +run_cmake_script(COPY_FILE-arg-unknown) + +run_cmake_script(RENAME-file-replace) +run_cmake_script(RENAME-file-to-file) +run_cmake_script(RENAME-file-to-dir-capture) +run_cmake_script(RENAME-file-to-dir-fail) +run_cmake_script(RENAME-file-NO_REPLACE-capture) +run_cmake_script(RENAME-file-NO_REPLACE-fail) +run_cmake_script(RENAME-arg-missing) +run_cmake_script(RENAME-arg-unknown) + # tests are valid both for GLOB and GLOB_RECURSE run_cmake(GLOB-sort-dedup) run_cmake(GLOB-error-LIST_DIRECTORIES-not-boolean) @@ -63,7 +87,9 @@ run_cmake(GLOB-noexp-RELATIVE) run_cmake_command(GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE.cmake) -if(NOT WIN32 OR CYGWIN) +if(NOT WIN32 + AND NOT MSYS # FIXME: This works on CYGWIN but not on MSYS + ) run_cmake(CREATE_LINK-SYMBOLIC) run_cmake(CREATE_LINK-SYMBOLIC-noexist) run_cmake(GLOB_RECURSE-cyclic-recursion) @@ -72,11 +98,12 @@ if(NOT WIN32 OR CYGWIN) run_cmake(READ_SYMLINK-noexist) run_cmake(READ_SYMLINK-notsymlink) run_cmake(INSTALL-FOLLOW_SYMLINK_CHAIN) - run_cmake(REAL_PATH-unexpected-arg) - run_cmake(REAL_PATH-no-base-dir) - run_cmake(REAL_PATH) endif() +run_cmake(REAL_PATH-unexpected-arg) +run_cmake(REAL_PATH-no-base-dir) +run_cmake(REAL_PATH) + if(RunCMake_GENERATOR MATCHES "Ninja") # Detect ninja version so we know what tests can be supported. execute_process( @@ -137,7 +164,9 @@ else() run_cmake_command(GLOB-CONFIGURE_DEPENDS-RerunCMake-rebuild_second ${CMAKE_COMMAND} --build .) run_cmake_command(GLOB-CONFIGURE_DEPENDS-RerunCMake-nowork ${CMAKE_COMMAND} --build .) - if(NOT WIN32 OR CYGWIN) + if(NOT WIN32 + AND NOT MSYS # FIXME: This works on CYGWIN but not on MSYS + ) message(STATUS "GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake: link the first test directory into a new directory...") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}/test2") execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${RunCMake_TEST_BINARY_DIR}/test" "${RunCMake_TEST_BINARY_DIR}/test2/test_folder_symlink") diff --git a/Tests/RunCMake/find_file/FromPATHEnv-stdout-msys.txt b/Tests/RunCMake/find_file/FromPATHEnv-stdout-msys.txt new file mode 100644 index 0000000..6912bdf --- /dev/null +++ b/Tests/RunCMake/find_file/FromPATHEnv-stdout-msys.txt @@ -0,0 +1,9 @@ +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_File='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' diff --git a/Tests/RunCMake/find_file/PrefixInPATH-stdout-msys.txt b/Tests/RunCMake/find_file/PrefixInPATH-stdout-msys.txt new file mode 100644 index 0000000..d73bc1d --- /dev/null +++ b/Tests/RunCMake/find_file/PrefixInPATH-stdout-msys.txt @@ -0,0 +1,4 @@ +-- PrefixInPATH_INCLUDE_DIR='PrefixInPATH_INCLUDE_DIR-NOTFOUND' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' diff --git a/Tests/RunCMake/find_library/FromPATHEnv-stdout-msys.txt b/Tests/RunCMake/find_library/FromPATHEnv-stdout-msys.txt new file mode 100644 index 0000000..01e2720 --- /dev/null +++ b/Tests/RunCMake/find_library/FromPATHEnv-stdout-msys.txt @@ -0,0 +1,6 @@ +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/FromPATHEnv-build/lib/libcreated.a' +-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/FromPATHEnv-build/lib/libcreated.a' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' diff --git a/Tests/RunCMake/find_library/PrefixInPATH-stdout-msys.txt b/Tests/RunCMake/find_library/PrefixInPATH-stdout-msys.txt new file mode 100644 index 0000000..1ab884c --- /dev/null +++ b/Tests/RunCMake/find_library/PrefixInPATH-stdout-msys.txt @@ -0,0 +1,4 @@ +-- PrefixInPATH_LIBRARY='PrefixInPATH_LIBRARY-NOTFOUND' +-- PrefixInPATH_LIBRARY='.*/Tests/RunCMake/find_library/lib/libPrefixInPATH.a' +-- PrefixInPATH_LIBRARY='.*/Tests/RunCMake/find_library/lib/libPrefixInPATH.a' +-- PrefixInPATH_LIBRARY='.*/Tests/RunCMake/find_library/lib/libPrefixInPATH.a' diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake index a899f46..3ba04c8 100644 --- a/Tests/RunCMake/find_package/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake @@ -38,8 +38,11 @@ run_cmake(VersionRange3) run_cmake(VersionRange4) run_cmake(VersionRangeConfig) run_cmake(VersionRangeConfig2) +run_cmake(VersionRangeConfig02) run_cmake(VersionRangeConfigStd) run_cmake(VersionRangeConfigStd2) -if(UNIX) +if(UNIX + AND NOT MSYS # FIXME: This works on CYGWIN but not on MSYS + ) run_cmake(SetFoundResolved) endif() diff --git a/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfigVersion.cmake b/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfigVersion.cmake index e9f6076..1d0adfe 100644 --- a/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfigVersion.cmake +++ b/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfigVersion.cmake @@ -1,6 +1,7 @@ if (NOT PACKAGE_FIND_VERSION_COMPLETE STREQUAL "1.2.3.4...5.6.7.8" - AND NOT PACKAGE_FIND_VERSION_COMPLETE STREQUAL "1.2.3.4...<5.6.7.8") + AND NOT PACKAGE_FIND_VERSION_COMPLETE STREQUAL "1.2.3.4...<5.6.7.8" + AND NOT PACKAGE_FIND_VERSION_COMPLETE STREQUAL "1.02.03.04...<5.06.07.08") message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_COMPLETE: ${PACKAGE_FIND_VERSION_COMPLETE}") endif() @@ -21,7 +22,8 @@ if (NOT PACKAGE_FIND_VERSION_TWEAK VERSION_EQUAL "4") endif() if (NOT PACKAGE_FIND_VERSION_RANGE STREQUAL "1.2.3.4...5.6.7.8" - AND NOT PACKAGE_FIND_VERSION_RANGE STREQUAL "1.2.3.4...<5.6.7.8") + AND NOT PACKAGE_FIND_VERSION_RANGE STREQUAL "1.2.3.4...<5.6.7.8" + AND NOT PACKAGE_FIND_VERSION_RANGE STREQUAL "1.02.03.04...<5.06.07.08") message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_RANGE: ${PACKAGE_FIND_VERSION_RANGE}") endif() diff --git a/Tests/RunCMake/find_package/VersionRangeConfig02.cmake b/Tests/RunCMake/find_package/VersionRangeConfig02.cmake new file mode 100644 index 0000000..6522f6d --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeConfig02.cmake @@ -0,0 +1,23 @@ +set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + +find_package(VersionRange 1.02.03.04...<5.06.07.08 CONFIG NAMES VersionRangeCfg) + +if (NOT VersionRange_FOUND) + message (FATAL_ERROR "Package VersionRange not found in CONFIG mode.") +endif() + +if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5") + message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}") +endif() +if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}") +endif() +if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3") + message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}") +endif() +if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4") + message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}") +endif() +if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5") + message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}") +endif() diff --git a/Tests/RunCMake/find_path/FromPATHEnv-stdout-msys.txt b/Tests/RunCMake/find_path/FromPATHEnv-stdout-msys.txt new file mode 100644 index 0000000..8f3e7ca --- /dev/null +++ b/Tests/RunCMake/find_path/FromPATHEnv-stdout-msys.txt @@ -0,0 +1,9 @@ +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='.*/Tests/RunCMake/find_path/include' +-- PATH_IN_ENV_PATH='.*/Tests/RunCMake/find_path/include' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' diff --git a/Tests/RunCMake/find_path/PrefixInPATH-stdout-msys.txt b/Tests/RunCMake/find_path/PrefixInPATH-stdout-msys.txt new file mode 100644 index 0000000..bb2ceb7 --- /dev/null +++ b/Tests/RunCMake/find_path/PrefixInPATH-stdout-msys.txt @@ -0,0 +1,4 @@ +-- PrefixInPATH_INCLUDE_DIR='PrefixInPATH_INCLUDE_DIR-NOTFOUND' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_path/include' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_path/include' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_path/include' diff --git a/Tests/RunCMake/find_program/RunCMakeTest.cmake b/Tests/RunCMake/find_program/RunCMakeTest.cmake index 3e23920..77c021d 100644 --- a/Tests/RunCMake/find_program/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_program/RunCMakeTest.cmake @@ -6,7 +6,7 @@ run_cmake(NamesPerDir) run_cmake(RelAndAbsPath) run_cmake(Required) -if(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN)$") +if(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN|MSYS)$") run_cmake(WindowsCom) run_cmake(WindowsExe) else() diff --git a/Tests/RunCMake/foreach/RunCMakeTest.cmake b/Tests/RunCMake/foreach/RunCMakeTest.cmake index d3f7c23..15ca477 100644 --- a/Tests/RunCMake/foreach/RunCMakeTest.cmake +++ b/Tests/RunCMake/foreach/RunCMakeTest.cmake @@ -20,3 +20,5 @@ run_cmake(foreach-RANGE-non-int-test-3-2) run_cmake(foreach-RANGE-non-int-test-3-3) run_cmake(foreach-RANGE-invalid-test) run_cmake(foreach-RANGE-out-of-range-test) +run_cmake(foreach-var-scope-CMP0124-OLD) +run_cmake(foreach-var-scope-CMP0124-NEW) diff --git a/Tests/RunCMake/foreach/foreach-var-scope-CMP0124-NEW.cmake b/Tests/RunCMake/foreach/foreach-var-scope-CMP0124-NEW.cmake new file mode 100644 index 0000000..7e2eee0 --- /dev/null +++ b/Tests/RunCMake/foreach/foreach-var-scope-CMP0124-NEW.cmake @@ -0,0 +1,51 @@ + +cmake_policy(SET CMP0124 NEW) + +foreach(VAR a b c) +endforeach() +if (DEFINED VAR) + message(SEND_ERROR "Variable 'VAR' unexpectedly defined.") +endif() + +set(LIST1 a b c) +set(LIST2 x y z) +foreach(VAR1_1 VAR1_2 IN ZIP_LISTS LIST1 LIST2) +endforeach() +if (DEFINED VAR1_1 OR DEFINED VAR1_2) + message(SEND_ERROR "Variables 'VAR1_1' or 'VAR1_2' unexpectedly defined.") +endif() + + +set (VAR2 OLD) +foreach(VAR2 a b c) +endforeach() +if (NOT DEFINED VAR2 OR NOT VAR2 STREQUAL "OLD") + message(SEND_ERROR "Variable 'VAR2' not defined or wrong value.") +endif() + +set (VAR2_2 OLD) +foreach(VAR2_1 VAR2_2 IN ZIP_LISTS LIST1 LIST2) +endforeach() +if (DEFINED VAR2_1 OR NOT DEFINED VAR2_2) + message(SEND_ERROR "Variable 'VAR2_1' unexpectedly defined or variable 'VAR2_2' not defined.") +endif() + + +set (VAR3 OLD CACHE STRING "") +foreach(VAR3 a b c) +endforeach() +# check that only cache variable is defined +set(OLD_VALUE "${VAR3}") +unset(VAR3 CACHE) +if (DEFINED VAR3 OR NOT OLD_VALUE STREQUAL "OLD") + message(SEND_ERROR "Variable 'VAR3' wrongly defined or wrong value.") +endif() + +set (VAR3_2 OLD CACHE STRING "") +foreach(VAR3_1 VAR3_2 IN ZIP_LISTS LIST1 LIST2) +endforeach() +set(OLD_VALUE "${VAR3_2}") +unset(VAR3_2 CACHE) +if (DEFINED VAR3_1 OR DEFINED VAR3_2 OR NOT OLD_VALUE STREQUAL "OLD") + message(SEND_ERROR "Variable 'VAR3_1' unexpectedly defined or variable 'VAR2_2' wrongly defined or wrong value.") +endif() diff --git a/Tests/RunCMake/foreach/foreach-var-scope-CMP0124-OLD.cmake b/Tests/RunCMake/foreach/foreach-var-scope-CMP0124-OLD.cmake new file mode 100644 index 0000000..f955982 --- /dev/null +++ b/Tests/RunCMake/foreach/foreach-var-scope-CMP0124-OLD.cmake @@ -0,0 +1,53 @@ + +cmake_policy(SET CMP0124 OLD) + +foreach(VAR a b c) +endforeach() +if (NOT DEFINED VAR OR NOT VAR STREQUAL "") + message(SEND_ERROR "Variable 'VAR' not defined or wrong value.") +endif() + +set(LIST1 a b c) +set(LIST2 x y z) +foreach(VAR1_1 VAR1_2 IN ZIP_LISTS LIST1 LIST2) +endforeach() +if (NOT DEFINED VAR1_1 OR NOT VAR1_1 STREQUAL "" + OR NOT DEFINED VAR1_2 OR NOT VAR1_2 STREQUAL "") + message(SEND_ERROR "Variables 'VAR1_1' or 'VAR1_2' not defined or wrong value.") +endif() + + +set (VAR2 OLD) +foreach(VAR2 a b c) +endforeach() +if (NOT DEFINED VAR2 OR NOT VAR2 STREQUAL "OLD") + message(SEND_ERROR "Variable 'VAR2' not defined or wrong value.") +endif() + +set (VAR2_2 OLD) +foreach(VAR2_1 VAR2_2 IN ZIP_LISTS LIST1 LIST2) +endforeach() +if (NOT DEFINED VAR2_1 OR NOT VAR2_1 STREQUAL "" + OR NOT DEFINED VAR2_2 OR NOT VAR2_2 STREQUAL "OLD") + message(SEND_ERROR "Variables 'VAR2_1' or 'VAR2_2' not defined or wrong value.") +endif() + + +set (VAR3 OLD CACHE STRING "") +foreach(VAR3 a b c) +endforeach() +# a normal variable is defined, holding cache variable value +unset(VAR3 CACHE) +if (NOT DEFINED VAR3 OR NOT VAR3 STREQUAL "OLD") + message(SEND_ERROR "Variable 'VAR3' not defined or wrong value.") +endif() + +set (VAR3_2 OLD CACHE STRING "") +foreach(VAR3_1 VAR3_2 IN ZIP_LISTS LIST1 LIST2) +endforeach() +# a normal variable is defined, holding cache variable value +unset(VAR3_2 CACHE) +if (NOT DEFINED VAR3_1 OR NOT VAR3_1 STREQUAL "" + OR NOT DEFINED VAR3_2 OR NOT VAR3_2 STREQUAL "OLD") + message(SEND_ERROR "Variables 'VAR3_1' or 'VAR3_2' not defined or wrong value.") +endif() diff --git a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake index 7ed0773..cb0eb18 100644 --- a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake @@ -8,4 +8,5 @@ run_cmake(CustomConfig) if(RunCMake_GENERATOR MATCHES "Visual Studio ([^9]|9[0-9])") run_cmake(SkipGetTargetFrameworkProperties) + run_cmake(VSCSharpReference) endif() diff --git a/Tests/RunCMake/include_external_msproject/VSCSharpReference-check.cmake b/Tests/RunCMake/include_external_msproject/VSCSharpReference-check.cmake new file mode 100644 index 0000000..71b8c1f --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/VSCSharpReference-check.cmake @@ -0,0 +1,36 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/internal.vcxproj" all_build) + +string(REGEX MATCH + "<ProjectReference.Include=.external.csproj.>.*</ProjectReference>" + ProjectReference + ${all_build} +) + +if(ProjectReference STREQUAL "") + set(RunCMake_TEST_FAILED "${test} is being set unexpectedly.") +else() + string(REGEX MATCH + "<ReferenceOutputAssembly>.*</ReferenceOutputAssembly>" + ReferenceOutputAssembly + ${ProjectReference} + ) + + if(NOT ReferenceOutputAssembly STREQUAL "") + string(REPLACE + "<ReferenceOutputAssembly>" + "" + ReferenceOutputAssemblyValue + ${ReferenceOutputAssembly} + ) + string(REPLACE + "</ReferenceOutputAssembly>" + "" + ReferenceOutputAssemblyValue + ${ReferenceOutputAssemblyValue} + ) + + if(ReferenceOutputAssemblyValue MATCHES "[Fa][Ll][Ss][Ee]") + set(RunCMake_TEST_FAILED "Referenced C# project with ReferenceOutputAssembly set to false.") + endif() + endif() +endif() diff --git a/Tests/RunCMake/include_external_msproject/VSCSharpReference.cmake b/Tests/RunCMake/include_external_msproject/VSCSharpReference.cmake new file mode 100644 index 0000000..6229e61 --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/VSCSharpReference.cmake @@ -0,0 +1,10 @@ +project(VSCSharpReference) + +include_external_msproject(external external.csproj) + +add_executable(internal + main.cpp +) +add_dependencies(internal + external +) diff --git a/Tests/RunCMake/install/FILES-directory-result.txt b/Tests/RunCMake/install/FILES-directory-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/install/FILES-directory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/FILES-directory-stderr.txt b/Tests/RunCMake/install/FILES-directory-stderr.txt new file mode 100644 index 0000000..4699037 --- /dev/null +++ b/Tests/RunCMake/install/FILES-directory-stderr.txt @@ -0,0 +1 @@ +install FILES given directory diff --git a/Tests/RunCMake/install/FILES-directory.cmake b/Tests/RunCMake/install/FILES-directory.cmake new file mode 100644 index 0000000..1199cf7 --- /dev/null +++ b/Tests/RunCMake/install/FILES-directory.cmake @@ -0,0 +1,7 @@ +set(dst "${CMAKE_CURRENT_BINARY_DIR}/dst") +set(src "${CMAKE_CURRENT_BINARY_DIR}/src") + +file(MAKE_DIRECTORY "${dst}") +file(MAKE_DIRECTORY "${src}") + +install(FILES "${src}" DESTINATION "${dst}") diff --git a/Tests/RunCMake/install/FILES-symlink-to-directory.cmake b/Tests/RunCMake/install/FILES-symlink-to-directory.cmake new file mode 100644 index 0000000..ed76470 --- /dev/null +++ b/Tests/RunCMake/install/FILES-symlink-to-directory.cmake @@ -0,0 +1,9 @@ +set(dst "${CMAKE_CURRENT_BINARY_DIR}/dst") +set(src "${CMAKE_CURRENT_BINARY_DIR}/src") +set(lnk "${CMAKE_CURRENT_BINARY_DIR}/lnk") + +file(MAKE_DIRECTORY "${dst}") +file(MAKE_DIRECTORY "${src}") +file(CREATE_LINK "${src}" "${lnk}" SYMBOLIC) + +install(FILES "${lnk}" DESTINATION "${dst}") diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index efd03df..94887a0 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -55,9 +55,9 @@ function(run_cmake_EDIT_RPATH_only case) else() # Sanity check against a platform known to be ELF-based if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - message(FATAL_ERROR "Expected platform Linux to advertize itself as ELF-based, but it did not.") + message(FATAL_ERROR "Expected platform Linux to advertise itself as ELF-based, but it did not.") elseif(CMAKE_SYSTEM_NAME STREQUAL "AIX") - message(FATAL_ERROR "Expected platform AIX to advertize itself as XCOFF-based, but it did not.") + message(FATAL_ERROR "Expected platform AIX to advertise itself as XCOFF-based, but it did not.") else() message(STATUS "${case} - SKIPPED (No ELF-based platform found)") endif() @@ -93,6 +93,10 @@ run_cmake(TARGETS-NAMELINK_COMPONENT-bad-all) run_cmake(TARGETS-NAMELINK_COMPONENT-bad-exc) run_cmake(FILES-DESTINATION-TYPE) run_cmake(DIRECTORY-DESTINATION-TYPE) +run_cmake(FILES-directory) +if(NOT WIN32) + run_cmake(FILES-symlink-to-directory) +endif() set(RunCMake_TEST_OPTIONS "-DCMAKE_BUILD_TYPE:STRING=Debug") run_install_test(FILES-RENAME) @@ -175,3 +179,4 @@ run_install_test(FILES-EXCLUDE_FROM_ALL) run_install_test(TARGETS-EXCLUDE_FROM_ALL) run_install_test(TARGETS-NAMELINK_COMPONENT) run_install_test(SCRIPT-COMPONENT) +run_install_test(SCRIPT-ALL_COMPONENTS) diff --git a/Tests/RunCMake/install/SCRIPT-ALL_COMPONENTS-all-check.cmake b/Tests/RunCMake/install/SCRIPT-ALL_COMPONENTS-all-check.cmake new file mode 100644 index 0000000..48d8e1a --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT-ALL_COMPONENTS-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^empty1.txt;empty2.txt$]]) diff --git a/Tests/RunCMake/install/SCRIPT-ALL_COMPONENTS-dev-check.cmake b/Tests/RunCMake/install/SCRIPT-ALL_COMPONENTS-dev-check.cmake new file mode 100644 index 0000000..48d8e1a --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT-ALL_COMPONENTS-dev-check.cmake @@ -0,0 +1 @@ +check_installed([[^empty1.txt;empty2.txt$]]) diff --git a/Tests/RunCMake/install/SCRIPT-ALL_COMPONENTS-uns-check.cmake b/Tests/RunCMake/install/SCRIPT-ALL_COMPONENTS-uns-check.cmake new file mode 100644 index 0000000..48d8e1a --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT-ALL_COMPONENTS-uns-check.cmake @@ -0,0 +1 @@ +check_installed([[^empty1.txt;empty2.txt$]]) diff --git a/Tests/RunCMake/install/SCRIPT-ALL_COMPONENTS.cmake b/Tests/RunCMake/install/SCRIPT-ALL_COMPONENTS.cmake new file mode 100644 index 0000000..aa3f9d1 --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT-ALL_COMPONENTS.cmake @@ -0,0 +1,5 @@ +install( + SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/install_script.cmake" + CODE "write_empty_file(empty2.txt)" + ALL_COMPONENTS + ) diff --git a/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake b/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake index 4a55cd6..d099469 100644 --- a/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake +++ b/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake @@ -13,6 +13,21 @@ if(WIN32) [[mylib/(lib)?lib1\.(dll\.a|lib)]] [[mylib/(lib)?lib2\.(a|lib)]] ) +elseif(MSYS) + set(_check_files + [[lib3]] + [[lib3/liblib3\.dll\.a]] + [[lib4]] + [[lib4/msys-lib4\.dll]] + [[mybin]] + [[mybin/exe\.exe]] + [[mybin/msys-lib1\.dll]] + [[myinclude]] + [[myinclude/obj3\.h]] + [[mylib]] + [[mylib/liblib1\.dll\.a]] + [[mylib/liblib2\.a]] + ) elseif(CYGWIN) set(_check_files [[lib3]] diff --git a/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake b/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake index 30f2266..6e13b84 100644 --- a/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake +++ b/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake @@ -15,6 +15,23 @@ if(WIN32) [[lib4]] [[lib4/(lib)?lib4\.dll]] ) +elseif(MSYS) + set(_check_files + [[bin]] + [[bin/exe\.exe]] + [[bin/msys-lib1\.dll]] + [[include]] + [[include/obj1\.h]] + [[include/obj2\.h]] + [[include/obj3\.h]] + [[lib]] + [[lib/liblib1\.dll\.a]] + [[lib/liblib2\.a]] + [[lib3]] + [[lib3/liblib3\.dll\.a]] + [[lib4]] + [[lib4/msys-lib4\.dll]] + ) elseif(CYGWIN) set(_check_files [[bin]] diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake index bc9ebd1..e602af9 100644 --- a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake @@ -8,6 +8,16 @@ if(WIN32) [[lib/(lib)?namelink-uns-dev\.dll]] [[lib/(lib)?namelink-uns\.dll]] ) +elseif(MSYS) + set(_check_files + [[lib]] + [[lib/msys-namelink-none\.dll]] + [[lib/msys-namelink-same-1\.dll]] + [[lib/msys-namelink-sep-1\.dll]] + [[lib/msys-namelink-skip-1\.dll]] + [[lib/msys-namelink-uns-1\.dll]] + [[lib/msys-namelink-uns-dev-1\.dll]] + ) elseif(CYGWIN) set(_check_files [[lib]] diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake index 3f6be68..cd579eb 100644 --- a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake @@ -6,6 +6,14 @@ if(WIN32) [[lib/(lib)?namelink-sep\.dll]] [[lib/(lib)?namelink-skip\.dll]] ) +elseif(MSYS) + set(_check_files + [[lib]] + [[lib/msys-namelink-none\.dll]] + [[lib/msys-namelink-same-1\.dll]] + [[lib/msys-namelink-sep-1\.dll]] + [[lib/msys-namelink-skip-1\.dll]] + ) elseif(CYGWIN) set(_check_files [[lib]] diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake index 0033c88..ea68f4a 100644 --- a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake @@ -4,6 +4,12 @@ if(WIN32) [[lib/(lib)?namelink-uns-dev\.dll]] [[lib/(lib)?namelink-uns\.dll]] ) +elseif(MSYS) + set(_check_files + [[lib]] + [[lib/msys-namelink-uns-1\.dll]] + [[lib/msys-namelink-uns-dev-1\.dll]] + ) elseif(CYGWIN) set(_check_files [[lib]] diff --git a/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake index 5daecc8..91d5ef0 100644 --- a/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake +++ b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake @@ -4,6 +4,8 @@ if(WIN32) set(test45 [[bin/test4\.dll;bin/test4\.lib;bin/test5ar\.lib]]) check_installed("^bin;(${libtest45};${test123})|(${test123};${test45})\$") +elseif(MSYS) + check_installed([[^bin;bin/libtest4\.dll\.a;bin/libtest5ar\.a;bin/msys-test4\.dll;bin/test1out\.exe;bin/test2deb\.exe;bin/test3exc\.exe$]]) elseif(CYGWIN) check_installed([[^bin;bin/cygtest4\.dll;bin/libtest4\.dll\.a;bin/libtest5ar\.a;bin/test1out\.exe;bin/test2deb\.exe;bin/test3exc\.exe$]]) elseif(APPLE) diff --git a/Tests/RunCMake/option/CMP0077-OLD-stderr.txt b/Tests/RunCMake/option/CMP0077-OLD-stderr.txt new file mode 100644 index 0000000..9d963cb --- /dev/null +++ b/Tests/RunCMake/option/CMP0077-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0077-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0077 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:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/project/ProjectIsTopLevel-stdout.txt b/Tests/RunCMake/project/ProjectIsTopLevel-stdout.txt new file mode 100644 index 0000000..af8abfd --- /dev/null +++ b/Tests/RunCMake/project/ProjectIsTopLevel-stdout.txt @@ -0,0 +1,2 @@ +-- PROJECT_IS_TOP_LEVEL=ON +-- ProjectIsTopLevel_IS_TOP_LEVEL=ON diff --git a/Tests/RunCMake/project/ProjectIsTopLevel.cmake b/Tests/RunCMake/project/ProjectIsTopLevel.cmake new file mode 100644 index 0000000..5a0af0a --- /dev/null +++ b/Tests/RunCMake/project/ProjectIsTopLevel.cmake @@ -0,0 +1,9 @@ +# no project() call, includer already calls project(${RunCMake_TEST} NONE) +if(NOT DEFINED PROJECT_IS_TOP_LEVEL) + message(FATAL_ERROR "PROJECT_IS_TOP_LEVEL is not defined") +endif() +if(NOT DEFINED "CACHE{${RunCMake_TEST}_IS_TOP_LEVEL}") + message(FATAL_ERROR "IsTopLevel_IS_TOP_LEVEL is not defined") +endif() +message(STATUS "PROJECT_IS_TOP_LEVEL=${PROJECT_IS_TOP_LEVEL}") +message(STATUS "${RunCMake_TEST}_IS_TOP_LEVEL=${${RunCMake_TEST}_IS_TOP_LEVEL}") diff --git a/Tests/RunCMake/project/ProjectIsTopLevelMultiple-stdout.txt b/Tests/RunCMake/project/ProjectIsTopLevelMultiple-stdout.txt new file mode 100644 index 0000000..75d787f --- /dev/null +++ b/Tests/RunCMake/project/ProjectIsTopLevelMultiple-stdout.txt @@ -0,0 +1,3 @@ +-- PROJECT_IS_TOP_LEVEL=ON +-- ProjectIsTopLevelMultiple_IS_TOP_LEVEL=ON +-- IsTopLevel_IS_TOP_LEVEL=ON diff --git a/Tests/RunCMake/project/ProjectIsTopLevelMultiple.cmake b/Tests/RunCMake/project/ProjectIsTopLevelMultiple.cmake new file mode 100644 index 0000000..98ba55b --- /dev/null +++ b/Tests/RunCMake/project/ProjectIsTopLevelMultiple.cmake @@ -0,0 +1,14 @@ +# only one project() call, includer already calls project(${RunCMake_TEST} NONE) +project(IsTopLevel NONE) +if(NOT DEFINED PROJECT_IS_TOP_LEVEL) + message(FATAL_ERROR "PROJECT_IS_TOP_LEVEL is not defined") +endif() +if(NOT DEFINED "CACHE{${RunCMake_TEST}_IS_TOP_LEVEL}") + message(FATAL_ERROR "${RunCMake_TEST}_IS_TOP_LEVEL is not defined") +endif() +if(NOT DEFINED CACHE{IsTopLevel_IS_TOP_LEVEL}) + message(FATAL_ERROR "IsTopLevel_IS_TOP_LEVEL is not defined") +endif() +message(STATUS "PROJECT_IS_TOP_LEVEL=${PROJECT_IS_TOP_LEVEL}") +message(STATUS "${RunCMake_TEST}_IS_TOP_LEVEL=${${RunCMake_TEST}_IS_TOP_LEVEL}") +message(STATUS "IsTopLevel_IS_TOP_LEVEL=${IsTopLevel_IS_TOP_LEVEL}") diff --git a/Tests/RunCMake/project/ProjectIsTopLevelSubdirectory-stdout.txt b/Tests/RunCMake/project/ProjectIsTopLevelSubdirectory-stdout.txt new file mode 100644 index 0000000..d9e15ff --- /dev/null +++ b/Tests/RunCMake/project/ProjectIsTopLevelSubdirectory-stdout.txt @@ -0,0 +1,6 @@ +-- PROJECT_IS_TOP_LEVEL=ON +-- PROJECT_IS_TOP_LEVEL=ON +-- PROJECT_IS_TOP_LEVEL=OFF +-- PROJECT_IS_TOP_LEVEL=ON +-- ProjectIsTopLevelSubdirectory_IS_TOP_LEVEL=ON +-- NotTopLevel_IS_TOP_LEVEL=OFF diff --git a/Tests/RunCMake/project/ProjectIsTopLevelSubdirectory.cmake b/Tests/RunCMake/project/ProjectIsTopLevelSubdirectory.cmake new file mode 100644 index 0000000..b5df84b --- /dev/null +++ b/Tests/RunCMake/project/ProjectIsTopLevelSubdirectory.cmake @@ -0,0 +1,8 @@ +# no project() call, includer already calls project(${RunCMake_TEST} NONE) +message(STATUS "PROJECT_IS_TOP_LEVEL=${PROJECT_IS_TOP_LEVEL}") + +add_subdirectory(ProjectIsTopLevelSubdirectory) + +message(STATUS "PROJECT_IS_TOP_LEVEL=${PROJECT_IS_TOP_LEVEL}") +message(STATUS "${RunCMake_TEST}_IS_TOP_LEVEL=${${RunCMake_TEST}_IS_TOP_LEVEL}") +message(STATUS "NotTopLevel_IS_TOP_LEVEL=${NotTopLevel_IS_TOP_LEVEL}") diff --git a/Tests/RunCMake/project/ProjectIsTopLevelSubdirectory/CMakeLists.txt b/Tests/RunCMake/project/ProjectIsTopLevelSubdirectory/CMakeLists.txt new file mode 100644 index 0000000..d2f16ea --- /dev/null +++ b/Tests/RunCMake/project/ProjectIsTopLevelSubdirectory/CMakeLists.txt @@ -0,0 +1,5 @@ +message(STATUS "PROJECT_IS_TOP_LEVEL=${PROJECT_IS_TOP_LEVEL}") + +project(NotTopLevel NONE) + +message(STATUS "PROJECT_IS_TOP_LEVEL=${PROJECT_IS_TOP_LEVEL}") diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake index 6914699..349e8ac 100644 --- a/Tests/RunCMake/project/RunCMakeTest.cmake +++ b/Tests/RunCMake/project/RunCMakeTest.cmake @@ -15,6 +15,9 @@ run_cmake(ProjectDescriptionNoArg2) run_cmake(ProjectHomepage) run_cmake(ProjectHomepage2) run_cmake(ProjectHomepageNoArg) +run_cmake(ProjectIsTopLevel) +run_cmake(ProjectIsTopLevelMultiple) +run_cmake(ProjectIsTopLevelSubdirectory) run_cmake(ProjectTwice) run_cmake(VersionAndLanguagesEmpty) run_cmake(VersionEmpty) diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD-stderr.txt new file mode 100644 index 0000000..c664505 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0079-iface-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0079 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:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-stderr.txt index 0b4c4c6..14f4789 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-stderr.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-stderr.txt @@ -1,4 +1,15 @@ -^CMake Error at CMP0079-link/CMakeLists.txt:[0-9]+ \(target_link_libraries\): +^CMake Deprecation Warning at CMP0079-link-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0079 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:[0-9]+ \(include\) ++ +CMake Error at CMP0079-link/CMakeLists.txt:[0-9]+ \(target_link_libraries\): Attempt to add link library "foo" to target "top" which is not built in this directory. |