summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLib/run_compile_commands.cxx2
-rw-r--r--Tests/CMakeLists.txt2
-rw-r--r--Tests/FindPython/CMakeLists.txt13
-rw-r--r--Tests/FindPython/DifferentComponents/CMakeLists.txt7
-rw-r--r--Tests/FindPython/DifferentComponents/subdir/CMakeLists.txt2
-rw-r--r--Tests/FindVulkan/Test/CMakeLists.txt23
-rw-r--r--Tests/FindVulkan/Test/main-MoltenVK.cxx16
-rw-r--r--Tests/Fortran/myc.c1
-rw-r--r--Tests/RunCMake/CMP0135/CMP0135-Common.cmake37
-rw-r--r--Tests/RunCMake/CMP0135/CMP0135-NEW-stdout.txt3
-rw-r--r--Tests/RunCMake/CMP0135/CMP0135-OLD-stdout.txt3
-rw-r--r--Tests/RunCMake/CMP0135/CMP0135-WARN-stderr.txt11
-rw-r--r--Tests/RunCMake/CMP0135/CMP0135-WARN-stdout.txt3
-rw-r--r--Tests/RunCMake/CMP0139/CMP0139-NEW.cmake25
-rw-r--r--Tests/RunCMake/CMP0139/CMP0139-OLD-result.txt1
-rw-r--r--Tests/RunCMake/CMP0139/CMP0139-OLD-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0139/CMP0139-OLD.cmake5
-rw-r--r--Tests/RunCMake/CMP0139/CMP0139-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0139/CMP0139-WARN-stderr.txt19
-rw-r--r--Tests/RunCMake/CMP0139/CMP0139-WARN.cmake4
-rw-r--r--Tests/RunCMake/CMP0139/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0139/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/CMakeRelease/FileTable-stdout.txt2
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx3
-rw-r--r--Tests/RunCMake/CheckIPOSupported/CMP0138-Common.cmake9
-rw-r--r--Tests/RunCMake/CheckIPOSupported/CMP0138-NEW-stdout.txt5
-rw-r--r--Tests/RunCMake/CheckIPOSupported/CMP0138-NEW.cmake2
-rw-r--r--Tests/RunCMake/CheckIPOSupported/CMP0138-OLD-stdout.txt3
-rw-r--r--Tests/RunCMake/CheckIPOSupported/CMP0138-OLD.cmake2
-rw-r--r--Tests/RunCMake/CheckIPOSupported/CMP0138-WARN-stdout.txt3
-rw-r--r--Tests/RunCMake/CheckIPOSupported/CMP0138-WARN.cmake2
-rw-r--r--Tests/RunCMake/CheckIPOSupported/Inspect.cmake5
-rw-r--r--Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake11
-rw-r--r--Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/DependencyProviders/AfterProject-result.txt1
-rw-r--r--Tests/RunCMake/DependencyProviders/AfterProject-stderr.txt6
-rw-r--r--Tests/RunCMake/DependencyProviders/BeforeProject-result.txt1
-rw-r--r--Tests/RunCMake/DependencyProviders/BeforeProject-stderr.txt6
-rw-r--r--Tests/RunCMake/DependencyProviders/Bypass-stdout.txt7
-rw-r--r--Tests/RunCMake/DependencyProviders/Bypass.cmake1
-rw-r--r--Tests/RunCMake/DependencyProviders/CMakeLists.txt13
-rw-r--r--Tests/RunCMake/DependencyProviders/ConfigFiles/SomeDepConfig.cmake2
-rw-r--r--Tests/RunCMake/DependencyProviders/FetchContentSerial-stdout.txt7
-rw-r--r--Tests/RunCMake/DependencyProviders/FetchContentSerial.cmake1
-rw-r--r--Tests/RunCMake/DependencyProviders/FindPackage-stdout.txt7
-rw-r--r--Tests/RunCMake/DependencyProviders/FindPackage.cmake1
-rw-r--r--Tests/RunCMake/DependencyProviders/NoCommand-result.txt1
-rw-r--r--Tests/RunCMake/DependencyProviders/NoCommand-stderr.txt3
-rw-r--r--Tests/RunCMake/DependencyProviders/NoCommandOrMethods-stdout.txt3
-rw-r--r--Tests/RunCMake/DependencyProviders/NoCommandOrMethods.cmake3
-rw-r--r--Tests/RunCMake/DependencyProviders/NoMethods-result.txt1
-rw-r--r--Tests/RunCMake/DependencyProviders/NoMethods-stderr.txt2
-rw-r--r--Tests/RunCMake/DependencyProviders/PassThroughProvider-stdout.txt7
-rw-r--r--Tests/RunCMake/DependencyProviders/PassThroughProvider.cmake1
-rw-r--r--Tests/RunCMake/DependencyProviders/ProjectIncludeAfter-result.txt1
-rw-r--r--Tests/RunCMake/DependencyProviders/ProjectIncludeAfter-stderr.txt6
-rw-r--r--Tests/RunCMake/DependencyProviders/ProjectIncludeBefore-result.txt1
-rw-r--r--Tests/RunCMake/DependencyProviders/ProjectIncludeBefore-stderr.txt6
-rw-r--r--Tests/RunCMake/DependencyProviders/Recurse-stdout.txt7
-rw-r--r--Tests/RunCMake/DependencyProviders/Recurse.cmake8
-rw-r--r--Tests/RunCMake/DependencyProviders/RedirectFetchContentSerial-result.txt1
-rw-r--r--Tests/RunCMake/DependencyProviders/RedirectFetchContentSerial-stderr.txt11
-rw-r--r--Tests/RunCMake/DependencyProviders/RedirectFetchContentSerial-stdout.txt5
-rw-r--r--Tests/RunCMake/DependencyProviders/RedirectFetchContentSerial.cmake1
-rw-r--r--Tests/RunCMake/DependencyProviders/RedirectFindPackage-stdout.txt7
-rw-r--r--Tests/RunCMake/DependencyProviders/RedirectFindPackage.cmake1
-rw-r--r--Tests/RunCMake/DependencyProviders/RunCMakeTest.cmake73
-rw-r--r--Tests/RunCMake/DependencyProviders/ToolchainFile-result.txt1
-rw-r--r--Tests/RunCMake/DependencyProviders/ToolchainFile-stderr.txt6
-rw-r--r--Tests/RunCMake/DependencyProviders/set_provider.cmake64
-rw-r--r--Tests/RunCMake/DependencyProviders/try_methods.cmake12
-rw-r--r--Tests/RunCMake/ExternalProject/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/FetchContent_find_package/ChildScope/CMakeLists.txt11
-rw-r--r--Tests/RunCMake/FetchContent_find_package/GLOBAL.cmake50
-rw-r--r--Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindEventuallyGlobal.cmake6
-rw-r--r--Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindGlobalWithArgsKeyword.cmake6
-rw-r--r--Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindGlobalWithoutArgsKeyword.cmake6
-rw-r--r--Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindLocalWithArgsKeyword.cmake6
-rw-r--r--Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindLocalWithoutArgsKeyword.cmake6
-rw-r--r--Tests/RunCMake/FetchContent_find_package/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake22
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-stdout.txt4
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH.cmake19
-rw-r--r--Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/GenEx-PATH/ABSOLUTE_PATH.cmake.in34
-rw-r--r--Tests/RunCMake/GenEx-PATH/APPEND.cmake.in68
-rw-r--r--Tests/RunCMake/GenEx-PATH/CMAKE_PATH.cmake.in53
-rw-r--r--Tests/RunCMake/GenEx-PATH/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/GenEx-PATH/GET_ITEM.cmake.in311
-rw-r--r--Tests/RunCMake/GenEx-PATH/HAS_ITEM.cmake.in199
-rw-r--r--Tests/RunCMake/GenEx-PATH/IS_ABSOLUTE.cmake.in44
-rw-r--r--Tests/RunCMake/GenEx-PATH/IS_PREFIX.cmake.in25
-rw-r--r--Tests/RunCMake/GenEx-PATH/IS_RELATIVE.cmake.in45
-rw-r--r--Tests/RunCMake/GenEx-PATH/NORMAL_PATH.cmake.in43
-rw-r--r--Tests/RunCMake/GenEx-PATH/RELATIVE_PATH.cmake.in64
-rw-r--r--Tests/RunCMake/GenEx-PATH/REMOVE_ITEM.cmake.in65
-rw-r--r--Tests/RunCMake/GenEx-PATH/REPLACE_ITEM.cmake.in73
-rw-r--r--Tests/RunCMake/GenEx-PATH/RunCMakeTest.cmake68
-rw-r--r--Tests/RunCMake/GenEx-PATH/bad-option-result.txt1
-rw-r--r--Tests/RunCMake/GenEx-PATH/bad-option-stderr.txt8
-rw-r--r--Tests/RunCMake/GenEx-PATH/bad-option.cmake2
-rw-r--r--Tests/RunCMake/GenEx-PATH/check_errors.cmake13
-rw-r--r--Tests/RunCMake/GenEx-PATH/generate.cmake2
-rw-r--r--Tests/RunCMake/GenEx-PATH/no-arguments-result.txt1
-rw-r--r--Tests/RunCMake/GenEx-PATH/no-arguments-stderr.txt8
-rw-r--r--Tests/RunCMake/GenEx-PATH/no-arguments.cmake2
-rw-r--r--Tests/RunCMake/GenEx-PATH/unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/GenEx-PATH/unexpected-arg-stderr.txt8
-rw-r--r--Tests/RunCMake/GenEx-PATH/unexpected-arg.cmake2
-rw-r--r--Tests/RunCMake/GenEx-PATH/unexpected-arg2-stderr.txt9
-rw-r--r--Tests/RunCMake/GenEx-PATH_EQUAL/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/GenEx-PATH_EQUAL/PATH_EQUAL.cmake.in8
-rw-r--r--Tests/RunCMake/GenEx-PATH_EQUAL/RunCMakeTest.cmake14
-rw-r--r--Tests/RunCMake/GenEx-PATH_EQUAL/WrongArguments-result.txt1
-rw-r--r--Tests/RunCMake/GenEx-PATH_EQUAL/WrongArguments-stderr.txt42
-rw-r--r--Tests/RunCMake/GenEx-PATH_EQUAL/WrongArguments.cmake7
-rw-r--r--Tests/RunCMake/GenEx-PATH_EQUAL/check_errors.cmake12
-rw-r--r--Tests/RunCMake/GenEx-PATH_EQUAL/generate.cmake2
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/ExternalProject.cmake9
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/PrintHelpers/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/PrintHelpers/Properties-stdout.txt14
-rw-r--r--Tests/RunCMake/PrintHelpers/Properties.cmake26
-rw-r--r--Tests/RunCMake/PrintHelpers/PropertiesSources-stdout.cmake8
-rw-r--r--Tests/RunCMake/PrintHelpers/PropertiesSources.cmake19
-rw-r--r--Tests/RunCMake/PrintHelpers/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/PrintHelpers/Variables-stdout.txt1
-rw-r--r--Tests/RunCMake/PrintHelpers/Variables.cmake6
-rw-r--r--Tests/RunCMake/PrintHelpers/nothing.c6
-rw-r--r--Tests/RunCMake/PrintHelpers/nothing.h8
-rw-r--r--Tests/RunCMake/PrintHelpers/rot13.c15
-rw-r--r--Tests/RunCMake/PrintHelpers/rot13.h9
-rw-r--r--Tests/RunCMake/PrintHelpers/something.c7
-rw-r--r--Tests/RunCMake/PrintHelpers/something.h8
-rw-r--r--Tests/RunCMake/RunCMake.cmake2
-rw-r--r--Tests/RunCMake/VS10Project/VsNoCompileBatching.cmake2
-rw-r--r--Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake10
-rw-r--r--Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent-result.txt1
-rw-r--r--Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent-stderr.txt9
-rw-r--r--Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent.cmake5
-rw-r--r--Tests/RunCMake/VerifyHeaderSets/error.h3
143 files changed, 2079 insertions, 44 deletions
diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx
index 0ebe00e7d4..0585774456 100644
--- a/Tests/CMakeLib/run_compile_commands.cxx
+++ b/Tests/CMakeLib/run_compile_commands.cxx
@@ -115,7 +115,7 @@ private:
void Next()
{
- this->C = char(this->Input.get());
+ this->C = static_cast<char>(this->Input.get());
if (this->Input.bad()) {
this->ErrorExit("Unexpected end of file.");
}
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 7fdfaeaeeb..24e98f4923 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -3367,7 +3367,7 @@ if(BUILD_TESTING)
set(JavaExportImport_BUILD_OPTIONS -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM})
ADD_TEST_MACRO(JavaExportImport JavaExportImport)
- get_filename_component(JNIPATH ${JAVA_COMPILE} PATH)
+ get_filename_component(JNIPATH ${Java_JAVAC_EXECUTABLE} PATH)
find_file(JNI_H jni.h
"${JNIPATH}/../include"
"${JNIPATH}/../java/include")
diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt
index 520ba9e166..d4cf36b33d 100644
--- a/Tests/FindPython/CMakeLists.txt
+++ b/Tests/FindPython/CMakeLists.txt
@@ -423,6 +423,19 @@ if(CMake_TEST_FindPython)
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+ add_test(NAME FindPython.DifferentComponents COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/DifferentComponents"
+ "${CMake_BINARY_DIR}/Tests/FindPython/DifferentComponents"
+ ${build_generator_args}
+ --build-project DifferentComponents
+ --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}"
+ "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}"
+ "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}"
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+
if (CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
add_test(NAME FindPython.Interpreter.SOABI COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
diff --git a/Tests/FindPython/DifferentComponents/CMakeLists.txt b/Tests/FindPython/DifferentComponents/CMakeLists.txt
new file mode 100644
index 0000000000..7476632a4e
--- /dev/null
+++ b/Tests/FindPython/DifferentComponents/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(TestDifferentComponents LANGUAGES C)
+
+add_subdirectory(subdir)
+
+find_package(Python3 REQUIRED COMPONENTS Development.Module)
diff --git a/Tests/FindPython/DifferentComponents/subdir/CMakeLists.txt b/Tests/FindPython/DifferentComponents/subdir/CMakeLists.txt
new file mode 100644
index 0000000000..98fcd5f51c
--- /dev/null
+++ b/Tests/FindPython/DifferentComponents/subdir/CMakeLists.txt
@@ -0,0 +1,2 @@
+
+find_package(Python3 REQUIRED COMPONENTS Development)
diff --git a/Tests/FindVulkan/Test/CMakeLists.txt b/Tests/FindVulkan/Test/CMakeLists.txt
index a492daa702..42543ac6fd 100644
--- a/Tests/FindVulkan/Test/CMakeLists.txt
+++ b/Tests/FindVulkan/Test/CMakeLists.txt
@@ -3,28 +3,37 @@ cmake_policy(SET CMP0091 NEW)
project(TestFindVulkan C CXX)
include(CTest)
+set(components
+ glslang
+ shaderc_combined
+ SPIRV-Tools
+)
+if(APPLE)
+ list(APPEND components MoltenVK)
+endif()
find_package(Vulkan REQUIRED
- COMPONENTS
- glslang
- shaderc_combined
- SPIRV-Tools)
+ COMPONENTS ${components})
add_executable(test_tgt main.c)
target_link_libraries(test_tgt Vulkan::Vulkan)
+target_compile_features(test_tgt PRIVATE cxx_std_11)
add_test(NAME test_tgt COMMAND test_tgt)
add_executable(test_var main.c)
target_include_directories(test_var PRIVATE ${Vulkan_INCLUDE_DIRS})
target_link_libraries(test_var PRIVATE ${Vulkan_LIBRARIES})
+target_compile_features(test_var PRIVATE cxx_std_11)
add_test(NAME test_var COMMAND test_var)
add_executable(test_tgt_dl main-dynamicVulkanLoading.cpp)
target_link_libraries(test_tgt_dl Vulkan::Headers ${CMAKE_DL_LIBS})
+target_compile_features(test_tgt_dl PRIVATE cxx_std_11)
add_test(NAME test_tgt_dl COMMAND test_tgt_dl)
add_executable(test_var_dl main-dynamicVulkanLoading.cpp)
target_include_directories(test_var_dl PRIVATE ${Vulkan_INCLUDE_DIRS})
target_link_libraries(test_var_dl ${CMAKE_DL_LIBS})
+target_compile_features(test_var_dl PRIVATE cxx_std_11)
add_test(NAME test_var_dl COMMAND test_var_dl)
add_executable(test_tgt_glslang main-glslang.cxx)
@@ -60,6 +69,12 @@ if(NOT SPIRV-Tools_debug_location)
MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
endif()
+if(APPLE)
+ add_executable(test_tgt_MoltenVK main-MoltenVK.cxx)
+ target_link_libraries(test_tgt_MoltenVK Vulkan::MoltenVK)
+ add_test(NAME test_tgt_MoltenVK COMMAND test_tgt_MoltenVK)
+endif()
+
if(Vulkan_GLSLC_EXECUTABLE)
add_test(NAME test_glslc
COMMAND ${CMAKE_COMMAND}
diff --git a/Tests/FindVulkan/Test/main-MoltenVK.cxx b/Tests/FindVulkan/Test/main-MoltenVK.cxx
new file mode 100644
index 0000000000..3156979b3f
--- /dev/null
+++ b/Tests/FindVulkan/Test/main-MoltenVK.cxx
@@ -0,0 +1,16 @@
+#include <iostream>
+
+#include <MoltenVK/vk_mvk_moltenvk.h>
+
+int main()
+{
+ char mvk_version[256];
+ char vk_version[256];
+ vkGetVersionStringsMVK(mvk_version, sizeof(mvk_version), vk_version,
+ sizeof(vk_version));
+
+ std::cout << "MoltenVK version: " << mvk_version << std::endl;
+ std::cout << "Vulkan version: " << vk_version << std::endl;
+
+ return 0;
+}
diff --git a/Tests/Fortran/myc.c b/Tests/Fortran/myc.c
index 1a4d5a4957..689d90c8cc 100644
--- a/Tests/Fortran/myc.c
+++ b/Tests/Fortran/myc.c
@@ -1,5 +1,6 @@
#include "foo.h"
extern void F_test_mod_sub(void);
+extern void F_my_sub(void);
extern void F_mysub(void);
int myc(void)
{
diff --git a/Tests/RunCMake/CMP0135/CMP0135-Common.cmake b/Tests/RunCMake/CMP0135/CMP0135-Common.cmake
index 4b7cce5519..ad60b7cef8 100644
--- a/Tests/RunCMake/CMP0135/CMP0135-Common.cmake
+++ b/Tests/RunCMake/CMP0135/CMP0135-Common.cmake
@@ -1,7 +1,8 @@
+#==============================================================================
+# ExternalProject
+#==============================================================================
+set(stamp_dir "${CMAKE_CURRENT_BINARY_DIR}/stamps-ep")
include(ExternalProject)
-
-set(stamp_dir "${CMAKE_CURRENT_BINARY_DIR}/stamps")
-
ExternalProject_Add(fake_ext_proj
# We don't actually do a build, so we never try to download from this URL
URL https://example.com/something.zip
@@ -12,7 +13,33 @@ ExternalProject_Add(fake_ext_proj
set(extraction_script "${stamp_dir}/extract-fake_ext_proj.cmake")
file(STRINGS "${extraction_script}" results REGEX "--touch")
if("${results}" STREQUAL "")
- message(STATUS "Using timestamps from archive")
+ message(STATUS "ExternalProject: Using timestamps from archive")
+else()
+ message(STATUS "ExternalProject: Using extraction time for the timestamps")
+endif()
+
+#==============================================================================
+# FetchContent
+#==============================================================================
+set(stamp_dir "${CMAKE_CURRENT_BINARY_DIR}/stamps-fc")
+set(archive_file ${CMAKE_CURRENT_BINARY_DIR}/test_archive.7z)
+file(ARCHIVE_CREATE
+ OUTPUT ${archive_file}
+ PATHS ${CMAKE_CURRENT_LIST_DIR}
+ FORMAT 7zip
+)
+include(FetchContent)
+FetchContent_Declare(fake_fc_proj
+ URL file://${archive_file}
+ STAMP_DIR ${stamp_dir}
+)
+FetchContent_MakeAvailable(fake_fc_proj)
+
+# Report whether the --touch option was added to the extraction script
+set(extraction_script "${stamp_dir}/extract-fake_fc_proj-populate.cmake")
+file(STRINGS "${extraction_script}" results REGEX "--touch")
+if("${results}" STREQUAL "")
+ message(STATUS "FetchContent: Using timestamps from archive")
else()
- message(STATUS "Using extraction time for the timestamps")
+ message(STATUS "FetchContent: Using extraction time for the timestamps")
endif()
diff --git a/Tests/RunCMake/CMP0135/CMP0135-NEW-stdout.txt b/Tests/RunCMake/CMP0135/CMP0135-NEW-stdout.txt
index bf53c0bdac..ceef9b855b 100644
--- a/Tests/RunCMake/CMP0135/CMP0135-NEW-stdout.txt
+++ b/Tests/RunCMake/CMP0135/CMP0135-NEW-stdout.txt
@@ -1 +1,2 @@
-Using extraction time for the timestamps
+-- ExternalProject: Using extraction time for the timestamps
+-- FetchContent: Using extraction time for the timestamps
diff --git a/Tests/RunCMake/CMP0135/CMP0135-OLD-stdout.txt b/Tests/RunCMake/CMP0135/CMP0135-OLD-stdout.txt
index ee57beb14c..1288c200dc 100644
--- a/Tests/RunCMake/CMP0135/CMP0135-OLD-stdout.txt
+++ b/Tests/RunCMake/CMP0135/CMP0135-OLD-stdout.txt
@@ -1 +1,2 @@
-Using timestamps from archive
+-- ExternalProject: Using timestamps from archive
+-- FetchContent: Using timestamps from archive
diff --git a/Tests/RunCMake/CMP0135/CMP0135-WARN-stderr.txt b/Tests/RunCMake/CMP0135/CMP0135-WARN-stderr.txt
index 8ba00274f2..6bf944e4df 100644
--- a/Tests/RunCMake/CMP0135/CMP0135-WARN-stderr.txt
+++ b/Tests/RunCMake/CMP0135/CMP0135-WARN-stderr.txt
@@ -8,3 +8,14 @@ CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+ \(message\):
what you want\. Update your project to the NEW behavior or specify the
DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
robustness issue\.
+.*
+CMake Warning \(dev\) at .*/Modules/FetchContent.cmake:[0-9]+ \(message\):
+ The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
+ not set\. The policy's OLD behavior will be used\. When using a URL
+ download, the timestamps of extracted files should preferably be that of
+ the time of extraction, otherwise code that depends on the extracted
+ contents might not be rebuilt if the URL changes\. The OLD behavior
+ preserves the timestamps from the archive instead, but this is usually not
+ what you want\. Update your project to the NEW behavior or specify the
+ DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
+ robustness issue\.
diff --git a/Tests/RunCMake/CMP0135/CMP0135-WARN-stdout.txt b/Tests/RunCMake/CMP0135/CMP0135-WARN-stdout.txt
index ee57beb14c..1288c200dc 100644
--- a/Tests/RunCMake/CMP0135/CMP0135-WARN-stdout.txt
+++ b/Tests/RunCMake/CMP0135/CMP0135-WARN-stdout.txt
@@ -1 +1,2 @@
-Using timestamps from archive
+-- ExternalProject: Using timestamps from archive
+-- FetchContent: Using timestamps from archive
diff --git a/Tests/RunCMake/CMP0139/CMP0139-NEW.cmake b/Tests/RunCMake/CMP0139/CMP0139-NEW.cmake
new file mode 100644
index 0000000000..8144696258
--- /dev/null
+++ b/Tests/RunCMake/CMP0139/CMP0139-NEW.cmake
@@ -0,0 +1,25 @@
+cmake_policy(SET CMP0139 NEW)
+
+
+set(path "a///b/c")
+if (NOT path PATH_EQUAL "a/b/c")
+ message(SEND_ERROR "if(PATH_EQUAL): '${path}' not equal to 'a/b/c'")
+endif()
+set(path2 "a/b/c")
+if (NOT path PATH_EQUAL path2)
+ message(SEND_ERROR "if(PATH_EQUAL): '${path}' not equal to '${path2}'")
+endif()
+
+set (path "a/b/d/../c")
+if (path PATH_EQUAL "a/b/c")
+ message(SEND_ERROR "if(PATH_EQUAL): '${path}' equal to 'a/b/c'")
+endif()
+set(path2 "a/b/c")
+if ("a/b/d/../c" PATH_EQUAL path2)
+ message(SEND_ERROR "if(PATH_EQUAL): 'a/b/d/../c' equal to '${path2}'")
+endif()
+
+cmake_path(NORMAL_PATH path)
+if (NOT path PATH_EQUAL "a/b/c")
+ message(SEND_ERROR "if(PATH_EQUAL): '${path}' not equal to 'a/b/c'")
+endif()
diff --git a/Tests/RunCMake/CMP0139/CMP0139-OLD-result.txt b/Tests/RunCMake/CMP0139/CMP0139-OLD-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CMP0139/CMP0139-OLD-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0139/CMP0139-OLD-stderr.txt b/Tests/RunCMake/CMP0139/CMP0139-OLD-stderr.txt
new file mode 100644
index 0000000000..1cfb319449
--- /dev/null
+++ b/Tests/RunCMake/CMP0139/CMP0139-OLD-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at CMP0139-OLD.cmake:[0-9]+ \(if\):
+ if given arguments:
+
+ "/path1" "PATH_EQUAL" "/path2"
+
+ Unknown arguments specified
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CMP0139/CMP0139-OLD.cmake b/Tests/RunCMake/CMP0139/CMP0139-OLD.cmake
new file mode 100644
index 0000000000..e813a472f8
--- /dev/null
+++ b/Tests/RunCMake/CMP0139/CMP0139-OLD.cmake
@@ -0,0 +1,5 @@
+cmake_policy(SET CMP0139 OLD)
+
+if("/path1" PATH_EQUAL "/path2")
+ message("PATH_EQUAL recognized")
+endif()
diff --git a/Tests/RunCMake/CMP0139/CMP0139-WARN-result.txt b/Tests/RunCMake/CMP0139/CMP0139-WARN-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CMP0139/CMP0139-WARN-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0139/CMP0139-WARN-stderr.txt b/Tests/RunCMake/CMP0139/CMP0139-WARN-stderr.txt
new file mode 100644
index 0000000000..6a873cac44
--- /dev/null
+++ b/Tests/RunCMake/CMP0139/CMP0139-WARN-stderr.txt
@@ -0,0 +1,19 @@
+CMake Warning \(dev\) at CMP0139-WARN.cmake:[0-9]+ \(if\):
+ Policy CMP0139 is not set: The if\(\) command supports path comparisons using
+ PATH_EQUAL operator. Run "cmake --help-policy CMP0139" for policy details.
+ Use the cmake_policy command to set the policy and suppress this warning.
+
+ PATH_EQUAL will be interpreted as an operator when the policy is set to
+ NEW. Since the policy is not set the OLD behavior will be used.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Error at CMP0139-WARN.cmake:[0-9]+ \(if\):
+ if given arguments:
+
+ "/path1" "PATH_EQUAL" "/path2"
+
+ Unknown arguments specified
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CMP0139/CMP0139-WARN.cmake b/Tests/RunCMake/CMP0139/CMP0139-WARN.cmake
new file mode 100644
index 0000000000..d74753e26c
--- /dev/null
+++ b/Tests/RunCMake/CMP0139/CMP0139-WARN.cmake
@@ -0,0 +1,4 @@
+
+if("/path1" PATH_EQUAL "/path2")
+ message("PATH_EQUAL recognized")
+endif()
diff --git a/Tests/RunCMake/CMP0139/CMakeLists.txt b/Tests/RunCMake/CMP0139/CMakeLists.txt
new file mode 100644
index 0000000000..18dfd2686f
--- /dev/null
+++ b/Tests/RunCMake/CMP0139/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.2)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0139/RunCMakeTest.cmake b/Tests/RunCMake/CMP0139/RunCMakeTest.cmake
new file mode 100644
index 0000000000..2dbea3c16e
--- /dev/null
+++ b/Tests/RunCMake/CMP0139/RunCMakeTest.cmake
@@ -0,0 +1,5 @@
+include(RunCMake)
+
+run_cmake(CMP0139-OLD)
+run_cmake(CMP0139-WARN)
+run_cmake(CMP0139-NEW)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 4fe6ac1d8b..5325a3a45d 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -150,6 +150,7 @@ endif()
add_RunCMake_test(CMP0132)
add_RunCMake_test(CMP0135)
+add_RunCMake_test(CMP0139)
# The test for Policy 65 requires the use of the
# CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode
@@ -330,6 +331,8 @@ add_RunCMake_test(GenEx-LINK_GROUP)
add_RunCMake_test(GenEx-TARGET_FILE -DLINKER_SUPPORTS_PDB=${LINKER_SUPPORTS_PDB})
add_RunCMake_test(GenEx-GENEX_EVAL)
add_RunCMake_test(GenEx-TARGET_RUNTIME_DLLS)
+add_RunCMake_test(GenEx-PATH)
+add_RunCMake_test(GenEx-PATH_EQUAL)
add_RunCMake_test(GeneratorExpression)
add_RunCMake_test(GeneratorInstance)
add_RunCMake_test(GeneratorPlatform)
@@ -459,8 +462,10 @@ add_RunCMake_test(load_cache)
add_RunCMake_test(math)
add_RunCMake_test(message)
add_RunCMake_test(option)
+add_RunCMake_test(PrintHelpers)
add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES})
add_RunCMake_test(project_injected)
+add_RunCMake_test(DependencyProviders)
add_RunCMake_test(return)
add_RunCMake_test(separate_arguments)
add_RunCMake_test(set_property)
diff --git a/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt b/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt
index 37eb91e66a..2960eeb0c3 100644
--- a/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt
+++ b/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt
@@ -17,6 +17,8 @@
"cmake-@version@-windows-i386\.zip"
"cmake-@version@-windows-x86_64\.msi"
"cmake-@version@-windows-x86_64\.zip"
+"cmake-@version@-windows-arm64\.msi"
+"cmake-@version@-windows-arm64\.zip"
"cmake-@version@\.tar\.gz"
"cmake-@version@\.zip"
-- query: \.files\[\] \| select\(\.os\[\] \| \. == "source"\) \| \.name
diff --git a/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx b/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx
index daf8a2d808..5c6c8d87b6 100644
--- a/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx
+++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx
@@ -89,7 +89,8 @@ static int doWrite(int argc, char const* const* argv)
return 1;
}
int resourceGroupCount = std::atoi(resourceGroupCountEnv);
- if (resourceGroups.size() != std::size_t(resourceGroupCount)) {
+ if (resourceGroups.size() !=
+ static_cast<std::size_t>(resourceGroupCount)) {
std::cout
<< "CTEST_RESOURCE_GROUP_COUNT does not match expected resource groups"
<< std::endl
diff --git a/Tests/RunCMake/CheckIPOSupported/CMP0138-Common.cmake b/Tests/RunCMake/CheckIPOSupported/CMP0138-Common.cmake
new file mode 100644
index 0000000000..508e6c3acb
--- /dev/null
+++ b/Tests/RunCMake/CheckIPOSupported/CMP0138-Common.cmake
@@ -0,0 +1,9 @@
+enable_language(C)
+string(APPEND CMAKE_C_FLAGS " -DFOO")
+string(APPEND CMAKE_C_FLAGS_DEBUG " -DBAR")
+check_ipo_supported(RESULT ipo_supported)
+file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/_CMakeLTOTest-C/bin/CMakeCache.txt"
+ cached_flags REGEX "^CMAKE_C_FLAGS(_DEBUG)?:")
+foreach(line IN LISTS cached_flags)
+ message(STATUS "${line}")
+endforeach()
diff --git a/Tests/RunCMake/CheckIPOSupported/CMP0138-NEW-stdout.txt b/Tests/RunCMake/CheckIPOSupported/CMP0138-NEW-stdout.txt
new file mode 100644
index 0000000000..aa150a82ea
--- /dev/null
+++ b/Tests/RunCMake/CheckIPOSupported/CMP0138-NEW-stdout.txt
@@ -0,0 +1,5 @@
+-- CMAKE_C_FLAGS:STRING=[^
+]*-DFOO
+-- CMAKE_C_FLAGS_DEBUG:STRING=[^
+]*-DBAR
+--
diff --git a/Tests/RunCMake/CheckIPOSupported/CMP0138-NEW.cmake b/Tests/RunCMake/CheckIPOSupported/CMP0138-NEW.cmake
new file mode 100644
index 0000000000..66115045d9
--- /dev/null
+++ b/Tests/RunCMake/CheckIPOSupported/CMP0138-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0138 NEW)
+include(CMP0138-Common.cmake)
diff --git a/Tests/RunCMake/CheckIPOSupported/CMP0138-OLD-stdout.txt b/Tests/RunCMake/CheckIPOSupported/CMP0138-OLD-stdout.txt
new file mode 100644
index 0000000000..c80b208ccc
--- /dev/null
+++ b/Tests/RunCMake/CheckIPOSupported/CMP0138-OLD-stdout.txt
@@ -0,0 +1,3 @@
+-- CMAKE_C_FLAGS:STRING=([^-]|-[^D]|-D[^F]|-DF[^O]|-DFO[^O])*
+-- CMAKE_C_FLAGS_DEBUG:STRING=([^-]|-[^D]|-D[^B]|-DB[^A]|-DBA[^R])*
+--
diff --git a/Tests/RunCMake/CheckIPOSupported/CMP0138-OLD.cmake b/Tests/RunCMake/CheckIPOSupported/CMP0138-OLD.cmake
new file mode 100644
index 0000000000..b16ac9f855
--- /dev/null
+++ b/Tests/RunCMake/CheckIPOSupported/CMP0138-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0138 OLD)
+include(CMP0138-Common.cmake)
diff --git a/Tests/RunCMake/CheckIPOSupported/CMP0138-WARN-stdout.txt b/Tests/RunCMake/CheckIPOSupported/CMP0138-WARN-stdout.txt
new file mode 100644
index 0000000000..c80b208ccc
--- /dev/null
+++ b/Tests/RunCMake/CheckIPOSupported/CMP0138-WARN-stdout.txt
@@ -0,0 +1,3 @@
+-- CMAKE_C_FLAGS:STRING=([^-]|-[^D]|-D[^F]|-DF[^O]|-DFO[^O])*
+-- CMAKE_C_FLAGS_DEBUG:STRING=([^-]|-[^D]|-D[^B]|-DB[^A]|-DBA[^R])*
+--
diff --git a/Tests/RunCMake/CheckIPOSupported/CMP0138-WARN.cmake b/Tests/RunCMake/CheckIPOSupported/CMP0138-WARN.cmake
new file mode 100644
index 0000000000..01118eeb2b
--- /dev/null
+++ b/Tests/RunCMake/CheckIPOSupported/CMP0138-WARN.cmake
@@ -0,0 +1,2 @@
+# (leave CMP0138 unset)
+include(CMP0138-Common.cmake)
diff --git a/Tests/RunCMake/CheckIPOSupported/Inspect.cmake b/Tests/RunCMake/CheckIPOSupported/Inspect.cmake
new file mode 100644
index 0000000000..07e4258850
--- /dev/null
+++ b/Tests/RunCMake/CheckIPOSupported/Inspect.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/info.cmake" "
+set(_CMAKE_C_IPO_SUPPORTED_BY_CMAKE \"${_CMAKE_C_IPO_SUPPORTED_BY_CMAKE}\")
+set(_CMAKE_C_IPO_MAY_BE_SUPPORTED_BY_COMPILER \"${_CMAKE_C_IPO_MAY_BE_SUPPORTED_BY_COMPILER}\")
+")
diff --git a/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake b/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake
index b7d524ccf0..2fb159e919 100644
--- a/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake
@@ -1,5 +1,8 @@
include(RunCMake)
+run_cmake(Inspect)
+include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake")
+
run_cmake(unparsed-arguments)
run_cmake(user-lang-unknown)
run_cmake(default-lang-none)
@@ -8,6 +11,14 @@ run_cmake(not-supported-by-compiler)
run_cmake(save-to-result)
run_cmake(cmp0069-is-old)
+if(_CMAKE_C_IPO_SUPPORTED_BY_CMAKE
+ AND _CMAKE_C_IPO_MAY_BE_SUPPORTED_BY_COMPILER
+ AND NOT RunCMake_GENERATOR MATCHES "^Visual Studio 9 ")
+ run_cmake(CMP0138-WARN)
+ run_cmake(CMP0138-OLD)
+ run_cmake(CMP0138-NEW)
+endif()
+
if(RunCMake_GENERATOR MATCHES "^Visual Studio 9 ")
run_cmake(not-supported-by-generator)
endif()
diff --git a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
index ad9619e9fe..a001c5d88d 100644
--- a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
@@ -71,11 +71,7 @@ macro(mangle_flags variable)
endmacro()
function(test_cmp0128_old_same_standard)
- if(extensions_default)
- set(flag_ext "_EXT")
- endif()
-
- set(flag "${${lang}${${lang}_STANDARD_DEFAULT}${flag_ext}_FLAG}")
+ set(flag "${${lang}${${lang}_STANDARD_DEFAULT}_EXT_FLAG}")
if(NOT flag)
return()
diff --git a/Tests/RunCMake/DependencyProviders/AfterProject-result.txt b/Tests/RunCMake/DependencyProviders/AfterProject-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/AfterProject-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/DependencyProviders/AfterProject-stderr.txt b/Tests/RunCMake/DependencyProviders/AfterProject-stderr.txt
new file mode 100644
index 0000000000..7bee23c15f
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/AfterProject-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at set_provider\.cmake:[0-9]+ \(cmake_language\):
+ cmake_language Dependency providers can only be set as part of the first
+ call to project\(\)\. More specifically,
+ cmake_language\(SET_DEPENDENCY_PROVIDER\) can only be called while the first
+ project\(\) command processes files listed in
+ CMAKE_PROJECT_TOP_LEVEL_INCLUDES\.
diff --git a/Tests/RunCMake/DependencyProviders/BeforeProject-result.txt b/Tests/RunCMake/DependencyProviders/BeforeProject-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/BeforeProject-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/DependencyProviders/BeforeProject-stderr.txt b/Tests/RunCMake/DependencyProviders/BeforeProject-stderr.txt
new file mode 100644
index 0000000000..7bee23c15f
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/BeforeProject-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at set_provider\.cmake:[0-9]+ \(cmake_language\):
+ cmake_language Dependency providers can only be set as part of the first
+ call to project\(\)\. More specifically,
+ cmake_language\(SET_DEPENDENCY_PROVIDER\) can only be called while the first
+ project\(\) command processes files listed in
+ CMAKE_PROJECT_TOP_LEVEL_INCLUDES\.
diff --git a/Tests/RunCMake/DependencyProviders/Bypass-stdout.txt b/Tests/RunCMake/DependencyProviders/Bypass-stdout.txt
new file mode 100644
index 0000000000..b0c7e6e3ad
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/Bypass-stdout.txt
@@ -0,0 +1,7 @@
+-- Before cmake_language
+-- After cmake_language
+-- Forwarding find_package\(SomeDep\)
+-- Provider invoked for method FIND_PACKAGE with args: QUIET;REQUIRED
+-- SomeDepConfig\.cmake was used
+-- Leaving provider
+-- Configuring done
diff --git a/Tests/RunCMake/DependencyProviders/Bypass.cmake b/Tests/RunCMake/DependencyProviders/Bypass.cmake
new file mode 100644
index 0000000000..883087e323
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/Bypass.cmake
@@ -0,0 +1 @@
+find_package(SomeDep QUIET REQUIRED)
diff --git a/Tests/RunCMake/DependencyProviders/CMakeLists.txt b/Tests/RunCMake/DependencyProviders/CMakeLists.txt
new file mode 100644
index 0000000000..355260485e
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/CMakeLists.txt
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 3.23...3.24)
+
+if(DEFINED include_before_project)
+ include("${include_before_project}")
+endif()
+
+project(${RunCMake_TEST} NONE)
+
+if(DEFINED include_after_project)
+ include("${include_after_project}")
+endif()
+
+include(${RunCMake_TEST}.cmake OPTIONAL)
diff --git a/Tests/RunCMake/DependencyProviders/ConfigFiles/SomeDepConfig.cmake b/Tests/RunCMake/DependencyProviders/ConfigFiles/SomeDepConfig.cmake
new file mode 100644
index 0000000000..e04eefe192
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/ConfigFiles/SomeDepConfig.cmake
@@ -0,0 +1,2 @@
+message(STATUS "SomeDepConfig.cmake was used")
+set(SomeDep_FOUND TRUE)
diff --git a/Tests/RunCMake/DependencyProviders/FetchContentSerial-stdout.txt b/Tests/RunCMake/DependencyProviders/FetchContentSerial-stdout.txt
new file mode 100644
index 0000000000..fa4a794dee
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/FetchContentSerial-stdout.txt
@@ -0,0 +1,7 @@
+-- Before cmake_language
+-- After cmake_language
+-- AThing_FOUND = 0
+-- Intercepted FetchContent_MakeAvailable\(SomeDep\)
+-- Provider invoked for method FETCHCONTENT_MAKEAVAILABLE_SERIAL with args: SOURCE_DIR;.*/Tests/RunCMake/DependencyProviders;BINARY_DIR;.*/Tests/RunCMake/DependencyProviders/FetchContentSerial-build/_deps/somedep-build;SOURCE_SUBDIR;DoesNotExist
+-- FetchContent_MakeAvailable\(\) succeeded
+-- Configuring done
diff --git a/Tests/RunCMake/DependencyProviders/FetchContentSerial.cmake b/Tests/RunCMake/DependencyProviders/FetchContentSerial.cmake
new file mode 100644
index 0000000000..cbd3010749
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/FetchContentSerial.cmake
@@ -0,0 +1 @@
+include(try_methods.cmake)
diff --git a/Tests/RunCMake/DependencyProviders/FindPackage-stdout.txt b/Tests/RunCMake/DependencyProviders/FindPackage-stdout.txt
new file mode 100644
index 0000000000..19c88b9bac
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/FindPackage-stdout.txt
@@ -0,0 +1,7 @@
+-- Before cmake_language
+-- After cmake_language
+-- Intercepted find_package\(AThing\)
+-- Provider invoked for method FIND_PACKAGE with args: QUIET
+-- AThing_FOUND = TRUE
+-- FetchContent_MakeAvailable\(\) succeeded
+-- Configuring done
diff --git a/Tests/RunCMake/DependencyProviders/FindPackage.cmake b/Tests/RunCMake/DependencyProviders/FindPackage.cmake
new file mode 100644
index 0000000000..cbd3010749
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/FindPackage.cmake
@@ -0,0 +1 @@
+include(try_methods.cmake)
diff --git a/Tests/RunCMake/DependencyProviders/NoCommand-result.txt b/Tests/RunCMake/DependencyProviders/NoCommand-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/NoCommand-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/DependencyProviders/NoCommand-stderr.txt b/Tests/RunCMake/DependencyProviders/NoCommand-stderr.txt
new file mode 100644
index 0000000000..a43222f085
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/NoCommand-stderr.txt
@@ -0,0 +1,3 @@
+CMake Error at set_provider\.cmake:[0-9]+ \(cmake_language\):
+ cmake_language Must specify a non-empty command name when provider methods
+ are given
diff --git a/Tests/RunCMake/DependencyProviders/NoCommandOrMethods-stdout.txt b/Tests/RunCMake/DependencyProviders/NoCommandOrMethods-stdout.txt
new file mode 100644
index 0000000000..c53435b87f
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/NoCommandOrMethods-stdout.txt
@@ -0,0 +1,3 @@
+-- Before cmake_language
+-- After cmake_language
+-- AThing_FOUND = 0
diff --git a/Tests/RunCMake/DependencyProviders/NoCommandOrMethods.cmake b/Tests/RunCMake/DependencyProviders/NoCommandOrMethods.cmake
new file mode 100644
index 0000000000..bde0cf8626
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/NoCommandOrMethods.cmake
@@ -0,0 +1,3 @@
+# Force the provider to be invoked
+find_package(AThing QUIET)
+message(STATUS "AThing_FOUND = ${AThing_FOUND}")
diff --git a/Tests/RunCMake/DependencyProviders/NoMethods-result.txt b/Tests/RunCMake/DependencyProviders/NoMethods-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/NoMethods-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/DependencyProviders/NoMethods-stderr.txt b/Tests/RunCMake/DependencyProviders/NoMethods-stderr.txt
new file mode 100644
index 0000000000..696885128d
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/NoMethods-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at set_provider\.cmake:[0-9]+ \(cmake_language\):
+ cmake_language Must specify at least one provider method
diff --git a/Tests/RunCMake/DependencyProviders/PassThroughProvider-stdout.txt b/Tests/RunCMake/DependencyProviders/PassThroughProvider-stdout.txt
new file mode 100644
index 0000000000..0c9303aba1
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/PassThroughProvider-stdout.txt
@@ -0,0 +1,7 @@
+-- Before cmake_language
+-- After cmake_language
+-- Null provider called
+-- Provider invoked for method FIND_PACKAGE with args: AThing;QUIET
+-- AThing_FOUND = 0
+-- Null provider called
+-- Provider invoked for method FETCHCONTENT_MAKEAVAILABLE_SERIAL with args: SomeDep;SOURCE_DIR;.*/Tests/RunCMake/DependencyProviders;BINARY_DIR;.*/Tests/RunCMake/DependencyProviders/PassThroughProvider-build/_deps/somedep-build;SOURCE_SUBDIR;DoesNotExist
diff --git a/Tests/RunCMake/DependencyProviders/PassThroughProvider.cmake b/Tests/RunCMake/DependencyProviders/PassThroughProvider.cmake
new file mode 100644
index 0000000000..cbd3010749
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/PassThroughProvider.cmake
@@ -0,0 +1 @@
+include(try_methods.cmake)
diff --git a/Tests/RunCMake/DependencyProviders/ProjectIncludeAfter-result.txt b/Tests/RunCMake/DependencyProviders/ProjectIncludeAfter-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/ProjectIncludeAfter-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/DependencyProviders/ProjectIncludeAfter-stderr.txt b/Tests/RunCMake/DependencyProviders/ProjectIncludeAfter-stderr.txt
new file mode 100644
index 0000000000..7bee23c15f
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/ProjectIncludeAfter-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at set_provider\.cmake:[0-9]+ \(cmake_language\):
+ cmake_language Dependency providers can only be set as part of the first
+ call to project\(\)\. More specifically,
+ cmake_language\(SET_DEPENDENCY_PROVIDER\) can only be called while the first
+ project\(\) command processes files listed in
+ CMAKE_PROJECT_TOP_LEVEL_INCLUDES\.
diff --git a/Tests/RunCMake/DependencyProviders/ProjectIncludeBefore-result.txt b/Tests/RunCMake/DependencyProviders/ProjectIncludeBefore-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/ProjectIncludeBefore-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/DependencyProviders/ProjectIncludeBefore-stderr.txt b/Tests/RunCMake/DependencyProviders/ProjectIncludeBefore-stderr.txt
new file mode 100644
index 0000000000..7bee23c15f
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/ProjectIncludeBefore-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at set_provider\.cmake:[0-9]+ \(cmake_language\):
+ cmake_language Dependency providers can only be set as part of the first
+ call to project\(\)\. More specifically,
+ cmake_language\(SET_DEPENDENCY_PROVIDER\) can only be called while the first
+ project\(\) command processes files listed in
+ CMAKE_PROJECT_TOP_LEVEL_INCLUDES\.
diff --git a/Tests/RunCMake/DependencyProviders/Recurse-stdout.txt b/Tests/RunCMake/DependencyProviders/Recurse-stdout.txt
new file mode 100644
index 0000000000..2c2035af36
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/Recurse-stdout.txt
@@ -0,0 +1,7 @@
+-- Before cmake_language
+-- After cmake_language
+-- Intercepted FetchContent_MakeAvailable\(SomeDep\)
+-- Provider invoked for method FETCHCONTENT_MAKEAVAILABLE_SERIAL with args: SOURCE_DIR;.*/Tests/RunCMake/DependencyProviders/Recurse-build/_deps/somedep-src;BINARY_DIR;.*/Tests/RunCMake/DependencyProviders/Recurse-build/_deps/somedep-build;DOWNLOAD_COMMAND;.*/cmake(\.exe)?;-E;echo;Download command called
+.*Download command called
+.*-- Should now be handled
+-- Configuring done
diff --git a/Tests/RunCMake/DependencyProviders/Recurse.cmake b/Tests/RunCMake/DependencyProviders/Recurse.cmake
new file mode 100644
index 0000000000..3a79d9cb8f
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/Recurse.cmake
@@ -0,0 +1,8 @@
+include(FetchContent)
+
+set(FETCHCONTENT_QUIET NO)
+
+FetchContent_Declare(SomeDep
+ DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E echo "Download command called"
+)
+FetchContent_MakeAvailable(SomeDep)
diff --git a/Tests/RunCMake/DependencyProviders/RedirectFetchContentSerial-result.txt b/Tests/RunCMake/DependencyProviders/RedirectFetchContentSerial-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/RedirectFetchContentSerial-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/DependencyProviders/RedirectFetchContentSerial-stderr.txt b/Tests/RunCMake/DependencyProviders/RedirectFetchContentSerial-stderr.txt
new file mode 100644
index 0000000000..047a64b1a8
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/RedirectFetchContentSerial-stderr.txt
@@ -0,0 +1,11 @@
+CMake Error at set_provider\.cmake:[0-9]+ \(find_package\):
+ Could not find a package configuration file provided by "SomeDep" with any
+ of the following names:
+
+ SomeDepConfig\.cmake
+ somedep-config\.cmake
+
+ Add the installation prefix of "SomeDep" to CMAKE_PREFIX_PATH or set
+ "SomeDep_DIR" to a directory containing one of the above files\. If
+ "SomeDep" provides a separate development package or SDK, be sure it has
+ been installed\.
diff --git a/Tests/RunCMake/DependencyProviders/RedirectFetchContentSerial-stdout.txt b/Tests/RunCMake/DependencyProviders/RedirectFetchContentSerial-stdout.txt
new file mode 100644
index 0000000000..a293324a36
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/RedirectFetchContentSerial-stdout.txt
@@ -0,0 +1,5 @@
+-- Before cmake_language
+-- After cmake_language
+-- AThing_FOUND = 0
+-- Redirecting FetchContent_MakeAvailable\(SomeDep\) to find_package\(\)
+-- Provider invoked for method FETCHCONTENT_MAKEAVAILABLE_SERIAL with args: SOURCE_DIR;.*/Tests/RunCMake/DependencyProviders;BINARY_DIR;.*/Tests/RunCMake/DependencyProviders/RedirectFetchContentSerial-build/_deps/somedep-build;SOURCE_SUBDIR;DoesNotExist
diff --git a/Tests/RunCMake/DependencyProviders/RedirectFetchContentSerial.cmake b/Tests/RunCMake/DependencyProviders/RedirectFetchContentSerial.cmake
new file mode 100644
index 0000000000..cbd3010749
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/RedirectFetchContentSerial.cmake
@@ -0,0 +1 @@
+include(try_methods.cmake)
diff --git a/Tests/RunCMake/DependencyProviders/RedirectFindPackage-stdout.txt b/Tests/RunCMake/DependencyProviders/RedirectFindPackage-stdout.txt
new file mode 100644
index 0000000000..23e751d063
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/RedirectFindPackage-stdout.txt
@@ -0,0 +1,7 @@
+-- Before cmake_language
+-- After cmake_language
+-- Redirecting find_package\(AThing\) to FetchContent_MakeAvailable\(\)
+-- Provider invoked for method FIND_PACKAGE with args: QUIET
+-- AThing_FOUND = TRUE
+-- FetchContent_MakeAvailable\(\) succeeded
+-- Configuring done
diff --git a/Tests/RunCMake/DependencyProviders/RedirectFindPackage.cmake b/Tests/RunCMake/DependencyProviders/RedirectFindPackage.cmake
new file mode 100644
index 0000000000..cbd3010749
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/RedirectFindPackage.cmake
@@ -0,0 +1 @@
+include(try_methods.cmake)
diff --git a/Tests/RunCMake/DependencyProviders/RunCMakeTest.cmake b/Tests/RunCMake/DependencyProviders/RunCMakeTest.cmake
new file mode 100644
index 0000000000..42893d2ed3
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/RunCMakeTest.cmake
@@ -0,0 +1,73 @@
+include(RunCMake)
+
+run_cmake_with_options(BeforeProject
+ -D "include_before_project=set_provider.cmake"
+ -D "provider_command=null_provider"
+ -D "provider_methods=find_package"
+)
+run_cmake_with_options(AfterProject
+ -D "include_after_project=set_provider.cmake"
+ -D "provider_command=null_provider"
+ -D "provider_methods=find_package"
+)
+run_cmake_with_options(ProjectIncludeBefore
+ -D "CMAKE_PROJECT_INCLUDE_BEFORE=set_provider.cmake"
+ -D "provider_command=null_provider"
+ -D "provider_methods=find_package"
+)
+run_cmake_with_options(ProjectIncludeAfter
+ -D "CMAKE_PROJECT_INCLUDE=set_provider.cmake"
+ -D "provider_command=null_provider"
+ -D "provider_methods=find_package"
+)
+run_cmake_with_options(ToolchainFile
+ -D "CMAKE_TOOLCHAIN_FILE=set_provider.cmake"
+ -D "provider_command=null_provider"
+ -D "provider_methods=find_package"
+)
+run_cmake_with_options(NoCommand
+ -D "CMAKE_PROJECT_TOP_LEVEL_INCLUDES=set_provider.cmake"
+ -D "provider_methods=find_package"
+)
+run_cmake_with_options(NoMethods
+ -D "CMAKE_PROJECT_TOP_LEVEL_INCLUDES=set_provider.cmake"
+ -D "provider_command=null_provider"
+)
+run_cmake_with_options(NoCommandOrMethods
+ -D "CMAKE_PROJECT_TOP_LEVEL_INCLUDES=set_provider.cmake"
+)
+run_cmake_with_options(PassThroughProvider
+ -D "CMAKE_PROJECT_TOP_LEVEL_INCLUDES=set_provider.cmake"
+ -D "provider_command=null_provider"
+ -D "provider_methods=FIND_PACKAGE\\;FETCHCONTENT_MAKEAVAILABLE_SERIAL"
+)
+run_cmake_with_options(FindPackage
+ -D "CMAKE_PROJECT_TOP_LEVEL_INCLUDES=set_provider.cmake"
+ -D "provider_command=find_package_provider"
+ -D "provider_methods=FIND_PACKAGE"
+)
+run_cmake_with_options(RedirectFindPackage
+ -D "CMAKE_PROJECT_TOP_LEVEL_INCLUDES=set_provider.cmake"
+ -D "provider_command=redirect_find_package_provider"
+ -D "provider_methods=FIND_PACKAGE"
+)
+run_cmake_with_options(FetchContentSerial
+ -D "CMAKE_PROJECT_TOP_LEVEL_INCLUDES=set_provider.cmake"
+ -D "provider_command=FetchContentSerial_provider"
+ -D "provider_methods=FETCHCONTENT_MAKEAVAILABLE_SERIAL"
+)
+run_cmake_with_options(RedirectFetchContentSerial
+ -D "CMAKE_PROJECT_TOP_LEVEL_INCLUDES=set_provider.cmake"
+ -D "provider_command=redirect_FetchContentSerial_provider"
+ -D "provider_methods=FETCHCONTENT_MAKEAVAILABLE_SERIAL"
+)
+run_cmake_with_options(Bypass
+ -D "CMAKE_PROJECT_TOP_LEVEL_INCLUDES=set_provider.cmake"
+ -D "provider_command=forward_find_package"
+ -D "provider_methods=FIND_PACKAGE"
+)
+run_cmake_with_options(Recurse
+ -D "CMAKE_PROJECT_TOP_LEVEL_INCLUDES=set_provider.cmake"
+ -D "provider_command=recurse_FetchContent"
+ -D "provider_methods=FETCHCONTENT_MAKEAVAILABLE_SERIAL"
+)
diff --git a/Tests/RunCMake/DependencyProviders/ToolchainFile-result.txt b/Tests/RunCMake/DependencyProviders/ToolchainFile-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/ToolchainFile-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/DependencyProviders/ToolchainFile-stderr.txt b/Tests/RunCMake/DependencyProviders/ToolchainFile-stderr.txt
new file mode 100644
index 0000000000..7bee23c15f
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/ToolchainFile-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at set_provider\.cmake:[0-9]+ \(cmake_language\):
+ cmake_language Dependency providers can only be set as part of the first
+ call to project\(\)\. More specifically,
+ cmake_language\(SET_DEPENDENCY_PROVIDER\) can only be called while the first
+ project\(\) command processes files listed in
+ CMAKE_PROJECT_TOP_LEVEL_INCLUDES\.
diff --git a/Tests/RunCMake/DependencyProviders/set_provider.cmake b/Tests/RunCMake/DependencyProviders/set_provider.cmake
new file mode 100644
index 0000000000..6e82b8fcb1
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/set_provider.cmake
@@ -0,0 +1,64 @@
+include(FetchContent)
+
+macro(null_provider method)
+ message(STATUS "Null provider called")
+ message(STATUS "Provider invoked for method ${method} with args: ${ARGN}")
+endmacro()
+
+macro(find_package_provider method package_name)
+ message(STATUS "Intercepted find_package(${package_name})")
+ message(STATUS "Provider invoked for method ${method} with args: ${ARGN}")
+ set(${package_name}_FOUND TRUE)
+endmacro()
+
+macro(FetchContentSerial_provider method dep_name)
+ message(STATUS "Intercepted FetchContent_MakeAvailable(${dep_name})")
+ message(STATUS "Provider invoked for method ${method} with args: ${ARGN}")
+ FetchContent_SetPopulated(${dep_name})
+endmacro()
+
+macro(redirect_find_package_provider method package_name)
+ message(STATUS "Redirecting find_package(${package_name}) to FetchContent_MakeAvailable()")
+ message(STATUS "Provider invoked for method ${method} with args: ${ARGN}")
+ FetchContent_Declare(${package_name}
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}
+ SOURCE_SUBDIR DoesNotExist
+ )
+ FetchContent_MakeAvailable(${package_name})
+ set(${package_name}_FOUND TRUE)
+endmacro()
+
+macro(redirect_FetchContentSerial_provider method dep_name)
+ message(STATUS "Redirecting FetchContent_MakeAvailable(${dep_name}) to find_package()")
+ message(STATUS "Provider invoked for method ${method} with args: ${ARGN}")
+ find_package(${dep_name} NO_DEFAULT_PATH
+ PATHS ${CMAKE_CURRENT_LIST_DIR}/Finders
+ REQUIRED
+ )
+ FetchContent_SetPopulated(${dep_name})
+endmacro()
+
+macro(forward_find_package method package_name)
+ message(STATUS "Forwarding find_package(${package_name})")
+ message(STATUS "Provider invoked for method ${method} with args: ${ARGN}")
+ find_package(${package_name}
+ BYPASS_PROVIDER
+ PATHS ${CMAKE_CURRENT_LIST_DIR}/ConfigFiles
+ ${ARGN}
+ )
+ message(STATUS "Leaving provider")
+endmacro()
+
+macro(recurse_FetchContent method dep_name)
+ message(STATUS "Intercepted FetchContent_MakeAvailable(${dep_name})")
+ message(STATUS "Provider invoked for method ${method} with args: ${ARGN}")
+ FetchContent_MakeAvailable(${dep_name})
+ message(STATUS "Should now be handled")
+endmacro()
+
+message(STATUS "Before cmake_language")
+cmake_language(
+ SET_DEPENDENCY_PROVIDER ${provider_command}
+ SUPPORTED_METHODS ${provider_methods}
+)
+message(STATUS "After cmake_language")
diff --git a/Tests/RunCMake/DependencyProviders/try_methods.cmake b/Tests/RunCMake/DependencyProviders/try_methods.cmake
new file mode 100644
index 0000000000..652c32db28
--- /dev/null
+++ b/Tests/RunCMake/DependencyProviders/try_methods.cmake
@@ -0,0 +1,12 @@
+# Force the provider to be invoked for each method
+find_package(AThing QUIET)
+message(STATUS "AThing_FOUND = ${AThing_FOUND}")
+
+# These declared details should always succeed when used
+include(FetchContent)
+FetchContent_Declare(SomeDep
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}
+ SOURCE_SUBDIR DoesNotExist
+)
+FetchContent_MakeAvailable(SomeDep)
+message(STATUS "FetchContent_MakeAvailable() succeeded")
diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
index 08adee23d7..2588d6c599 100644
--- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
@@ -6,6 +6,13 @@ include(RunCMake)
unset(ENV{http_proxy})
unset(ENV{https_proxy})
+if(RunCMake_GENERATOR STREQUAL "Borland Makefiles" OR
+ RunCMake_GENERATOR STREQUAL "Watcom WMake")
+ set(fs_delay 3)
+else()
+ set(fs_delay 1.125)
+endif()
+
run_cmake(BadIndependentStep1)
run_cmake(BadIndependentStep2)
run_cmake(NoOptions)
@@ -72,7 +79,7 @@ function(__ep_test_source_dir_change)
# we have to ensure we don't re-run the configure stage too quickly after the
# first build. Otherwise, the modified RepositoryInfo.txt files the next
# configure writes might still have the same timestamp as the previous one.
- execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1.125)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E sleep ${fs_delay})
run_cmake_command(SourceDirChange-change ${CMAKE_COMMAND} -DSOURCE_DIR_CHANGE=YES .)
run_cmake_command(SourceDirChange-build2 ${CMAKE_COMMAND} --build .)
endfunction()
diff --git a/Tests/RunCMake/FetchContent_find_package/ChildScope/CMakeLists.txt b/Tests/RunCMake/FetchContent_find_package/ChildScope/CMakeLists.txt
new file mode 100644
index 0000000000..7e994d6ecf
--- /dev/null
+++ b/Tests/RunCMake/FetchContent_find_package/ChildScope/CMakeLists.txt
@@ -0,0 +1,11 @@
+FetchContent_MakeAvailable(
+ GlobalWithArgsKeyword
+ GlobalWithoutArgsKeyword
+ LocalWithArgsKeyword
+ LocalWithoutArgsKeyword
+)
+
+# This one was declared without GLOBAL, but should still become global when
+# this variable is true at the time FetchContent_MakeAvailable() is called
+set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL TRUE)
+FetchContent_MakeAvailable(EventuallyGlobal)
diff --git a/Tests/RunCMake/FetchContent_find_package/GLOBAL.cmake b/Tests/RunCMake/FetchContent_find_package/GLOBAL.cmake
new file mode 100644
index 0000000000..0de65d59be
--- /dev/null
+++ b/Tests/RunCMake/FetchContent_find_package/GLOBAL.cmake
@@ -0,0 +1,50 @@
+include(FetchContent)
+
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/PackageFindModules)
+set(FETCHCONTENT_TRY_FIND_PACKAGE_MODE ALWAYS)
+
+set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL TRUE)
+FetchContent_Declare(
+ GlobalWithArgsKeyword
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/FatalIfAdded
+ FIND_PACKAGE_ARGS
+)
+FetchContent_Declare(
+ GlobalWithoutArgsKeyword
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/FatalIfAdded
+)
+
+set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL FALSE)
+FetchContent_Declare(
+ LocalWithArgsKeyword
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/FatalIfAdded
+ FIND_PACKAGE_ARGS
+)
+FetchContent_Declare(
+ LocalWithoutArgsKeyword
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/FatalIfAdded
+)
+FetchContent_Declare(
+ EventuallyGlobal
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/FatalIfAdded
+)
+
+add_subdirectory(ChildScope)
+
+if(NOT TARGET GlobalWithArgsKeywordExe)
+ message(SEND_ERROR "GlobalWithArgsKeywordExe is not a global target")
+endif()
+if(NOT TARGET GlobalWithoutArgsKeywordExe)
+ message(SEND_ERROR "GlobalWithoutArgsKeywordExe is not a global target")
+endif()
+
+if(TARGET LocalWithArgsKeywordExe)
+ message(SEND_ERROR "LocalWithArgsKeywordExe is unexpectedly a global target")
+endif()
+if(TARGET LocalWithoutArgsKeywordExe)
+ message(SEND_ERROR "LocalWithoutArgsKeywordExe is unexpectedly a global target")
+endif()
+
+if(NOT TARGET EventuallyGlobalExe)
+ message(SEND_ERROR "EventuallyGlobalExe is not a global target")
+endif()
diff --git a/Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindEventuallyGlobal.cmake b/Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindEventuallyGlobal.cmake
new file mode 100644
index 0000000000..2389cb1029
--- /dev/null
+++ b/Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindEventuallyGlobal.cmake
@@ -0,0 +1,6 @@
+add_executable(EventuallyGlobalExe IMPORTED)
+set_target_properties(EventuallyGlobalExe PROPERTIES
+ IMPORTED_LOCATION "${CMAKE_COMMAND}"
+)
+
+set(EventuallyGlobal_FOUND TRUE)
diff --git a/Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindGlobalWithArgsKeyword.cmake b/Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindGlobalWithArgsKeyword.cmake
new file mode 100644
index 0000000000..55588b81dc
--- /dev/null
+++ b/Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindGlobalWithArgsKeyword.cmake
@@ -0,0 +1,6 @@
+add_executable(GlobalWithArgsKeywordExe IMPORTED)
+set_target_properties(GlobalWithArgsKeywordExe PROPERTIES
+ IMPORTED_LOCATION "${CMAKE_COMMAND}"
+)
+
+set(GlobalWithArgsKeyword_FOUND TRUE)
diff --git a/Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindGlobalWithoutArgsKeyword.cmake b/Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindGlobalWithoutArgsKeyword.cmake
new file mode 100644
index 0000000000..c3e6a6b7b3
--- /dev/null
+++ b/Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindGlobalWithoutArgsKeyword.cmake
@@ -0,0 +1,6 @@
+add_executable(GlobalWithoutArgsKeywordExe IMPORTED)
+set_target_properties(GlobalWithoutArgsKeywordExe PROPERTIES
+ IMPORTED_LOCATION "${CMAKE_COMMAND}"
+)
+
+set(GlobalWithoutArgsKeyword_FOUND TRUE)
diff --git a/Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindLocalWithArgsKeyword.cmake b/Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindLocalWithArgsKeyword.cmake
new file mode 100644
index 0000000000..381daa3c32
--- /dev/null
+++ b/Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindLocalWithArgsKeyword.cmake
@@ -0,0 +1,6 @@
+add_executable(LocalWithArgsKeywordExe IMPORTED)
+set_target_properties(LocalWithArgsKeywordExe PROPERTIES
+ IMPORTED_LOCATION "${CMAKE_COMMAND}"
+)
+
+set(LocalWithArgsKeyword_FOUND TRUE)
diff --git a/Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindLocalWithoutArgsKeyword.cmake b/Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindLocalWithoutArgsKeyword.cmake
new file mode 100644
index 0000000000..523fecdf48
--- /dev/null
+++ b/Tests/RunCMake/FetchContent_find_package/PackageFindModules/FindLocalWithoutArgsKeyword.cmake
@@ -0,0 +1,6 @@
+add_executable(LocalWithoutArgsKeywordExe IMPORTED)
+set_target_properties(LocalWithoutArgsKeywordExe PROPERTIES
+ IMPORTED_LOCATION "${CMAKE_COMMAND}"
+)
+
+set(LocalWithoutArgsKeyword_FOUND TRUE)
diff --git a/Tests/RunCMake/FetchContent_find_package/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent_find_package/RunCMakeTest.cmake
index c139f5780b..83c0a9a5ff 100644
--- a/Tests/RunCMake/FetchContent_find_package/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FetchContent_find_package/RunCMakeTest.cmake
@@ -20,3 +20,4 @@ run_cmake(Try_find_package-NEVER)
run_cmake(Try_find_package-OPT_IN)
run_cmake(Try_find_package-BOGUS)
run_cmake(Redirect_find_package_MODULE)
+run_cmake(GLOBAL)
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake
index d697fc6778..f149d99174 100644
--- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake
@@ -49,12 +49,15 @@ set(ENV{PKG_CONFIG_PATH} ${fakePkgDir}/lib/pkgconfig)
# find targets in subdir and check their visibility
add_subdirectory(target_subdir)
-if (TARGET PkgConfig::FakePackage1_dir)
- message(FATAL_ERROR "imported target PkgConfig::FakePackage1_dir is visible outside it's directory")
+
+set(tgt PkgConfig::FakePackage1_dir)
+if (TARGET ${tgt})
+ message(FATAL_ERROR "imported target \"${tgt}\" is visible outside its directory")
endif()
-if (NOT TARGET PkgConfig::FakePackage1_global)
- message(FATAL_ERROR "imported target PkgConfig::FakePackage1_global is not visible outside it's directory")
+set(tgt PkgConfig::FakePackage1_global)
+if (NOT TARGET ${tgt})
+ message(FATAL_ERROR "imported target \"${tgt}\" is not visible outside its directory")
endif()
# And now do the same for the NO_CMAKE_ENVIRONMENT_PATH - ENV{CMAKE_PREFIX_PATH}
@@ -104,10 +107,13 @@ Cflags: -I/special -isystem /other -isystem/more -DA-isystem/foo
set(expected_link_options -e dummy_main)
pkg_check_modules(FakeLinkOptionsPackage REQUIRED QUIET IMPORTED_TARGET fakelinkoptionspackage)
-if (NOT TARGET PkgConfig::FakeLinkOptionsPackage)
+
+set(tgt PkgConfig::FakeLinkOptionsPackage)
+message(STATUS "Verifying target \"${tgt}\"")
+if (NOT TARGET ${tgt})
message(FATAL_ERROR "No import target for fake link options package")
endif()
-get_target_property(link_options PkgConfig::FakeLinkOptionsPackage INTERFACE_LINK_OPTIONS)
+get_target_property(link_options ${tgt} INTERFACE_LINK_OPTIONS)
if (NOT link_options STREQUAL expected_link_options)
message(FATAL_ERROR
"Additional link options not present in INTERFACE_LINK_OPTIONS property\n"
@@ -115,7 +121,7 @@ if (NOT link_options STREQUAL expected_link_options)
)
endif()
-get_target_property(inc_dirs PkgConfig::FakeLinkOptionsPackage INTERFACE_INCLUDE_DIRECTORIES)
+get_target_property(inc_dirs ${tgt} INTERFACE_INCLUDE_DIRECTORIES)
set(expected_inc_dirs "/special" "/other" "/more")
if (NOT inc_dirs STREQUAL expected_inc_dirs)
@@ -125,7 +131,7 @@ if (NOT inc_dirs STREQUAL expected_inc_dirs)
)
endif ()
-get_target_property(c_opts PkgConfig::FakeLinkOptionsPackage INTERFACE_COMPILE_OPTIONS)
+get_target_property(c_opts ${tgt} INTERFACE_COMPILE_OPTIONS)
set(expected_c_opts "-DA-isystem/foo") # this is an invalid option, but a good testcase
if (NOT c_opts STREQUAL expected_c_opts)
message(FATAL_ERROR
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-stdout.txt b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-stdout.txt
index 6615d805a6..539e5ef167 100644
--- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-stdout.txt
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-stdout.txt
@@ -1,3 +1,3 @@
-- ZOT_LIBRARIES='zot'
--- ZOT_LINK_LIBRARIES='[^']*/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-build/zot/lib/prefix-zot-suffix'
--- ZOT_LDFLAGS='-L[^']*/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-build/zot/lib;-lzot'
+-- ZOT_LINK_LIBRARIES='[^']*/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-build/root/lib/prefix-zot-suffix'
+-- ZOT_LDFLAGS='-L[^']*/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-build/root/lib;-lzot'
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH.cmake
index 9f654b50a9..1278c49e72 100644
--- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH.cmake
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH.cmake
@@ -1,11 +1,16 @@
find_package(PkgConfig REQUIRED)
-file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/zot/lib/pkgconfig/zot.pc" "
-prefix=${CMAKE_CURRENT_BINARY_DIR}/zot
+set(ROOT "${CMAKE_CURRENT_BINARY_DIR}/root")
+string(REPLACE " " "\\ " ESCAPED_ROOT "${ROOT}")
+set(LIB_DIR "${ROOT}/lib")
+set(PKGCONFIG_DIR "${LIB_DIR}/pkgconfig")
+
+file(WRITE "${PKGCONFIG_DIR}/zot.pc" "
+prefix=${ESCAPED_ROOT}
libdir=\${prefix}/lib
Name: Zot
-Description: Dummy packaget to test LIBRARY_DIR support
+Description: Dummy package to test LIBRARY_DIR support
Version: 1.0
Libs: -L\${libdir} -lzot
")
@@ -13,15 +18,15 @@ Libs: -L\${libdir} -lzot
# Create a "library" file to find in libdir.
set(CMAKE_FIND_LIBRARY_PREFIXES "prefix-")
set(CMAKE_FIND_LIBRARY_SUFFIXES "-suffix")
-file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/zot/lib/prefix-zot-suffix")
+file(WRITE "${LIB_DIR}/prefix-zot-suffix")
# 'pkg-config --libs' drops -L flags in PKG_CONFIG_SYSTEM_LIBRARY_PATH by default.
-set(ENV{PKG_CONFIG_SYSTEM_LIBRARY_PATH} "${CMAKE_CURRENT_BINARY_DIR}/zot/lib")
+set(ENV{PKG_CONFIG_SYSTEM_LIBRARY_PATH} "${LIB_DIR}")
# 'pkgconf --libs' also drops -L flags in LIBRARY_PATH by default.
-set(ENV{LIBRARY_PATH} "${CMAKE_CURRENT_BINARY_DIR}/zot/lib")
+set(ENV{LIBRARY_PATH} "${LIB_DIR}")
-set(ENV{PKG_CONFIG_PATH} "${CMAKE_CURRENT_BINARY_DIR}/zot/lib/pkgconfig")
+set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_DIR}")
pkg_check_modules(ZOT REQUIRED zot)
message(STATUS "ZOT_LIBRARIES='${ZOT_LIBRARIES}'")
diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
index f36d1eb85b..f479dcf4fd 100644
--- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
@@ -32,8 +32,5 @@ if (PKG_CONFIG_FOUND)
run_cmake(FindPkgConfig_VERSION_OPERATORS)
run_cmake(FindPkgConfig_GET_MATCHING_MODULE_NAME)
run_cmake(FindPkgConfig_empty_target)
-
- if(NOT RunCMake_BINARY_DIR MATCHES " ")
- run_cmake(FindPkgConfig_LIBRARY_PATH)
- endif()
+ run_cmake(FindPkgConfig_LIBRARY_PATH)
endif ()
diff --git a/Tests/RunCMake/GenEx-PATH/ABSOLUTE_PATH.cmake.in b/Tests/RunCMake/GenEx-PATH/ABSOLUTE_PATH.cmake.in
new file mode 100644
index 0000000000..cc5ff54d14
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/ABSOLUTE_PATH.cmake.in
@@ -0,0 +1,34 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (reference "../../a/d")
+cmake_path(ABSOLUTE_PATH reference BASE_DIRECTORY "/x/y/a/f")
+set(output "$<PATH:ABSOLUTE_PATH,../../a/d,/x/y/a/f>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+endif()
+
+set (reference "../../a/d")
+cmake_path(ABSOLUTE_PATH reference BASE_DIRECTORY "/x/y/a/f" NORMALIZE)
+set(output "$<PATH:ABSOLUTE_PATH,NORMALIZE,../../a/d,/x/y/a/f>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+endif()
+
+set (reference "/a/d/../e")
+cmake_path(ABSOLUTE_PATH reference BASE_DIRECTORY "/x/y/a/f")
+set(output "$<PATH:ABSOLUTE_PATH,/a/d/../e,/x/y/a/f>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+endif()
+
+set (reference "/a/d/../e")
+cmake_path(ABSOLUTE_PATH reference BASE_DIRECTORY "/x/y/a/f" NORMALIZE)
+set(output "$<PATH:ABSOLUTE_PATH,NORMALIZE,/a/d/../e,/x/y/a/f>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+endif()
+
+
+check_errors("PATH:ABSOLUTE_PATH" ${errors})
diff --git a/Tests/RunCMake/GenEx-PATH/APPEND.cmake.in b/Tests/RunCMake/GenEx-PATH/APPEND.cmake.in
new file mode 100644
index 0000000000..ab967a2a8a
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/APPEND.cmake.in
@@ -0,0 +1,68 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+cmake_path (APPEND path "/a/b" "c")
+set(output "$<PATH:APPEND,/a/b,c>")
+if (NOT output STREQUAL path)
+ list (APPEND errors "'${output}' instead of '${path}'")
+endif()
+
+set (path "a")
+cmake_path (APPEND path "")
+set(output "$<PATH:APPEND,a,>")
+if (NOT output STREQUAL path)
+ list (APPEND errors "'${output}' instead of '${path}'")
+endif()
+
+cmake_path (APPEND path "/b")
+set(output "$<PATH:APPEND,a/,/b>")
+if (NOT output STREQUAL path)
+ list (APPEND errors "'${output}' instead of '${path}'")
+endif()
+
+if (WIN32)
+ set (path "a")
+ cmake_path (APPEND path "c:/b")
+ set(output "$<PATH:APPEND,a,c:/b>")
+ if (NOT output STREQUAL path)
+ list (APPEND errors "'${output}' instead of '${path}'")
+ endif()
+
+ set (path "a")
+ cmake_path (APPEND path "c:")
+ set(output "$<PATH:APPEND,a,c:>")
+ if (NOT output STREQUAL path)
+ list (APPEND errors "'${output}' instead of '${path}'")
+ endif()
+
+ set (path "c:a")
+ cmake_path (APPEND path "/b")
+ set(output "$<PATH:APPEND,c:a,/b>")
+ if (NOT output STREQUAL path)
+ list (APPEND errors "'${output}' instead of '${path}'")
+ endif()
+
+ set (path "c:a")
+ cmake_path (APPEND path "c:b")
+ set(output "$<PATH:APPEND,c:a,c:b>")
+ if (NOT output STREQUAL path)
+ list (APPEND errors "'${output}' instead of '${path}'")
+ endif()
+
+ set (path "//host")
+ cmake_path (APPEND path "b")
+ set(output "$<PATH:APPEND,//host,b>")
+ if (NOT output STREQUAL path)
+ list (APPEND errors "'${output}' instead of '${path}'")
+ endif()
+
+ set (path "//host/")
+ cmake_path (APPEND path "b")
+ set(output "$<PATH:APPEND,//host/,b>")
+ if (NOT output STREQUAL path)
+ list (APPEND errors "'${output}' instead of '${path}'")
+ endif()
+endif()
+
+check_errors ("PATH:APPEND" ${errors})
diff --git a/Tests/RunCMake/GenEx-PATH/CMAKE_PATH.cmake.in b/Tests/RunCMake/GenEx-PATH/CMAKE_PATH.cmake.in
new file mode 100644
index 0000000000..41205fa674
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/CMAKE_PATH.cmake.in
@@ -0,0 +1,53 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+
+cmake_path(SET reference "/x/y/z/../../a/d")
+set(output "$<PATH:CMAKE_PATH,/x/y/z/../../a/d>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+endif()
+cmake_path(SET reference NORMALIZE "/x/y/z/../../a/d")
+set(output "$<PATH:CMAKE_PATH,NORMALIZE,/x/y/z/../../a/d>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+endif()
+
+if (WIN32)
+ cmake_path(SET reference "/x\\y/z\\..\\../a/d")
+ set(output "$<PATH:CMAKE_PATH,/x\y/z\..\../a/d>")
+ if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+ endif()
+ cmake_path(SET reference NORMALIZE "/x\\y/z\\..\\../a/d")
+ set(output "$<PATH:CMAKE_PATH,NORMALIZE,/x\y/z\..\../a/d>")
+ if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+ endif()
+
+ cmake_path(SET reference "//?/c:/x\\y/z\\..\\../a/d")
+ set(output "$<PATH:CMAKE_PATH,//?/c:/x\y/z\..\../a/d>")
+ if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+ endif()
+ cmake_path(SET reference NORMALIZE "//?/c:/x\\y/z\\..\\../a/d")
+ set(output "$<PATH:CMAKE_PATH,NORMALIZE,//?/c:/x\y/z\..\../a/d>")
+ if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+ endif()
+
+ cmake_path(SET reference "\\\\?\\UNC/host/x\\y/z\\..\\../a/d")
+ set(output "$<PATH:CMAKE_PATH,\\?\UNC/host/x\y/z\..\../a/d>")
+ if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+ endif()
+ cmake_path(SET reference NORMALIZE "\\\\?\\UNC\\host/x\\y/z\\..\\../a/d")
+ set(output "$<PATH:CMAKE_PATH,NORMALIZE,\\?\UNC/host/x\y/z\..\../a/d>")
+ if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+ endif()
+endif()
+
+
+check_errors("PATH:CMAKE_PATH" ${errors})
diff --git a/Tests/RunCMake/GenEx-PATH/CMakeLists.txt b/Tests/RunCMake/GenEx-PATH/CMakeLists.txt
new file mode 100644
index 0000000000..f9748e968b
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.18...3.24)
+
+project(${RunCMake_TEST} NONE)
+
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/GenEx-PATH/GET_ITEM.cmake.in b/Tests/RunCMake/GenEx-PATH/GET_ITEM.cmake.in
new file mode 100644
index 0000000000..b58998cdba
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/GET_ITEM.cmake.in
@@ -0,0 +1,311 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+###############################################
+## First test with a path defining all elements
+###############################################
+if (WIN32)
+ set (path "C:/aa/bb/cc.ext1.ext2")
+else()
+ set (path "/aa/bb/cc.ext1.ext2")
+endif()
+
+cmake_path(GET path ROOT_NAME reference)
+if (WIN32)
+ set(output "$<PATH:GET_ROOT_NAME,C:/aa/bb/cc.ext1.ext2>")
+else()
+ set (output "$<PATH:GET_ROOT_NAME,/aa/bb/cc.ext1.ext2>")
+endif()
+if (NOT output STREQUAL reference)
+ list (APPEND errors "ROOT_NAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_DIRECTORY reference)
+if (WIN32)
+ set(output "$<PATH:GET_ROOT_DIRECTORY,C:/aa/bb/cc.ext1.ext2>")
+else()
+ set (output "$<PATH:GET_ROOT_DIRECTORY,/aa/bb/cc.ext1.ext2>")
+endif()
+if (NOT output STREQUAL reference)
+ list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_PATH reference)
+if (WIN32)
+ set(output "$<PATH:GET_ROOT_PATH,C:/aa/bb/cc.ext1.ext2>")
+else()
+ set (output "$<PATH:GET_ROOT_PATH,/aa/bb/cc.ext1.ext2>")
+endif()
+if (NOT output STREQUAL reference)
+ list (APPEND errors "ROOT_PATH returns bad data: ${output}")
+endif()
+
+cmake_path(GET path FILENAME reference)
+if (WIN32)
+ set(output "$<PATH:GET_FILENAME,C:/aa/bb/cc.ext1.ext2>")
+else()
+ set (output "$<PATH:GET_FILENAME,/aa/bb/cc.ext1.ext2>")
+endif()
+if (NOT output STREQUAL reference)
+ list (APPEND errors "FILENAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path EXTENSION reference)
+if (WIN32)
+ set(output "$<PATH:GET_EXTENSION,C:/aa/bb/cc.ext1.ext2>")
+else()
+ set (output "$<PATH:GET_EXTENSION,/aa/bb/cc.ext1.ext2>")
+endif()
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+cmake_path(GET path EXTENSION LAST_ONLY reference)
+if (WIN32)
+ set(output "$<PATH:GET_EXTENSION,LAST_ONLY,C:/aa/bb/cc.ext1.ext2>")
+else()
+ set (output "$<PATH:GET_EXTENSION,LAST_ONLY,/aa/bb/cc.ext1.ext2>")
+endif()
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION LAST_ONLY returns bad data: ${output}")
+endif()
+
+cmake_path(GET path STEM reference)
+if (WIN32)
+ set(output "$<PATH:GET_STEM,C:/aa/bb/cc.ext1.ext2>")
+else()
+ set (output "$<PATH:GET_STEM,/aa/bb/cc.ext1.ext2>")
+endif()
+if (NOT output STREQUAL reference)
+ list (APPEND errors "STEM returns bad data: ${output}")
+endif()
+cmake_path(GET path STEM LAST_ONLY reference)
+if (WIN32)
+ set(output "$<PATH:GET_STEM,LAST_ONLY,C:/aa/bb/cc.ext1.ext2>")
+else()
+ set (output "$<PATH:GET_STEM,LAST_ONLY,/aa/bb/cc.ext1.ext2>")
+endif()
+if (NOT output STREQUAL reference)
+ list (APPEND errors "STEM LAST_ONLY returns bad data: ${reference}")
+endif()
+
+cmake_path(GET path RELATIVE_PART reference)
+if (WIN32)
+ set(output "$<PATH:GET_RELATIVE_PART,C:/aa/bb/cc.ext1.ext2>")
+else()
+ set (output "$<PATH:GET_RELATIVE_PART,/aa/bb/cc.ext1.ext2>")
+endif()
+if (NOT output STREQUAL reference)
+ list (APPEND errors "RELATIVE_PART returns bad data: ${output}")
+endif()
+
+cmake_path(GET path PARENT_PATH reference)
+if (WIN32)
+ set(output "$<PATH:GET_PARENT_PATH,C:/aa/bb/cc.ext1.ext2>")
+else()
+ set (output "$<PATH:GET_PARENT_PATH,/aa/bb/cc.ext1.ext2>")
+endif()
+if (NOT output STREQUAL reference)
+ list (APPEND errors "PARENT_PATH returns bad data: ${output}")
+endif()
+
+######################################
+## second, tests with missing elements
+######################################
+set (path "aa/bb/")
+
+cmake_path(GET path ROOT_NAME reference)
+set(output "$<PATH:GET_ROOT_NAME,aa/bb/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "ROOT_NAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_DIRECTORY reference)
+set(output "$<PATH:GET_ROOT_DIRECTORY,aa/bb/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "ROOT_DIRECTORY returns bad data: >${output}<, >${reference}<")
+endif()
+
+cmake_path(GET path ROOT_PATH reference)
+set(output "$<PATH:GET_ROOT_PATH,aa/bb/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "ROOT_PATH returns bad data: ${output}")
+endif()
+
+cmake_path(GET path FILENAME reference)
+set(output "$<PATH:GET_FILENAME,aa/bb/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "FILENAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path EXTENSION reference)
+set(output "$<PATH:GET_EXTENSION,aa/bb/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+
+cmake_path(GET path STEM reference)
+set(output "$<PATH:GET_STEM,aa/bb/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "STEM returns bad data: ${output}")
+endif()
+
+cmake_path(GET path RELATIVE_PART reference)
+set(output "$<PATH:GET_RELATIVE_PART,aa/bb/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "RELATIVE_PART returns bad data: ${output}")
+endif()
+
+cmake_path(GET path PARENT_PATH reference)
+set(output "$<PATH:GET_PARENT_PATH,aa/bb/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "PARENT_PATH returns bad data: ${output}")
+endif()
+
+##################################
+set (path "/aa/bb/")
+
+cmake_path(GET path ROOT_NAME reference)
+set(output "$<PATH:GET_ROOT_NAME,/aa/bb/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "ROOT_NAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_DIRECTORY reference)
+set(output "$<PATH:GET_ROOT_DIRECTORY,/aa/bb/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_PATH reference)
+set(output "$<PATH:GET_ROOT_PATH,/aa/bb/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "ROOT_PATH returns bad data: ${output}")
+endif()
+
+###################################
+set (path "/")
+
+cmake_path(GET path ROOT_NAME reference)
+set(output "$<PATH:GET_ROOT_NAME,/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "ROOT_NAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_DIRECTORY reference)
+set(output "$<PATH:GET_ROOT_DIRECTORY,/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_PATH reference)
+set(output "$<PATH:GET_ROOT_PATH,/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "ROOT_PATH returns bad data: ${output}")
+endif()
+
+cmake_path(GET path FILENAME reference)
+set(output "$<PATH:GET_FILENAME,/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "FILENAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path EXTENSION reference)
+set(output "$<PATH:GET_EXTENSION,/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+
+cmake_path(GET path STEM reference)
+set(output "$<PATH:GET_STEM,/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "STEM returns bad data: ${output}")
+endif()
+
+cmake_path(GET path RELATIVE_PART reference)
+set(output "$<PATH:GET_RELATIVE_PART,/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "RELATIVE_PART returns bad data: ${output}")
+endif()
+
+cmake_path(GET path PARENT_PATH reference)
+set(output "$<PATH:GET_PARENT_PATH,/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "PARENT_PATH returns bad data: ${output}")
+endif()
+
+###################################
+set (path ".file")
+
+cmake_path(GET path FILENAME reference)
+set(output "$<PATH:GET_FILENAME,.file>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "FILENAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path EXTENSION reference)
+set(output "$<PATH:GET_EXTENSION,.file>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+
+cmake_path(GET path STEM reference)
+set(output "$<PATH:GET_STEM,.file>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "STEM returns bad data: ${output}")
+endif()
+
+###################################
+set (path ".file.ext")
+
+cmake_path(GET path FILENAME reference)
+set(output "$<PATH:GET_FILENAME,.file.ext>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "FILENAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path EXTENSION reference)
+set(output "$<PATH:GET_EXTENSION,.file.ext>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+cmake_path(GET path EXTENSION LAST_ONLY reference)
+set(output "$<PATH:GET_EXTENSION,LAST_ONLY,.file.ext>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+
+cmake_path(GET path STEM reference)
+set(output "$<PATH:GET_STEM,.file.ext>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "STEM returns bad data: ${output}")
+endif()
+
+###################################
+set (path ".file.ext1.ext2")
+
+cmake_path(GET path FILENAME reference)
+set(output "$<PATH:GET_FILENAME,.file.ext1.ext2>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "FILENAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path EXTENSION reference)
+set(output "$<PATH:GET_EXTENSION,.file.ext1.ext2>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+cmake_path(GET path EXTENSION LAST_ONLY reference)
+set(output "$<PATH:GET_EXTENSION,LAST_ONLY,.file.ext1.ext2>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+
+cmake_path(GET path STEM reference)
+set(output "$<PATH:GET_STEM,.file.ext1.ext2>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "STEM returns bad data: ${output}")
+endif()
+
+
+check_errors("PATH:GET..." ${errors})
diff --git a/Tests/RunCMake/GenEx-PATH/HAS_ITEM.cmake.in b/Tests/RunCMake/GenEx-PATH/HAS_ITEM.cmake.in
new file mode 100644
index 0000000000..fab9bd6782
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/HAS_ITEM.cmake.in
@@ -0,0 +1,199 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set(output "$<PATH:HAS_ROOT_NAME,/a/b>")
+if (output)
+ list (APPEND errors "ROOT_NAME: '/a/b' has root name")
+endif()
+set(output "$<PATH:HAS_ROOT_DIRECTORY,/a/b>")
+if (NOT output)
+ list (APPEND errors "ROOT_DIRECTORY: '/a/b' does not have root directory")
+endif()
+set(output "$<PATH:HAS_ROOT_PATH,/a/b>")
+if (NOT output)
+ list (APPEND errors "ROOT_PATH: '/a/b' does not have root path")
+endif()
+
+set(output "$<PATH:HAS_ROOT_PATH,a/b>")
+if (output)
+ list (APPEND errors "ROOT_PATH: 'a/b' has root path")
+endif()
+
+set(output "$<PATH:HAS_FILENAME,/a/b>")
+if (NOT output)
+ list (APPEND errors "FILENAME: '/a/b' does not have filename")
+endif()
+set(output "$<PATH:HAS_FILENAME,a.b>")
+if (NOT output)
+ list (APPEND errors "FILENAME: 'a.b' does not have filename")
+endif()
+set(output "$<PATH:HAS_FILENAME,/a/b/>")
+if (output)
+ list (APPEND errors "FILENAME: '/a/b/' has filename")
+endif()
+set(output "$<PATH:HAS_FILENAME,/>")
+if (output)
+ list (APPEND errors "FILENAME: '/' has filename")
+endif()
+
+set(output "$<PATH:HAS_STEM,/a/b>")
+if (NOT output)
+ list (APPEND errors "STEM: '/a/b' does not have stem")
+endif()
+set(output "$<PATH:HAS_STEM,a.b>")
+if (NOT output)
+ list (APPEND errors "STEM: 'a.b' does not have stem")
+endif()
+set(output "$<PATH:HAS_STEM,.a>")
+if (NOT output)
+ list (APPEND errors "STEM: '.a'} does not have stem")
+endif()
+set(output "$<PATH:HAS_STEM,/a/>")
+if (output)
+ list (APPEND errors "STEM: '/a/' has stem")
+endif()
+set(output "$<PATH:HAS_STEM,/>")
+if (output)
+ list (APPEND errors "STEM: '/' has stem")
+endif()
+
+set(output "$<PATH:HAS_EXTENSION,/a/b.c>")
+if (NOT output)
+ list (APPEND errors "EXTENSION: '/a/b.c' does not have extension")
+endif()
+set(output "$<PATH:HAS_EXTENSION,b.c>")
+if (NOT output)
+ list (APPEND errors "EXTENSION: 'b.c' does not have extension")
+endif()
+set(output "$<PATH:HAS_EXTENSION,/.a>")
+if (output)
+ list (APPEND errors "EXTENSION: '/.a' has extension")
+endif()
+set(output "$<PATH:HAS_EXTENSION,/a/>")
+if (output)
+ list (APPEND errors "EXTENSION: '/a/' has extension")
+endif()
+set(output "$<PATH:HAS_EXTENSION,/>")
+if (output)
+ list (APPEND errors "EXTENSION: '/' has extension")
+endif()
+
+set(output "$<PATH:HAS_RELATIVE_PART,/a/b>")
+if (NOT output)
+ list (APPEND errors "RELATIVE_PART: '/a/b' does not have relative part")
+endif()
+set(output "$<PATH:HAS_RELATIVE_PART,/>")
+if (output)
+ list (APPEND errors "RELATIVE_PART: '/' has relative part")
+endif()
+
+set(output "$<PATH:HAS_PARENT_PATH,/a/b>")
+if (NOT output)
+ list (APPEND errors "PARENT_PATH: '/a/b' does not have parent path")
+endif()
+set(output "$<PATH:HAS_PARENT_PATH,/>")
+if (NOT output)
+ list (APPEND errors "PARENT_PATH: '/' does not have parent path")
+endif()
+set(output "$<PATH:HAS_PARENT_PATH,a>")
+if (output)
+ list (APPEND errors "PARENT_PATH: 'a' has parent path")
+endif()
+
+if (WIN32)
+ set(output "$<PATH:HAS_ROOT_NAME,c:/a/b>")
+ if (NOT output)
+ list (APPEND errors "ROOT_NAME: 'c:/a/b' does not have root name")
+ endif()
+ set(output "$<PATH:HAS_ROOT_DIRECTORY,c:/a/b>")
+ if (NOT output)
+ list (APPEND errors "ROOT_DIRECTORY: 'c:/a/b' does not have root directory")
+ endif()
+ set(output "$<PATH:HAS_ROOT_PATH,c:/a/b>")
+ if (NOT output)
+ list (APPEND errors "ROOT_PATH: 'c:/a/b' does not have root path")
+ endif()
+
+ set(output "$<PATH:HAS_ROOT_NAME,c:a/b>")
+ if (NOT output)
+ list (APPEND errors "ROOT_NAME: 'c:a/b' does not have root name")
+ endif()
+ set(output "$<PATH:HAS_ROOT_DIRECTORY,c:a/b>")
+ if (output)
+ list (APPEND errors "ROOT_DIRECTORY: 'c:a/b' has root directory")
+ endif()
+ set(output "$<PATH:HAS_ROOT_PATH,c:a/b>")
+ if (NOT output)
+ list (APPEND errors "ROOT_PATH: 'c:a/b' does not have root path")
+ endif()
+
+ set(output "$<PATH:HAS_ROOT_NAME,//host/b>")
+ if (NOT output)
+ list (APPEND errors "ROOT_NAME: '//host/b' does not have root name")
+ endif()
+ set(output "$<PATH:HAS_ROOT_DIRECTORY,//host/b>")
+ if (NOT output)
+ list (APPEND errors "ROOT_DIRECTORY: '//host/b' does not have root directory")
+ endif()
+ set(output "$<PATH:HAS_ROOT_PATH,//host/b>")
+ if (NOT output)
+ list (APPEND errors "ROOT_PATH: '//host/b' does not have root path")
+ endif()
+
+ set(output "$<PATH:HAS_ROOT_NAME,//host>")
+ if (NOT output)
+ list (APPEND errors "ROOT_NAME: '//host' does not have root name")
+ endif()
+ set(output "$<PATH:HAS_ROOT_DIRECTORY,//host>")
+ if (output)
+ list (APPEND errors "ROOT_DIRECTORY: '//host' has root directory")
+ endif()
+ set(output "$<PATH:HAS_ROOT_PATH,//host>")
+ if (NOT output)
+ list (APPEND errors "ROOT_PATH: '//host' does not have root path")
+ endif()
+
+ set(output "$<PATH:HAS_RELATIVE_PART,c:/a/b>")
+ if (NOT output)
+ list (APPEND errors "RELATIVE_PART: 'c:/a/b' does not have relative part")
+ endif()
+
+ set(output "$<PATH:HAS_RELATIVE_PART,c:a/b>")
+ if (NOT output)
+ list (APPEND errors "RELATIVE_PART: 'c:a/b' does not have relative part")
+ endif()
+
+ set(output "$<PATH:HAS_RELATIVE_PART,//host/b>")
+ if (NOT output)
+ list (APPEND errors "RELATIVE_PART: '//host/b' does not have relative part")
+ endif()
+
+ set(output "$<PATH:HAS_PARENT_PATH,c:/a/b>")
+ if (NOT output)
+ list (APPEND errors "PARENT_PATH: 'c:/a/b' does not have parent path")
+ endif()
+
+ set(output "$<PATH:HAS_PARENT_PATH,c:/>")
+ if (NOT output)
+ list (APPEND errors "PARENT_PATH: 'c:/' does not have parent path")
+ endif()
+
+ set(output "$<PATH:HAS_PARENT_PATH,c:>")
+ if (NOT output)
+ list (APPEND errors "PARENT_PATH: 'c:' does not have parent path")
+ endif()
+
+ set(output "$<PATH:HAS_PARENT_PATH,//host/>")
+ if (NOT output)
+ list (APPEND errors "PARENT_PATH: '//host/' does not have parent path")
+ endif()
+
+ set(output "$<PATH:HAS_PARENT_PATH,//host>")
+ if (NOT output)
+ list (APPEND errors "PARENT_PATH: '//host' does not have parent path")
+ endif()
+endif()
+
+
+check_errors ("PATH:HAS..." ${errors})
diff --git a/Tests/RunCMake/GenEx-PATH/IS_ABSOLUTE.cmake.in b/Tests/RunCMake/GenEx-PATH/IS_ABSOLUTE.cmake.in
new file mode 100644
index 0000000000..872dae484a
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/IS_ABSOLUTE.cmake.in
@@ -0,0 +1,44 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+if (WIN32)
+ set(path "c:/a")
+ set(output "$<PATH:IS_ABSOLUTE,c:/a>")
+else()
+ set(path "/a")
+ set(output "$<PATH:IS_ABSOLUTE,/a>")
+endif()
+if (NOT output)
+ list (APPEND errors "'${path}' is not absolute")
+endif()
+
+set(output "$<PATH:IS_ABSOLUTE,a/b>")
+if (output)
+ list (APPEND errors "'a/b' is absolute")
+endif()
+
+if (WIN32)
+ set(output "$<PATH:IS_ABSOLUTE,c:/a/b>")
+ if (NOT output)
+ list (APPEND errors "'c:/a/b' is not absolute")
+ endif()
+
+ set(output "$<PATH:IS_ABSOLUTE,//host/b>")
+ if (NOT output)
+ list (APPEND errors "'//host/b' is not absolute")
+ endif()
+
+ set(output "$<PATH:IS_ABSOLUTE,/a>")
+ if (output)
+ list (APPEND errors "'/a' is absolute")
+ endif()
+
+ set(output "$<PATH:IS_ABSOLUTE,c:a>")
+ if (output)
+ list (APPEND errors "'c:a' is absolute")
+ endif()
+endif()
+
+
+check_errors("PATH:IS_ABSOLUTE" ${errors})
diff --git a/Tests/RunCMake/GenEx-PATH/IS_PREFIX.cmake.in b/Tests/RunCMake/GenEx-PATH/IS_PREFIX.cmake.in
new file mode 100644
index 0000000000..98b7ff81d3
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/IS_PREFIX.cmake.in
@@ -0,0 +1,25 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set(output "$<PATH:IS_PREFIX,a///b/c,a/b/c/d>")
+if (NOT output)
+ list (APPEND errors "'a///b/c' is not prefix of 'a/b/c/d'")
+endif()
+
+set(output "$<PATH:IS_PREFIX,a///b/c/../d,a/b/d/e>")
+if (output)
+ list (APPEND errors "'a///b/c/../d' is prefix of 'a/b/d/e'")
+endif()
+set(output "$<PATH:IS_PREFIX,NORMALIZE,a///b/c/../d,a/b/d/e>")
+if (NOT output)
+ list (APPEND errors "'a///b/c/../d' is not prefix of 'a/b/d/e'")
+endif()
+
+set(output "$<PATH:IS_PREFIX,NORMALIZE,/a/b/..,/a/c/../b")
+if (NOT output)
+ list (APPEND errors "'/a/b/..' is not prefix of '/a/c/../b'")
+endif()
+
+
+check_errors("PATH:IS_PREFIX" ${errors})
diff --git a/Tests/RunCMake/GenEx-PATH/IS_RELATIVE.cmake.in b/Tests/RunCMake/GenEx-PATH/IS_RELATIVE.cmake.in
new file mode 100644
index 0000000000..6d36581fbb
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/IS_RELATIVE.cmake.in
@@ -0,0 +1,45 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+
+if (WIN32)
+ set(path "c:/a")
+ set(output "$<PATH:IS_RELATIVE,c:/a>")
+else()
+ set(path "/a")
+ set(output "$<PATH:IS_RELATIVE,/a>")
+endif()
+if (output)
+ list (APPEND errors "'${path} is relative")
+endif()
+
+set(output "$<PATH:IS_RELATIVE,a/b>")
+if (NOT output)
+ list (APPEND errors "'a/b' is not relative")
+endif()
+
+if (WIN32)
+ set(output "$<PATH:IS_RELATIVE,c:/a/b>")
+ if (output)
+ list (APPEND errors "'c:/a/b' is relative")
+ endif()
+
+ set(output "$<PATH:IS_RELATIVE,//host/b>")
+ if (output)
+ list (APPEND errors "'//host/b' is relative")
+ endif()
+
+ set(output "$<PATH:IS_RELATIVE,/a>")
+ if (NOT output)
+ list (APPEND errors "'/a' is not relative")
+ endif()
+
+ set(output "$<PATH:IS_RELATIVE,c:a>")
+ if (NOT output)
+ list (APPEND errors "'c:a' is not relative")
+ endif()
+endif()
+
+
+check_errors("PATH:IS_RELATIVE" ${errors})
diff --git a/Tests/RunCMake/GenEx-PATH/NORMAL_PATH.cmake.in b/Tests/RunCMake/GenEx-PATH/NORMAL_PATH.cmake.in
new file mode 100644
index 0000000000..e6cc4a3868
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/NORMAL_PATH.cmake.in
@@ -0,0 +1,43 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (reference "a/./b/..")
+cmake_path(NORMAL_PATH reference)
+set(output "$<PATH:NORMAL_PATH,a/./b/..>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+endif()
+
+set (reference "a/.///b/../")
+cmake_path(NORMAL_PATH reference)
+set(output "$<PATH:NORMAL_PATH,a/.///b/../>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+endif()
+
+if (WIN32)
+ set (reference "//host/./b/..")
+ cmake_path(NORMAL_PATH reference)
+ set(output "$<PATH:NORMAL_PATH,//host/./b/..>")
+ if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+ endif()
+
+ set (reference "//host/./b/../")
+ cmake_path(NORMAL_PATH reference)
+ set(output "$<PATH:NORMAL_PATH,//host/./b/../>")
+ if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+ endif()
+
+ set (reference "c://a/.///b/../")
+ cmake_path(NORMAL_PATH reference)
+ set(output "$<PATH:NORMAL_PATH,c://a/.///b/../>")
+ if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+ endif()
+endif()
+
+
+check_errors("PATH:NORMAL_PATH" ${errors})
diff --git a/Tests/RunCMake/GenEx-PATH/RELATIVE_PATH.cmake.in b/Tests/RunCMake/GenEx-PATH/RELATIVE_PATH.cmake.in
new file mode 100644
index 0000000000..11d73ad8f7
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/RELATIVE_PATH.cmake.in
@@ -0,0 +1,64 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (reference "/a//d")
+cmake_path(RELATIVE_PATH reference BASE_DIRECTORY "/a/b/c")
+set(output "$<PATH:RELATIVE_PATH,/a//d,/a/b/c>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+endif()
+
+set (reference "/a//b///c")
+cmake_path(RELATIVE_PATH reference BASE_DIRECTORY "/a/d")
+set(output "$<PATH:RELATIVE_PATH,/a/b///c,/a/d>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+endif()
+
+set (reference "a/b/c")
+cmake_path(RELATIVE_PATH reference BASE_DIRECTORY "a")
+set(output "$<PATH:RELATIVE_PATH,a/b/c,a>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+endif()
+
+set (reference "a/b/c")
+cmake_path(RELATIVE_PATH reference BASE_DIRECTORY "a/b/c/x/y")
+set(output "$<PATH:RELATIVE_PATH,a/b/c,a/b/c/x/y>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+endif()
+
+set (reference "a/b/c")
+cmake_path(RELATIVE_PATH reference BASE_DIRECTORY "a/b/c")
+set(output "$<PATH:RELATIVE_PATH,a/b/c,a/b/c>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+endif()
+
+set (reference "a/b")
+cmake_path(RELATIVE_PATH reference BASE_DIRECTORY "c/d")
+set(output "$<PATH:RELATIVE_PATH,a/b,c/d>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+endif()
+
+set (reference "/a/d")
+cmake_path(RELATIVE_PATH reference BASE_DIRECTORY "e/d/c")
+set(output "$<PATH:RELATIVE_PATH,/a/d,e/d/c>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+endif()
+
+if (WIN32)
+ set (reference "c:/a/d")
+ cmake_path(RELATIVE_PATH reference BASE_DIRECTORY "e/d/c")
+ set(output "$<PATH:RELATIVE_PATH,c:/a/d,e/d/c>")
+ if (NOT output STREQUAL reference)
+ list (APPEND errors "'${output}' instead of '${reference}'")
+ endif()
+endif()
+
+
+check_errors("PATH:RELATIVE_PATH" ${errors})
diff --git a/Tests/RunCMake/GenEx-PATH/REMOVE_ITEM.cmake.in b/Tests/RunCMake/GenEx-PATH/REMOVE_ITEM.cmake.in
new file mode 100644
index 0000000000..cce4143591
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/REMOVE_ITEM.cmake.in
@@ -0,0 +1,65 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (reference "a/b/c.e.f")
+cmake_path (REMOVE_FILENAME reference)
+set(output "$<PATH:REMOVE_FILENAME,a/b/c.e.f>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "FILENAME: '${output}' instead of '${reference}'")
+endif()
+
+cmake_path (REMOVE_FILENAME reference)
+set(output "$<PATH:REMOVE_FILENAME,a/b/>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "FILENAME: '${output}' instead of '${reference}'")
+endif()
+
+
+set (reference "a/b/c.e.f")
+cmake_path (REMOVE_EXTENSION reference)
+set(output "$<PATH:REMOVE_EXTENSION,a/b/c.e.f>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
+endif()
+
+set (reference "a/b/c.e.f")
+cmake_path (REMOVE_EXTENSION reference LAST_ONLY)
+set(output "$<PATH:REMOVE_EXTENSION,LAST_ONLY,a/b/c.e.f>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
+endif()
+cmake_path (REMOVE_EXTENSION reference)
+set(output "$<PATH:REMOVE_EXTENSION,a/b/c.e>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
+endif()
+
+set (reference "a/b/c")
+cmake_path (REMOVE_EXTENSION reference)
+set(output "$<PATH:REMOVE_EXTENSION,a/b/c>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
+endif()
+
+set (reference "a/b/.c")
+cmake_path (REMOVE_EXTENSION reference)
+set(output "$<PATH:REMOVE_EXTENSION,a/b/.c>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
+endif()
+cmake_path (REMOVE_EXTENSION reference LAST_ONLY)
+set(output "$<PATH:REMOVE_EXTENSION,LAST_ONLY,a/b/.c>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
+endif()
+
+set (reference "a/b/.")
+cmake_path (REMOVE_EXTENSION reference LAST_ONLY)
+set(output "$<PATH:REMOVE_EXTENSION,LAST_ONLY,a/b/.>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
+endif()
+
+
+check_errors("PATH:REMOVE..." ${errors})
diff --git a/Tests/RunCMake/GenEx-PATH/REPLACE_ITEM.cmake.in b/Tests/RunCMake/GenEx-PATH/REPLACE_ITEM.cmake.in
new file mode 100644
index 0000000000..5bb04c3117
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/REPLACE_ITEM.cmake.in
@@ -0,0 +1,73 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (reference "a/b/c.e.f")
+cmake_path (REPLACE_FILENAME reference "x.y")
+set(output "$<PATH:REPLACE_FILENAME,a/b/c.e.f,x.y>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "FILENAME: '${output}' instead of '${reference}'")
+endif()
+
+set (reference "a/b/")
+cmake_path (REPLACE_FILENAME reference "x.y")
+set(output "$<PATH:REPLACE_FILENAME,a/b/,x.y>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "FILENAME: '${output}' instead of '${reference}'")
+endif()
+
+set (reference "a/b/c.e.f")
+cmake_path (REPLACE_EXTENSION reference ".x")
+set(output "$<PATH:REPLACE_EXTENSION,a/b/c.e.f,.x>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
+endif()
+cmake_path (REPLACE_EXTENSION reference ".y")
+set(output "$<PATH:REPLACE_EXTENSION,a/b/c.x,.y>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
+endif()
+cmake_path (REPLACE_EXTENSION reference "")
+set(output "$<PATH:REPLACE_EXTENSION,a/b/c.y,>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
+endif()
+
+set (reference "a/b/c.e.f")
+cmake_path (REPLACE_EXTENSION reference ".x" LAST_ONLY)
+set(output "$<PATH:REPLACE_EXTENSION,LAST_ONLY,a/b/c.e.f,.x>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
+endif()
+cmake_path (REPLACE_EXTENSION reference ".y" LAST_ONLY)
+set(output "$<PATH:REPLACE_EXTENSION,LAST_ONLY,a/b/c.e.x,.y>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
+endif()
+cmake_path (REPLACE_EXTENSION reference "" LAST_ONLY)
+set(output "$<PATH:REPLACE_EXTENSION,LAST_ONLY,a/b/c.e.y,>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
+endif()
+
+set (reference "/a/.b")
+cmake_path (REPLACE_EXTENSION reference ".x")
+set(output "$<PATH:REPLACE_EXTENSION,/a/.b,.x>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION: '${output}' instead of '/${reference}'")
+endif()
+cmake_path (REPLACE_EXTENSION reference ".x" LAST_ONLY)
+set(output "$<PATH:REPLACE_EXTENSION,LAST_ONLY,/a/.b.x,.x>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
+endif()
+
+set (reference "/a/b")
+cmake_path (REPLACE_EXTENSION reference ".x")
+set(output "$<PATH:REPLACE_EXTENSION,/a/b,.x>")
+if (NOT output STREQUAL reference)
+ list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
+endif()
+
+
+check_errors("PATH:REPLACE..." ${errors})
diff --git a/Tests/RunCMake/GenEx-PATH/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-PATH/RunCMakeTest.cmake
new file mode 100644
index 0000000000..a93777a29c
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/RunCMakeTest.cmake
@@ -0,0 +1,68 @@
+
+include(RunCMake)
+
+run_cmake(no-arguments)
+run_cmake(bad-option)
+
+function(check_path_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 GET_ROOT_NAME GET_ROOT_DIRECTORY GET_ROOT_PATH GET_FILENAME
+ GET_EXTENSION GET_STEM GET_RELATIVE_PART GET_PARENT_PATH
+ HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH HAS_FILENAME
+ HAS_EXTENSION HAS_STEM HAS_RELATIVE_PART HAS_PARENT_PATH
+ IS_ABSOLUTE IS_RELATIVE CMAKE_PATH REMOVE_FILENAME REMOVE_EXTENSION
+ NORMAL_PATH)
+ check_path_syntax (${subcommand} unexpected-arg "-DPATH_ARGUMENTS=${subcommand},ARG1,ARG2")
+endforeach()
+foreach (subcommand IN ITEMS GET_EXTENSION GET_STEM REMOVE_EXTENSION)
+ if (subcommand STREQUAL "REMOVE_EXTENSION")
+ set(RunCMake-stderr-file "unexpected-arg2-stderr.txt")
+ endif()
+ check_path_syntax ("${subcommand}[LAST_ONLY]" unexpected-arg "-DPATH_ARGUMENTS=${subcommand},LAST_ONLY,ARG1,ARG2")
+ unset(RunCMake-stderr-file)
+endforeach()
+foreach (subcommand IN ITEMS CMAKE_PATH)
+ check_path_syntax ("${subcommand}[NORMALIZE]" unexpected-arg "-DPATH_ARGUMENTS=${subcommand},NORMALIZE,ARG1,ARG2")
+endforeach()
+
+### sub-commands with two arguments
+foreach (subcommand IN ITEMS IS_PREFIX REPLACE_FILENAME REPLACE_EXTENSION RELATIVE_PATH ABSOLUTE_PATH)
+ check_path_syntax (${subcommand} unexpected-arg "-DPATH_ARGUMENTS=${subcommand},ARG1,ARG2,ARG3")
+endforeach()
+foreach (subcommand IN ITEMS IS_PREFIX ABSOLUTE_PATH)
+ check_path_syntax ("${subcommand}[NORMALIZE]" unexpected-arg "-DPATH_ARGUMENTS=${subcommand},NORMALIZE,ARG1,ARG2,ARG3")
+endforeach()
+foreach (subcommand IN ITEMS REPLACE_EXTENSION)
+ set(RunCMake-stderr-file "unexpected-arg2-stderr.txt")
+ check_path_syntax ("${subcommand}[LAST_ONLY]" unexpected-arg "-DPATH_ARGUMENTS=${subcommand},LAST_ONLY,ARG1,ARG2,ARG3")
+ unset(RunCMake-stderr-file)
+endforeach()
+unset (RunCMake-stderr-file)
+
+
+function(check_path_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 -DPATH_TEST=${name})
+ run_cmake_command(check "${CMAKE_COMMAND}" "-DRunCMake_SOURCE_DIR=${RunCMake_SOURCE_DIR}" -P "${RunCMake_TEST_BINARY_DIR}/${name}.cmake")
+endfunction()
+
+check_path_execution (GET_ITEM)
+check_path_execution (HAS_ITEM)
+check_path_execution (CMAKE_PATH)
+check_path_execution (APPEND)
+check_path_execution (REMOVE_ITEM)
+check_path_execution (REPLACE_ITEM)
+check_path_execution (NORMAL_PATH)
+check_path_execution (RELATIVE_PATH)
+check_path_execution (ABSOLUTE_PATH)
+check_path_execution (IS_RELATIVE)
+check_path_execution (IS_ABSOLUTE)
+check_path_execution (IS_PREFIX)
diff --git a/Tests/RunCMake/GenEx-PATH/bad-option-result.txt b/Tests/RunCMake/GenEx-PATH/bad-option-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/bad-option-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GenEx-PATH/bad-option-stderr.txt b/Tests/RunCMake/GenEx-PATH/bad-option-stderr.txt
new file mode 100644
index 0000000000..0a9584de8c
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/bad-option-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at bad-option.cmake:[0-9]+ \(file\):
+ Error evaluating generator expression:
+
+ \$<PATH:BAD_OPTION,ARG>
+
+ BAD_OPTION: invalid option.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/GenEx-PATH/bad-option.cmake b/Tests/RunCMake/GenEx-PATH/bad-option.cmake
new file mode 100644
index 0000000000..c9bfd4a890
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/bad-option.cmake
@@ -0,0 +1,2 @@
+
+file(GENERATE OUTPUT result.txt CONTENT "$<PATH:BAD_OPTION,ARG>")
diff --git a/Tests/RunCMake/GenEx-PATH/check_errors.cmake b/Tests/RunCMake/GenEx-PATH/check_errors.cmake
new file mode 100644
index 0000000000..7e60fc725e
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/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-PATH/generate.cmake b/Tests/RunCMake/GenEx-PATH/generate.cmake
new file mode 100644
index 0000000000..4bd5f3bcc6
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/generate.cmake
@@ -0,0 +1,2 @@
+
+file(GENERATE OUTPUT "${PATH_TEST}.cmake" INPUT "${PATH_TEST}.cmake.in")
diff --git a/Tests/RunCMake/GenEx-PATH/no-arguments-result.txt b/Tests/RunCMake/GenEx-PATH/no-arguments-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/no-arguments-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GenEx-PATH/no-arguments-stderr.txt b/Tests/RunCMake/GenEx-PATH/no-arguments-stderr.txt
new file mode 100644
index 0000000000..d1e534f6b4
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/no-arguments-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at no-arguments.cmake:[0-9]+ \(file\):
+ Error evaluating generator expression:
+
+ \$<PATH:>
+
+ \$<PATH> expression requires at least two parameters.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/GenEx-PATH/no-arguments.cmake b/Tests/RunCMake/GenEx-PATH/no-arguments.cmake
new file mode 100644
index 0000000000..5164339086
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/no-arguments.cmake
@@ -0,0 +1,2 @@
+
+file(GENERATE OUTPUT result.txt CONTENT "$<PATH:>")
diff --git a/Tests/RunCMake/GenEx-PATH/unexpected-arg-result.txt b/Tests/RunCMake/GenEx-PATH/unexpected-arg-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GenEx-PATH/unexpected-arg-stderr.txt b/Tests/RunCMake/GenEx-PATH/unexpected-arg-stderr.txt
new file mode 100644
index 0000000000..afc0026998
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/unexpected-arg-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at unexpected-arg.cmake:[0-9]+ \(file\):
+ Error evaluating generator expression:
+
+ \$<PATH:[A-Z_]+,.+>
+
+ \$<PATH:[A-Z_]+(,[A-Z_]+)?> expression requires exactly (one|two) parameters?.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/GenEx-PATH/unexpected-arg.cmake b/Tests/RunCMake/GenEx-PATH/unexpected-arg.cmake
new file mode 100644
index 0000000000..4625f044b3
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/unexpected-arg.cmake
@@ -0,0 +1,2 @@
+
+file(GENERATE OUTPUT result.txt CONTENT "$<PATH:${PATH_ARGUMENTS}>")
diff --git a/Tests/RunCMake/GenEx-PATH/unexpected-arg2-stderr.txt b/Tests/RunCMake/GenEx-PATH/unexpected-arg2-stderr.txt
new file mode 100644
index 0000000000..a38a7954a9
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH/unexpected-arg2-stderr.txt
@@ -0,0 +1,9 @@
+CMake Error at unexpected-arg.cmake:[0-9]+ \(file\):
+ Error evaluating generator expression:
+
+ \$<PATH:[A-Z_]+,.+>
+
+ \$<PATH:[A-Z_]+(,[A-Z_]+)?> expression requires exactly (one|two)
+ parameters?.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/GenEx-PATH_EQUAL/CMakeLists.txt b/Tests/RunCMake/GenEx-PATH_EQUAL/CMakeLists.txt
new file mode 100644
index 0000000000..f9748e968b
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH_EQUAL/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.18...3.24)
+
+project(${RunCMake_TEST} NONE)
+
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/GenEx-PATH_EQUAL/PATH_EQUAL.cmake.in b/Tests/RunCMake/GenEx-PATH_EQUAL/PATH_EQUAL.cmake.in
new file mode 100644
index 0000000000..e8a1e9534f
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH_EQUAL/PATH_EQUAL.cmake.in
@@ -0,0 +1,8 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+
+expect_true("$<PATH_EQUAL:a///b/c,a/b/c>" "a///b/c" "a/b/c")
+
+expect_false("$<PATH_EQUAL:a/b/d/../c,a/b/c>" "a/b/d/../c" "a/b/c")
+
+expect_true("$<PATH_EQUAL:$<PATH:NORMAL_PATH,a/b/d/../c>,a/b/c>" "a/b/d/../c" "a/b/c")
diff --git a/Tests/RunCMake/GenEx-PATH_EQUAL/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-PATH_EQUAL/RunCMakeTest.cmake
new file mode 100644
index 0000000000..802c50371d
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH_EQUAL/RunCMakeTest.cmake
@@ -0,0 +1,14 @@
+
+include(RunCMake)
+
+run_cmake(WrongArguments)
+
+function(check_path_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 -DPATH_TEST=${name})
+ run_cmake_command(check "${CMAKE_COMMAND}" "-DRunCMake_SOURCE_DIR=${RunCMake_SOURCE_DIR}" -P "${RunCMake_TEST_BINARY_DIR}/${name}.cmake")
+endfunction()
+
+check_path_execution (PATH_EQUAL)
diff --git a/Tests/RunCMake/GenEx-PATH_EQUAL/WrongArguments-result.txt b/Tests/RunCMake/GenEx-PATH_EQUAL/WrongArguments-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH_EQUAL/WrongArguments-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GenEx-PATH_EQUAL/WrongArguments-stderr.txt b/Tests/RunCMake/GenEx-PATH_EQUAL/WrongArguments-stderr.txt
new file mode 100644
index 0000000000..4cbc7ba0b8
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH_EQUAL/WrongArguments-stderr.txt
@@ -0,0 +1,42 @@
+CMake Error at WrongArguments.cmake:[0-9]+ \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<PATH_EQUAL>
+
+ \$<PATH_EQUAL> expression requires 2 comma separated parameters, but got 0
+ instead.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+
+
+CMake Error at WrongArguments.cmake:[0-9]+ \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<PATH_EQUAL:>
+
+ \$<PATH_EQUAL> expression requires 2 comma separated parameters, but got 1
+ instead.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+
+
+CMake Error at WrongArguments.cmake:2 \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<PATH_EQUAL:,,>
+
+ \$<PATH_EQUAL> expression requires 2 comma separated parameters, but got 3
+ instead.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+
+
+CMake Error at WrongArguments.cmake:[0-9]+ \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<PATH_EQUAL:something,,>
+
+ \$<PATH_EQUAL> expression requires 2 comma separated parameters, but got 3
+ instead.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/GenEx-PATH_EQUAL/WrongArguments.cmake b/Tests/RunCMake/GenEx-PATH_EQUAL/WrongArguments.cmake
new file mode 100644
index 0000000000..1288a0ece5
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH_EQUAL/WrongArguments.cmake
@@ -0,0 +1,7 @@
+
+add_custom_target(check ALL COMMAND check
+ $<PATH_EQUAL>
+ $<PATH_EQUAL:>
+ $<PATH_EQUAL:,,>
+ $<PATH_EQUAL:something,,>
+ VERBATIM)
diff --git a/Tests/RunCMake/GenEx-PATH_EQUAL/check_errors.cmake b/Tests/RunCMake/GenEx-PATH_EQUAL/check_errors.cmake
new file mode 100644
index 0000000000..fd99eb4c3f
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH_EQUAL/check_errors.cmake
@@ -0,0 +1,12 @@
+
+function(EXPECT_TRUE output data reference)
+ if (NOT output)
+ message(SEND_ERROR "'${data}' not equal to '${reference}'")
+ endif()
+endfunction()
+
+function(EXPECT_FALSE output data reference)
+ if (output)
+ message(SEND_ERROR "'${data}' equal to '${reference}'")
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/GenEx-PATH_EQUAL/generate.cmake b/Tests/RunCMake/GenEx-PATH_EQUAL/generate.cmake
new file mode 100644
index 0000000000..4bd5f3bcc6
--- /dev/null
+++ b/Tests/RunCMake/GenEx-PATH_EQUAL/generate.cmake
@@ -0,0 +1,2 @@
+
+file(GENERATE OUTPUT "${PATH_TEST}.cmake" INPUT "${PATH_TEST}.cmake.in")
diff --git a/Tests/RunCMake/NinjaMultiConfig/ExternalProject.cmake b/Tests/RunCMake/NinjaMultiConfig/ExternalProject.cmake
new file mode 100644
index 0000000000..7948133768
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/ExternalProject.cmake
@@ -0,0 +1,9 @@
+include(ExternalProject)
+ExternalProject_Add(proj1
+ DOWNLOAD_COMMAND ""
+ SOURCE_DIR ""
+ CONFIGURE_COMMAND ${CMAKE_COMMAND} -E echo "Configure proj1"
+ BUILD_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/out-$<CONFIG>.txt
+ BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/out-$<CONFIG>.txt
+ INSTALL_COMMAND ""
+)
diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
index 919015f792..738bc6c5d2 100644
--- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
@@ -17,7 +17,7 @@ function(check_files dir)
list(SORT expected)
file(GLOB_RECURSE actual "${dir}/*")
- list(FILTER actual EXCLUDE REGEX "/CMakeFiles/|\\.ninja$|/CMakeCache\\.txt$|/target_files[^/]*\\.cmake$|/\\.ninja_[^/]*$|/cmake_install\\.cmake$|\\.ilk$|\\.manifest$|\\.pdb$|\\.exp$|/install_manifest\\.txt$")
+ list(FILTER actual EXCLUDE REGEX "/CMakeFiles/|\\.ninja$|/CMakeCache\\.txt$|/target_files[^/]*\\.cmake$|/\\.ninja_[^/]*$|/cmake_install\\.cmake$|\\.ilk$|\\.manifest$|\\.pdb$|\\.exp$|/install_manifest\\.txt$|/\\.qt/QtDeploySupport[^/]*\\.cmake$")
foreach(f IN LISTS _check_files_INCLUDE _check_files_EXCLUDE)
if(EXISTS ${f})
list(APPEND actual ${f})
@@ -432,6 +432,13 @@ run_cmake_configure(ExcludeFromAll)
include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
run_cmake_build(ExcludeFromAll all "" all:all)
+set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ExternalProject-build)
+set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all;-DCMAKE_DEFAULT_CONFIGS=Debug\\;Release")
+run_cmake_configure(ExternalProject)
+unset(RunCMake_TEST_OPTIONS)
+run_cmake_build(ExternalProject release-in-debug-graph "Debug" all:Release)
+run_cmake_build(ExternalProject debug-in-release-graph "Release" all:Debug)
+
# FIXME Get this working
#set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AutoMocExecutable-build)
#run_cmake_configure(AutoMocExecutable)
diff --git a/Tests/RunCMake/PrintHelpers/CMakeLists.txt b/Tests/RunCMake/PrintHelpers/CMakeLists.txt
new file mode 100644
index 0000000000..6d4fe632dc
--- /dev/null
+++ b/Tests/RunCMake/PrintHelpers/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.23)
+project(${RunCMake_TEST} C)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/PrintHelpers/Properties-stdout.txt b/Tests/RunCMake/PrintHelpers/Properties-stdout.txt
new file mode 100644
index 0000000000..c52f7b6938
--- /dev/null
+++ b/Tests/RunCMake/PrintHelpers/Properties-stdout.txt
@@ -0,0 +1,14 @@
+.*Properties for TARGET nothing:.*
+.*nothing.LINKER_LANGUAGE = <NOTFOUND>.*
+.*nothing.TYPE = \"STATIC_LIBRARY\".*
+.*Properties for TARGET something:.*
+.*something.LINKER_LANGUAGE = <NOTFOUND>.*
+.*something.TYPE = \"EXECUTABLE\".*
++
+.*
+.*Properties for SOURCE nothing.c:.*
+.*nothing.c.COMPILE_DEFINITIONS = <NOTFOUND>.*
+.*nothing.c.LANGUAGE = \"C\".*
+.*Properties for SOURCE something.c:.*
+.*something.c.COMPILE_DEFINITIONS = \"SOMETHING=1\".*
+.*something.c.LANGUAGE = \"C\".*
diff --git a/Tests/RunCMake/PrintHelpers/Properties.cmake b/Tests/RunCMake/PrintHelpers/Properties.cmake
new file mode 100644
index 0000000000..3e8ecd1039
--- /dev/null
+++ b/Tests/RunCMake/PrintHelpers/Properties.cmake
@@ -0,0 +1,26 @@
+enable_language(C)
+
+set_property(SOURCE nothing.c PROPERTY LANGUAGE C)
+set_property(SOURCE something.c PROPERTY
+ COMPILE_DEFINITIONS SOMETHING=1)
+
+add_library(nothing STATIC nothing.c nothing.h)
+
+add_executable(something something.c something.h)
+target_link_libraries(something PUBLIC nothing)
+
+include(CMakePrintHelpers)
+
+cmake_print_properties(
+ TARGETS nothing something
+ PROPERTIES
+ LINKER_LANGUAGE
+ TYPE
+)
+
+cmake_print_properties(
+ SOURCES nothing.c something.c
+ PROPERTIES
+ COMPILE_DEFINITIONS
+ LANGUAGE
+)
diff --git a/Tests/RunCMake/PrintHelpers/PropertiesSources-stdout.cmake b/Tests/RunCMake/PrintHelpers/PropertiesSources-stdout.cmake
new file mode 100644
index 0000000000..93b3df07c6
--- /dev/null
+++ b/Tests/RunCMake/PrintHelpers/PropertiesSources-stdout.cmake
@@ -0,0 +1,8 @@
+.*Properties for TARGET rot13:.*
+.*rot13.SOURCES = \"rot13.c;rot13.h\".*
+.*rot13.POSITION_INDEPENDENT_CODE = \"True\".*
++
+.*--.*
+.*Properties for SOURCE rot13.c:.*
+.*rot13.c.LOCATION = \"[^\"]*/PrintHelpers/rot13.c\".*
+.*rot13.c.LANGUAGE = \"C\".*
diff --git a/Tests/RunCMake/PrintHelpers/PropertiesSources.cmake b/Tests/RunCMake/PrintHelpers/PropertiesSources.cmake
new file mode 100644
index 0000000000..f102b9416b
--- /dev/null
+++ b/Tests/RunCMake/PrintHelpers/PropertiesSources.cmake
@@ -0,0 +1,19 @@
+set_property(SOURCE rot13.c PROPERTY LANGUAGE C)
+
+add_library(rot13 SHARED rot13.c rot13.h)
+
+include(CMakePrintHelpers)
+
+cmake_print_properties(
+ TARGETS rot13
+ PROPERTIES
+ SOURCES
+ POSITION_INDEPENDENT_CODE
+)
+
+cmake_print_properties(
+ SOURCES rot13.c
+ PROPERTIES
+ LOCATION
+ LANGUAGE
+)
diff --git a/Tests/RunCMake/PrintHelpers/RunCMakeTest.cmake b/Tests/RunCMake/PrintHelpers/RunCMakeTest.cmake
new file mode 100644
index 0000000000..5b8ad0c46b
--- /dev/null
+++ b/Tests/RunCMake/PrintHelpers/RunCMakeTest.cmake
@@ -0,0 +1,5 @@
+include(RunCMake)
+
+run_cmake(Variables)
+run_cmake(Properties)
+run_cmake(PropertiesSources)
diff --git a/Tests/RunCMake/PrintHelpers/Variables-stdout.txt b/Tests/RunCMake/PrintHelpers/Variables-stdout.txt
new file mode 100644
index 0000000000..ca95c8d233
--- /dev/null
+++ b/Tests/RunCMake/PrintHelpers/Variables-stdout.txt
@@ -0,0 +1 @@
+-- source_dir="src" ; binary_dir="build"
diff --git a/Tests/RunCMake/PrintHelpers/Variables.cmake b/Tests/RunCMake/PrintHelpers/Variables.cmake
new file mode 100644
index 0000000000..88f5ad1857
--- /dev/null
+++ b/Tests/RunCMake/PrintHelpers/Variables.cmake
@@ -0,0 +1,6 @@
+
+set(source_dir "src")
+set(binary_dir "build")
+
+include(CMakePrintHelpers)
+cmake_print_variables(source_dir binary_dir)
diff --git a/Tests/RunCMake/PrintHelpers/nothing.c b/Tests/RunCMake/PrintHelpers/nothing.c
new file mode 100644
index 0000000000..32b7b393ca
--- /dev/null
+++ b/Tests/RunCMake/PrintHelpers/nothing.c
@@ -0,0 +1,6 @@
+#include "nothing.h"
+
+void nothing()
+{
+ (void*)0;
+}
diff --git a/Tests/RunCMake/PrintHelpers/nothing.h b/Tests/RunCMake/PrintHelpers/nothing.h
new file mode 100644
index 0000000000..ae86667598
--- /dev/null
+++ b/Tests/RunCMake/PrintHelpers/nothing.h
@@ -0,0 +1,8 @@
+#ifndef NOTHING_H
+#define NOTHING_H
+
+#include <stdlib.h>
+
+void nothing();
+
+#endif
diff --git a/Tests/RunCMake/PrintHelpers/rot13.c b/Tests/RunCMake/PrintHelpers/rot13.c
new file mode 100644
index 0000000000..053bebdbe7
--- /dev/null
+++ b/Tests/RunCMake/PrintHelpers/rot13.c
@@ -0,0 +1,15 @@
+#include "rot13.h"
+
+void rot13(char* in)
+{
+ char* end = in + strlen(in);
+ for (char* c = in; c < end; c++) {
+ if (*c >= 'a' && *c <= 'z') {
+ *c += (*c < 'n') ? 13 : -13;
+ continue;
+ }
+ if (*c >= 'A' && *c <= 'Z') {
+ *c += (*c < 'N') ? 13 : -13;
+ }
+ }
+}
diff --git a/Tests/RunCMake/PrintHelpers/rot13.h b/Tests/RunCMake/PrintHelpers/rot13.h
new file mode 100644
index 0000000000..9afea5f49e
--- /dev/null
+++ b/Tests/RunCMake/PrintHelpers/rot13.h
@@ -0,0 +1,9 @@
+#ifndef ROT13_H
+#define ROT13_H
+
+#include <stdlib.h>
+#include <string.h>
+
+void rot13(char* in);
+
+#endif
diff --git a/Tests/RunCMake/PrintHelpers/something.c b/Tests/RunCMake/PrintHelpers/something.c
new file mode 100644
index 0000000000..a2bc42573b
--- /dev/null
+++ b/Tests/RunCMake/PrintHelpers/something.c
@@ -0,0 +1,7 @@
+#include "something.h"
+
+int main()
+{
+ nothing();
+ return 0;
+}
diff --git a/Tests/RunCMake/PrintHelpers/something.h b/Tests/RunCMake/PrintHelpers/something.h
new file mode 100644
index 0000000000..667ee99c2f
--- /dev/null
+++ b/Tests/RunCMake/PrintHelpers/something.h
@@ -0,0 +1,8 @@
+#ifndef SOMETHING_H
+#define SOMETHING_H
+
+#include <stdlib.h>
+
+#include "nothing.h"
+
+#endif
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index f232b1bfb1..1c92ca0fdc 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -165,7 +165,9 @@ function(run_cmake test)
"|[^\n]*install_name_tool: warning: changes being made to the file will invalidate the code signature in:"
"|[^\n]*xcodebuild[^\n]*DVTPlugInManager"
+ "|[^\n]*xcodebuild[^\n]*DVTSDK: Warning: SDK path collision for path"
"|[^\n]*xcodebuild[^\n]*Requested but did not find extension point with identifier"
+ "|[^\n]*xcodebuild[^\n]*nil host used in call to allows.*HTTPSCertificateForHost"
"|[^\n]*xcodebuild[^\n]*warning: file type[^\n]*is based on missing file type"
"|[^\n]*objc[^\n]*: Class [^\n]* One of the two will be used. Which one is undefined."
"|[^\n]*is a member of multiple groups"
diff --git a/Tests/RunCMake/VS10Project/VsNoCompileBatching.cmake b/Tests/RunCMake/VS10Project/VsNoCompileBatching.cmake
index c96edce7ab..b405136a2e 100644
--- a/Tests/RunCMake/VS10Project/VsNoCompileBatching.cmake
+++ b/Tests/RunCMake/VS10Project/VsNoCompileBatching.cmake
@@ -2,8 +2,8 @@ enable_language(CXX)
add_library(foo foo.cpp)
+set(CMAKE_VS_NO_COMPILE_BATCHING ON)
add_library(foo_NB foo.cpp)
-set_property(TARGET foo_NB PROPERTY VS_NO_COMPILE_BATCHING ON)
add_library(foo_NB_OFF foo.cpp)
set_property(TARGET foo_NB_OFF PROPERTY VS_NO_COMPILE_BATCHING OFF)
diff --git a/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake b/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake
index edc655b362..f022a43c47 100644
--- a/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake
@@ -40,3 +40,8 @@ endif()
run_cmake_build(VerifyHeaderSets lang_test_c_verify_interface_header_sets)
run_cmake_build(VerifyHeaderSets lang_test_cxx_verify_interface_header_sets)
+run_cmake_build(VerifyHeaderSets list_verify_interface_header_sets)
+
+set(RunCMake_TEST_OPTIONS -DCMAKE_VERIFY_INTERFACE_HEADER_SETS=ON)
+run_cmake(VerifyHeaderSetsNonexistent)
+unset(RunCMake_TEST_OPTIONS)
diff --git a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake
index 24298df22e..82ed935a62 100644
--- a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake
+++ b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake
@@ -58,3 +58,13 @@ target_sources(lang_test_c INTERFACE FILE_SET HEADERS FILES lang_test.h)
add_library(lang_test_cxx STATIC lib.c lib.cxx)
target_compile_definitions(lang_test_cxx INTERFACE EXPECT_CXX)
target_sources(lang_test_cxx INTERFACE FILE_SET HEADERS FILES lang_test.h)
+
+set_property(SOURCE error.h PROPERTY LANGUAGE C)
+
+add_library(list STATIC lib.c)
+target_sources(list INTERFACE
+ FILE_SET a TYPE HEADERS FILES a.h
+ FILE_SET c TYPE HEADERS FILES dir/c.h
+ FILE_SET error TYPE HEADERS FILES error.h
+ )
+set_property(TARGET list PROPERTY INTERFACE_HEADER_SETS_TO_VERIFY "a;c")
diff --git a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent-result.txt b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent-stderr.txt b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent-stderr.txt
new file mode 100644
index 0000000000..76c2f94c56
--- /dev/null
+++ b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent-stderr.txt
@@ -0,0 +1,9 @@
+^CMake Error in CMakeLists\.txt:
+ Property INTERFACE_HEADER_SETS_TO_VERIFY of target "nonexistent" contained
+ the following header sets that are nonexistent or not INTERFACE:
+
+ b
+ c
+
+
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent.cmake b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent.cmake
new file mode 100644
index 0000000000..b269b73c0e
--- /dev/null
+++ b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+
+add_library(nonexistent STATIC lib.c)
+target_sources(nonexistent INTERFACE FILE_SET a TYPE HEADERS FILES a.h)
+set_property(TARGET nonexistent PROPERTY INTERFACE_HEADER_SETS_TO_VERIFY "a;c;b")
diff --git a/Tests/RunCMake/VerifyHeaderSets/error.h b/Tests/RunCMake/VerifyHeaderSets/error.h
new file mode 100644
index 0000000000..cbba5ae600
--- /dev/null
+++ b/Tests/RunCMake/VerifyHeaderSets/error.h
@@ -0,0 +1,3 @@
+#error "This file should not be included"
+
+extern void error_h(void);