diff options
Diffstat (limited to 'Tests/RunCMake')
198 files changed, 2193 insertions, 12 deletions
diff --git a/Tests/RunCMake/Autogen/AutogenUseSystemIncludeCommon.cmake b/Tests/RunCMake/Autogen/AutogenUseSystemIncludeCommon.cmake new file mode 100644 index 0000000000..bbefd5f55b --- /dev/null +++ b/Tests/RunCMake/Autogen/AutogenUseSystemIncludeCommon.cmake @@ -0,0 +1,10 @@ +enable_language(CXX) + +find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui) + +set(CMAKE_AUTOMOC ON) + +add_library(dummy SHARED empty.cpp) +target_link_libraries(dummy Qt${with_qt_version}::Core + Qt${with_qt_version}::Widgets + Qt${with_qt_version}::Gui) diff --git a/Tests/RunCMake/Autogen/AutogenUseSystemIncludeOff.cmake b/Tests/RunCMake/Autogen/AutogenUseSystemIncludeOff.cmake new file mode 100644 index 0000000000..dfdbb98b5b --- /dev/null +++ b/Tests/RunCMake/Autogen/AutogenUseSystemIncludeOff.cmake @@ -0,0 +1,3 @@ +include("${CMAKE_CURRENT_LIST_DIR}/AutogenUseSystemIncludeCommon.cmake") + +set_target_properties(dummy PROPERTIES AUTOGEN_USE_SYSTEM_INCLUDE OFF) diff --git a/Tests/RunCMake/Autogen/AutogenUseSystemIncludeOn.cmake b/Tests/RunCMake/Autogen/AutogenUseSystemIncludeOn.cmake new file mode 100644 index 0000000000..f556ed43af --- /dev/null +++ b/Tests/RunCMake/Autogen/AutogenUseSystemIncludeOn.cmake @@ -0,0 +1,3 @@ +include("${CMAKE_CURRENT_LIST_DIR}/AutogenUseSystemIncludeCommon.cmake") + +set_target_properties(dummy PROPERTIES AUTOGEN_USE_SYSTEM_INCLUDE ON) diff --git a/Tests/RunCMake/Autogen/CMP0151-common.cmake b/Tests/RunCMake/Autogen/CMP0151-common.cmake new file mode 100644 index 0000000000..bbefd5f55b --- /dev/null +++ b/Tests/RunCMake/Autogen/CMP0151-common.cmake @@ -0,0 +1,10 @@ +enable_language(CXX) + +find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui) + +set(CMAKE_AUTOMOC ON) + +add_library(dummy SHARED empty.cpp) +target_link_libraries(dummy Qt${with_qt_version}::Core + Qt${with_qt_version}::Widgets + Qt${with_qt_version}::Gui) diff --git a/Tests/RunCMake/Autogen/CMP0151-new.cmake b/Tests/RunCMake/Autogen/CMP0151-new.cmake new file mode 100644 index 0000000000..9c77e586f9 --- /dev/null +++ b/Tests/RunCMake/Autogen/CMP0151-new.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/CMP0151-common.cmake") diff --git a/Tests/RunCMake/Autogen/CMP0151-old.cmake b/Tests/RunCMake/Autogen/CMP0151-old.cmake new file mode 100644 index 0000000000..9c77e586f9 --- /dev/null +++ b/Tests/RunCMake/Autogen/CMP0151-old.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/CMP0151-common.cmake") diff --git a/Tests/RunCMake/Autogen/Inspect.cmake b/Tests/RunCMake/Autogen/Inspect.cmake new file mode 100644 index 0000000000..d5dc4b4093 --- /dev/null +++ b/Tests/RunCMake/Autogen/Inspect.cmake @@ -0,0 +1,13 @@ +enable_language(CXX) + +set(info "") +foreach(var + CMAKE_INCLUDE_FLAG_CXX + CMAKE_INCLUDE_SYSTEM_FLAG_CXX + ) + if(DEFINED ${var}) + string(APPEND info "set(${var} \"${${var}}\")\n") + endif() +endforeach() + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/info.cmake" "${info}") diff --git a/Tests/RunCMake/Autogen/RunCMakeTest.cmake b/Tests/RunCMake/Autogen/RunCMakeTest.cmake index 6a3c49b534..45051326cb 100644 --- a/Tests/RunCMake/Autogen/RunCMakeTest.cmake +++ b/Tests/RunCMake/Autogen/RunCMakeTest.cmake @@ -22,4 +22,70 @@ if (DEFINED with_qt_version) set(RunCMake_TEST_NO_CLEAN 1) run_cmake_command(MocPredefs-build ${CMAKE_COMMAND} --build . --config Debug) endblock() + + # Detect information from the toolchain: + # - CMAKE_INCLUDE_FLAG_CXX + # - CMAKE_INCLUDE_SYSTEM_FLAG_CXX + run_cmake(Inspect) + include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake") + + if(CMAKE_INCLUDE_SYSTEM_FLAG_CXX) + if(RunCMake_GENERATOR MATCHES "Visual Studio") + string(REGEX REPLACE "^-" "/" test_expect_stdout "${CMAKE_INCLUDE_SYSTEM_FLAG_CXX}") + else() + set(test_expect_stdout "-*${CMAKE_INCLUDE_SYSTEM_FLAG_CXX}") + endif() + string(APPEND test_expect_stdout " *(\"[^\"]*|([^ ]|\\ )*)[\\/]dummy_autogen[\\/]include") + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + string(APPEND test_expect_stdout "_Debug") + endif() + + block() + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0151-new-build) + run_cmake_with_options(CMP0151-new ${RunCMake_TEST_OPTIONS} -DCMAKE_POLICY_DEFAULT_CMP0151=NEW) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_EXPECT_stdout "${test_expect_stdout}") + message(STATUS "RunCMake_TEST_EXPECT_stdout: ${RunCMake_TEST_EXPECT_stdout}") + run_cmake_command(CMP0151-new-build ${CMAKE_COMMAND} --build . --config Debug --verbose) + endblock() + + block() + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AutogenUseSystemIncludeOn-build) + run_cmake_with_options(AutogenUseSystemIncludeOn ${RunCMake_TEST_OPTIONS} -DCMAKE_POLICY_DEFAULT_CMP0151=NEW) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_EXPECT_stdout "${test_expect_stdout}") + message(STATUS "RunCMake_TEST_EXPECT_stdout: ${RunCMake_TEST_EXPECT_stdout}") + run_cmake_command(AutogenUseSystemIncludeOn ${CMAKE_COMMAND} --build . --config Debug --verbose) + endblock() + endif() + + if(CMAKE_INCLUDE_FLAG_CXX) + if(RunCMake_GENERATOR MATCHES "Visual Studio") + string(REGEX REPLACE "^-" "/" test_expect_stdout "${CMAKE_INCLUDE_FLAG_CXX}") + else() + set(test_expect_stdout "-*${CMAKE_INCLUDE_FLAG_CXX}") + endif() + string(APPEND test_expect_stdout " *(\"[^\"]*|([^ ]|\\ )*)[\\/]dummy_autogen[\\/]include") + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + string(APPEND test_expect_stdout "_Debug") + endif() + + block() + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0151-old-build) + run_cmake_with_options(CMP0151-old ${RunCMake_TEST_OPTIONS} -DCMAKE_POLICY_DEFAULT_CMP0151=OLD) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_EXPECT_stdout "${test_expect_stdout}") + message(STATUS "RunCMake_TEST_EXPECT_stdout: ${RunCMake_TEST_EXPECT_stdout}") + run_cmake_command(CMP0151-old-build ${CMAKE_COMMAND} --build . --config Debug --verbose) + endblock() + + block() + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AutogenUseSystemIncludeOff-build) + run_cmake_with_options(AutogenUseSystemIncludeOff ${RunCMake_TEST_OPTIONS} -DCMAKE_POLICY_DEFAULT_CMP0151=NEW) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_EXPECT_stdout "${test_expect_stdout}") + message(STATUS "RunCMake_TEST_EXPECT_stdout: ${RunCMake_TEST_EXPECT_stdout}") + run_cmake_command(AutogenUseSystemIncludeOff ${CMAKE_COMMAND} --build . --config Debug --verbose) + endblock() + endif() endif () diff --git a/Tests/RunCMake/BuildDepends/LinkDepends.cmake b/Tests/RunCMake/BuildDepends/LinkDepends.cmake new file mode 100644 index 0000000000..a414e03597 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/LinkDepends.cmake @@ -0,0 +1,22 @@ + +enable_language(C) + +include("${CMAKE_BINARY_DIR}/../LinkDependsExternalLibrary-build/ExternalLibrary-debug.cmake") +cmake_path(GET EXTERNAL_LIBRARY PARENT_PATH EXTERNAL_DIR) + +add_library(LinkDependsLib SHARED "${CMAKE_CURRENT_BINARY_DIR}/lib_depends.c") +target_link_directories(LinkDependsLib PRIVATE "${EXTERNAL_DIR}") +target_link_libraries(LinkDependsLib PRIVATE External) + +add_executable(LinkDependsExe "${CMAKE_CURRENT_BINARY_DIR}/exe_depends.c") +target_link_directories(LinkDependsExe PRIVATE "${EXTERNAL_DIR}") +target_link_libraries(LinkDependsExe PRIVATE External) + + +file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake" + CONTENT " +set(check_pairs + \"$<TARGET_FILE:LinkDependsLib>|${EXTERNAL_LIBRARY}\" + \"$<TARGET_FILE:LinkDependsExe>|${EXTERNAL_LIBRARY}\" + ) +") diff --git a/Tests/RunCMake/BuildDepends/LinkDepends.step1.cmake b/Tests/RunCMake/BuildDepends/LinkDepends.step1.cmake new file mode 100644 index 0000000000..5ce55b0177 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/LinkDepends.step1.cmake @@ -0,0 +1,23 @@ + +file(WRITE "${RunCMake_TEST_BINARY_DIR}/lib_depends.c" [[ + +extern void external(void); + +void lib_depends(void) +{ + external(); +} +]]) + + +file(WRITE "${RunCMake_TEST_BINARY_DIR}/exe_depends.c" [[ + +extern void external(void); + +int main(void) +{ + external(); + + return 0; +} +]]) diff --git a/Tests/RunCMake/BuildDepends/LinkDepends.step2.cmake b/Tests/RunCMake/BuildDepends/LinkDepends.step2.cmake new file mode 100644 index 0000000000..f2c0067747 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/LinkDepends.step2.cmake @@ -0,0 +1,4 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/../LinkDependsExternalLibrary-build/ExternalLibrary-debug.cmake") + +file(TOUCH "${EXTERNAL_LIBRARY}") diff --git a/Tests/RunCMake/BuildDepends/LinkDependsCheck.cmake b/Tests/RunCMake/BuildDepends/LinkDependsCheck.cmake new file mode 100644 index 0000000000..a21096b2ae --- /dev/null +++ b/Tests/RunCMake/BuildDepends/LinkDependsCheck.cmake @@ -0,0 +1,11 @@ + +enable_language(C) + +file(WRITE "${CMAKE_BINARY_DIR}/LinkDependsUseLinker.cmake" + "set(CMAKE_C_LINK_DEPENDS_USE_LINKER \"${CMAKE_C_LINK_DEPENDS_USE_LINKER}\")\n") + + +file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake" + CONTENT " +# no required actions +") diff --git a/Tests/RunCMake/BuildDepends/LinkDependsExternalLibrary.cmake b/Tests/RunCMake/BuildDepends/LinkDependsExternalLibrary.cmake new file mode 100644 index 0000000000..fe6575c9b8 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/LinkDependsExternalLibrary.cmake @@ -0,0 +1,13 @@ + +enable_language(C) + +add_library(External SHARED "${CMAKE_CURRENT_BINARY_DIR}/external.c") + +file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/ExternalLibrary-$<LOWER_CASE:$<CONFIG>>.cmake" + CONTENT "set(EXTERNAL_LIBRARY \"$<TARGET_LINKER_FILE:External>\")\n") + + +file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake" + CONTENT " +# no required actions +") diff --git a/Tests/RunCMake/BuildDepends/LinkDependsExternalLibrary.step1.cmake b/Tests/RunCMake/BuildDepends/LinkDependsExternalLibrary.step1.cmake new file mode 100644 index 0000000000..df302f7614 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/LinkDependsExternalLibrary.step1.cmake @@ -0,0 +1,11 @@ + +file(WRITE "${RunCMake_TEST_BINARY_DIR}/external.c" [[ + + +#if defined(_WIN32) +__declspec(dllexport) +#endif + void external(void) +{ +} +]]) diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index 809907931d..b52758045e 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -194,3 +194,15 @@ if(RunCMake_GENERATOR MATCHES "^Visual Studio 9 " OR endif() run_BuildDepends(CustomCommandUnityBuild) unset(run_BuildDepends_skip_step_2) + +#if (RunCMake_GENERATOR MATCHES "Make|Ninja" AND CMAKE_C_LINK_DEPENDS_USE_LINKER) +if (RunCMake_GENERATOR MATCHES "Make|Ninja") + set(run_BuildDepends_skip_step_2 1) + run_BuildDepends(LinkDependsCheck) + include("${RunCMake_BINARY_DIR}/LinkDependsCheck-build/LinkDependsUseLinker.cmake") + if (CMAKE_C_LINK_DEPENDS_USE_LINKER) + run_BuildDepends(LinkDependsExternalLibrary) + unset(run_BuildDepends_skip_step_2) + run_BuildDepends(LinkDepends) + endif() +endif() diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD-stderr.txt index 5a035596e3..ac01c80b32 100644 --- a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-OLD-stderr.txt @@ -1,5 +1,5 @@ CMake Error at CMP0121-ERANGE-Common.cmake:3 \(list\): - list index: (-2147483643|2147483647) out of range \(-5, 4\) + list index: (-2147483648|2147483647) out of range \(-5, 4\) Call Stack \(most recent call first\): CMP0121-ERANGE-OLD.cmake:2 \(include\) CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN-stderr.txt b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN-stderr.txt index cb4ea46439..c644dd3618 100644 --- a/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0121/CMP0121-ERANGE-WARN-stderr.txt @@ -9,7 +9,7 @@ Call Stack \(most recent call first\): 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\) + list index: (-2147483648|2147483647) out of range \(-5, 4\) Call Stack \(most recent call first\): CMP0121-ERANGE-WARN.cmake:2 \(include\) CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0150/CMP0150-NEW-build-stdout.txt b/Tests/RunCMake/CMP0150/CMP0150-NEW-build-stdout.txt new file mode 100644 index 0000000000..9e71b731c7 --- /dev/null +++ b/Tests/RunCMake/CMP0150/CMP0150-NEW-build-stdout.txt @@ -0,0 +1,7 @@ +.*-- Configured bottom project +.*ExternalProject for ep-Y +.*-- Configured bottom project +[^\n]*-- Completed configuring project middle +.*-- Configured bottom project +.*ExternalProject for ep-X +.*Non-ep top project diff --git a/Tests/RunCMake/CMP0150/CMP0150-NEW-resolve.cmake b/Tests/RunCMake/CMP0150/CMP0150-NEW-resolve.cmake new file mode 100644 index 0000000000..f43f3d5f7b --- /dev/null +++ b/Tests/RunCMake/CMP0150/CMP0150-NEW-resolve.cmake @@ -0,0 +1,107 @@ +include(ExternalProject/shared_internal_commands) + +function(test_resolve parentUrl relativeUrl expectedResult) + _ep_resolve_relative_git_remote(result "${parentUrl}" "${relativeUrl}") + if(NOT result STREQUAL expectedResult) + message(SEND_ERROR "URL resolved to unexpected result:\n" + " Expected: ${expectedResult}\n" + " Actual : ${result}" + ) + endif() +endfunction() + +test_resolve( + "https://example.com/group/parent" + "../other" + "https://example.com/group/other" +) +test_resolve( + "https://example.com/group/parent" + "../../alt/other" + "https://example.com/alt/other" +) + +test_resolve( + "git@example.com:group/parent" + "../other" + "git@example.com:group/other" +) +test_resolve( + "git@example.com:group/parent" + "../../alt/other" + "git@example.com:alt/other" +) +test_resolve( + "git@example.com:/group/parent" + "../other" + "git@example.com:/group/other" +) +test_resolve( + "git@example.com:/group/parent" + "../../alt/other" + "git@example.com:/alt/other" +) +test_resolve( + "git+ssh://git@example.com:group/parent" + "../other" + "git+ssh://git@example.com:group/other" +) +test_resolve( + "ssh://git@example.com:1234/group/parent" + "../../alt/other" + "ssh://git@example.com:1234/alt/other" +) + +test_resolve( + "file:///group/parent" + "../other" + "file:///group/other" +) +test_resolve( + "file:///group/parent" + "../../alt/other" + "file:///alt/other" +) +test_resolve( + "file:///~/group/parent" + "../../other" + "file:///~/other" +) +test_resolve( + "/group/parent" + "../other" + "/group/other" +) +test_resolve( + "/group/parent" + "../../alt/other" + "/alt/other" +) +test_resolve( + "C:/group/parent" + "../other" + "C:/group/other" +) +test_resolve( + "C:/group/parent" + "../../alt/other" + "C:/alt/other" +) + +test_resolve( + "x-Test+v1.0://example.com/group/parent" + "../other" + "x-Test+v1.0://example.com/group/other" +) + +# IPv6 literals +test_resolve( + "http://[::1]/group/parent" + "../../alt/other" + "http://[::1]/alt/other" +) +test_resolve( + "git@[::1]:group/parent" + "../../alt/other" + "git@[::1]:alt/other" +) diff --git a/Tests/RunCMake/CMP0150/CMP0150-NEW-stdout.txt b/Tests/RunCMake/CMP0150/CMP0150-NEW-stdout.txt new file mode 100644 index 0000000000..0f25fabf40 --- /dev/null +++ b/Tests/RunCMake/CMP0150/CMP0150-NEW-stdout.txt @@ -0,0 +1,4 @@ +-- Configured bottom project +-- Completed configuring project middle +-- Completed configuring project top +-- Configuring done diff --git a/Tests/RunCMake/CMP0150/CMP0150-NEW.cmake b/Tests/RunCMake/CMP0150/CMP0150-NEW.cmake new file mode 100644 index 0000000000..c1c5607af7 --- /dev/null +++ b/Tests/RunCMake/CMP0150/CMP0150-NEW.cmake @@ -0,0 +1,45 @@ +set(policyCommand "cmake_policy(SET CMP0150 NEW)") + +# Need to keep paths and file names short to avoid hitting limits on Windows. +# Directory names "a" through to "g" are used here according to the following: +# a = Top project +# b/c = Middle project +# d = Bottom project +# e/f = Cloned Top project +# g = Build directory for cloned Top project +# +# Dependency names map as follows: +# X = middle dependency +# Y = bottom dependency + +set(projName top) +set(depName X) +set(epRelativeGitRepo ../b/c) +set(fcRelativeGitRepo ../b/c) +configure_file(CMakeLists.txt.in a/CMakeLists.txt @ONLY) +initGitRepo("${CMAKE_CURRENT_BINARY_DIR}/a") + +set(projName middle) +set(depName Y) +set(epRelativeGitRepo ../../d) +set(fcRelativeGitRepo ../../d) +configure_file(CMakeLists.txt.in b/c/CMakeLists.txt @ONLY) +initGitRepo("${CMAKE_CURRENT_BINARY_DIR}/b/c") + +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/d") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/d/CMakeLists.txt" [[ +cmake_minimum_required(VERSION 3.26) +project(bottom LANGUAGES NONE) +message(STATUS "Configured bottom project") +]]) +initGitRepo("${CMAKE_CURRENT_BINARY_DIR}/d") + +set(clonedTopDir "${CMAKE_CURRENT_BINARY_DIR}/e/f") +file(MAKE_DIRECTORY "${clonedTopDir}") +execGitCommand(${CMAKE_CURRENT_BINARY_DIR} clone --quiet "file://${CMAKE_CURRENT_BINARY_DIR}/a" "${clonedTopDir}") +add_subdirectory("${clonedTopDir}" "${CMAKE_CURRENT_BINARY_DIR}/g") + +# Ensure build order is predictable +add_custom_target(non-ep-top ALL COMMAND ${CMAKE_COMMAND} -E echo "Non-ep top project") +add_dependencies(non-ep-top ep-X) +add_dependencies(ep-X ep-Y) diff --git a/Tests/RunCMake/CMP0150/CMP0150-OLD-build-stdout.txt b/Tests/RunCMake/CMP0150/CMP0150-OLD-build-stdout.txt new file mode 100644 index 0000000000..0150af769b --- /dev/null +++ b/Tests/RunCMake/CMP0150/CMP0150-OLD-build-stdout.txt @@ -0,0 +1,3 @@ +.*-- Configured bottom project +.*ExternalProject for ep-bottom +.*Non-ep top project diff --git a/Tests/RunCMake/CMP0150/CMP0150-OLD-common.cmake b/Tests/RunCMake/CMP0150/CMP0150-OLD-common.cmake new file mode 100644 index 0000000000..69748f7325 --- /dev/null +++ b/Tests/RunCMake/CMP0150/CMP0150-OLD-common.cmake @@ -0,0 +1,21 @@ +# There's no point testing more than one level for OLD, since the behavior only +# depends on the current build, not anything about the parent git repo, etc. +set(projName top) +set(depName bottom) +set(epRelativeGitRepo ../../../Bottom) +set(fcRelativeGitRepo ../Bottom) +configure_file(CMakeLists.txt.in Top/CMakeLists.txt @ONLY) + +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Bottom") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/Bottom/CMakeLists.txt" [[ +cmake_minimum_required(VERSION 3.26) +project(bottom LANGUAGES NONE) +message(STATUS "Configured bottom project") +]]) +initGitRepo("${CMAKE_CURRENT_BINARY_DIR}/Bottom") + +add_subdirectory("${CMAKE_CURRENT_BINARY_DIR}/Top" "${CMAKE_CURRENT_BINARY_DIR}/Top-build") + +# Ensure build order is predictable +add_custom_target(non-ep-top ALL COMMAND ${CMAKE_COMMAND} -E echo "Non-ep top project") +add_dependencies(non-ep-top ep-bottom) diff --git a/Tests/RunCMake/CMP0150/CMP0150-OLD-stdout.txt b/Tests/RunCMake/CMP0150/CMP0150-OLD-stdout.txt new file mode 100644 index 0000000000..680f9c1d3d --- /dev/null +++ b/Tests/RunCMake/CMP0150/CMP0150-OLD-stdout.txt @@ -0,0 +1,3 @@ +-- Configured bottom project +-- Completed configuring project top +-- Configuring done diff --git a/Tests/RunCMake/CMP0150/CMP0150-OLD.cmake b/Tests/RunCMake/CMP0150/CMP0150-OLD.cmake new file mode 100644 index 0000000000..6b58e70c83 --- /dev/null +++ b/Tests/RunCMake/CMP0150/CMP0150-OLD.cmake @@ -0,0 +1,2 @@ +set(policyCommand "cmake_policy(SET CMP0150 OLD)") +include(CMP0150-OLD-common.cmake) diff --git a/Tests/RunCMake/CMP0150/CMP0150-WARN-build-stdout.txt b/Tests/RunCMake/CMP0150/CMP0150-WARN-build-stdout.txt new file mode 100644 index 0000000000..0150af769b --- /dev/null +++ b/Tests/RunCMake/CMP0150/CMP0150-WARN-build-stdout.txt @@ -0,0 +1,3 @@ +.*-- Configured bottom project +.*ExternalProject for ep-bottom +.*Non-ep top project diff --git a/Tests/RunCMake/CMP0150/CMP0150-WARN-stderr.txt b/Tests/RunCMake/CMP0150/CMP0150-WARN-stderr.txt new file mode 100644 index 0000000000..74c932aaa2 --- /dev/null +++ b/Tests/RunCMake/CMP0150/CMP0150-WARN-stderr.txt @@ -0,0 +1,25 @@ +CMake Warning \(dev\) at .*/Modules/ExternalProject/shared_internal_commands\.cmake:[0-9]+ \(message\): + Policy CMP0150 is not set: ExternalProject_Add and FetchContent_Declare + commands treat relative GIT_REPOSITORY paths as being relative to the + parent project's remote\. Run "cmake --help-policy CMP0150" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + A relative GIT_REPOSITORY path was detected\. This will be interpreted as a + local path to where the project is being cloned\. Set GIT_REPOSITORY to an + absolute path or set policy CMP0150 to NEW to avoid this warning\. +Call Stack \(most recent call first\): + .*/Modules/ExternalProject\.cmake:[0-9]+ \(_ep_resolve_git_remote\) +.* +CMake Warning \(dev\) at .*/Modules/ExternalProject/shared_internal_commands\.cmake:[0-9]+ \(message\): + Policy CMP0150 is not set: ExternalProject_Add and FetchContent_Declare + commands treat relative GIT_REPOSITORY paths as being relative to the + parent project's remote\. Run "cmake --help-policy CMP0150" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + A relative GIT_REPOSITORY path was detected\. This will be interpreted as a + local path to where the project is being cloned\. Set GIT_REPOSITORY to an + absolute path or set policy CMP0150 to NEW to avoid this warning\. +Call Stack \(most recent call first\): + .*/Modules/FetchContent\.cmake:[0-9]+ \(_ep_resolve_git_remote\) diff --git a/Tests/RunCMake/CMP0150/CMP0150-WARN-stdout.txt b/Tests/RunCMake/CMP0150/CMP0150-WARN-stdout.txt new file mode 100644 index 0000000000..680f9c1d3d --- /dev/null +++ b/Tests/RunCMake/CMP0150/CMP0150-WARN-stdout.txt @@ -0,0 +1,3 @@ +-- Configured bottom project +-- Completed configuring project top +-- Configuring done diff --git a/Tests/RunCMake/CMP0150/CMP0150-WARN.cmake b/Tests/RunCMake/CMP0150/CMP0150-WARN.cmake new file mode 100644 index 0000000000..20fd45d4e6 --- /dev/null +++ b/Tests/RunCMake/CMP0150/CMP0150-WARN.cmake @@ -0,0 +1,2 @@ +set(policyCommand "") +include(CMP0150-OLD-common.cmake) diff --git a/Tests/RunCMake/CMP0150/CMakeLists.txt b/Tests/RunCMake/CMP0150/CMakeLists.txt new file mode 100644 index 0000000000..371dccc7b2 --- /dev/null +++ b/Tests/RunCMake/CMP0150/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.25) +project(${RunCMake_TEST} NONE) + +find_package(Git REQUIRED) + +function(execGitCommand workDir) + execute_process( + WORKING_DIRECTORY "${workDir}" + COMMAND "${GIT_EXECUTABLE}" ${ARGN} + COMMAND_ECHO STDOUT + COMMAND_ERROR_IS_FATAL ANY + ) +endfunction() + +function(initGitRepo workDir) + # init.defaultBranch only works with git 2.28 or later, so we must use the + # historical default branch name "master". Force the old default in case test + # sites have overridden the default to something else. + execGitCommand("${workDir}" -c init.defaultBranch=master init) + execGitCommand("${workDir}" config user.email "testauthor@cmake.org") + execGitCommand("${workDir}" config user.name testauthor) + execGitCommand("${workDir}" config core.autocrlf false) + execGitCommand("${workDir}" add CMakeLists.txt) + execGitCommand("${workDir}" commit -m "Initial commit") +endfunction() + +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0150/CMakeLists.txt.in b/Tests/RunCMake/CMP0150/CMakeLists.txt.in new file mode 100644 index 0000000000..db6cfc76e0 --- /dev/null +++ b/Tests/RunCMake/CMP0150/CMakeLists.txt.in @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.25) +project(@projName@ LANGUAGES NONE) + +@policyCommand@ + +include(ExternalProject) +ExternalProject_Add(ep-@depName@ + GIT_REPOSITORY @epRelativeGitRepo@ + GIT_TAG master + GIT_CONFIG init.defaultBranch=master + TEST_COMMAND "" + INSTALL_COMMAND "${CMAKE_COMMAND}" -E echo "ExternalProject for ep-@depName@" +) + +include(FetchContent) +FetchContent_Declare(@depName@ + GIT_REPOSITORY @fcRelativeGitRepo@ + GIT_TAG master + GIT_CONFIG init.defaultBranch=master +) +FetchContent_MakeAvailable(@depName@) + +message(STATUS "Completed configuring project @projName@") diff --git a/Tests/RunCMake/CMP0150/RunCMakeTest.cmake b/Tests/RunCMake/CMP0150/RunCMakeTest.cmake new file mode 100644 index 0000000000..940c33e65b --- /dev/null +++ b/Tests/RunCMake/CMP0150/RunCMakeTest.cmake @@ -0,0 +1,17 @@ +include(RunCMake) + +function(test_CMP0150 val) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${val}-build) + run_cmake(CMP0150-${val}) + set(RunCMake_TEST_NO_CLEAN TRUE) + # Some git versions write clone messages to stderr. These would cause the + # test to fail, so we need to merge them into stdout. + set(RunCMake_TEST_OUTPUT_MERGE TRUE) + run_cmake_command(CMP0150-${val}-build ${CMAKE_COMMAND} --build .) +endfunction() + +test_CMP0150(WARN) +test_CMP0150(OLD) +test_CMP0150(NEW) + +run_cmake_script(CMP0150-NEW-resolve) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index f05f784d7d..ada913299b 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -160,6 +160,7 @@ endif() add_RunCMake_test(CMP0132) add_RunCMake_test(CMP0135) add_RunCMake_test(CMP0139) +add_RunCMake_test(CMP0150) # The test for Policy 65 requires the use of the # CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode @@ -294,6 +295,7 @@ endif() add_RunCMake_test(BuildDepends -DMSVC_VERSION=${MSVC_VERSION} -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} + -DCMAKE_C_LINK_DEPENDS_USE_COMPILER=${CMAKE_C_LINK_DEPENDS_USE_COMPILER} -DCMake_TEST_BuildDepends_GNU_AS=${CMake_TEST_BuildDepends_GNU_AS} ) if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") @@ -370,6 +372,7 @@ add_RunCMake_test(GenEx-TARGET_PROPERTY) add_RunCMake_test(GenEx-TARGET_RUNTIME_DLLS) add_RunCMake_test(GenEx-PATH) add_RunCMake_test(GenEx-PATH_EQUAL) +add_RunCMake_test(GenEx-LIST) add_RunCMake_test(GeneratorExpression) add_RunCMake_test(GeneratorInstance) add_RunCMake_test(GeneratorPlatform) diff --git a/Tests/RunCMake/CMakePresets/EmptyPenvInInclude-result.txt b/Tests/RunCMake/CMakePresets/EmptyPenvInInclude-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyPenvInInclude-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/EmptyPenvInInclude-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyPenvInInclude-stderr.txt new file mode 100644 index 0000000000..e0f858a1e1 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyPenvInInclude-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/EmptyPenvInInclude: +Error: @3,15: Invalid "include" field + "include": \["\$penv\{\}"\], + \^$ diff --git a/Tests/RunCMake/CMakePresets/EmptyPenvInInclude.json.in b/Tests/RunCMake/CMakePresets/EmptyPenvInInclude.json.in new file mode 100644 index 0000000000..651b0de1b9 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyPenvInInclude.json.in @@ -0,0 +1,11 @@ +{ + "version": 7, + "include": ["$penv{}"], + "configurePresets": [ + { + "name": "EmptyPenvInInclude", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/IncludeExpansion-stdout.txt b/Tests/RunCMake/CMakePresets/IncludeExpansion-stdout.txt new file mode 100644 index 0000000000..d3f1afceb2 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/IncludeExpansion-stdout.txt @@ -0,0 +1,5 @@ +^Not searching for unused variables given on the command line\. +Available configure presets: + + "Include" + "IncludeCommon"$ diff --git a/Tests/RunCMake/CMakePresets/IncludeExpansion.json.in b/Tests/RunCMake/CMakePresets/IncludeExpansion.json.in new file mode 100644 index 0000000000..b4f82927b5 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/IncludeExpansion.json.in @@ -0,0 +1,10 @@ +{ + "version": 7, + "include": ["$penv{TEST_ENV_INCLUDE_DIR}/IncludeCommon.json"], + "configurePresets": [ + { + "name": "Include", + "inherits": ["IncludeCommon"] + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake index d67e8b14ee..c4a8b3f080 100644 --- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake @@ -146,6 +146,7 @@ run_cmake_presets(NoSuchMacro) run_cmake_presets(EnvCycle) run_cmake_presets(EmptyEnv) run_cmake_presets(EmptyPenv) +run_cmake_presets(EmptyPenvInInclude) run_cmake_presets(InvalidRegex) set(CMakePresets_SCHEMA_EXPECTED_RESULT 1) run_cmake_presets(ConditionFuture) @@ -393,6 +394,12 @@ set(CMakePresets_EXTRA_FILES "${RunCMake_SOURCE_DIR}/subdir/CMakePresets.json.in" ) run_cmake_presets(Include --list-presets) +set(CMakePresets_EXTRA_FILES + "${RunCMake_SOURCE_DIR}/IncludeCommon.json.in" + ) +set(ENV{TEST_ENV_INCLUDE_DIR} ${RunCMake_BINARY_DIR}/IncludeExpansion) +run_cmake_presets(IncludeExpansion --list-presets) +unset(ENV{TEST_ENV_INCLUDE_DIR}) unset(CMakePresets_EXTRA_FILES) run_cmake_presets(IncludeNotFound) run_cmake_presets(IncludeCycle) diff --git a/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx b/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx index 65f17b6e32..2824fbfe31 100644 --- a/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx @@ -19,6 +19,7 @@ #include "cmCTestTestHandler.h" #include "cmFileLock.h" #include "cmFileLockResult.h" +#include "cmList.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" @@ -282,7 +283,7 @@ static int doVerify(int argc, char const* const* argv) if (argc == 5) { testNames = argv[4]; } - auto testNameList = cmExpandedList(testNames, false); + cmList testNameList{ testNames }; std::set<std::string> testNameSet(testNameList.begin(), testNameList.end()); cmCTestResourceSpec spec; diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py index fda18b5c08..eb52975265 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py +++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py @@ -848,8 +848,204 @@ def gen_check_targets(c, g, inSource): for e in expected: if e["type"] == "UTILITY": if e["id"] == "^ZERO_CHECK::@6890427a1f51a3e7e1df$": + # The json files have data for Xcode. Substitute data for VS. e["sources"] = [ { + "path": "^CMakeLists\\.txt$", + "isGenerated": None, + "fileSetName": None, + "sourceGroupName": "", + "compileGroupLanguage": None, + "backtrace": [ + { + "file": "^CMakeLists\\.txt$", + "line": None, + "command": None, + "hasParent": False, + }, + ], + }, + { + "path": "^alias/CMakeLists\\.txt$", + "isGenerated": None, + "fileSetName": None, + "sourceGroupName": "", + "compileGroupLanguage": None, + "backtrace": [ + { + "file": "^CMakeLists\\.txt$", + "line": None, + "command": None, + "hasParent": False, + }, + ], + }, + { + "path": "^codemodel-v2\\.cmake$", + "isGenerated": None, + "fileSetName": None, + "sourceGroupName": "", + "compileGroupLanguage": None, + "backtrace": [ + { + "file": "^CMakeLists\\.txt$", + "line": None, + "command": None, + "hasParent": False, + }, + ], + }, + { + "path": "^custom/CMakeLists\\.txt$", + "isGenerated": None, + "fileSetName": None, + "sourceGroupName": "", + "compileGroupLanguage": None, + "backtrace": [ + { + "file": "^CMakeLists\\.txt$", + "line": None, + "command": None, + "hasParent": False, + }, + ], + }, + { + "path": "^cxx/CMakeLists\\.txt$", + "isGenerated": None, + "fileSetName": None, + "sourceGroupName": "", + "compileGroupLanguage": None, + "backtrace": [ + { + "file": "^CMakeLists\\.txt$", + "line": None, + "command": None, + "hasParent": False, + }, + ], + }, + { + "path": "^dir/CMakeLists\\.txt$", + "isGenerated": None, + "fileSetName": None, + "sourceGroupName": "", + "compileGroupLanguage": None, + "backtrace": [ + { + "file": "^CMakeLists\\.txt$", + "line": None, + "command": None, + "hasParent": False, + }, + ], + }, + { + "path": "^dir/dir/CMakeLists\\.txt$", + "isGenerated": None, + "fileSetName": None, + "sourceGroupName": "", + "compileGroupLanguage": None, + "backtrace": [ + { + "file": "^CMakeLists\\.txt$", + "line": None, + "command": None, + "hasParent": False, + }, + ], + }, + { + "path": "^fileset/CMakeLists\\.txt$", + "isGenerated": None, + "fileSetName": None, + "sourceGroupName": "", + "compileGroupLanguage": None, + "backtrace": [ + { + "file": "^CMakeLists\\.txt$", + "line": None, + "command": None, + "hasParent": False, + }, + ], + }, + { + "path": "^imported/CMakeLists\\.txt$", + "isGenerated": None, + "fileSetName": None, + "sourceGroupName": "", + "compileGroupLanguage": None, + "backtrace": [ + { + "file": "^CMakeLists\\.txt$", + "line": None, + "command": None, + "hasParent": False, + }, + ], + }, + { + "path": "^include_test\\.cmake$", + "isGenerated": None, + "fileSetName": None, + "sourceGroupName": "", + "compileGroupLanguage": None, + "backtrace": [ + { + "file": "^CMakeLists\\.txt$", + "line": None, + "command": None, + "hasParent": False, + }, + ], + }, + { + "path": "^interface/CMakeLists\\.txt$", + "isGenerated": None, + "fileSetName": None, + "sourceGroupName": "", + "compileGroupLanguage": None, + "backtrace": [ + { + "file": "^CMakeLists\\.txt$", + "line": None, + "command": None, + "hasParent": False, + }, + ], + }, + { + "path": "^object/CMakeLists\\.txt$", + "isGenerated": None, + "fileSetName": None, + "sourceGroupName": "", + "compileGroupLanguage": None, + "backtrace": [ + { + "file": "^CMakeLists\\.txt$", + "line": None, + "command": None, + "hasParent": False, + }, + ], + }, + { + "path": "^subdir/CMakeLists\\.txt$", + "isGenerated": None, + "fileSetName": None, + "sourceGroupName": "", + "compileGroupLanguage": None, + "backtrace": [ + { + "file": "^CMakeLists\\.txt$", + "line": None, + "command": None, + "hasParent": False, + }, + ], + }, + { "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/([0-9a-f]+/)?generate\\.stamp\\.rule$", "isGenerated": True, "fileSetName": None, @@ -867,6 +1063,24 @@ def gen_check_targets(c, g, inSource): ] e["sourceGroups"] = [ { + "name": "", + "sourcePaths": [ + "^CMakeLists\\.txt$", + "^alias/CMakeLists\\.txt$", + "^codemodel-v2\\.cmake$", + "^custom/CMakeLists\\.txt$", + "^cxx/CMakeLists\\.txt$", + "^dir/CMakeLists\\.txt$", + "^dir/dir/CMakeLists\\.txt$", + "^fileset/CMakeLists\\.txt$", + "^imported/CMakeLists\\.txt$", + "^include_test\\.cmake$", + "^interface/CMakeLists\\.txt$", + "^object/CMakeLists\\.txt$", + "^subdir/CMakeLists\\.txt$", + ], + }, + { "name": "CMake Rules", "sourcePaths": [ "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/([0-9a-f]+/)?generate\\.stamp\\.rule$", diff --git a/Tests/RunCMake/GenEx-LIST/APPEND.cmake.in b/Tests/RunCMake/GenEx-LIST/APPEND.cmake.in new file mode 100644 index 0000000000..19e1d127bb --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/APPEND.cmake.in @@ -0,0 +1,34 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) +list(APPEND listvar e) +set (output "$<LIST:APPEND,a;b;c;d,e>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(APPEND listvar e f) +set (output "$<LIST:APPEND,a;b;c;d,e,f>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(APPEND listvar e f) +set (output "$<LIST:APPEND,a;b;c;d,e;f>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +unset(listvar) +list(APPEND listvar e f) +set (output "$<LIST:APPEND,,e,f>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:APPEND..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/CMakeLists.txt b/Tests/RunCMake/GenEx-LIST/CMakeLists.txt new file mode 100644 index 0000000000..5161b995a9 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.18...3.25) + +project(${RunCMake_TEST} NONE) + +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GenEx-LIST/FILTER-wrong-operator-result.txt b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-operator-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-operator-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/FILTER-wrong-operator-stderr.txt b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-operator-stderr.txt new file mode 100644 index 0000000000..3064c00ee5 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-operator-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at FILTER-wrong-operator.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:FILTER,a;b;c,WRONG_OPERATOR,\^a> + + sub-command FILTER does not recognize operator "WRONG_OPERATOR". It must + be either INCLUDE or EXCLUDE. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/FILTER-wrong-operator.cmake b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-operator.cmake new file mode 100644 index 0000000000..e01b4fe7ae --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-operator.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:FILTER,a;b;c,WRONG_OPERATOR,^a>") diff --git a/Tests/RunCMake/GenEx-LIST/FILTER-wrong-regex-result.txt b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-regex-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-regex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/FILTER-wrong-regex-stderr.txt b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-regex-stderr.txt new file mode 100644 index 0000000000..b2f9b8a97b --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-regex-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at FILTER-wrong-regex.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:FILTER,a;b;c,INCLUDE,\^\(a> + + sub-command FILTER, failed to compile regex "\^\(a". +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/FILTER-wrong-regex.cmake b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-regex.cmake new file mode 100644 index 0000000000..1311f319cd --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-regex.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:FILTER,a;b;c,INCLUDE,^(a>") diff --git a/Tests/RunCMake/GenEx-LIST/FIND.cmake.in b/Tests/RunCMake/GenEx-LIST/FIND.cmake.in new file mode 100644 index 0000000000..e2242c3a4c --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/FIND.cmake.in @@ -0,0 +1,20 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) + +list(FIND listvar "c" reference) +set (output "$<LIST:FIND,a;b;c;d,c>") +if (NOT output EQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(FIND listvar "e" reference) +set (output "$<LIST:FIND,a;b;c;d,e>") +if (NOT output EQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:FIND..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/GET-wrong-index1-result.txt b/Tests/RunCMake/GenEx-LIST/GET-wrong-index1-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET-wrong-index1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/GET-wrong-index1-stderr.txt b/Tests/RunCMake/GenEx-LIST/GET-wrong-index1-stderr.txt new file mode 100644 index 0000000000..dcd1f2f3bf --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET-wrong-index1-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at GET-wrong-index1.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:GET,,0> + + given empty list +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/GET-wrong-index1.cmake b/Tests/RunCMake/GenEx-LIST/GET-wrong-index1.cmake new file mode 100644 index 0000000000..4c395b318c --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET-wrong-index1.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:GET,,0>") diff --git a/Tests/RunCMake/GenEx-LIST/GET-wrong-index2-result.txt b/Tests/RunCMake/GenEx-LIST/GET-wrong-index2-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET-wrong-index2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/GET-wrong-index2-stderr.txt b/Tests/RunCMake/GenEx-LIST/GET-wrong-index2-stderr.txt new file mode 100644 index 0000000000..20f1af4fd6 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET-wrong-index2-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at GET-wrong-index2.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:GET,a;b,2> + + index: 2 out of range \(-2, 1\) +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/GET-wrong-index2.cmake b/Tests/RunCMake/GenEx-LIST/GET-wrong-index2.cmake new file mode 100644 index 0000000000..28c97e2fd8 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET-wrong-index2.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:GET,a;b,2>") diff --git a/Tests/RunCMake/GenEx-LIST/GET-wrong-index3-result.txt b/Tests/RunCMake/GenEx-LIST/GET-wrong-index3-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET-wrong-index3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/GET-wrong-index3-stderr.txt b/Tests/RunCMake/GenEx-LIST/GET-wrong-index3-stderr.txt new file mode 100644 index 0000000000..a5dccbe953 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET-wrong-index3-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at GET-wrong-index3.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:GET,a;b,1,-3> + + index: -3 out of range \(-2, 1\) +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/GET-wrong-index3.cmake b/Tests/RunCMake/GenEx-LIST/GET-wrong-index3.cmake new file mode 100644 index 0000000000..fd7be176d3 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET-wrong-index3.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:GET,a;b,1,-3>") diff --git a/Tests/RunCMake/GenEx-LIST/GET.cmake.in b/Tests/RunCMake/GenEx-LIST/GET.cmake.in new file mode 100644 index 0000000000..102eb42e3d --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET.cmake.in @@ -0,0 +1,20 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) + +list(GET listvar 0 2 reference) +set (output "$<LIST:GET,a;b;c;d,0,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(GET listvar 0 -3 2 reference) +set (output "$<LIST:GET,a;b;c;d,0,-3,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:GET..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index1-result.txt b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index1-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index1-stderr.txt b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index1-stderr.txt new file mode 100644 index 0000000000..ce36fb1197 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index1-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at INSERT-wrong-index1.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:INSERT,a;b;c,4,d> + + index: 4 out of range \(-3, 3\) +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index1.cmake b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index1.cmake new file mode 100644 index 0000000000..ead5832418 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index1.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:INSERT,a;b;c,4,d>") diff --git a/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index2-result.txt b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index2-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index2-stderr.txt b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index2-stderr.txt new file mode 100644 index 0000000000..f0ea1d70c3 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index2-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at INSERT-wrong-index2.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:INSERT,a;b;c,-4,d> + + index: -4 out of range \(-3, 3\) +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index2.cmake b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index2.cmake new file mode 100644 index 0000000000..c057b876a9 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index2.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:INSERT,a;b;c,-4,d>") diff --git a/Tests/RunCMake/GenEx-LIST/INSERT.cmake.in b/Tests/RunCMake/GenEx-LIST/INSERT.cmake.in new file mode 100644 index 0000000000..d3bb9b9b18 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/INSERT.cmake.in @@ -0,0 +1,50 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) + +list(INSERT listvar 1 e) +set (output "$<LIST:INSERT,a;b;c;d,1,e>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) + +list(INSERT listvar 2 e f) +set (output "$<LIST:INSERT,a;b;c;d,2,e,f>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(INSERT listvar 0 e f) +set (output "$<LIST:INSERT,a;b;c;d,0,e;f>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(INSERT listvar -2 e f) +set (output "$<LIST:INSERT,a;b;c;d,-2,e;f>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(INSERT listvar 3 e f) +set (output "$<LIST:INSERT,a;b;c;d,3,e;f>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +unset(listvar) +list(INSERT listvar 0 e f) +set (output "$<LIST:INSERT,,0,e,f>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:INSERT..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/JOIN.cmake.in b/Tests/RunCMake/GenEx-LIST/JOIN.cmake.in new file mode 100644 index 0000000000..0a564507be --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/JOIN.cmake.in @@ -0,0 +1,35 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) + +list(JOIN listvar ":" reference) +set (output "$<LIST:JOIN,a;b;c;d,:>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(JOIN listvar "" reference) +set (output "$<LIST:JOIN,a;b;c;d,>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a) + +list(JOIN listvar ":" reference) +set (output "$<LIST:JOIN,a,:>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +unset(listvar) + +list(JOIN listvar ":" reference) +set (output "$<LIST:JOIN,,:>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +check_errors("LIST:JOIN..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/LENGTH.cmake.in b/Tests/RunCMake/GenEx-LIST/LENGTH.cmake.in new file mode 100644 index 0000000000..0840e11116 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/LENGTH.cmake.in @@ -0,0 +1,30 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) + +list(LENGTH listvar reference) +set (output "$<LIST:LENGTH,a;b;c;d>") +if (NOT output EQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar "") + +list(LENGTH listvar reference) +set (output "$<LIST:LENGTH,>") +if (NOT output EQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +unset(listvar) + +list(LENGTH listvar reference) +set (output "$<LIST:LENGTH,>") +if (NOT output EQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:LENGTH..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/POP_BACK.cmake.in b/Tests/RunCMake/GenEx-LIST/POP_BACK.cmake.in new file mode 100644 index 0000000000..ba95c839c0 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/POP_BACK.cmake.in @@ -0,0 +1,18 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) +list(POP_BACK listvar) +set (output "$<LIST:POP_BACK,a;b;c;d>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set (output "$<LIST:POP_BACK,>") +if (NOT output STREQUAL "") + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:POP_BACK..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/POP_FRONT.cmake.in b/Tests/RunCMake/GenEx-LIST/POP_FRONT.cmake.in new file mode 100644 index 0000000000..0d676af60e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/POP_FRONT.cmake.in @@ -0,0 +1,18 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) +list(POP_FRONT listvar) +set (output "$<LIST:POP_FRONT,a;b;c;d>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set (output "$<LIST:POP_FRONT,>") +if (NOT output STREQUAL "") + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:POP_FRONT..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/PREPEND.cmake.in b/Tests/RunCMake/GenEx-LIST/PREPEND.cmake.in new file mode 100644 index 0000000000..49b8f98239 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/PREPEND.cmake.in @@ -0,0 +1,34 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) +list(PREPEND listvar e) +set (output "$<LIST:PREPEND,a;b;c;d,e>") +if (NOT output STREQUAL listvar) + list (PREPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(PREPEND listvar e f) +set (output "$<LIST:PREPEND,a;b;c;d,e,f>") +if (NOT output STREQUAL listvar) + list (PREPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(PREPEND listvar e f) +set (output "$<LIST:PREPEND,a;b;c;d,e;f>") +if (NOT output STREQUAL listvar) + list (PREPEND errors "returns bad value: ${output}") +endif() + +unset(listvar) +list(PREPEND listvar e f) +set (output "$<LIST:PREPEND,,e,f>") +if (NOT output STREQUAL listvar) + list (PREPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:PREPEND..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index1-result.txt b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index1-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index1-stderr.txt b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index1-stderr.txt new file mode 100644 index 0000000000..b874f1d09b --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index1-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at REMOVE_AT-wrong-index1.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:REMOVE_AT,,0> + + index: 0 out of range \(0, 0\) +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index1.cmake b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index1.cmake new file mode 100644 index 0000000000..d87559e83b --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index1.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:REMOVE_AT,,0>") diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index2-result.txt b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index2-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index2-stderr.txt b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index2-stderr.txt new file mode 100644 index 0000000000..509eed4b16 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index2-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at REMOVE_AT-wrong-index2.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:REMOVE_AT,a;b;c,3> + + index: 3 out of range \(-3, 2\) +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index2.cmake b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index2.cmake new file mode 100644 index 0000000000..7ecfad2281 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index2.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:REMOVE_AT,a;b;c,3>") diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index3-result.txt b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index3-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index3-stderr.txt b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index3-stderr.txt new file mode 100644 index 0000000000..c8fc465062 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index3-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at REMOVE_AT-wrong-index3.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:REMOVE_AT,a;b;c,-4> + + index: -4 out of range \(-3, 2\) +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index3.cmake b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index3.cmake new file mode 100644 index 0000000000..f8f9a3e24b --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index3.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:REMOVE_AT,a;b;c,-4>") diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT.cmake.in b/Tests/RunCMake/GenEx-LIST/REMOVE_AT.cmake.in new file mode 100644 index 0000000000..42a94766f9 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT.cmake.in @@ -0,0 +1,25 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) +list(REMOVE_AT listvar 1 3) +set (output "$<LIST:REMOVE_AT,a;b;c;d,1,3>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(REMOVE_AT listvar 1 -2) +set (output "$<LIST:REMOVE_AT,a;b;c;d,1;-2>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set (output "$<LIST:REMOVE_AT,a;b;c;d,1,0,3;2>") +if (NOT output STREQUAL "") + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:REMOVE_AT..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_DUPLICATES.cmake.in b/Tests/RunCMake/GenEx-LIST/REMOVE_DUPLICATES.cmake.in new file mode 100644 index 0000000000..8785ae522a --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_DUPLICATES.cmake.in @@ -0,0 +1,20 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) +list(REMOVE_DUPLICATES listvar) +set (output "$<LIST:REMOVE_DUPLICATES,a;b;c;d>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar "b;c;b;a;a;c;b;a;c;b") +list(REMOVE_DUPLICATES listvar) +set (output "$<LIST:REMOVE_DUPLICATES,b;c;b;a;a;c;b;a;c;b>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:REMOVE_DUPLICATES..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_ITEM.cmake.in b/Tests/RunCMake/GenEx-LIST/REMOVE_ITEM.cmake.in new file mode 100644 index 0000000000..5434a5d51d --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_ITEM.cmake.in @@ -0,0 +1,32 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) +list(REMOVE_ITEM listvar b d) +set (output "$<LIST:REMOVE_ITEM,a;b;c;d,b,d>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(REMOVE_ITEM listvar b e) +set (output "$<LIST:REMOVE_ITEM,a;b;c;d,b,e>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(REMOVE_ITEM listvar b a d c) +set (output "$<LIST:REMOVE_ITEM,a;b;c;d,b;a;d;c>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set (output "$<LIST:REMOVE_ITEM,,b;a;d;c>") +if (NOT output STREQUAL "") + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:REMOVE_ITEM..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/REVERSE.cmake.in b/Tests/RunCMake/GenEx-LIST/REVERSE.cmake.in new file mode 100644 index 0000000000..295e1a3c8a --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REVERSE.cmake.in @@ -0,0 +1,19 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) + +list(REVERSE listvar) +set (output "$<LIST:REVERSE,a;b;c;d>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set (output "$<LIST:REVERSE,>") +if (NOT output STREQUAL "") + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:REVERSE..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-LIST/RunCMakeTest.cmake new file mode 100644 index 0000000000..1946e84915 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/RunCMakeTest.cmake @@ -0,0 +1,130 @@ + +include(RunCMake) + +run_cmake(no-arguments) +run_cmake(bad-option) + +function(check_list_syntax name test) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-${test}-build) + set(RunCMake_TEST_VARIANT_DESCRIPTION " - ${name}") + run_cmake_with_options(${test} ${ARGN}) +endfunction() + +## Unexpected arguments +### sub-commands with one argument +foreach (subcommand IN ITEMS LENGTH POP_BACK POP_FRONT REMOVE_DUPLICATES REVERSE) + check_list_syntax (${subcommand} unexpected-arg "-DLIST_ARGUMENTS=${subcommand},ARG1,ARG2") +endforeach() + +### sub-commands with two arguments +foreach (subcommand IN ITEMS FIND JOIN) + check_list_syntax (${subcommand} unexpected-arg "-DLIST_ARGUMENTS=${subcommand},ARG1,ARG2,ARG3") +endforeach() + +### sub-commands with three arguments +foreach (subcommand IN ITEMS SUBLIST FILTER) + check_list_syntax (${subcommand} unexpected-arg "-DLIST_ARGUMENTS=${subcommand},ARG1,ARG2,ARG3,ARG4") +endforeach() + +# TRANSFORM sub-commands + set(RunCMake-stderr-file "TRANSFORM-unexpected-arg-stderr.txt") +foreach (action IN ITEMS TOLOWER TOUPPER STRIP) + check_list_syntax (TRANSFORM-${action} unexpected-arg "-DLIST_ARGUMENTS=TRANSFORM,ARG1,${action},ARG2") +endforeach() +foreach (action IN ITEMS APPEND PREPEND) + check_list_syntax (TRANSFORM-${action} unexpected-arg "-DLIST_ARGUMENTS=TRANSFORM,ARG1,${action},ARG2,ARG3") +endforeach() +foreach (action IN ITEMS REPLACE) + check_list_syntax (TRANSFORM-${action} unexpected-arg "-DLIST_ARGUMENTS=TRANSFORM,ARG1,${action},ARG2,ARG3,ARG4") +endforeach() +check_list_syntax (TRANSFORM-SELECTOR-REGEX unexpected-arg "-DLIST_ARGUMENTS=TRANSFORM,ARG1,STRIP,REGEX,ARG2,ARG3") +check_list_syntax (TRANSFORM-SELECTOR-FOR unexpected-arg "-DLIST_ARGUMENTS=TRANSFORM,ARG1,STRIP,FOR,1,2,3,4") +unset(RunCMake-stderr-file) + +## Missing arguments +### sub-command with, at least, two arguments +foreach (subcommand IN ITEMS GET APPEND PREPEND REMOVE_ITEM REMOVE_AT TRANSFORM) + check_list_syntax (${subcommand} missing-arg "-DLIST_ARGUMENTS=${subcommand},ARG1") +endforeach() + +### sub-command with, at least, three arguments +foreach (subcommand IN ITEMS INSERT) + check_list_syntax (${subcommand} missing-arg "-DLIST_ARGUMENTS=${subcommand},ARG1,ARG2") +endforeach() + +# TRANSFORM sub-commands +set(RunCMake-stderr-file "TRANSFORM-missing-arg-stderr.txt") +foreach (action IN ITEMS APPEND PREPEND) + check_list_syntax (TRANSFORM-${action} missing-arg "-DLIST_ARGUMENTS=TRANSFORM,ARG1,${action}") +endforeach() +check_list_syntax (TRANSFORM-REPLACE-1 missing-arg "-DLIST_ARGUMENTS=TRANSFORM,ARG1,REPLACE,ARG2") +check_list_syntax (TRANSFORM-REPLACE-2 missing-arg "-DLIST_ARGUMENTS=TRANSFORM,ARG1,REPLACE") +unset(RunCMake-stderr-file) + + +run_cmake(GET-wrong-index1) +run_cmake(GET-wrong-index2) +run_cmake(GET-wrong-index3) +run_cmake(SUBLIST-wrong-argument1) +run_cmake(SUBLIST-wrong-argument2) +run_cmake(INSERT-wrong-index1) +run_cmake(INSERT-wrong-index2) +run_cmake(REMOVE_AT-wrong-index1) +run_cmake(REMOVE_AT-wrong-index2) +run_cmake(REMOVE_AT-wrong-index3) +run_cmake(FILTER-wrong-operator) +run_cmake(FILTER-wrong-regex) +run_cmake(TRANSFORM-wrong-action) +run_cmake(TRANSFORM-REPLACE-wrong-regex) +run_cmake(TRANSFORM-REPLACE-invalid-replace1) +run_cmake(TRANSFORM-REPLACE-invalid-replace2) +run_cmake(TRANSFORM-selector-REGEX-no-arguments) +run_cmake(TRANSFORM-selector-REGEX-wrong-regex) +run_cmake(TRANSFORM-selector-AT-no-arguments) +run_cmake(TRANSFORM-selector-AT-wrong-argument) +run_cmake(TRANSFORM-selector-AT-wrong-index) +run_cmake(TRANSFORM-selector-FOR-no-arguments) +run_cmake(TRANSFORM-selector-FOR-missing-arguments) +run_cmake(TRANSFORM-selector-FOR-wrong-argument) +run_cmake(TRANSFORM-selector-FOR-wrong-index) +run_cmake(TRANSFORM-selector-FOR-zero-step) +run_cmake(TRANSFORM-selector-FOR-negative-step) +run_cmake(TRANSFORM-selector-FOR-backwards-range) +run_cmake(SORT-wrong-option) +run_cmake(SORT-wrong-COMPARE-option) +run_cmake(SORT-wrong-CASE-option) +run_cmake(SORT-wrong-ORDER-option) +run_cmake(SORT-duplicate-COMPARE-option) +run_cmake(SORT-duplicate-CASE-option) +run_cmake(SORT-duplicate-ORDER-option) + + +function(check_list_execution name) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_VARIANT_DESCRIPTION " - ${name}") + run_cmake_with_options(generate -DLIST_TEST=${name}) + run_cmake_command(check "${CMAKE_COMMAND}" "-DRunCMake_SOURCE_DIR=${RunCMake_SOURCE_DIR}" -P "${RunCMake_TEST_BINARY_DIR}/${name}.cmake") +endfunction() + +check_list_execution (LENGTH) +check_list_execution (GET) +check_list_execution (JOIN) +check_list_execution (SUBLIST) +check_list_execution (FIND) +check_list_execution (APPEND) +check_list_execution (PREPEND) +check_list_execution (INSERT) +check_list_execution (POP_BACK) +check_list_execution (POP_FRONT) +check_list_execution (REMOVE_ITEM) +check_list_execution (REMOVE_AT) +check_list_execution (REMOVE_DUPLICATES) +check_list_execution (TRANSFORM-TOUPPER) +check_list_execution (TRANSFORM-TOLOWER) +check_list_execution (TRANSFORM-STRIP) +check_list_execution (TRANSFORM-APPEND) +check_list_execution (TRANSFORM-PREPEND) +check_list_execution (TRANSFORM-REPLACE) +check_list_execution (REVERSE) +check_list_execution (SORT) diff --git a/Tests/RunCMake/GenEx-LIST/SORT-duplicate-CASE-option-result.txt b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-CASE-option-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-CASE-option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/SORT-duplicate-CASE-option-stderr.txt b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-CASE-option-stderr.txt new file mode 100644 index 0000000000..4f3121a361 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-CASE-option-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at SORT-duplicate-CASE-option.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:SORT,a;b,COMPARE:STRING,CASE:SENSITIVE,CASE:SENSITIVE> + + sub-command SORT, CASE option has been specified multiple times. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/SORT-duplicate-CASE-option.cmake b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-CASE-option.cmake new file mode 100644 index 0000000000..e09dc6ca07 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-CASE-option.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:SORT,a;b,COMPARE:STRING,CASE:SENSITIVE,CASE:SENSITIVE>") diff --git a/Tests/RunCMake/GenEx-LIST/SORT-duplicate-COMPARE-option-result.txt b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-COMPARE-option-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-COMPARE-option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/SORT-duplicate-COMPARE-option-stderr.txt b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-COMPARE-option-stderr.txt new file mode 100644 index 0000000000..fbb96bbb29 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-COMPARE-option-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at SORT-duplicate-COMPARE-option.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:SORT,a;b,COMPARE:STRING,COMPARE:NATURAL> + + sub-command SORT, COMPARE option has been specified multiple times. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/SORT-duplicate-COMPARE-option.cmake b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-COMPARE-option.cmake new file mode 100644 index 0000000000..cf8da0d32e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-COMPARE-option.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:SORT,a;b,COMPARE:STRING,COMPARE:NATURAL>") diff --git a/Tests/RunCMake/GenEx-LIST/SORT-duplicate-ORDER-option-result.txt b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-ORDER-option-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-ORDER-option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/SORT-duplicate-ORDER-option-stderr.txt b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-ORDER-option-stderr.txt new file mode 100644 index 0000000000..b45034a7db --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-ORDER-option-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at SORT-duplicate-ORDER-option.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:SORT,a;b,ORDER:ASCENDING,COMPARE:STRING,ORDER:DESCENDING,CASE:SENSITIVE> + + sub-command SORT, ORDER option has been specified multiple times. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/SORT-duplicate-ORDER-option.cmake b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-ORDER-option.cmake new file mode 100644 index 0000000000..3826072fdc --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-ORDER-option.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:SORT,a;b,ORDER:ASCENDING,COMPARE:STRING,ORDER:DESCENDING,CASE:SENSITIVE>") diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-CASE-option-result.txt b/Tests/RunCMake/GenEx-LIST/SORT-wrong-CASE-option-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-CASE-option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-CASE-option-stderr.txt b/Tests/RunCMake/GenEx-LIST/SORT-wrong-CASE-option-stderr.txt new file mode 100644 index 0000000000..d36e63b1ec --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-CASE-option-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at SORT-wrong-CASE-option.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:SORT,a;b,COMPARE:STRING,CASE:WRONG_OPTION> + + sub-command SORT, an invalid CASE option has been specified: + "WRONG_OPTION". +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-CASE-option.cmake b/Tests/RunCMake/GenEx-LIST/SORT-wrong-CASE-option.cmake new file mode 100644 index 0000000000..58df9ea3dc --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-CASE-option.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:SORT,a;b,COMPARE:STRING,CASE:WRONG_OPTION>") diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-COMPARE-option-result.txt b/Tests/RunCMake/GenEx-LIST/SORT-wrong-COMPARE-option-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-COMPARE-option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-COMPARE-option-stderr.txt b/Tests/RunCMake/GenEx-LIST/SORT-wrong-COMPARE-option-stderr.txt new file mode 100644 index 0000000000..70a99c6419 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-COMPARE-option-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at SORT-wrong-COMPARE-option.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:SORT,a;b,COMPARE:WRONG_OPTION> + + sub-command SORT, an invalid COMPARE option has been specified: + "WRONG_OPTION". +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-COMPARE-option.cmake b/Tests/RunCMake/GenEx-LIST/SORT-wrong-COMPARE-option.cmake new file mode 100644 index 0000000000..73727bb416 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-COMPARE-option.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:SORT,a;b,COMPARE:WRONG_OPTION>") diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-ORDER-option-result.txt b/Tests/RunCMake/GenEx-LIST/SORT-wrong-ORDER-option-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-ORDER-option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-ORDER-option-stderr.txt b/Tests/RunCMake/GenEx-LIST/SORT-wrong-ORDER-option-stderr.txt new file mode 100644 index 0000000000..2e23d8c4b0 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-ORDER-option-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at SORT-wrong-ORDER-option.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:SORT,a;b,COMPARE:STRING,CASE:SENSITIVE,ORDER:WRONG_OPTION> + + sub-command SORT, an invalid ORDER option has been specified: + "WRONG_OPTION". +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-ORDER-option.cmake b/Tests/RunCMake/GenEx-LIST/SORT-wrong-ORDER-option.cmake new file mode 100644 index 0000000000..135c9350eb --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-ORDER-option.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:SORT,a;b,COMPARE:STRING,CASE:SENSITIVE,ORDER:WRONG_OPTION>") diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-option-result.txt b/Tests/RunCMake/GenEx-LIST/SORT-wrong-option-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-option-stderr.txt b/Tests/RunCMake/GenEx-LIST/SORT-wrong-option-stderr.txt new file mode 100644 index 0000000000..3c2d492508 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-option-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at SORT-wrong-option.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:SORT,a;b,WRONG_OPTION> + + sub-command SORT, option "WRONG_OPTION" is invalid. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-option.cmake b/Tests/RunCMake/GenEx-LIST/SORT-wrong-option.cmake new file mode 100644 index 0000000000..fca268b817 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-option.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:SORT,a;b,WRONG_OPTION>") diff --git a/Tests/RunCMake/GenEx-LIST/SORT.cmake.in b/Tests/RunCMake/GenEx-LIST/SORT.cmake.in new file mode 100644 index 0000000000..aca6691f90 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT.cmake.in @@ -0,0 +1,92 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(source_unsorted c/B.h a/c.h B/a.h) + +set(listvar ${source_unsorted}) +list(SORT listvar) +set (output "$<LIST:SORT,c/B.h;a/c.h;B/a.h>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar ${source_unsorted}) +list(SORT listvar CASE INSENSITIVE ORDER ASCENDING COMPARE STRING) +set (output "$<LIST:SORT,c/B.h;a/c.h;B/a.h,CASE:INSENSITIVE,ORDER:ASCENDING,COMPARE:STRING>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar ${source_unsorted}) +list(SORT listvar CASE INSENSITIVE ORDER DESCENDING COMPARE STRING) +set (output "$<LIST:SORT,c/B.h;a/c.h;B/a.h,CASE:INSENSITIVE,ORDER:DESCENDING,COMPARE:STRING>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar ${source_unsorted}) +list(SORT listvar CASE SENSITIVE ORDER ASCENDING COMPARE STRING) +set (output "$<LIST:SORT,c/B.h;a/c.h;B/a.h,CASE:SENSITIVE,ORDER:ASCENDING,COMPARE:STRING>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar ${source_unsorted}) +list(SORT listvar CASE SENSITIVE ORDER DESCENDING COMPARE STRING) +set (output "$<LIST:SORT,c/B.h;a/c.h;B/a.h,CASE:SENSITIVE,ORDER:DESCENDING,COMPARE:STRING>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar ${source_unsorted}) +list(SORT listvar CASE INSENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME) +set (output "$<LIST:SORT,c/B.h;a/c.h;B/a.h,CASE:INSENSITIVE,ORDER:ASCENDING,COMPARE:FILE_BASENAME>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar ${source_unsorted}) +list(SORT listvar CASE INSENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME) +set (output "$<LIST:SORT,c/B.h;a/c.h;B/a.h,CASE:INSENSITIVE,ORDER:DESCENDING,COMPARE:FILE_BASENAME>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar ${source_unsorted}) +list(SORT listvar CASE SENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME) +set (output "$<LIST:SORT,c/B.h;a/c.h;B/a.h,CASE:SENSITIVE,ORDER:ASCENDING,COMPARE:FILE_BASENAME>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar ${source_unsorted}) +list(SORT listvar CASE SENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME) +set (output "$<LIST:SORT,c/B.h;a/c.h;B/a.h,CASE:SENSITIVE,ORDER:DESCENDING,COMPARE:FILE_BASENAME>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar 10.0 1.1 2.1 8.0 2.0 3.1) +list(SORT listvar CASE SENSITIVE ORDER DESCENDING COMPARE STRING) +set (output "$<LIST:SORT,10.0;1.1;2.1;8.0;2.0;3.1,CASE:SENSITIVE,ORDER:DESCENDING,COMPARE:STRING>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar 10.0 1.1 2.1 8.0 2.0 3.1) +list(SORT listvar CASE SENSITIVE ORDER DESCENDING COMPARE NATURAL) +set (output "$<LIST:SORT,10.0;1.1;2.1;8.0;2.0;3.1,CASE:SENSITIVE,ORDER:DESCENDING,COMPARE:NATURAL>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar 10.0 1.1 2.1 8.0 2.0 3.1) +list(SORT listvar CASE SENSITIVE ORDER ASCENDING COMPARE NATURAL) +set (output "$<LIST:SORT,10.0;1.1;2.1;8.0;2.0;3.1,CASE:SENSITIVE,ORDER:ASCENDING,COMPARE:NATURAL>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:SORT..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument1-result.txt b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument1-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument1-stderr.txt b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument1-stderr.txt new file mode 100644 index 0000000000..078f345e3f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument1-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at SUBLIST-wrong-argument1.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:SUBLIST,a;b;c,3,-1> + + begin index: 3 is out of range 0 - 2 +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument1.cmake b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument1.cmake new file mode 100644 index 0000000000..293c2ae977 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument1.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:SUBLIST,a;b;c,3,-1>") diff --git a/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument2-result.txt b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument2-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument2-stderr.txt b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument2-stderr.txt new file mode 100644 index 0000000000..7271b30b3f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument2-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at SUBLIST-wrong-argument2.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:SUBLIST,a;b;c,1,-2> + + length: -2 should be -1 or greater +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument2.cmake b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument2.cmake new file mode 100644 index 0000000000..9d1db53245 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument2.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:SUBLIST,a;b;c,1,-2>") diff --git a/Tests/RunCMake/GenEx-LIST/SUBLIST.cmake.in b/Tests/RunCMake/GenEx-LIST/SUBLIST.cmake.in new file mode 100644 index 0000000000..9fcb6d50ab --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SUBLIST.cmake.in @@ -0,0 +1,32 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) + +list(SUBLIST listvar 1 2 reference) +set (output "$<LIST:SUBLIST,a;b;c;d,1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(SUBLIST listvar 1 -1 reference) +set (output "$<LIST:SUBLIST,a;b;c;d,1,-1>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(SUBLIST listvar 1 0 reference) +set (output "$<LIST:SUBLIST,a;b;c;d,1,0>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(SUBLIST listvar 1 5 reference) +set (output "$<LIST:SUBLIST,a;b;c;d,1,5>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:SUBLIST..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-APPEND.cmake.in b/Tests/RunCMake/GenEx-LIST/TRANSFORM-APPEND.cmake.in new file mode 100644 index 0000000000..a6529ec578 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-APPEND.cmake.in @@ -0,0 +1,50 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar alpha bravo charlie delta) + +list(TRANSFORM listvar APPEND "_A" OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,APPEND,_A>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar APPEND "_A" AT 1 3 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,APPEND,_A,AT,1,3>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar APPEND "_A" AT 1 -2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,APPEND,_A,AT,1,-2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar APPEND "_A" FOR 1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,APPEND,_A,FOR,1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar APPEND "_A" FOR 1 -1 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,APPEND,_A,FOR,1,-1>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar APPEND "_A" FOR 1 -1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,APPEND,_A,FOR,1,-1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar APPEND "_A" REGEX "(r|t)a" OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,APPEND,_A,REGEX,(r|t)a>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:TRANSFORM,APPEND..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-PREPEND.cmake.in b/Tests/RunCMake/GenEx-LIST/TRANSFORM-PREPEND.cmake.in new file mode 100644 index 0000000000..5ec6acdcc8 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-PREPEND.cmake.in @@ -0,0 +1,50 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar alpha bravo charlie delta) + +list(TRANSFORM listvar PREPEND "P_" OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,PREPEND,P_>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar PREPEND "P_" AT 1 3 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,PREPEND,P_,AT,1,3>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar PREPEND "P_" AT 1 -2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,PREPEND,P_,AT,1,-2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar PREPEND "P_" FOR 1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,PREPEND,P_,FOR,1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar PREPEND "P_" FOR 1 -1 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,PREPEND,P_,FOR,1,-1>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar PREPEND "P_" FOR 1 -1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,PREPEND,P_,FOR,1,-1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar PREPEND "P_" REGEX "(r|t)a" OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,PREPEND,P_,REGEX,(r|t)a>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:TRANSFORM,PREPEND..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace1-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace1-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace1-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace1-stderr.txt new file mode 100644 index 0000000000..6674b30688 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace1-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TRANSFORM-REPLACE-invalid-replace1.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b,REPLACE,\^a,b\\> + + sub-command TRANSFORM, action REPLACE: replace-expression ends in a + backslash. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace1.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace1.cmake new file mode 100644 index 0000000000..d45e1fdaf4 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace1.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b,REPLACE,^a,b\\>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace2-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace2-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace2-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace2-stderr.txt new file mode 100644 index 0000000000..2351b72eb1 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace2-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TRANSFORM-REPLACE-invalid-replace2.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b,REPLACE,\^a,\\b> + + sub-command TRANSFORM, action REPLACE: Unknown escape "\\b" in + replace-expression. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace2.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace2.cmake new file mode 100644 index 0000000000..b800f24f2e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace2.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b,REPLACE,^a,\\b>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-wrong-regex-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-wrong-regex-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-wrong-regex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-wrong-regex-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-wrong-regex-stderr.txt new file mode 100644 index 0000000000..617c3d6d04 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-wrong-regex-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TRANSFORM-REPLACE-wrong-regex.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b,REPLACE,\(a,b> + + sub-command TRANSFORM, action REPLACE: Failed to compile regex "\(a". +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-wrong-regex.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-wrong-regex.cmake new file mode 100644 index 0000000000..941e3e7ff8 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-wrong-regex.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b,REPLACE,(a,b>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE.cmake.in b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE.cmake.in new file mode 100644 index 0000000000..5fba23109c --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE.cmake.in @@ -0,0 +1,50 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar alpha bravo charlie delta) + +list(TRANSFORM listvar REPLACE "(.+a)$" "\\1_\\1" OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,REPLACE,(.+a)$,\1_\1>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar REPLACE "(.+a)$" "\\1_\\1" AT 1 3 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,REPLACE,(.+a)$,\1_\1,AT,1,3>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar REPLACE "(.+a)$" "\\1_\\1" AT 1 -2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,REPLACE,(.+a)$,\1_\1,AT,1,-2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar REPLACE "(.+a)$" "\\1_\\1" FOR 1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,REPLACE,(.+a)$,\1_\1,FOR,1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar REPLACE "(.+a)$" "\\1_\\1" FOR 1 -1 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,REPLACE,(.+a)$,\1_\1,FOR,1,-1>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar REPLACE "(.+a)$" "\\1_\\1" FOR 1 -1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,REPLACE,(.+a)$,\1_\1,FOR,1,-1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar REPLACE "(.+a)$" "\\1_\\1" REGEX "(r|t)a" OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,REPLACE,(.+a)$,\1_\1,REGEX,(r|t)a>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:TRANSFORM,REPLACE..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-STRIP.cmake.in b/Tests/RunCMake/GenEx-LIST/TRANSFORM-STRIP.cmake.in new file mode 100644 index 0000000000..860faec771 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-STRIP.cmake.in @@ -0,0 +1,50 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar " alpha" "bravo " " charlie " delta) + +list(TRANSFORM listvar STRIP OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM, alpha;bravo ; charlie ;delta,STRIP>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar STRIP AT 1 3 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM, alpha;bravo ; charlie ;delta,STRIP,AT,1,3>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar STRIP AT 1 -2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM, alpha;bravo ; charlie ;delta,STRIP,AT,1,-2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar STRIP FOR 1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM, alpha;bravo ; charlie ;delta,STRIP,FOR,1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar STRIP FOR 1 -1 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM, alpha;bravo ; charlie ;delta,STRIP,FOR,1,-1>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar STRIP FOR 1 -1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM, alpha;bravo ; charlie ;delta,STRIP,FOR,1,-1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar STRIP REGEX "(r|t)a" OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM, alpha;bravo ; charlie ;delta,STRIP,REGEX,(r|t)a>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:TRANSFORM,STRIP..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-TOLOWER.cmake.in b/Tests/RunCMake/GenEx-LIST/TRANSFORM-TOLOWER.cmake.in new file mode 100644 index 0000000000..43e99556c6 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-TOLOWER.cmake.in @@ -0,0 +1,50 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar ALPHA BRAVO CHARLIE DELTA) + +list(TRANSFORM listvar TOLOWER OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,ALPHA;BRAVO;CHARLIE;DELTA,TOLOWER>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOLOWER AT 1 3 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,ALPHA;BRAVO;CHARLIE;DELTA,TOLOWER,AT,1,3>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOLOWER AT 1 -2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,ALPHA;BRAVO;CHARLIE;DELTA,TOLOWER,AT,1,-2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOLOWER FOR 1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,ALPHA;BRAVO;CHARLIE;DELTA,TOLOWER,FOR,1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOLOWER FOR 1 -1 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,ALPHA;BRAVO;CHARLIE;DELTA,TOLOWER,FOR,1,-1>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOLOWER FOR 1 -1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,ALPHA;BRAVO;CHARLIE;DELTA,TOLOWER,FOR,1,-1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOLOWER REGEX "(R|T)A" OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,ALPHA;BRAVO;CHARLIE;DELTA,TOLOWER,REGEX,(R|T)A>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:TRANSFORM,TOLOWER..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-TOUPPER.cmake.in b/Tests/RunCMake/GenEx-LIST/TRANSFORM-TOUPPER.cmake.in new file mode 100644 index 0000000000..be2bc3039c --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-TOUPPER.cmake.in @@ -0,0 +1,50 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar alpha bravo charlie delta) + +list(TRANSFORM listvar TOUPPER OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,TOUPPER>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOUPPER AT 1 3 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,TOUPPER,AT,1,3>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOUPPER AT 1 -2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,TOUPPER,AT,1,-2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOUPPER FOR 1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,TOUPPER,FOR,1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOUPPER FOR 1 -1 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,TOUPPER,FOR,1,-1>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOUPPER FOR 1 -1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,TOUPPER,FOR,1,-1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOUPPER REGEX "(r|t)a" OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,TOUPPER,REGEX,(r|t)a>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:TRANSFORM,TOUPPER..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-missing-arg-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-missing-arg-stderr.txt new file mode 100644 index 0000000000..46e36c3bcc --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-missing-arg-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at missing-arg.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,ARG1,[A-Z]+(,ARG[0-9])?> + + sub-command TRANSFORM, action [A-Z]+ expects (1|2) argument\(s\). +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-no-arguments-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-no-arguments-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-no-arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-no-arguments-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-no-arguments-stderr.txt new file mode 100644 index 0000000000..69b4915e74 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-no-arguments-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TRANSFORM-selector-AT-no-arguments.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b,TOUPPER,AT> + + sub-command TRANSFORM, selector AT expects at least one numeric value. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-no-arguments.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-no-arguments.cmake new file mode 100644 index 0000000000..2447511598 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-no-arguments.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b,TOUPPER,AT>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-argument-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-argument-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-argument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-argument-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-argument-stderr.txt new file mode 100644 index 0000000000..40007a181c --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-argument-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TRANSFORM-selector-AT-wrong-argument.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b,TOUPPER,AT,0,1x,2> + + sub-command TRANSFORM, selector AT: '1x': unexpected argument. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-argument.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-argument.cmake new file mode 100644 index 0000000000..49f4e908d8 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-argument.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b,TOUPPER,AT,0,1x,2>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-index-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-index-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-index-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-index-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-index-stderr.txt new file mode 100644 index 0000000000..66085ab862 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-index-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TRANSFORM-selector-AT-wrong-index.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b;c,TOUPPER,AT,0,3,2> + + sub-command TRANSFORM, selector AT, index: 3 out of range \(-3, 2\). +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-index.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-index.cmake new file mode 100644 index 0000000000..fd6c3ed1ef --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-index.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b;c,TOUPPER,AT,0,3,2>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-backwards-range-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-backwards-range-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-backwards-range-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-backwards-range-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-backwards-range-stderr.txt new file mode 100644 index 0000000000..77cffdc831 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-backwards-range-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TRANSFORM-selector-FOR-backwards-range.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,2,0> + + sub-command TRANSFORM, selector FOR expects <start> to be no greater than + <stop> \(2 > 0\) +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-backwards-range.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-backwards-range.cmake new file mode 100644 index 0000000000..17f57f586e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-backwards-range.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,2,0>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-missing-arguments-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-missing-arguments-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-missing-arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-missing-arguments-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-missing-arguments-stderr.txt new file mode 100644 index 0000000000..a9de7f8070 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-missing-arguments-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TRANSFORM-selector-FOR-missing-arguments.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b,TOUPPER,FOR,0> + + sub-command TRANSFORM, selector FOR expects, at least, two arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-missing-arguments.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-missing-arguments.cmake new file mode 100644 index 0000000000..5ae481aac2 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-missing-arguments.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b,TOUPPER,FOR,0>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-negative-step-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-negative-step-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-negative-step-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-negative-step-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-negative-step-stderr.txt new file mode 100644 index 0000000000..9c81de4bf6 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-negative-step-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TRANSFORM-selector-FOR-negative-step.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,0,2,-1> + + sub-command TRANSFORM, selector FOR expects positive numeric value for + <step>. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-negative-step.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-negative-step.cmake new file mode 100644 index 0000000000..b8e6433617 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-negative-step.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,0,2,-1>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-no-arguments-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-no-arguments-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-no-arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-no-arguments-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-no-arguments-stderr.txt new file mode 100644 index 0000000000..d31f171bfc --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-no-arguments-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TRANSFORM-selector-FOR-no-arguments.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b,TOUPPER,FOR> + + sub-command TRANSFORM, selector FOR expects, at least, two arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-no-arguments.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-no-arguments.cmake new file mode 100644 index 0000000000..6545ff95e6 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-no-arguments.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b,TOUPPER,FOR>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-argument-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-argument-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-argument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-argument-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-argument-stderr.txt new file mode 100644 index 0000000000..727be10714 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-argument-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TRANSFORM-selector-FOR-wrong-argument.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,0,1x,2> + + sub-command TRANSFORM, selector FOR expects, at least, two numeric values. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-argument.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-argument.cmake new file mode 100644 index 0000000000..a50b62c1d8 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-argument.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,0,1x,2>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-index-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-index-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-index-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-index-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-index-stderr.txt new file mode 100644 index 0000000000..664e35a591 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-index-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TRANSFORM-selector-FOR-wrong-index.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,0,4,2> + + sub-command TRANSFORM, selector FOR, index: 4 out of range \(-3, 2\). +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-index.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-index.cmake new file mode 100644 index 0000000000..f35bfbf027 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-index.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,0,4,2>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-zero-step-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-zero-step-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-zero-step-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-zero-step-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-zero-step-stderr.txt new file mode 100644 index 0000000000..e542fbfcdb --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-zero-step-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TRANSFORM-selector-FOR-zero-step.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,0,2,0> + + sub-command TRANSFORM, selector FOR expects positive numeric value for + <step>. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-zero-step.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-zero-step.cmake new file mode 100644 index 0000000000..2bfaab0907 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-zero-step.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,0,2,0>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-no-arguments-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-no-arguments-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-no-arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-no-arguments-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-no-arguments-stderr.txt new file mode 100644 index 0000000000..079172b03d --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-no-arguments-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TRANSFORM-selector-REGEX-no-arguments.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b,TOUPPER,REGEX> + + sub-command TRANSFORM, selector REGEX expects 'regular expression' + argument. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-no-arguments.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-no-arguments.cmake new file mode 100644 index 0000000000..1f802b757e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-no-arguments.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b,TOUPPER,REGEX>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-wrong-regex-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-wrong-regex-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-wrong-regex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-wrong-regex-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-wrong-regex-stderr.txt new file mode 100644 index 0000000000..3fe2b014a7 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-wrong-regex-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TRANSFORM-selector-REGEX-wrong-regex.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b,TOUPPER,REGEX,\(a> + + sub-command TRANSFORM, selector REGEX failed to compile regex "\(a". +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-wrong-regex.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-wrong-regex.cmake new file mode 100644 index 0000000000..164809206c --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-wrong-regex.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b,TOUPPER,REGEX,(a>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-unexpected-arg-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-unexpected-arg-stderr.txt new file mode 100644 index 0000000000..04e9df1679 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-unexpected-arg-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at unexpected-arg.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,ARG1,[A-Z_]+(,[A-Z0-9]+)+> + + sub-command TRANSFORM, '[A-Z0-9]+': unexpected argument\(s\). +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-wrong-action-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-wrong-action-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-wrong-action-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-wrong-action-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-wrong-action-stderr.txt new file mode 100644 index 0000000000..1c30c4f903 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-wrong-action-stderr.txt @@ -0,0 +1,7 @@ +CMake Error at TRANSFORM-wrong-action.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b;c,WRONG_ACTION> + sub-command TRANSFORM, WRONG_ACTION invalid action. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-wrong-action.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-wrong-action.cmake new file mode 100644 index 0000000000..fba6c90f43 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-wrong-action.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b;c,WRONG_ACTION>") diff --git a/Tests/RunCMake/GenEx-LIST/bad-option-result.txt b/Tests/RunCMake/GenEx-LIST/bad-option-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/bad-option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/bad-option-stderr.txt b/Tests/RunCMake/GenEx-LIST/bad-option-stderr.txt new file mode 100644 index 0000000000..37048c5f0e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/bad-option-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at bad-option.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:BAD_OPTION,ARG> + + BAD_OPTION: invalid option. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/bad-option.cmake b/Tests/RunCMake/GenEx-LIST/bad-option.cmake new file mode 100644 index 0000000000..d1dc85f276 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/bad-option.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:BAD_OPTION,ARG>") diff --git a/Tests/RunCMake/GenEx-LIST/check_errors.cmake b/Tests/RunCMake/GenEx-LIST/check_errors.cmake new file mode 100644 index 0000000000..7e60fc725e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/check_errors.cmake @@ -0,0 +1,13 @@ + +function (CHECK_ERRORS command) + set (errors ${ARGN}) + set (command "$<${command}>") + if (errors) + string (LENGTH "${command}" length) + math (EXPR count "${length} + 2") + string (REPEAT " " ${count} shift) + list (TRANSFORM errors PREPEND "${shift}") + list (JOIN errors "\n" msg) + message (FATAL_ERROR "${command}: ${msg}") + endif() +endfunction() diff --git a/Tests/RunCMake/GenEx-LIST/generate.cmake b/Tests/RunCMake/GenEx-LIST/generate.cmake new file mode 100644 index 0000000000..92cdca2a5d --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/generate.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT "${LIST_TEST}.cmake" INPUT "${LIST_TEST}.cmake.in") diff --git a/Tests/RunCMake/GenEx-LIST/missing-arg-result.txt b/Tests/RunCMake/GenEx-LIST/missing-arg-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/missing-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/missing-arg-stderr.txt b/Tests/RunCMake/GenEx-LIST/missing-arg-stderr.txt new file mode 100644 index 0000000000..c7cbe4b13a --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/missing-arg-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at missing-arg.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:[A-Z_]+,.+> + + \$<LIST:[A-Z_]+> expression requires at least (two|three) parameters. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/missing-arg.cmake b/Tests/RunCMake/GenEx-LIST/missing-arg.cmake new file mode 100644 index 0000000000..48b26e13af --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/missing-arg.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:${LIST_ARGUMENTS}>") diff --git a/Tests/RunCMake/GenEx-LIST/no-arguments-result.txt b/Tests/RunCMake/GenEx-LIST/no-arguments-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/no-arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/no-arguments-stderr.txt b/Tests/RunCMake/GenEx-LIST/no-arguments-stderr.txt new file mode 100644 index 0000000000..ee782ecfde --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/no-arguments-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at no-arguments.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:> + + \$<LIST> expression requires at least two parameters. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/no-arguments.cmake b/Tests/RunCMake/GenEx-LIST/no-arguments.cmake new file mode 100644 index 0000000000..f704e2b76e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/no-arguments.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:>") diff --git a/Tests/RunCMake/GenEx-LIST/unexpected-arg-result.txt b/Tests/RunCMake/GenEx-LIST/unexpected-arg-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/unexpected-arg-stderr.txt b/Tests/RunCMake/GenEx-LIST/unexpected-arg-stderr.txt new file mode 100644 index 0000000000..a7b1f25e1e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/unexpected-arg-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at unexpected-arg.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:[A-Z_]+,.+> + + \$<LIST:[A-Z_]+(,[A-Z_]+)?> expression requires exactly (one|two|three) parameters?. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/unexpected-arg.cmake b/Tests/RunCMake/GenEx-LIST/unexpected-arg.cmake new file mode 100644 index 0000000000..48b26e13af --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/unexpected-arg.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:${LIST_ARGUMENTS}>") diff --git a/Tests/RunCMake/IncludeWhatYouUse/C-error-Build-result.txt b/Tests/RunCMake/IncludeWhatYouUse/C-error-Build-result.txt new file mode 100644 index 0000000000..d197c913c2 --- /dev/null +++ b/Tests/RunCMake/IncludeWhatYouUse/C-error-Build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/IncludeWhatYouUse/C-error-Build-stdout.txt b/Tests/RunCMake/IncludeWhatYouUse/C-error-Build-stdout.txt new file mode 100644 index 0000000000..cb7467705e --- /dev/null +++ b/Tests/RunCMake/IncludeWhatYouUse/C-error-Build-stdout.txt @@ -0,0 +1,4 @@ +Warning: include-what-you-use reported diagnostics: +should add these lines: +* +#include <\.\.\.> diff --git a/Tests/RunCMake/IncludeWhatYouUse/C-error.cmake b/Tests/RunCMake/IncludeWhatYouUse/C-error.cmake new file mode 100644 index 0000000000..d5230bbf8c --- /dev/null +++ b/Tests/RunCMake/IncludeWhatYouUse/C-error.cmake @@ -0,0 +1,3 @@ +enable_language(C) +set(CMAKE_C_INCLUDE_WHAT_YOU_USE "${PSEUDO_IWYU}" -Xiwyu --error) +add_executable(main main.c) diff --git a/Tests/RunCMake/IncludeWhatYouUse/CXX-error-Build-result.txt b/Tests/RunCMake/IncludeWhatYouUse/CXX-error-Build-result.txt new file mode 100644 index 0000000000..d197c913c2 --- /dev/null +++ b/Tests/RunCMake/IncludeWhatYouUse/CXX-error-Build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/IncludeWhatYouUse/CXX-error-Build-stdout.txt b/Tests/RunCMake/IncludeWhatYouUse/CXX-error-Build-stdout.txt new file mode 100644 index 0000000000..cb7467705e --- /dev/null +++ b/Tests/RunCMake/IncludeWhatYouUse/CXX-error-Build-stdout.txt @@ -0,0 +1,4 @@ +Warning: include-what-you-use reported diagnostics: +should add these lines: +* +#include <\.\.\.> diff --git a/Tests/RunCMake/IncludeWhatYouUse/CXX-error.cmake b/Tests/RunCMake/IncludeWhatYouUse/CXX-error.cmake new file mode 100644 index 0000000000..1d10a550d4 --- /dev/null +++ b/Tests/RunCMake/IncludeWhatYouUse/CXX-error.cmake @@ -0,0 +1,3 @@ +enable_language(CXX) +set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "$<1:${PSEUDO_IWYU}>" -Xiwyu --error) +add_executable(main main.cxx) diff --git a/Tests/RunCMake/IncludeWhatYouUse/RunCMakeTest.cmake b/Tests/RunCMake/IncludeWhatYouUse/RunCMakeTest.cmake index 8f99eb1047..8ec24be5ca 100644 --- a/Tests/RunCMake/IncludeWhatYouUse/RunCMakeTest.cmake +++ b/Tests/RunCMake/IncludeWhatYouUse/RunCMakeTest.cmake @@ -16,6 +16,8 @@ endfunction() run_iwyu(C) run_iwyu(CXX) +run_iwyu(C-error) +run_iwyu(CXX-error) if (NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") run_iwyu(C-launch) run_iwyu(CXX-launch) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 8e85f6cf46..18dde944d7 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -47,6 +47,8 @@ function(run_cmake test) elseif(EXISTS ${top_src}/${test}-${o}.txt) file(READ ${top_src}/${test}-${o}.txt expect_${o}) string(REGEX REPLACE "\n+$" "" expect_${o} "${expect_${o}}") + elseif(DEFINED RunCMake_TEST_EXPECT_${o}) + string(REGEX REPLACE "\n+$" "" expect_${o} "${RunCMake_TEST_EXPECT_${o}}") else() unset(expect_${o}) endif() @@ -175,7 +177,7 @@ function(run_cmake test) "|Your license to use PGI[^\n]*expired" "|Please obtain a new version at" "|contact PGI Sales at" - "|icp?c: remark #10441: The Intel\\(R\\) C\\+\\+ Compiler Classic \\(ICC\\) is deprecated" + "|ic(p?c|l): remark #10441: The Intel\\(R\\) C\\+\\+ Compiler Classic \\(ICC\\) is deprecated" "|[^\n]*install_name_tool: warning: changes being made to the file will invalidate the code signature in:" "|[^\n]*xcodebuild[^\n]*DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default" diff --git a/Tests/RunCMake/TransformDepfile/deps-unix.d.txt b/Tests/RunCMake/TransformDepfile/deps-unix.d.txt index fbdecc072b..2588181b8b 100644 --- a/Tests/RunCMake/TransformDepfile/deps-unix.d.txt +++ b/Tests/RunCMake/TransformDepfile/deps-unix.d.txt @@ -1,8 +1,8 @@ subdir/out1 \ /home/build/out2: \ - subdir/in1 \ - /home/build/in2 + /home/build/in2 \ + subdir/in1 subdir/out3 \ /home/build/out4: \ - subdir/in3 \ - /home/build/in4 + /home/build/in4 \ + subdir/in3 diff --git a/Tests/RunCMake/TransformDepfile/deps-windows.d.txt b/Tests/RunCMake/TransformDepfile/deps-windows.d.txt index e09ae375a8..805a4c8362 100644 --- a/Tests/RunCMake/TransformDepfile/deps-windows.d.txt +++ b/Tests/RunCMake/TransformDepfile/deps-windows.d.txt @@ -1,8 +1,8 @@ subdir/out1 \ C:/build/out2: \ - subdir/in1 \ - C:/build/in2 + C:/build/in2 \ + subdir/in1 subdir/out3 \ C:/build/out4: \ - subdir/in3 \ - C:/build/in4 + C:/build/in4 \ + subdir/in3 diff --git a/Tests/RunCMake/VS10Project/CMakeInputs-check.cmake b/Tests/RunCMake/VS10Project/CMakeInputs-check.cmake new file mode 100644 index 0000000000..a125574d8e --- /dev/null +++ b/Tests/RunCMake/VS10Project/CMakeInputs-check.cmake @@ -0,0 +1,25 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/ZERO_CHECK.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(found_CMakeInputs 0) +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "<([A-Za-z0-9_]+) +Include=.*CMakeInputs.cmake") + set(rule "${CMAKE_MATCH_1}") + if(NOT rule STREQUAL "None") + set(RunCMake_TEST_FAILED "CMakeInputs.cmake referenced as ${rule} instead of None") + return() + endif() + if(found_CMakeInputs) + set(RunCMake_TEST_FAILED "CMakeInputs.cmake referenced multiple times") + return() + endif() + set(found_CMakeInputs 1) + endif() +endforeach() +if(NOT found_CMakeInputs) + set(RunCMake_TEST_FAILED "CMakeInputs.cmake not referenced") +endif() diff --git a/Tests/RunCMake/VS10Project/CMakeInputs.cmake b/Tests/RunCMake/VS10Project/CMakeInputs.cmake new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/Tests/RunCMake/VS10Project/CMakeInputs.cmake diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 669049a737..cb1a5d5403 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -7,6 +7,7 @@ if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND CMAKE_C_COMPILER_VERSION VERSION_GREA run_cmake(LanguageStandard) endif() +run_cmake(CMakeInputs) run_cmake(CustomCommandGenex) if(NOT RunCMake_GENERATOR MATCHES "^Visual Studio 1[1-5] ") run_cmake(CustomCommandParallel) |
