diff options
Diffstat (limited to 'Tests')
220 files changed, 3117 insertions, 110 deletions
diff --git a/Tests/CMakeLib/testGccDepfileReader_data/deps1.txt b/Tests/CMakeLib/testGccDepfileReader_data/deps1.txt index fd2679f41a..4207b58139 100644 --- a/Tests/CMakeLib/testGccDepfileReader_data/deps1.txt +++ b/Tests/CMakeLib/testGccDepfileReader_data/deps1.txt @@ -1,26 +1,26 @@ --RULES-- main.o --DEPENDENCIES-- -main.cpp +/usr/include/features.h /usr/include/stdc-predef.h /usr/include/stdio.h /usr/include/x86_64-linux-gnu/bits/libc-header-start.h -/usr/include/features.h -/usr/include/x86_64-linux-gnu/sys/cdefs.h -/usr/include/x86_64-linux-gnu/bits/wordsize.h /usr/include/x86_64-linux-gnu/bits/long-double.h -/usr/include/x86_64-linux-gnu/gnu/stubs.h -/usr/include/x86_64-linux-gnu/gnu/stubs-64.h -/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h -/usr/lib/gcc/x86_64-linux-gnu/8/include/stdarg.h +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h +/usr/include/x86_64-linux-gnu/bits/sys_errlist.h /usr/include/x86_64-linux-gnu/bits/types.h -/usr/include/x86_64-linux-gnu/bits/typesizes.h +/usr/include/x86_64-linux-gnu/bits/types/FILE.h +/usr/include/x86_64-linux-gnu/bits/types/__FILE.h +/usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h /usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h -/usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h -/usr/include/x86_64-linux-gnu/bits/types/__FILE.h -/usr/include/x86_64-linux-gnu/bits/types/FILE.h -/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h /usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h -/usr/include/x86_64-linux-gnu/bits/stdio_lim.h -/usr/include/x86_64-linux-gnu/bits/sys_errlist.h +/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h +/usr/include/x86_64-linux-gnu/bits/typesizes.h +/usr/include/x86_64-linux-gnu/bits/wordsize.h +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h +/usr/include/x86_64-linux-gnu/gnu/stubs.h +/usr/include/x86_64-linux-gnu/sys/cdefs.h +/usr/lib/gcc/x86_64-linux-gnu/8/include/stdarg.h +/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h +main.cpp diff --git a/Tests/CMakeLib/testGccDepfileReader_data/deps3.txt b/Tests/CMakeLib/testGccDepfileReader_data/deps3.txt index 448f69c1e5..8d82c60d44 100644 --- a/Tests/CMakeLib/testGccDepfileReader_data/deps3.txt +++ b/Tests/CMakeLib/testGccDepfileReader_data/deps3.txt @@ -1,11 +1,11 @@ --RULES-- main.o --DEPENDENCIES-- -main.cpp -foo#bar.h -foo\#bar.h foo bar.h +foo#bar.h +foo$bar.h foo\ bar.h +foo\#bar.h foo\\ bar.h foo\\\\ -foo$bar.h +main.cpp diff --git a/Tests/CMakeLib/testList.cxx b/Tests/CMakeLib/testList.cxx index 7294be0b31..f6ec7208ea 100644 --- a/Tests/CMakeLib/testList.cxx +++ b/Tests/CMakeLib/testList.cxx @@ -8,7 +8,7 @@ #include <utility> #include <vector> -#include <cm/string_view> +#include <cmext/string_view> #include "cmList.h" @@ -42,7 +42,7 @@ bool testConstructors() } { cmList list1{ "aa", "bb" }; - cmList list2("aa;bb"); + cmList list2("aa;bb"_s); if (list1.size() != 2 || list2.size() != 2 || list1 != list2) { result = false; @@ -174,7 +174,7 @@ bool testAssign() { cmList list{ "cc", "dd" }; - list = "aa;bb"; + list = "aa;bb"_s; if (list.size() != 2) { result = false; } @@ -195,7 +195,7 @@ bool testConversions() bool result = true; { - cmList list("a;b;c"); + cmList list("a;b;c"_s); std::string s = list.to_string(); if (s != "a;b;c") { @@ -203,7 +203,7 @@ bool testConversions() } } { - cmList list("a;b;c"); + cmList list("a;b;c"_s); std::vector<std::string> v = list; if (list.size() != 3 || v.size() != 3) { @@ -211,7 +211,7 @@ bool testConversions() } } { - cmList list("a;b;c"); + cmList list("a;b;c"_s); std::vector<std::string> v = std::move(list); // Microsoft compiler is not able to handle correctly the move semantics @@ -221,7 +221,7 @@ bool testConversions() } } { - cmList list("a;b;c"); + cmList list("a;b;c"_s); std::vector<std::string> v; // compiler is not able to select the cmList conversion operator @@ -247,20 +247,20 @@ bool testAccess() { cmList list{ "a", "b", "c" }; - if (list.at(1) != "b") { + if (list.get_item(1) != "b") { result = false; } } { cmList list{ "a", "b", "c" }; - if (list.at(-3) != "a") { + if (list.get_item(-3) != "a") { result = false; } } { try { cmList list{ "a", "b", "c" }; - if (list.at(4) != "a") { + if (list.get_item(4) != "a") { result = false; } } catch (std::out_of_range&) { @@ -269,7 +269,7 @@ bool testAccess() { try { cmList list{ "a", "b", "c" }; - if (list.at(-4) != "a") { + if (list.get_item(-4) != "a") { result = false; } } catch (std::out_of_range&) { @@ -342,7 +342,7 @@ bool testModifiers() { cmList list{ "1;2;3;4;5" }; - auto it = list.insert(list.begin() + 2, "6;7;8"); + auto it = list.insert(list.begin() + 2, "6;7;8"_s); if (list.size() != 8 || list.to_string() != "1;2;6;7;8;3;4;5") { result = false; } @@ -354,7 +354,7 @@ bool testModifiers() cmList list{ "1;2;3;4;5" }; auto it = - list.insert(list.begin() + 2, "6;7;8", cmList::ExpandElements::No); + list.insert(list.begin() + 2, "6;7;8"_s, cmList::ExpandElements::No); if (list.size() != 6 || list.to_string() != "1;2;6;7;8;3;4;5") { result = false; } @@ -479,7 +479,7 @@ bool testRemoveItems() bool result = true; { - cmList list("a;b;c;d;e;f;g;h"); + cmList list("a;b;c;d;e;f;g;h"_s); list.remove_items({ 1, 3, 5 }); @@ -488,7 +488,7 @@ bool testRemoveItems() } } { - cmList list("a;b;c;b;a;d;e;f"); + cmList list("a;b;c;b;a;d;e;f"_s); list.remove_items({ "a", "b", "h" }); @@ -497,7 +497,7 @@ bool testRemoveItems() } } { - cmList list("a;b;c;d;e;f;g;h"); + cmList list("a;b;c;d;e;f;g;h"_s); std::vector<cmList::index_type> remove{ 1, 3, 5 }; list.remove_items(remove.begin(), remove.end()); @@ -507,7 +507,7 @@ bool testRemoveItems() } } { - cmList list("a;b;c;b;a;d;e;f"); + cmList list("a;b;c;b;a;d;e;f"_s); std::vector<std::string> remove{ "b", "a", "h" }; list.remove_items(remove.begin(), remove.end()); @@ -529,7 +529,7 @@ bool testRemoveDuplicates() bool result = true; { - cmList list("b;c;b;a;a;c;b;a;c;b"); + cmList list("b;c;b;a;a;c;b;a;c;b"_s); list.remove_duplicates(); @@ -803,7 +803,7 @@ bool testStaticModifiers() { std::vector<std::string> v{ "a", "b", "c" }; - cmList::assign("d;e", v); + cmList::assign(v, "d;e"_s); if (v.size() != 2 || v[0] != "d" || v[1] != "e") { result = false; @@ -811,7 +811,7 @@ bool testStaticModifiers() } { std::vector<std::string> v{ "a", "b", "c" }; - cmList::append("d;;e", v); + cmList::append(v, "d;;e"_s); if (v.size() != 5 || v[3] != "d" || v[4] != "e") { result = false; @@ -819,7 +819,7 @@ bool testStaticModifiers() } { std::vector<std::string> v{ "a", "b", "c" }; - cmList::append("d;;e", v, cmList::EmptyElements::Yes); + cmList::append(v, "d;;e"_s, cmList::EmptyElements::Yes); if (v.size() != 6 || v[3] != "d" || !v[4].empty() || v[5] != "e") { result = false; @@ -827,7 +827,7 @@ bool testStaticModifiers() } { std::vector<std::string> v{ "a", "b", "c" }; - cmList::prepend("d;e", v); + cmList::prepend(v, "d;e"_s); if (v.size() != 5 || v[0] != "d" || v[1] != "e") { result = false; @@ -835,7 +835,7 @@ bool testStaticModifiers() } { std::vector<std::string> v{ "a", "b", "c" }; - cmList::prepend("d;;e", v, cmList::EmptyElements::Yes); + cmList::prepend(v, "d;;e"_s, cmList::EmptyElements::Yes); if (v.size() != 6 || v[0] != "d" || !v[1].empty() || v[2] != "e") { result = false; @@ -843,7 +843,7 @@ bool testStaticModifiers() } { std::string list{ "a;b;c" }; - cmList::append("d;e", list); + cmList::append(list, "d;e"_s); if (list != "a;b;c;d;e") { result = false; @@ -851,7 +851,7 @@ bool testStaticModifiers() } { std::string list; - cmList::append("d;e", list); + cmList::append(list, "d;e"_s); if (list != "d;e") { result = false; @@ -859,7 +859,7 @@ bool testStaticModifiers() } { std::string list{ "a;b;c" }; - cmList::append("", list); + cmList::append(list, ""); if (list != "a;b;c;") { result = false; @@ -868,7 +868,7 @@ bool testStaticModifiers() { std::string list{ "a;b;c" }; std::vector<std::string> v{ "d", "e" }; - cmList::append(v.begin(), v.end(), list); + cmList::append(list, v.begin(), v.end()); if (list != "a;b;c;d;e") { result = false; @@ -877,7 +877,7 @@ bool testStaticModifiers() { std::string list{ "a;b;c" }; std::vector<std::string> v; - cmList::append(v.begin(), v.end(), list); + cmList::append(list, v.begin(), v.end()); if (list != "a;b;c") { result = false; @@ -886,7 +886,7 @@ bool testStaticModifiers() { std::string list; std::vector<std::string> v{ "d", "e" }; - cmList::append(v.begin(), v.end(), list); + cmList::append(list, v.begin(), v.end()); if (list != "d;e") { result = false; @@ -894,7 +894,7 @@ bool testStaticModifiers() } { std::string list{ "a;b;c" }; - cmList::prepend("d;e", list); + cmList::prepend(list, "d;e"); if (list != "d;e;a;b;c") { result = false; @@ -902,7 +902,7 @@ bool testStaticModifiers() } { std::string list; - cmList::prepend("d;e", list); + cmList::prepend(list, "d;e"); if (list != "d;e") { result = false; @@ -910,7 +910,7 @@ bool testStaticModifiers() } { std::string list{ "a;b;c" }; - cmList::prepend("", list); + cmList::prepend(list, ""); if (list != ";a;b;c") { result = false; @@ -919,7 +919,7 @@ bool testStaticModifiers() { std::string list{ "a;b;c" }; std::vector<std::string> v{ "d", "e" }; - cmList::prepend(v.begin(), v.end(), list); + cmList::prepend(list, v.begin(), v.end()); if (list != "d;e;a;b;c") { result = false; @@ -928,7 +928,7 @@ bool testStaticModifiers() { std::string list{ "a;b;c" }; std::vector<std::string> v; - cmList::prepend(v.begin(), v.end(), list); + cmList::prepend(list, v.begin(), v.end()); if (list != "a;b;c") { result = false; @@ -937,7 +937,7 @@ bool testStaticModifiers() { std::string list; std::vector<std::string> v{ "d", "e" }; - cmList::prepend(v.begin(), v.end(), list); + cmList::prepend(list, v.begin(), v.end()); if (list != "d;e") { result = false; diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index e92d1c1c09..e3b5ec41d8 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -986,6 +986,30 @@ if(BUILD_TESTING) endif() endif() + # On Windows run the CPackInnoSetupGenerator test + if(WIN32 AND CMake_TEST_CPACK_INNOSETUP) + add_test(CPackInnoSetupGenerator ${CMAKE_CTEST_COMMAND} + -C \${CTEST_CONFIGURATION_TYPE} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/CPackInnoSetupGenerator" + "${CMake_BINARY_DIR}/Tests/CPackInnoSetupGenerator" + ${build_generator_args} + --build-project CPackInnoSetupGenerator + --build-options + --test-command ${CMAKE_CMAKE_COMMAND} + "-DCPackInnoSetupGenerator_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackInnoSetupGenerator" + "-Dconfig=\${CTEST_CONFIGURATION_TYPE}" + -P "${CMake_SOURCE_DIR}/Tests/CPackInnoSetupGenerator/RunCPackVerifyResult.cmake") + + set_property(TEST CPackInnoSetupGenerator PROPERTY + ATTACHED_FILES_ON_FAIL + "${CMake_BINARY_DIR}/Tests/CPackInnoSetupGenerator/_CPack_Packages/win32/INNOSETUP/ISCCOutput.log") + + set_property(TEST CPackInnoSetupGenerator PROPERTY + ATTACHED_FILES + "${CMake_BINARY_DIR}/Tests/CPackInnoSetupGenerator/_CPack_Packages/win32/INNOSETUP/ISScript.iss") + endif() + # On Windows run the CPackNSISGenerator test # if the nsis is available if(WIN32 AND NSIS_MAKENSIS_EXECUTABLE) diff --git a/Tests/CPackInnoSetupGenerator/CMakeLists.txt b/Tests/CPackInnoSetupGenerator/CMakeLists.txt new file mode 100644 index 0000000000..bca0ad6cd7 --- /dev/null +++ b/Tests/CPackInnoSetupGenerator/CMakeLists.txt @@ -0,0 +1,55 @@ +cmake_minimum_required(VERSION 3.13) + +project(CPackInnoSetupGenerator VERSION 42.0 HOMEPAGE_URL "https://www.example.com") + +add_executable(hello main.c) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/empty) + +install(TARGETS hello DESTINATION / COMPONENT application) +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/empty DESTINATION / COMPONENT extras) +install(FILES my_bitmap.bmp DESTINATION awesome COMPONENT extras) +install(FILES my_file.txt DESTINATION / COMPONENT hidden_component) +install(FILES my_file.txt DESTINATION / COMPONENT hidden_component2) + +set(CPACK_GENERATOR "INNOSETUP") + +set(CPACK_PACKAGE_NAME "Hello, World!") # Test constant escape (like {cm:...}, see code documentation) +set(CPACK_PACKAGE_VENDOR "Sheldon Cooper") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "hello_world") +set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "hello_world") +set(CPACK_PACKAGE_FILE_NAME "hello_world_setup") +set(CPACK_SYSTEM_NAME "win32") +set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/my_bitmap.bmp") +set(CPACK_VERBATIM_VARIABLES ON) +set(CPACK_PACKAGE_EXECUTABLES "hello" "Hello, World!") +set(CPACK_CREATE_DESKTOP_LINKS hello) + +set(CPACK_INNOSETUP_INSTALL_ROOT "{autopf}\\Sheldon Cooper") +set(CPACK_INNOSETUP_PROGRAM_MENU_FOLDER ".") +set(CPACK_INNOSETUP_IGNORE_LICENSE_PAGE ON) +set(CPACK_INNOSETUP_IGNORE_README_PAGE OFF) # Test if only readme page is shown +set(CPACK_INNOSETUP_SETUP_AppComments ON) # Test if CPACK_INNOSETUP_USE_CMAKE_BOOL_FORMAT works +set(CPACK_INNOSETUP_CUSTOM_INSTALL_INSTRUCTIONS "extras/empty" + "Name: \"{userdocs}\\empty\"\; Check: ReturnTrue\; Components: accessories\\extras") +set(CPACK_INNOSETUP_MENU_LINKS "https://www.example.com" "Web" + "my_file.txt" "Text") +set(CPACK_INNOSETUP_RUN_EXECUTABLES hello) +set(CPACK_INNOSETUP_CREATE_UNINSTALL_LINK ON) +# Test if this macro is available in the code file below containing the check function +set(CPACK_INNOSETUP_DEFINE_PascalMacro "end;") +set(CPACK_INNOSETUP_CODE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Code.pas") +set(CPACK_INNOSETUP_EXECUTABLE "ISCC.exe") + +include(CPackComponent) + +cpack_add_install_type(basic DISPLAY_NAME "Basic installation") +cpack_add_install_type(full DISPLAY_NAME "\"Large\" installation") # Test double quote syntax +cpack_add_component_group(accessories DISPLAY_NAME "Accessories") + +cpack_add_component(application DISPLAY_NAME "Application" INSTALL_TYPES basic full REQUIRED) +cpack_add_component(extras DISPLAY_NAME "Additional components" INSTALL_TYPES full GROUP accessories) +cpack_add_component(hidden_component HIDDEN) +cpack_add_component(hidden_component2 HIDDEN DISABLED) +set(CPACK_INNOSETUP_extras_INSTALL_DIRECTORY "{userdocs}") + +include(CPack) diff --git a/Tests/CPackInnoSetupGenerator/Code.pas b/Tests/CPackInnoSetupGenerator/Code.pas new file mode 100644 index 0000000000..d96d82f2df --- /dev/null +++ b/Tests/CPackInnoSetupGenerator/Code.pas @@ -0,0 +1,4 @@ +function ReturnTrue(): Boolean; +begin + Result := true; +{#PascalMacro} diff --git a/Tests/CPackInnoSetupGenerator/RunCPackVerifyResult.cmake b/Tests/CPackInnoSetupGenerator/RunCPackVerifyResult.cmake new file mode 100644 index 0000000000..72a26ee754 --- /dev/null +++ b/Tests/CPackInnoSetupGenerator/RunCPackVerifyResult.cmake @@ -0,0 +1,136 @@ +message(STATUS "=============================================================") +message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") +message(STATUS "") + +if(NOT CPackInnoSetupGenerator_BINARY_DIR) + message(FATAL_ERROR "CPackInnoSetupGenerator_BINARY_DIR not set") +endif() + +message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}") +message(STATUS "CMAKE_CPACK_COMMAND: ${CMAKE_CPACK_COMMAND}") +message(STATUS "CPackInnoSetupGenerator_BINARY_DIR: ${CPackInnoSetupGenerator_BINARY_DIR}") + +if(config) + set(_C_config -C ${config}) +endif() + +execute_process(COMMAND "${CMAKE_CPACK_COMMAND}" + ${_C_config} + RESULT_VARIABLE CPack_result + OUTPUT_VARIABLE CPack_output + ERROR_VARIABLE CPack_output + WORKING_DIRECTORY "${CPackInnoSetupGenerator_BINARY_DIR}") + +if(CPack_result) + message(FATAL_ERROR "CPack execution went wrong!, Output: ${CPack_output}") +else () + message(STATUS "Output: ${CPack_output}") +endif() + +file(GLOB project_file "${CPackInnoSetupGenerator_BINARY_DIR}/_CPack_Packages/win32/INNOSETUP/ISScript.iss") +file(GLOB installer_file "${CPackInnoSetupGenerator_BINARY_DIR}/_CPack_Packages/win32/INNOSETUP/hello_world_setup.exe") + +message(STATUS "Project file: '${project_file}'") +message(STATUS "Installer file: '${installer_file}'") + +if(NOT project_file) + message(FATAL_ERROR "Project file does not exist") +endif() + +if(NOT installer_file) + message(FATAL_ERROR "Installer file does not exist") +endif() + +# Test if the correct registry key is set +file(STRINGS "${project_file}" results REGEX "^AppId=hello_world$") +if(results STREQUAL "") + message(FATAL_ERROR "CPACK_PACKAGE_INSTALL_REGISTRY_KEY doesn't match AppId") +endif() + +# Test if only readme page is shown +file(STRINGS "${project_file}" results REGEX "^LicenseFile=") +file(STRINGS "${project_file}" results2 REGEX "^InfoBeforeFile=") +if(NOT results STREQUAL "" OR results2 STREQUAL "") + message(FATAL_ERROR "Erroneous output with license and readme files") +endif() + +# Test if classic style is used by default +file(STRINGS "${project_file}" results REGEX "compiler:SetupClassicIcon\\.ico") +file(STRINGS "${project_file}" results2 REGEX "compiler:WizClassicImage\\.bmp") +if(results STREQUAL "" OR results2 STREQUAL "") + message(FATAL_ERROR "Images of classic style not used") +endif() + +# Test if the top-level start menu folder is used +file(STRINGS "${project_file}" results REGEX "{autoprograms}") +file(STRINGS "${project_file}" results2 REGEX "{group}") +if(results STREQUAL "" OR NOT results2 STREQUAL "") + message(FATAL_ERROR "Top-level start menu folder not used") +endif() + +# Test CPACK_INNOSETUP_USE_CMAKE_BOOL_FORMAT +file(STRINGS "${project_file}" results REGEX "^AppComments=yes$") +if(results STREQUAL "") + message(FATAL_ERROR "CPACK_INNOSETUP_USE_CMAKE_BOOL_FORMAT doesn't convert booleans") +endif() + +# Test the custom installation rule +file(STRINGS "${project_file}" results REGEX "^Name: \"{userdocs}\\\\empty\"; Check: ReturnTrue; Components: accessories\\\\extras$") +if(results STREQUAL "") + message(FATAL_ERROR "Custom installation rule not found or incomplete") +endif() + +# Test if an uninstall shortcut has been created +file(STRINGS "${project_file}" results REGEX "{uninstallexe}") +if(results STREQUAL "") + message(FATAL_ERROR "No uninstall shortcut created") +endif() + +# Test CPACK_INNOSETUP_<compName>_INSTALL_DIRECTORY +file(STRINGS "${project_file}" results REGEX "{app}.*Components: accessories\\\\extras") +if(NOT results STREQUAL "") + message(FATAL_ERROR "Component not in custom install directory") +endif() + +# Test if component names are nested correctly +file(STRINGS "${project_file}" results REGEX "Components:.* extras") +if(NOT results STREQUAL "") + message(FATAL_ERROR "Component names must contain their parent groups according to the documentation") +endif() + +# Test if custom installation type exists +file(STRINGS "${project_file}" results REGEX "Flags: .*iscustom") +if(results STREQUAL "") + message(FATAL_ERROR "Custom installation type doesn't exist") +endif() + +# Test if hidden components are processed but not displayed +file(STRINGS "${project_file}" results REGEX "Source:.+hidden_component\\\\my_file\\.txt") +file(STRINGS "${project_file}" results2 REGEX "Name: \"hidden_component\"") +if(results STREQUAL "" OR NOT results2 STREQUAL "") + message(FATAL_ERROR "Hidden component displayed or one of its files ignored") +endif() + +# Test if disabled and hidden components are ignored at all +file(STRINGS "${project_file}" results REGEX "Source:.+hidden_component2\\\\my_file\\.txt") +if(NOT results STREQUAL "") + message(FATAL_ERROR "Disabled and hidden component not ignored") +endif() + +# Test if required components ignore their installation types +file(STRINGS "${project_file}" results REGEX "Types: (basic|full|custom|basic full|full basic|basic custom|full custom); Flags: fixed") +if(NOT results STREQUAL "") + message(FATAL_ERROR "Required components don't ignore their installation types") +endif() + +# Test constant escape (should contain Hello%2c World!) +file(STRINGS "${project_file}" results REGEX "Hello%2c World!") +if(results STREQUAL "") + message(FATAL_ERROR "The comma character isn't escaped to %2c") +endif() + +# Test double quote syntax +file(STRINGS "${project_file}" results REGEX "\"\"Large\"\"") +if(results STREQUAL "") + message(FATAL_ERROR "The quote character isn't escaped correctly") +endif() diff --git a/Tests/CPackInnoSetupGenerator/main.c b/Tests/CPackInnoSetupGenerator/main.c new file mode 100644 index 0000000000..413899c807 --- /dev/null +++ b/Tests/CPackInnoSetupGenerator/main.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main() +{ + printf("Hello, World!\n"); + return 42; +} diff --git a/Tests/CPackInnoSetupGenerator/my_bitmap.bmp b/Tests/CPackInnoSetupGenerator/my_bitmap.bmp Binary files differnew file mode 100644 index 0000000000..d0e562fb37 --- /dev/null +++ b/Tests/CPackInnoSetupGenerator/my_bitmap.bmp diff --git a/Tests/CPackInnoSetupGenerator/my_file.txt b/Tests/CPackInnoSetupGenerator/my_file.txt new file mode 100644 index 0000000000..8ab686eafe --- /dev/null +++ b/Tests/CPackInnoSetupGenerator/my_file.txt @@ -0,0 +1 @@ +Hello, World! diff --git a/Tests/CompileFeatures/default_dialect.c b/Tests/CompileFeatures/default_dialect.c index b990e53258..c696c83f3e 100644 --- a/Tests/CompileFeatures/default_dialect.c +++ b/Tests/CompileFeatures/default_dialect.c @@ -20,7 +20,8 @@ # error Buildsystem error # endif # if defined(__STDC_VERSION__) && \ - !(defined(__SUNPRO_C) && __STDC_VERSION__ == 199409L) + !(__STDC_VERSION__ == 199409L && \ + (defined(__INTEL_COMPILER) || defined(__SUNPRO_C))) # error Unexpected __STDC_VERSION__ definition # endif #endif diff --git a/Tests/Cuda/Toolkit/CMakeLists.txt b/Tests/Cuda/Toolkit/CMakeLists.txt index b67aa3279f..8432b71ff1 100644 --- a/Tests/Cuda/Toolkit/CMakeLists.txt +++ b/Tests/Cuda/Toolkit/CMakeLists.txt @@ -16,8 +16,22 @@ message(STATUS "CUDAToolkit_VERSION_PATCH: ${CUDAToolkit_VERSION_PATCH}") message(STATUS "CUDAToolkit_BIN_DIR: ${CUDAToolkit_BIN_DIR}") message(STATUS "CUDAToolkit_INCLUDE_DIRS: ${CUDAToolkit_INCLUDE_DIRS}") message(STATUS "CUDAToolkit_LIBRARY_DIR: ${CUDAToolkit_LIBRARY_DIR}") +message(STATUS "CUDAToolkit_LIBRARY_ROOT: ${CUDAToolkit_LIBRARY_ROOT}") message(STATUS "CUDAToolkit_NVCC_EXECUTABLE ${CUDAToolkit_NVCC_EXECUTABLE}") +set(should_exist + CUDAToolkit_BIN_DIR + CUDAToolkit_INCLUDE_DIRS + CUDAToolkit_LIBRARY_DIR + CUDAToolkit_LIBRARY_ROOT + ) +foreach (cuda_loc_var IN LISTS should_exist) + if(NOT EXISTS "${${cuda_loc_var}}") + message(FATAL_ERROR "${cuda_loc_var} variable is expected to be set to valid path") + endif() +endforeach() + + set(cuda_libs cudart cuda_driver cublas cufft cufftw curand cusolver cusparse) if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 10.1) list(APPEND cuda_libs cublasLt) diff --git a/Tests/FindX11/Test/CMakeLists.txt b/Tests/FindX11/Test/CMakeLists.txt index e39ffb1eff..3312f6f772 100644 --- a/Tests/FindX11/Test/CMakeLists.txt +++ b/Tests/FindX11/Test/CMakeLists.txt @@ -32,16 +32,38 @@ test_x11_component(x11_components Xau) test_x11_component(x11_components Xaw) test_x11_component(x11_components xcb) test_x11_component(x11_components X11_xcb) +test_x11_component(x11_components xcb_composite) test_x11_component(x11_components xcb_cursor) +test_x11_component(x11_components xcb_damage) +test_x11_component(x11_components xcb_dpms) +test_x11_component(x11_components xcb_dri2) +test_x11_component(x11_components xcb_dri3) +test_x11_component(x11_components xcb_errors) +test_x11_component(x11_components xcb_ewmh) +test_x11_component(x11_components xcb_glx) test_x11_component(x11_components xcb_icccm) +test_x11_component(x11_components xcb_image) +test_x11_component(x11_components xcb_keysyms) +test_x11_component(x11_components xcb_present) test_x11_component(x11_components xcb_randr) +test_x11_component(x11_components xcb_record) +test_x11_component(x11_components xcb_render) +test_x11_component(x11_components xcb_render_util) +test_x11_component(x11_components xcb_res) +test_x11_component(x11_components xcb_screensaver) test_x11_component(x11_components xcb_shape) +test_x11_component(x11_components xcb_shm) +test_x11_component(x11_components xcb_sync) test_x11_component(x11_components xcb_util) +test_x11_component(x11_components xcb_xf86dri) test_x11_component(x11_components xcb_xfixes) +test_x11_component(x11_components xcb_xinerama) +test_x11_component(x11_components xcb_xinput) +test_x11_component(x11_components xcb_xkb) test_x11_component(x11_components xcb_xrm) test_x11_component(x11_components xcb_xtest) -test_x11_component(x11_components xcb_keysyms) -test_x11_component(x11_components xcb_xkb) +test_x11_component(x11_components xcb_xvmc) +test_x11_component(x11_components xcb_xv) test_x11_component(x11_components Xcomposite) test_x11_component(x11_components Xdamage) test_x11_component(x11_components Xdmcp) @@ -79,13 +101,38 @@ foreach(lib Xaw xcb X11_xcb + xcb_composite xcb_cursor + xcb_damage + xcb_dpms + xcb_dri2 + xcb_dri3 + xcb_errors + xcb_ewmh + xcb_glx xcb_icccm + xcb_image + xcb_keysyms + xcb_present xcb_randr + xcb_record + xcb_render + xcb_render_util + xcb_res + xcb_screensaver xcb_shape + xcb_shm + xcb_sync xcb_util + xcb_xf86dri xcb_xfixes + xcb_xinerama + xcb_xinput + xcb_xkb xcb_xrm + xcb_xtest + xcb_xvmc + xcb_xv Xcomposite Xdamage Xdmcp diff --git a/Tests/FindX11/Test/main.c b/Tests/FindX11/Test/main.c index 5240de0f68..2542145e5f 100644 --- a/Tests/FindX11/Test/main.c +++ b/Tests/FindX11/Test/main.c @@ -326,7 +326,7 @@ static void test_Xaw(void) #endif -#ifdef HAVE_xcb +#ifdef HAVE_X11_xcb # include <xcb/xcb.h> static void test_xcb(void) @@ -336,24 +336,216 @@ static void test_xcb(void) xcb_disconnect(connection); } -# ifdef HAVE_xcb_cursor -# include <xcb/xcb_cursor.h> +#endif + +#ifdef HAVE_X11_xcb_composite +# include <xcb/composite.h> +# include <xcb/xcb.h> + +static void test_xcb_composite(void) +{ + xcb_connection_t* connection = xcb_connect(NULL, NULL); + xcb_composite_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_cursor +# include <xcb/xcb.h> +# include <xcb/xcb_cursor.h> static void test_xcb_cursor(void) { int screen_nbr; xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); - xcb_screen_t* screen = xcb_aux_get_screen(conn, screen_nbr); + xcb_screen_iterator_t screens = + xcb_setup_roots_iterator(xcb_get_setup(connection)); xcb_cursor_context_t* ctx; - xcb_cursor_context_new(connection, screen, &ctx); + xcb_cursor_context_new(connection, screens.data, &ctx); xcb_cursor_context_free(ctx); xcb_disconnect(connection); } -# endif +#endif -# ifdef HAVE_xcb_randr -# include <xcb/randr.h> +#ifdef HAVE_X11_xcb_damage +# include <xcb/damage.h> +# include <xcb/xcb.h> + +static void test_xcb_damage(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_damage_query_version_cookie_t cookie = + xcb_damage_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_dpms +# include <xcb/dpms.h> +# include <xcb/xcb.h> + +static void test_xcb_dpms(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_dpms_get_version_cookie_t cookie = + xcb_dpms_get_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_dri2 +# include <xcb/dri2.h> +# include <xcb/xcb.h> + +static void test_xcb_dri2(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_dri2_query_version_cookie_t cookie = + xcb_dri2_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_dri3 +# include <xcb/dri3.h> +# include <xcb/xcb.h> + +static void test_xcb_dri3(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_dri3_query_version_cookie_t cookie = + xcb_dri3_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_errors +# include <xcb/xcb.h> +# include <xcb/xcb_errors.h> + +static void test_xcb_errors(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_errors_context_t* context; + xcb_errors_context_new(connection, &context); + xcb_errors_context_free(context); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_ewmh +# include <xcb/xcb.h> +# include <xcb/xcb_ewmh.h> + +static void test_xcb_ewmh(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_ewmh_connection_t ewmh_connection; + xcb_intern_atom_cookie_t* cookie = + xcb_ewmh_init_atoms(connection, &ewmh_connection); + xcb_ewmh_init_atoms_replies(&ewmh_connection, cookie, NULL); + xcb_ewmh_connection_wipe(&ewmh_connection); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_glx +# include <xcb/glx.h> +# include <xcb/xcb.h> + +static void test_xcb_glx(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_glx_query_version_cookie_t cookie = + xcb_glx_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_icccm +# include <xcb/xcb.h> +# include <xcb/xcb_icccm.h> + +static void test_xcb_icccm(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_window_t root = + xcb_setup_roots_iterator(xcb_get_setup(connection)).data->root; + xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_name(connection, root); + xcb_icccm_get_text_property_reply_t reply; + xcb_icccm_get_wm_name_reply(connection, cookie, &reply, NULL); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_image +# include <xcb/xcb.h> +# include <xcb/xcb_image.h> + +static void test_xcb_image(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + // xcb_image is too convoluted/undocumented to make an + // actually working example, apologies :) + xcb_image_create(0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_keysyms +# include <xcb/xcb.h> +# include <xcb/xcb_keysyms.h> + +static void test_xcb_keysyms(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_key_symbols_t* symbols = xcb_key_symbols_alloc(connection); + if (symbols != NULL) + xcb_key_symbols_free(symbols); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_present +# include <xcb/present.h> +# include <xcb/xcb.h> + +static void test_xcb_present(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_present_query_version_cookie_t cookie = + xcb_present_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_randr +# include <xcb/randr.h> +# include <xcb/xcb.h> static void test_xcb_randr(void) { @@ -364,10 +556,86 @@ static void test_xcb_randr(void) xcb_disconnect(connection); } -# endif +#endif + +#ifdef HAVE_X11_xcb_record +# include <xcb/record.h> +# include <xcb/xcb.h> + +static void test_xcb_record(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_record_query_version_cookie_t cookie = + xcb_record_query_version(connection, 0, 0); + xcb_disconnect(connection); +} -# ifdef HAVE_xcb_shape -# include <xcb/shape.h> +#endif + +#ifdef HAVE_X11_xcb_render +# include <xcb/render.h> +# include <xcb/xcb.h> + +static void test_xcb_render(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_render_query_version_cookie_t cookie = + xcb_render_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_render_util +# include <xcb/xcb.h> +# include <xcb/xcb_renderutil.h> + +static void test_xcb_render_util(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + const xcb_render_query_version_reply_t* cookie = + xcb_render_util_query_version(connection); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_res +# include <xcb/res.h> +# include <xcb/xcb.h> + +static void test_xcb_res(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_res_query_version_cookie_t cookie = + xcb_res_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_screensaver +# include <xcb/screensaver.h> +# include <xcb/xcb.h> + +static void test_xcb_screensaver(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_screensaver_query_version_cookie_t cookie = + xcb_screensaver_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_shape +# include <xcb/shape.h> +# include <xcb/xcb.h> static void test_xcb_shape(void) { @@ -378,10 +646,39 @@ static void test_xcb_shape(void) xcb_disconnect(connection); } -# endif +#endif + +#ifdef HAVE_X11_xcb_shm +# include <xcb/shm.h> +# include <xcb/xcb.h> + +static void test_xcb_shm(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_shm_query_version_cookie_t cookie = xcb_shm_query_version(connection); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_sync +# include <xcb/sync.h> +# include <xcb/xcb.h> + +static void test_xcb_sync(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_sync_initialize_cookie_t cookie = xcb_sync_initialize(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif -# ifdef HAVE_xcb_util -# include <xcb/xcb_aux.h> +#ifdef HAVE_X11_xcb_util +# include <xcb/xcb.h> +# include <xcb/xcb_aux.h> static void test_xcb_util(void) { @@ -391,10 +688,26 @@ static void test_xcb_util(void) xcb_disconnect(connection); } -# endif +#endif + +#ifdef HAVE_X11_xcb_xf86dri +# include <xcb/xcb.h> +# include <xcb/xf86dri.h> + +static void test_xcb_xf86dri(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_xf86dri_query_version_cookie_t cookie = + xcb_xf86dri_query_version(connection); + xcb_disconnect(connection); +} + +#endif -# ifdef HAVE_xcb_xfixes -# include <xcb/xcb_xfixes.h> +#ifdef HAVE_X11_xcb_xfixes +# include <xcb/xcb.h> +# include <xcb/xfixes.h> static void test_xcb_xfixes(void) { @@ -404,10 +717,56 @@ static void test_xcb_xfixes(void) xcb_disconnect(connection); } -# endif +#endif + +#ifdef HAVE_X11_xcb_xinerama +# include <xcb/xcb.h> +# include <xcb/xinerama.h> + +static void test_xcb_xinerama(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_xinerama_query_version_cookie_t cookie = + xcb_xinerama_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_xinput +# include <xcb/xcb.h> +# include <xcb/xinput.h> + +static void test_xcb_xinput(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_input_xi_query_version_cookie_t cookie = + xcb_input_xi_query_version(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif + +#ifdef HAVE_X11_xcb_xkb +# include <xcb/xcb.h> +# include <xcb/xkb.h> + +static void test_xcb_xkb(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_xkb_use_extension_cookie_t cookie = + xcb_xkb_use_extension(connection, 0, 0); + xcb_disconnect(connection); +} + +#endif -# ifdef HAVE_xcb_xrm -# include <xcb/xcb_xrm.h> +#ifdef HAVE_X11_xcb_xrm +# include <xcb/xcb.h> +# include <xcb/xcb_xrm.h> static void test_xcb_xrm(void) { @@ -418,10 +777,11 @@ static void test_xcb_xrm(void) xcb_disconnect(connection); } -# endif +#endif -# ifdef HAVE_xcb_xtest -# include <xcb/xtest.h> +#ifdef HAVE_X11_xcb_xtest +# include <xcb/xcb.h> +# include <xcb/xtest.h> static void test_xcb_xtest(void) { @@ -431,22 +791,33 @@ static void test_xcb_xtest(void) xcb_disconnect(connection); } -# endif +#endif -# ifdef HAVE_xcb_keysyms -# include <xcb/xcb_keysyms.h> +#ifdef HAVE_X11_xcb_xvmc +# include <xcb/xcb.h> +# include <xcb/xvmc.h> -static void test_xcb_keysyms(void) +static void test_xcb_xvmc(void) { int screen_nbr; xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); - xcb_key_symbols_t* symbols = xcb_key_symbols_alloc(connection); - if (symbols != NULL) - xcb_key_symbols_free(symbols); + xcb_xvmc_query_version_cookie_t cookie = xcb_xvmc_query_version(connection); xcb_disconnect(connection); } -# endif +#endif + +#ifdef HAVE_X11_xcb_xv +# include <xcb/xcb.h> +# include <xcb/xv.h> + +static void test_xcb_xv(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_xv_query_extension_cookie_t cookie = xcb_xv_query_extension(connection); + xcb_disconnect(connection); +} #endif @@ -537,28 +908,105 @@ int main(int argc, char* argv[]) #ifdef HAVE_X11_Xaw test_Xaw, #endif -#ifdef HAVE_xcb +#ifdef HAVE_X11_xcb test_xcb, #endif -#ifdef HAVE_xcb_cursor +#ifdef HAVE_X11_xcb_composite + test_xcb_composite, +#endif +#ifdef HAVE_X11_xcb_cursor test_xcb_cursor, #endif -#ifdef HAVE_xcb_randr +#ifdef HAVE_X11_xcb_damage + test_xcb_damage, +#endif +#ifdef HAVE_X11_xcb_dpms + test_xcb_dpms, +#endif +#ifdef HAVE_X11_xcb_dri2 + test_xcb_dri2, +#endif +#ifdef HAVE_X11_xcb_dri3 + test_xcb_dri3, +#endif +#ifdef HAVE_X11_xcb_errors + test_xcb_errors, +#endif +#ifdef HAVE_X11_xcb_ewmh + test_xcb_ewmh, +#endif +#ifdef HAVE_X11_xcb_glx + test_xcb_glx, +#endif +#ifdef HAVE_X11_xcb_icccm + test_xcb_icccm, +#endif +#ifdef HAVE_X11_xcb_image + test_xcb_image, +#endif +#ifdef HAVE_X11_xcb_keysyms + test_xcb_keysyms, +#endif +#ifdef HAVE_X11_xcb_present + test_xcb_present, +#endif +#ifdef HAVE_X11_xcb_randr test_xcb_randr, #endif -#ifdef HAVE_xcb_shape +#ifdef HAVE_X11_xcb_record + test_xcb_record, +#endif +#ifdef HAVE_X11_xcb_render + test_xcb_render, +#endif +#ifdef HAVE_X11_xcb_render_util + test_xcb_render_util, +#endif +#ifdef HAVE_X11_xcb_res + test_xcb_res, +#endif +#ifdef HAVE_X11_xcb_screensaver + test_xcb_screensaver, +#endif +#ifdef HAVE_X11_xcb_shape test_xcb_shape, #endif -#ifdef HAVE_xcb_util +#ifdef HAVE_X11_xcb_shm + test_xcb_shm, +#endif +#ifdef HAVE_X11_xcb_sync + test_xcb_sync, +#endif +#ifdef HAVE_X11_xcb_util test_xcb_util, #endif -#ifdef HAVE_xcb_xfixes +#ifdef HAVE_X11_xcb_xf86dri + test_xcb_xf86dri, +#endif +#ifdef HAVE_X11_xcb_xfixes test_xcb_xfixes, #endif -#ifdef HAVE_xcb_xrm +#ifdef HAVE_X11_xcb_xinerama + test_xcb_xinerama, +#endif +#ifdef HAVE_X11_xcb_xinput + test_xcb_xinput, +#endif +#ifdef HAVE_X11_xcb_xkb + test_xcb_xkb, +#endif +#ifdef HAVE_X11_xcb_xrm test_xcb_xrm, #endif - +#ifdef HAVE_X11_xcb_xtest + test_xcb_xtest, +#endif +#ifdef HAVE_X11_xcb_xvmc + test_xcb_xvmc, +#endif +#ifdef HAVE_X11_xcb_xv + test_xcb_xv, +#endif NULL, }; @@ -567,5 +1015,6 @@ int main(int argc, char* argv[]) // always 1 in the test harness which always returns the sentinel at the end // of the array. The array logic is there to ensure that the contents of // `fptrs` is not optimized out. +#pragma GCC diagnostic ignored "-Wpointer-to-int-cast" return (int)fptrs[(sizeof(fptrs) / sizeof(*fptrs)) - argc]; } diff --git a/Tests/QtAutogen/GlobalAutogenSystemUseInclude/CMakeLists.txt b/Tests/QtAutogen/GlobalAutogenSystemUseInclude/CMakeLists.txt new file mode 100644 index 0000000000..1095fb1e66 --- /dev/null +++ b/Tests/QtAutogen/GlobalAutogenSystemUseInclude/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.26) +project(GlobalAutogenSystemUseInclude) + +include("../AutogenCoreTest.cmake") + +block() + set(test_autogen_use_system_include ON) + set(CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE ${test_autogen_use_system_include}) + + add_executable(autogen_test_on main.cpp) + get_target_property(target_autogen_use_system_include autogen_test_on AUTOGEN_USE_SYSTEM_INCLUDE) + + if(NOT ${CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE} STREQUAL ${target_autogen_use_system_include}) + message(FATAL_ERROR "CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE not set") + endif() +endblock() + +block() + set(test_autogen_use_system_include OFF) + set(CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE ${test_autogen_use_system_include}) + + add_executable(autogen_test_off main.cpp) + get_target_property(target_autogen_use_system_include autogen_test_off AUTOGEN_USE_SYSTEM_INCLUDE) + + if(NOT ${CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE} STREQUAL ${target_autogen_use_system_include}) + message(FATAL_ERROR "CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE not set") + endif() +endblock() diff --git a/Tests/QtAutogen/GlobalAutogenSystemUseInclude/main.cpp b/Tests/QtAutogen/GlobalAutogenSystemUseInclude/main.cpp new file mode 100644 index 0000000000..f8b643afbf --- /dev/null +++ b/Tests/QtAutogen/GlobalAutogenSystemUseInclude/main.cpp @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/QtAutogen/RccAutogenBuildDir/CMakeLists.txt b/Tests/QtAutogen/RccAutogenBuildDir/CMakeLists.txt new file mode 100644 index 0000000000..9bdb68986d --- /dev/null +++ b/Tests/QtAutogen/RccAutogenBuildDir/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.16) +project(RccAutogenBuildDir) +include("../AutogenCoreTest.cmake") + +set(PROJECTS_ROOT ${CMAKE_BINARY_DIR}) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +macro(set_build_type_dependent varName debugValue releaseValue + relWithDebInfoValue minSizeRelValue) + + if(CMAKE_BUILD_TYPE MATCHES Debug) + set(${varName} ${debugValue}) + elseif(CMAKE_BUILD_TYPE MATCHES Release) + set(${varName} ${releaseValue}) + elseif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) + set(${varName} ${relWithDebInfoValue}) + elseif(CMAKE_BUILD_TYPE MATCHES MinSizeRel) + set(${varName} ${minSizeRelValue}) + endif() +endmacro() + +set_build_type_dependent(AUTOGEN_DIR agd agr ags agm) +add_library(testlib SHARED lib.h lib.cpp resource.qrc) +set_target_properties(testlib PROPERTIES AUTOGEN_BUILD_DIR "${PROJECTS_ROOT}/${AUTOGEN_DIR}/testlib_ag") +target_link_libraries(testlib ${QT_LIBRARIES}) + +set_build_type_dependent(AUTOGEN_DIR agd agr ags agm) +add_executable(autorcctest main.cpp lib.h) +set_target_properties(autorcctest PROPERTIES AUTOGEN_BUILD_DIR "${PROJECTS_ROOT}/${AUTOGEN_DIR}/autorcctest_ag") +target_link_libraries(autorcctest ${QT_LIBRARIES} testlib) diff --git a/Tests/QtAutogen/RccAutogenBuildDir/lib.cpp b/Tests/QtAutogen/RccAutogenBuildDir/lib.cpp new file mode 100644 index 0000000000..3a5c48208f --- /dev/null +++ b/Tests/QtAutogen/RccAutogenBuildDir/lib.cpp @@ -0,0 +1,6 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + void foo() +{ +} diff --git a/Tests/QtAutogen/RccAutogenBuildDir/lib.h b/Tests/QtAutogen/RccAutogenBuildDir/lib.h new file mode 100644 index 0000000000..28138f189a --- /dev/null +++ b/Tests/QtAutogen/RccAutogenBuildDir/lib.h @@ -0,0 +1,6 @@ +#ifndef LIB_H +#define LIB_H + +void foo(); + +#endif diff --git a/Tests/QtAutogen/RccAutogenBuildDir/main.cpp b/Tests/QtAutogen/RccAutogenBuildDir/main.cpp new file mode 100644 index 0000000000..a211f4011e --- /dev/null +++ b/Tests/QtAutogen/RccAutogenBuildDir/main.cpp @@ -0,0 +1,7 @@ +#include "lib.h" + +int main() +{ + foo(); + return 0; +} diff --git a/Tests/QtAutogen/RccAutogenBuildDir/resource.qrc b/Tests/QtAutogen/RccAutogenBuildDir/resource.qrc new file mode 100644 index 0000000000..90f4a8379a --- /dev/null +++ b/Tests/QtAutogen/RccAutogenBuildDir/resource.qrc @@ -0,0 +1,2 @@ +<!DOCTYPE RCC> +<RCC version="1.0"/> diff --git a/Tests/QtAutogen/Tests.cmake b/Tests/QtAutogen/Tests.cmake index 412d511349..3e4f04d07e 100644 --- a/Tests/QtAutogen/Tests.cmake +++ b/Tests/QtAutogen/Tests.cmake @@ -1,8 +1,9 @@ -# Qt4 and Qt5 tests +# Qt4, Qt5 and Qt6 tests ADD_AUTOGEN_TEST(AutogenOriginDependsOff autogenOriginDependsOff) ADD_AUTOGEN_TEST(AutogenOriginDependsOn) ADD_AUTOGEN_TEST(AutogenTargetDepends) ADD_AUTOGEN_TEST(Complex QtAutogen) +ADD_AUTOGEN_TEST(GlobalAutogenSystemUseInclude) ADD_AUTOGEN_TEST(GlobalAutogenTarget) ADD_AUTOGEN_TEST(GlobalAutogenExecutable) ADD_AUTOGEN_TEST(LowMinimumVersion lowMinimumVersion) @@ -17,6 +18,7 @@ ADD_AUTOGEN_TEST(Parallel2 parallel2) ADD_AUTOGEN_TEST(Parallel3 parallel3) ADD_AUTOGEN_TEST(Parallel4 parallel4) ADD_AUTOGEN_TEST(ParallelAUTO parallelAUTO) +ADD_AUTOGEN_TEST(RccAutogenBuildDir) ADD_AUTOGEN_TEST(RccEmpty rccEmpty) ADD_AUTOGEN_TEST(RccOffMocLibrary) ADD_AUTOGEN_TEST(RccOnly rccOnly) @@ -46,7 +48,7 @@ if(QT_TEST_ALLOW_QT_MACROS) ADD_AUTOGEN_TEST(MocSkipSource) endif() -# Qt5 only tests +# Qt5 and Qt6 only tests if(QT_TEST_VERSION GREATER 4) ADD_AUTOGEN_TEST(MocMacroName mocMacroName) ADD_AUTOGEN_TEST(MocOsMacros) 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) |