summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLib/CMakeLists.txt1
-rw-r--r--Tests/CMakeLib/testJSONHelpers.cxx493
-rw-r--r--Tests/CMakeLib/testOptional.cxx315
-rw-r--r--Tests/CMakeLib/testStringAlgorithms.cxx10
-rw-r--r--Tests/CMakeLists.txt4
-rw-r--r--Tests/ISPC/CMakeLists.txt16
-rw-r--r--Tests/ISPC/ChainedStaticLibraries/CMakeLists.txt22
-rw-r--r--Tests/ISPC/ChainedStaticLibraries/extra.cxx17
-rw-r--r--Tests/ISPC/ChainedStaticLibraries/extra.ispc12
-rw-r--r--Tests/ISPC/ChainedStaticLibraries/main.cxx15
-rw-r--r--Tests/ISPC/ChainedStaticLibraries/simple.ispc12
-rw-r--r--Tests/ISPC/Defines/CMakeLists.txt16
-rw-r--r--Tests/ISPC/Defines/main.cxx15
-rw-r--r--Tests/ISPC/Defines/simple.ispc15
-rw-r--r--Tests/ISPC/DynamicLibrary/CMakeLists.txt20
-rw-r--r--Tests/ISPC/DynamicLibrary/extra.cxx17
-rw-r--r--Tests/ISPC/DynamicLibrary/extra.ispc12
-rw-r--r--Tests/ISPC/DynamicLibrary/main.cxx15
-rw-r--r--Tests/ISPC/DynamicLibrary/simple.ispc12
-rw-r--r--Tests/ISPC/ObjectGenex/CMakeLists.txt45
-rw-r--r--Tests/ISPC/ObjectGenex/main.cxx87
-rw-r--r--Tests/ISPC/ObjectGenex/simple.ispc12
-rw-r--r--Tests/ISPC/ObjectLibrary/CMakeLists.txt18
-rw-r--r--Tests/ISPC/ObjectLibrary/extra.cxx17
-rw-r--r--Tests/ISPC/ObjectLibrary/extra.ispc12
-rw-r--r--Tests/ISPC/ObjectLibrary/main.cxx15
-rw-r--r--Tests/ISPC/ObjectLibrary/simple.ispc12
-rw-r--r--Tests/ISPC/ResponseAndDefine/CMakeLists.txt28
-rw-r--r--Tests/ISPC/ResponseAndDefine/main.cxx15
-rw-r--r--Tests/ISPC/ResponseAndDefine/simple.ispc16
-rw-r--r--Tests/ISPC/StaticLibrary/CMakeLists.txt15
-rw-r--r--Tests/ISPC/StaticLibrary/main.cxx15
-rw-r--r--Tests/ISPC/StaticLibrary/simple.ispc12
-rw-r--r--Tests/ISPC/TryCompile/CMakeLists.txt16
-rw-r--r--Tests/ISPC/TryCompile/main.cxx19
-rw-r--r--Tests/ISPC/TryCompile/simple.ispc12
-rw-r--r--Tests/QtAutogen/RerunMocOnAddFile/CMakeLists.txt96
-rw-r--r--Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/CMakeLists.txt.in9
-rw-r--r--Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/anotherobject.cpp15
-rw-r--r--Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/main.cpp.in6
-rw-r--r--Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.cpp6
-rw-r--r--Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.h13
-rw-r--r--Tests/QtAutogen/RerunMocOnMissingDependency/CMakeLists.txt80
-rw-r--r--Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/CMakeLists.txt.in7
-rw-r--r--Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/inc1/foo.h2
-rw-r--r--Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/inc2/foo.h2
-rw-r--r--Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/main.cpp9
-rw-r--r--Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/myobject.cpp6
-rw-r--r--Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/myobject.h10
-rw-r--r--Tests/QtAutogen/Tests.cmake2
-rw-r--r--Tests/RunCMake/CMakeLists.txt17
-rw-r--r--Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt21
-rw-r--r--Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt21
-rw-r--r--Tests/RunCMake/CompilerLauncher/ISPC-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/ISPC-common.cmake4
-rw-r--r--Tests/RunCMake/CompilerLauncher/ISPC-env-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/ISPC-env-launch-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/ISPC-env.cmake1
-rw-r--r--Tests/RunCMake/CompilerLauncher/ISPC-launch-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/ISPC-launch-env.cmake3
-rw-r--r--Tests/RunCMake/CompilerLauncher/ISPC-launch.cmake3
-rw-r--r--Tests/RunCMake/CompilerLauncher/ISPC.cmake2
-rw-r--r--Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CompilerLauncher/test.ispc4
-rw-r--r--Tests/RunCMake/ExternalProject/DownloadServer.py6
-rw-r--r--Tests/RunCMake/ExternalProject/MultiCommand.cmake4
-rw-r--r--Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-result.txt1
-rw-r--r--Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-stderr.txt6
-rw-r--r--Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency.cmake12
-rw-r--r--Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-no-dependency.cmake12
-rw-r--r--Tests/RunCMake/Make/CMP0113-Common.cmake17
-rw-r--r--Tests/RunCMake/Make/CMP0113-NEW-build-gnu-stderr.txt5
-rw-r--r--Tests/RunCMake/Make/CMP0113-NEW-build-result.txt1
-rw-r--r--Tests/RunCMake/Make/CMP0113-NEW-build-stderr.txt1
-rw-r--r--Tests/RunCMake/Make/CMP0113-NEW-build-stdout.txt1
-rw-r--r--Tests/RunCMake/Make/CMP0113-NEW.cmake2
-rw-r--r--Tests/RunCMake/Make/CMP0113-OLD-build-stdout.txt1
-rw-r--r--Tests/RunCMake/Make/CMP0113-OLD.cmake2
-rw-r--r--Tests/RunCMake/Make/CMP0113-WARN-build-stdout.txt1
-rw-r--r--Tests/RunCMake/Make/CMP0113-WARN.cmake2
-rw-r--r--Tests/RunCMake/Make/RunCMakeTest.cmake22
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-clean-build-check.cmake3
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-leaf-custom-ninja-check.cmake6
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-leaf-exe-ninja-check.cmake6
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets.cmake12
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithNewline-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithTabs-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/ParenInENV-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt2
-rw-r--r--Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt2
-rw-r--r--Tests/RunCMake/XcodeProject/DeploymentTarget.cmake3
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase.cmake87
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY-check.cmake19
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_Funcs.cmake55
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-result.txt1
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-stderr.txt1
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID.cmake4
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION-check.cmake19
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE-check.cmake19
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject/RunCMakeTest.cmake13
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeBundles.cmake2
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake1
-rw-r--r--Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/ABSOLUTE_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/ABSOLUTE_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake39
-rw-r--r--Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/APPEND-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/APPEND.cmake77
-rw-r--r--Tests/RunCMake/cmake_path/CMAKE_PATH-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CMAKE_PATH-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CMAKE_PATH-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CMAKE_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CMAKE_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CMAKE_PATH.cmake43
-rw-r--r--Tests/RunCMake/cmake_path/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE-EQUAL-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE-EQUAL-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE-EQUAL-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE-wrong-operator-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE-wrong-operator-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE-wrong-operator.cmake3
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE.cmake22
-rw-r--r--Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONCAT-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONCAT.cmake20
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT-wrong-operator-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT-wrong-operator-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT-wrong-operator.cmake2
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT.cmake110
-rw-r--r--Tests/RunCMake/cmake_path/GET-EXTENSION-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-EXTENSION-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-EXTENSION-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-EXTENSION-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-FILENAME-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-FILENAME-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-FILENAME-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-FILENAME-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-PARENT_PATH-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-PARENT_PATH-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-PARENT_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-PARENT_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_NAME-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_NAME-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_NAME-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_NAME-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_PATH-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_PATH-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-STEM-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-STEM-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-STEM-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-STEM-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-wrong-operator-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-wrong-operator-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_path/GET-wrong-operator.cmake3
-rw-r--r--Tests/RunCMake/cmake_path/GET.cmake248
-rw-r--r--Tests/RunCMake/cmake_path/HASH-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HASH-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HASH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HASH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HASH.cmake27
-rw-r--r--Tests/RunCMake/cmake_path/HAS_EXTENSION-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_EXTENSION-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_EXTENSION-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_EXTENSION-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_FILENAME-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_FILENAME-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_FILENAME-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_FILENAME-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ITEM.cmake232
-rw-r--r--Tests/RunCMake/cmake_path/HAS_PARENT_PATH-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_PARENT_PATH-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_PARENT_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_PARENT_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_NAME-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_NAME-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_NAME-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_NAME-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_PATH-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_PATH-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_STEM-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_STEM-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_STEM-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_STEM-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_ABSOLUTE-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_ABSOLUTE-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_ABSOLUTE-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_ABSOLUTE-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_ABSOLUTE.cmake48
-rw-r--r--Tests/RunCMake/cmake_path/IS_PREFIX-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_PREFIX-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_PREFIX-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_PREFIX-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_PREFIX.cmake22
-rw-r--r--Tests/RunCMake/cmake_path/IS_RELATIVE-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_RELATIVE-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_RELATIVE-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_RELATIVE-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_RELATIVE.cmake48
-rw-r--r--Tests/RunCMake/cmake_path/NATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/NATIVE_PATH-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/NATIVE_PATH-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/NATIVE_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/NATIVE_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/NATIVE_PATH.cmake37
-rw-r--r--Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/NORMAL_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/NORMAL_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/NORMAL_PATH.cmake46
-rw-r--r--Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/PROXIMATE_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/PROXIMATE_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/PROXIMATE_PATH.cmake41
-rw-r--r--Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/RELATIVE_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/RELATIVE_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/RELATIVE_PATH.cmake76
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_EXTENSION-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_EXTENSION-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_EXTENSION.cmake52
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_FILENAME-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_FILENAME-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_FILENAME.cmake25
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_EXTENSION-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_EXTENSION-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_EXTENSION.cmake58
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_FILENAME-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_FILENAME-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_FILENAME.cmake26
-rw-r--r--Tests/RunCMake/cmake_path/RunCMakeTest.cmake191
-rw-r--r--Tests/RunCMake/cmake_path/call-cmake_path.cmake19
-rw-r--r--Tests/RunCMake/cmake_path/check_errors.cmake12
-rw-r--r--Tests/RunCMake/cmake_path/invalid-output-var-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_path/missing-output-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_path/unexpected-arg-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_path/wrong-path-stderr.txt2
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt5
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake6
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt6
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake4
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt4
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake5
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt4
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake5
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt4
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake5
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake5
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-override.cmake6
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt6
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake6
-rw-r--r--Tests/RunCMake/file-CHMOD/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake19
-rw-r--r--Tests/RunCMake/file/REAL_PATH-no-base-dir-result.txt1
-rw-r--r--Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt2
-rw-r--r--Tests/RunCMake/file/REAL_PATH-no-base-dir.cmake2
-rw-r--r--Tests/RunCMake/file/REAL_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/file/REAL_PATH-unexpected-arg-stderr.txt2
-rw-r--r--Tests/RunCMake/file/REAL_PATH-unexpected-arg.cmake2
-rw-r--r--Tests/RunCMake/file/REAL_PATH.cmake14
-rw-r--r--Tests/RunCMake/file/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake11
-rw-r--r--Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake4
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/install/obj1.ispc4
-rw-r--r--Tests/RunCMake/install/obj2.ispc4
-rw-r--r--Tests/RunCMake/try_compile/ISPCDuplicateTarget-stderr.txt1
-rw-r--r--Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake8
-rw-r--r--Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-stderr.txt1
-rw-r--r--Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake11
-rw-r--r--Tests/RunCMake/try_compile/ISPCInvalidTarget-stderr.txt1
-rw-r--r--Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake7
-rw-r--r--Tests/RunCMake/try_compile/ISPCTargets-stderr.txt1
-rw-r--r--Tests/RunCMake/try_compile/ISPCTargets-stdout.txt1
-rw-r--r--Tests/RunCMake/try_compile/ISPCTargets.cmake7
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/try_compile/src.ispc4
-rw-r--r--Tests/UseSWIG/CMakeLists.txt9
-rw-r--r--Tests/UseSWIG/MultipleFiles/CMakeLists.txt30
-rw-r--r--Tests/UseSWIG/MultipleFiles/add.cxx6
-rw-r--r--Tests/UseSWIG/MultipleFiles/add.h1
-rw-r--r--Tests/UseSWIG/MultipleFiles/add.i4
-rw-r--r--Tests/UseSWIG/MultipleFiles/sub.cxx6
-rw-r--r--Tests/UseSWIG/MultipleFiles/sub.h1
-rw-r--r--Tests/UseSWIG/MultipleFiles/sub.i5
-rw-r--r--Tests/XCTest/CMakeLists.txt4
355 files changed, 3952 insertions, 155 deletions
diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt
index 0b2c8f6..87925bd 100644
--- a/Tests/CMakeLib/CMakeLists.txt
+++ b/Tests/CMakeLib/CMakeLists.txt
@@ -13,6 +13,7 @@ set(CMakeLib_TESTS
testCTestResourceGroups.cxx
testGccDepfileReader.cxx
testGeneratedFileStream.cxx
+ testJSONHelpers.cxx
testRST.cxx
testRange.cxx
testOptional.cxx
diff --git a/Tests/CMakeLib/testJSONHelpers.cxx b/Tests/CMakeLib/testJSONHelpers.cxx
new file mode 100644
index 0000000..78eed5b
--- /dev/null
+++ b/Tests/CMakeLib/testJSONHelpers.cxx
@@ -0,0 +1,493 @@
+#include <functional>
+#include <iostream>
+#include <map>
+#include <string>
+#include <vector>
+
+#include <cm/optional>
+#include <cmext/string_view>
+
+#include <cm3p/json/value.h>
+
+#include "cmJSONHelpers.h"
+
+#define ASSERT_TRUE(x) \
+ do { \
+ if (!(x)) { \
+ std::cout << "ASSERT_TRUE(" #x ") failed on line " << __LINE__ << "\n"; \
+ return false; \
+ } \
+ } while (false)
+
+namespace {
+struct ObjectStruct
+{
+ std::string Field1;
+ int Field2;
+};
+
+struct InheritedStruct : public ObjectStruct
+{
+ std::string Field3;
+};
+
+enum class ErrorCode
+{
+ Success,
+ InvalidInt,
+ InvalidBool,
+ InvalidString,
+ InvalidObject,
+ InvalidArray,
+ MissingRequired,
+};
+
+auto const IntHelper =
+ cmJSONIntHelper<ErrorCode>(ErrorCode::Success, ErrorCode::InvalidInt, 1);
+auto const RequiredIntHelper =
+ cmJSONRequiredHelper<int, ErrorCode>(ErrorCode::MissingRequired, IntHelper);
+auto const UIntHelper =
+ cmJSONUIntHelper<ErrorCode>(ErrorCode::Success, ErrorCode::InvalidInt, 1);
+auto const BoolHelper = cmJSONBoolHelper<ErrorCode>(
+ ErrorCode::Success, ErrorCode::InvalidBool, false);
+auto const StringHelper = cmJSONStringHelper<ErrorCode>(
+ ErrorCode::Success, ErrorCode::InvalidString, "default");
+auto const RequiredStringHelper = cmJSONRequiredHelper<std::string, ErrorCode>(
+ ErrorCode::MissingRequired, StringHelper);
+auto const StringVectorHelper = cmJSONVectorHelper<std::string, ErrorCode>(
+ ErrorCode::Success, ErrorCode::InvalidArray, StringHelper);
+auto const StringVectorFilterHelper =
+ cmJSONVectorFilterHelper<std::string, ErrorCode>(
+ ErrorCode::Success, ErrorCode::InvalidArray, StringHelper,
+ [](const std::string& value) { return value != "ignore"; });
+auto const StringMapHelper = cmJSONMapHelper<std::string, ErrorCode>(
+ ErrorCode::Success, ErrorCode::InvalidObject, StringHelper);
+auto const StringMapFilterHelper =
+ cmJSONMapFilterHelper<std::string, ErrorCode>(
+ ErrorCode::Success, ErrorCode::InvalidObject, StringHelper,
+ [](const std::string& key) { return key != "ignore"; });
+auto const OptionalStringHelper =
+ cmJSONOptionalHelper<std::string>(ErrorCode::Success, StringHelper);
+
+bool testInt()
+{
+ Json::Value v(2);
+ int i = 0;
+ ASSERT_TRUE(IntHelper(i, &v) == ErrorCode::Success);
+ ASSERT_TRUE(i == 2);
+
+ i = 0;
+ v = Json::nullValue;
+ ASSERT_TRUE(IntHelper(i, &v) == ErrorCode::InvalidInt);
+
+ i = 0;
+ ASSERT_TRUE(IntHelper(i, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(i == 1);
+
+ return true;
+}
+
+bool testUInt()
+{
+ Json::Value v(2);
+ unsigned int i = 0;
+ ASSERT_TRUE(UIntHelper(i, &v) == ErrorCode::Success);
+ ASSERT_TRUE(i == 2);
+
+ i = 0;
+ v = Json::nullValue;
+ ASSERT_TRUE(UIntHelper(i, &v) == ErrorCode::InvalidInt);
+
+ i = 0;
+ ASSERT_TRUE(UIntHelper(i, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(i == 1);
+
+ return true;
+}
+
+bool testBool()
+{
+ Json::Value v(true);
+ bool b = false;
+ ASSERT_TRUE(BoolHelper(b, &v) == ErrorCode::Success);
+ ASSERT_TRUE(b);
+
+ b = false;
+ v = false;
+ ASSERT_TRUE(BoolHelper(b, &v) == ErrorCode::Success);
+ ASSERT_TRUE(!b);
+
+ b = false;
+ v = 4;
+ ASSERT_TRUE(BoolHelper(b, &v) == ErrorCode::InvalidBool);
+
+ b = true;
+ ASSERT_TRUE(BoolHelper(b, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(!b);
+
+ return true;
+}
+
+bool testString()
+{
+ Json::Value v("str");
+ std::string str = "";
+ ASSERT_TRUE(StringHelper(str, &v) == ErrorCode::Success);
+ ASSERT_TRUE(str == "str");
+
+ str = "";
+ v = Json::nullValue;
+ ASSERT_TRUE(StringHelper(str, &v) == ErrorCode::InvalidString);
+
+ str = "";
+ ASSERT_TRUE(StringHelper(str, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(str == "default");
+
+ return true;
+}
+
+bool testObject()
+{
+ auto const helper = cmJSONObjectHelper<ObjectStruct, ErrorCode>(
+ ErrorCode::Success, ErrorCode::InvalidObject)
+ .Bind("field1"_s, &ObjectStruct::Field1, StringHelper)
+ .Bind("field2"_s, &ObjectStruct::Field2, IntHelper)
+ .Bind<std::string>("field3"_s, nullptr, StringHelper);
+
+ Json::Value v(Json::objectValue);
+ v["field1"] = "Hello";
+ v["field2"] = 2;
+ v["field3"] = "world!";
+ v["extra"] = "extra";
+
+ ObjectStruct s1;
+ ASSERT_TRUE(helper(s1, &v) == ErrorCode::Success);
+ ASSERT_TRUE(s1.Field1 == "Hello");
+ ASSERT_TRUE(s1.Field2 == 2);
+
+ v["field2"] = "wrong";
+ ObjectStruct s2;
+ ASSERT_TRUE(helper(s2, &v) == ErrorCode::InvalidInt);
+
+ v.removeMember("field2");
+ ObjectStruct s3;
+ ASSERT_TRUE(helper(s3, &v) == ErrorCode::InvalidObject);
+
+ v["field2"] = 2;
+ v["field3"] = 3;
+ ObjectStruct s4;
+ ASSERT_TRUE(helper(s4, &v) == ErrorCode::InvalidString);
+
+ v.removeMember("field3");
+ ObjectStruct s5;
+ ASSERT_TRUE(helper(s5, &v) == ErrorCode::InvalidObject);
+
+ v = "Hello";
+ ObjectStruct s6;
+ ASSERT_TRUE(helper(s6, &v) == ErrorCode::InvalidObject);
+
+ ObjectStruct s7;
+ ASSERT_TRUE(helper(s7, nullptr) == ErrorCode::InvalidObject);
+
+ return true;
+}
+
+bool testObjectInherited()
+{
+ auto const helper =
+ cmJSONObjectHelper<InheritedStruct, ErrorCode>(ErrorCode::Success,
+ ErrorCode::InvalidObject)
+ .Bind("field1"_s, &InheritedStruct::Field1, StringHelper)
+ .Bind("field2"_s, &InheritedStruct::Field2, IntHelper)
+ .Bind("field3"_s, &InheritedStruct::Field3, StringHelper);
+
+ Json::Value v(Json::objectValue);
+ v["field1"] = "Hello";
+ v["field2"] = 2;
+ v["field3"] = "world!";
+ v["extra"] = "extra";
+
+ InheritedStruct s1;
+ ASSERT_TRUE(helper(s1, &v) == ErrorCode::Success);
+ ASSERT_TRUE(s1.Field1 == "Hello");
+ ASSERT_TRUE(s1.Field2 == 2);
+ ASSERT_TRUE(s1.Field3 == "world!");
+
+ v["field2"] = "wrong";
+ InheritedStruct s2;
+ ASSERT_TRUE(helper(s2, &v) == ErrorCode::InvalidInt);
+
+ v.removeMember("field2");
+ InheritedStruct s3;
+ ASSERT_TRUE(helper(s3, &v) == ErrorCode::InvalidObject);
+
+ v["field2"] = 2;
+ v["field3"] = 3;
+ InheritedStruct s4;
+ ASSERT_TRUE(helper(s4, &v) == ErrorCode::InvalidString);
+
+ v.removeMember("field3");
+ InheritedStruct s5;
+ ASSERT_TRUE(helper(s5, &v) == ErrorCode::InvalidObject);
+
+ v = "Hello";
+ InheritedStruct s6;
+ ASSERT_TRUE(helper(s6, &v) == ErrorCode::InvalidObject);
+
+ InheritedStruct s7;
+ ASSERT_TRUE(helper(s7, nullptr) == ErrorCode::InvalidObject);
+
+ return true;
+}
+
+bool testObjectNoExtra()
+{
+ auto const helper = cmJSONObjectHelper<ObjectStruct, ErrorCode>(
+ ErrorCode::Success, ErrorCode::InvalidObject, false)
+ .Bind("field1"_s, &ObjectStruct::Field1, StringHelper)
+ .Bind("field2"_s, &ObjectStruct::Field2, IntHelper);
+
+ Json::Value v(Json::objectValue);
+ v["field1"] = "Hello";
+ v["field2"] = 2;
+
+ ObjectStruct s1;
+ ASSERT_TRUE(helper(s1, &v) == ErrorCode::Success);
+ ASSERT_TRUE(s1.Field1 == "Hello");
+ ASSERT_TRUE(s1.Field2 == 2);
+
+ v["extra"] = "world!";
+ ObjectStruct s2;
+ ASSERT_TRUE(helper(s2, &v) == ErrorCode::InvalidObject);
+
+ return true;
+}
+
+bool testObjectOptional()
+{
+ auto const helper =
+ cmJSONObjectHelper<ObjectStruct, ErrorCode>(ErrorCode::Success,
+ ErrorCode::InvalidObject)
+ .Bind("field1"_s, &ObjectStruct::Field1, StringHelper, false)
+ .Bind("field2"_s, &ObjectStruct::Field2, IntHelper, false)
+ .Bind<std::string>("field3_s", nullptr, StringHelper, false);
+
+ Json::Value v(Json::objectValue);
+ v["field1"] = "Hello";
+ v["field2"] = 2;
+ v["field3"] = "world!";
+ v["extra"] = "extra";
+
+ ObjectStruct s1;
+ ASSERT_TRUE(helper(s1, &v) == ErrorCode::Success);
+ ASSERT_TRUE(s1.Field1 == "Hello");
+ ASSERT_TRUE(s1.Field2 == 2);
+
+ v = Json::objectValue;
+ ObjectStruct s2;
+ ASSERT_TRUE(helper(s2, &v) == ErrorCode::Success);
+ ASSERT_TRUE(s2.Field1 == "default");
+ ASSERT_TRUE(s2.Field2 == 1);
+
+ ObjectStruct s3;
+ ASSERT_TRUE(helper(s3, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(s3.Field1 == "default");
+ ASSERT_TRUE(s3.Field2 == 1);
+
+ return true;
+}
+
+bool testVector()
+{
+ Json::Value v(Json::arrayValue);
+ v.append("Hello");
+ v.append("world!");
+ v.append("ignore");
+
+ std::vector<std::string> l{ "default" };
+ std::vector<std::string> expected{ "Hello", "world!", "ignore" };
+ ASSERT_TRUE(StringVectorHelper(l, &v) == ErrorCode::Success);
+ ASSERT_TRUE(l == expected);
+
+ v[1] = 2;
+ l = { "default" };
+ ASSERT_TRUE(StringVectorHelper(l, &v) == ErrorCode::InvalidString);
+
+ v = "Hello";
+ l = { "default" };
+ ASSERT_TRUE(StringVectorHelper(l, &v) == ErrorCode::InvalidArray);
+
+ l = { "default" };
+ ASSERT_TRUE(StringVectorHelper(l, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(l.empty());
+
+ return true;
+}
+
+bool testVectorFilter()
+{
+ Json::Value v(Json::arrayValue);
+ v.append("Hello");
+ v.append("world!");
+ v.append("ignore");
+
+ std::vector<std::string> l{ "default" };
+ std::vector<std::string> expected{
+ "Hello",
+ "world!",
+ };
+ ASSERT_TRUE(StringVectorFilterHelper(l, &v) == ErrorCode::Success);
+ ASSERT_TRUE(l == expected);
+
+ v[1] = 2;
+ l = { "default" };
+ ASSERT_TRUE(StringVectorFilterHelper(l, &v) == ErrorCode::InvalidString);
+
+ v = "Hello";
+ l = { "default" };
+ ASSERT_TRUE(StringVectorFilterHelper(l, &v) == ErrorCode::InvalidArray);
+
+ l = { "default" };
+ ASSERT_TRUE(StringVectorFilterHelper(l, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(l.empty());
+
+ return true;
+}
+
+bool testMap()
+{
+ Json::Value v(Json::objectValue);
+ v["field1"] = "Hello";
+ v["field2"] = "world!";
+ v["ignore"] = "ignore";
+
+ std::map<std::string, std::string> m{ { "key", "default" } };
+ std::map<std::string, std::string> expected{ { "field1", "Hello" },
+ { "field2", "world!" },
+ { "ignore", "ignore" } };
+ ASSERT_TRUE(StringMapHelper(m, &v) == ErrorCode::Success);
+ ASSERT_TRUE(m == expected);
+
+ v = Json::arrayValue;
+ m = { { "key", "default" } };
+ ASSERT_TRUE(StringMapHelper(m, &v) == ErrorCode::InvalidObject);
+
+ m = { { "key", "default" } };
+ ASSERT_TRUE(StringMapHelper(m, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(m.empty());
+
+ return true;
+}
+
+bool testMapFilter()
+{
+ Json::Value v(Json::objectValue);
+ v["field1"] = "Hello";
+ v["field2"] = "world!";
+ v["ignore"] = "ignore";
+
+ std::map<std::string, std::string> m{ { "key", "default" } };
+ std::map<std::string, std::string> expected{ { "field1", "Hello" },
+ { "field2", "world!" } };
+ ASSERT_TRUE(StringMapFilterHelper(m, &v) == ErrorCode::Success);
+ ASSERT_TRUE(m == expected);
+
+ v = Json::arrayValue;
+ m = { { "key", "default" } };
+ ASSERT_TRUE(StringMapFilterHelper(m, &v) == ErrorCode::InvalidObject);
+
+ m = { { "key", "default" } };
+ ASSERT_TRUE(StringMapFilterHelper(m, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(m.empty());
+
+ return true;
+}
+
+bool testOptional()
+{
+ Json::Value v = "Hello";
+
+ cm::optional<std::string> str{ "default" };
+ ASSERT_TRUE(OptionalStringHelper(str, &v) == ErrorCode::Success);
+ ASSERT_TRUE(str == "Hello");
+
+ str.emplace("default");
+ ASSERT_TRUE(OptionalStringHelper(str, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(str == cm::nullopt);
+
+ return true;
+}
+
+bool testRequired()
+{
+ Json::Value v = "Hello";
+
+ std::string str = "default";
+ int i = 1;
+ ASSERT_TRUE(RequiredStringHelper(str, &v) == ErrorCode::Success);
+ ASSERT_TRUE(str == "Hello");
+ ASSERT_TRUE(RequiredIntHelper(i, &v) == ErrorCode::InvalidInt);
+
+ v = 2;
+ str = "default";
+ i = 1;
+ ASSERT_TRUE(RequiredStringHelper(str, &v) == ErrorCode::InvalidString);
+ ASSERT_TRUE(RequiredIntHelper(i, &v) == ErrorCode::Success);
+ ASSERT_TRUE(i == 2);
+
+ str = "default";
+ i = 1;
+ ASSERT_TRUE(RequiredStringHelper(str, nullptr) ==
+ ErrorCode::MissingRequired);
+ ASSERT_TRUE(RequiredIntHelper(i, nullptr) == ErrorCode::MissingRequired);
+
+ return true;
+}
+}
+
+int testJSONHelpers(int /*unused*/, char* /*unused*/ [])
+{
+ if (!testInt()) {
+ return 1;
+ }
+ if (!testUInt()) {
+ return 1;
+ }
+ if (!testBool()) {
+ return 1;
+ }
+ if (!testString()) {
+ return 1;
+ }
+ if (!testObject()) {
+ return 1;
+ }
+ if (!testObjectInherited()) {
+ return 1;
+ }
+ if (!testObjectNoExtra()) {
+ return 1;
+ }
+ if (!testObjectOptional()) {
+ return 1;
+ }
+ if (!testVector()) {
+ return 1;
+ }
+ if (!testVectorFilter()) {
+ return 1;
+ }
+ if (!testMap()) {
+ return 1;
+ }
+ if (!testMapFilter()) {
+ return 1;
+ }
+ if (!testOptional()) {
+ return 1;
+ }
+ if (!testRequired()) {
+ return 1;
+ }
+ return 0;
+}
diff --git a/Tests/CMakeLib/testOptional.cxx b/Tests/CMakeLib/testOptional.cxx
index c6bc9c2..de09c0f 100644
--- a/Tests/CMakeLib/testOptional.cxx
+++ b/Tests/CMakeLib/testOptional.cxx
@@ -29,6 +29,13 @@ public:
CONST_RVALUE_REFERENCE,
SWAP,
+
+ COMPARE_EE_EQ,
+ COMPARE_EE_NE,
+ COMPARE_EE_LT,
+ COMPARE_EE_LE,
+ COMPARE_EE_GT,
+ COMPARE_EE_GE,
};
EventType Type;
@@ -75,6 +82,14 @@ public:
int Value = 0;
};
+#define ASSERT_TRUE(x) \
+ do { \
+ if (!(x)) { \
+ std::cout << "ASSERT_TRUE(" #x ") failed on line " << __LINE__ << "\n"; \
+ return false; \
+ } \
+ } while (false)
+
// Certain builds of GCC generate false -Wmaybe-uninitialized warnings when
// doing a release build with the system version of std::optional. These
// warnings do not manifest when using our own cm::optional implementation.
@@ -153,6 +168,42 @@ EventLogger& EventLogger::operator=(int value)
return *this;
}
+bool operator==(const EventLogger& lhs, const EventLogger& rhs)
+{
+ events.push_back({ Event::COMPARE_EE_EQ, &lhs, &rhs, lhs.Value });
+ return lhs.Value == rhs.Value;
+}
+
+bool operator!=(const EventLogger& lhs, const EventLogger& rhs)
+{
+ events.push_back({ Event::COMPARE_EE_NE, &lhs, &rhs, lhs.Value });
+ return lhs.Value != rhs.Value;
+}
+
+bool operator<(const EventLogger& lhs, const EventLogger& rhs)
+{
+ events.push_back({ Event::COMPARE_EE_LT, &lhs, &rhs, lhs.Value });
+ return lhs.Value < rhs.Value;
+}
+
+bool operator<=(const EventLogger& lhs, const EventLogger& rhs)
+{
+ events.push_back({ Event::COMPARE_EE_LE, &lhs, &rhs, lhs.Value });
+ return lhs.Value <= rhs.Value;
+}
+
+bool operator>(const EventLogger& lhs, const EventLogger& rhs)
+{
+ events.push_back({ Event::COMPARE_EE_GT, &lhs, &rhs, lhs.Value });
+ return lhs.Value > rhs.Value;
+}
+
+bool operator>=(const EventLogger& lhs, const EventLogger& rhs)
+{
+ events.push_back({ Event::COMPARE_EE_GE, &lhs, &rhs, lhs.Value });
+ return lhs.Value >= rhs.Value;
+}
+
void EventLogger::Reference() &
{
events.push_back({ Event::REFERENCE, this, nullptr, this->Value });
@@ -368,42 +419,23 @@ static bool testDereference(std::vector<Event>& expected)
static bool testHasValue(std::vector<Event>& expected)
{
- bool retval = true;
-
const cm::optional<EventLogger> o1{ 4 };
const cm::optional<EventLogger> o2{};
- if (!o1.has_value()) {
- std::cout << "o1 should have a value" << std::endl;
- retval = false;
- }
-
- if (!o1) {
- std::cout << "(bool)o1 should be true" << std::endl;
- retval = false;
- }
-
- if (o2.has_value()) {
- std::cout << "o2 should not have a value" << std::endl;
- retval = false;
- }
-
- if (o2) {
- std::cout << "(bool)o2 should be false" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(o1.has_value());
+ ASSERT_TRUE(o1);
+ ASSERT_TRUE(!o2.has_value());
+ ASSERT_TRUE(!o2);
expected = {
{ Event::VALUE_CONSTRUCT, &*o1, nullptr, 4 },
{ Event::DESTRUCT, &*o1, nullptr, 4 },
};
- return retval;
+ return true;
}
static bool testValue(std::vector<Event>& expected)
{
- bool retval = true;
-
cm::optional<EventLogger> o1{ 4 };
const cm::optional<EventLogger> o2{ 5 };
cm::optional<EventLogger> o3{};
@@ -418,10 +450,7 @@ static bool testValue(std::vector<Event>& expected)
} catch (cm::bad_optional_access&) {
thrown = true;
}
- if (!thrown) {
- std::cout << "o3.value() did not throw" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(thrown);
thrown = false;
try {
@@ -429,10 +458,7 @@ static bool testValue(std::vector<Event>& expected)
} catch (cm::bad_optional_access&) {
thrown = true;
}
- if (!thrown) {
- std::cout << "o4.value() did not throw" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(thrown);
expected = {
{ Event::VALUE_CONSTRUCT, &*o1, nullptr, 4 },
@@ -442,13 +468,11 @@ static bool testValue(std::vector<Event>& expected)
{ Event::DESTRUCT, &*o2, nullptr, 5 },
{ Event::DESTRUCT, &*o1, nullptr, 4 },
};
- return retval;
+ return true;
}
static bool testValueOr()
{
- bool retval = true;
-
const cm::optional<EventLogger> o1{ 4 };
cm::optional<EventLogger> o2{ 5 };
const cm::optional<EventLogger> o3{};
@@ -460,33 +484,133 @@ static bool testValueOr()
EventLogger e4{ 9 };
EventLogger r1 = o1.value_or(e1);
- if (r1.Value != 4) {
- std::cout << "r1.Value should be 4" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(r1.Value == 4);
EventLogger r2 = std::move(o2).value_or(e2);
- if (r2.Value != 5) {
- std::cout << "r2.Value should be 5" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(r2.Value == 5);
EventLogger r3 = o3.value_or(e3);
- if (r3.Value != 8) {
- std::cout << "r3.Value should be 8" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(r3.Value == 8);
EventLogger r4 = std::move(o4).value_or(e4);
- if (r4.Value != 9) {
- std::cout << "r4.Value should be 9" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(r4.Value == 9);
- return retval;
+ return true;
}
-static bool testSwap(std::vector<Event>& expected)
+static bool testComparison(std::vector<Event>& expected)
{
- bool retval = true;
+ const cm::optional<EventLogger> o1{ 1 };
+ const cm::optional<EventLogger> o2{ 2 };
+ const cm::optional<EventLogger> o3{ 2 };
+ const cm::optional<EventLogger> o4{};
+ const cm::optional<EventLogger> o5{};
+ const EventLogger e1{ 2 };
+
+ ASSERT_TRUE(!(o1 == o2) && o1 != o2);
+ ASSERT_TRUE(o1 < o2 && !(o1 >= o2));
+ ASSERT_TRUE(!(o1 > o2) && o1 <= o2);
+
+ ASSERT_TRUE(o2 == o3 && !(o2 != o3));
+ ASSERT_TRUE(!(o2 < o3) && o2 >= o3);
+ ASSERT_TRUE(!(o2 > o3) && o2 <= o3);
+
+ ASSERT_TRUE(!(o3 == o4) && o3 != o4);
+ ASSERT_TRUE(!(o3 < o4) && o3 >= o4);
+ ASSERT_TRUE(o3 > o4 && !(o3 <= o4));
+
+ ASSERT_TRUE(o4 == o5 && !(o4 != o5));
+ ASSERT_TRUE(!(o4 < o5) && o4 >= o5);
+ ASSERT_TRUE(!(o4 > o5) && o4 <= o5);
+
+ ASSERT_TRUE(!(o1 == cm::nullopt) && o1 != cm::nullopt);
+ ASSERT_TRUE(!(o1 < cm::nullopt) && o1 >= cm::nullopt);
+ ASSERT_TRUE(o1 > cm::nullopt && !(o1 <= cm::nullopt));
+
+ ASSERT_TRUE(!(cm::nullopt == o1) && cm::nullopt != o1);
+ ASSERT_TRUE(cm::nullopt < o1 && !(cm::nullopt >= o1));
+ ASSERT_TRUE(!(cm::nullopt > o1) && cm::nullopt <= o1);
+
+ ASSERT_TRUE(o4 == cm::nullopt && !(o4 != cm::nullopt));
+ ASSERT_TRUE(!(o4 < cm::nullopt) && o4 >= cm::nullopt);
+ ASSERT_TRUE(!(o4 > cm::nullopt) && o4 <= cm::nullopt);
+
+ ASSERT_TRUE(cm::nullopt == o4 && !(cm::nullopt != o4));
+ ASSERT_TRUE(!(cm::nullopt < o4) && cm::nullopt >= o4);
+ ASSERT_TRUE(!(cm::nullopt > o4) && cm::nullopt <= o4);
+
+ ASSERT_TRUE(!(o1 == e1) && o1 != e1);
+ ASSERT_TRUE(o1 < e1 && !(o1 >= e1));
+ ASSERT_TRUE(!(o1 > e1) && o1 <= e1);
+
+ ASSERT_TRUE(o2 == e1 && !(o2 != e1));
+ ASSERT_TRUE(!(o2 < e1) && o2 >= e1);
+ ASSERT_TRUE(!(o2 > e1) && o2 <= e1);
+ ASSERT_TRUE(!(o4 == e1) && o4 != e1);
+ ASSERT_TRUE(o4 < e1 && !(o4 >= e1));
+ ASSERT_TRUE(!(o4 > e1) && o4 <= e1);
+
+ ASSERT_TRUE(!(e1 == o1) && e1 != o1);
+ ASSERT_TRUE(!(e1 < o1) && e1 >= o1);
+ ASSERT_TRUE(e1 > o1 && !(e1 <= o1));
+
+ ASSERT_TRUE(e1 == o2 && !(e1 != o2));
+ ASSERT_TRUE(!(e1 < o2) && e1 >= o2);
+ ASSERT_TRUE(!(e1 > o2) && e1 <= o2);
+
+ ASSERT_TRUE(!(e1 == o4) && e1 != o4);
+ ASSERT_TRUE(!(e1 < o4) && e1 >= o4);
+ ASSERT_TRUE(e1 > o4 && !(e1 <= o4));
+
+ expected = {
+ { Event::VALUE_CONSTRUCT, &*o1, nullptr, 1 },
+ { Event::VALUE_CONSTRUCT, &*o2, nullptr, 2 },
+ { Event::VALUE_CONSTRUCT, &*o3, nullptr, 2 },
+ { Event::VALUE_CONSTRUCT, &e1, nullptr, 2 },
+ { Event::COMPARE_EE_EQ, &*o1, &*o2, 1 },
+ { Event::COMPARE_EE_NE, &*o1, &*o2, 1 },
+ { Event::COMPARE_EE_LT, &*o1, &*o2, 1 },
+ { Event::COMPARE_EE_GE, &*o1, &*o2, 1 },
+ { Event::COMPARE_EE_GT, &*o1, &*o2, 1 },
+ { Event::COMPARE_EE_LE, &*o1, &*o2, 1 },
+ { Event::COMPARE_EE_EQ, &*o2, &*o3, 2 },
+ { Event::COMPARE_EE_NE, &*o2, &*o3, 2 },
+ { Event::COMPARE_EE_LT, &*o2, &*o3, 2 },
+ { Event::COMPARE_EE_GE, &*o2, &*o3, 2 },
+ { Event::COMPARE_EE_GT, &*o2, &*o3, 2 },
+ { Event::COMPARE_EE_LE, &*o2, &*o3, 2 },
+ { Event::COMPARE_EE_EQ, &*o1, &e1, 1 },
+ { Event::COMPARE_EE_NE, &*o1, &e1, 1 },
+ { Event::COMPARE_EE_LT, &*o1, &e1, 1 },
+ { Event::COMPARE_EE_GE, &*o1, &e1, 1 },
+ { Event::COMPARE_EE_GT, &*o1, &e1, 1 },
+ { Event::COMPARE_EE_LE, &*o1, &e1, 1 },
+ { Event::COMPARE_EE_EQ, &*o2, &e1, 2 },
+ { Event::COMPARE_EE_NE, &*o2, &e1, 2 },
+ { Event::COMPARE_EE_LT, &*o2, &e1, 2 },
+ { Event::COMPARE_EE_GE, &*o2, &e1, 2 },
+ { Event::COMPARE_EE_GT, &*o2, &e1, 2 },
+ { Event::COMPARE_EE_LE, &*o2, &e1, 2 },
+ { Event::COMPARE_EE_EQ, &e1, &*o1, 2 },
+ { Event::COMPARE_EE_NE, &e1, &*o1, 2 },
+ { Event::COMPARE_EE_LT, &e1, &*o1, 2 },
+ { Event::COMPARE_EE_GE, &e1, &*o1, 2 },
+ { Event::COMPARE_EE_GT, &e1, &*o1, 2 },
+ { Event::COMPARE_EE_LE, &e1, &*o1, 2 },
+ { Event::COMPARE_EE_EQ, &e1, &*o2, 2 },
+ { Event::COMPARE_EE_NE, &e1, &*o2, 2 },
+ { Event::COMPARE_EE_LT, &e1, &*o2, 2 },
+ { Event::COMPARE_EE_GE, &e1, &*o2, 2 },
+ { Event::COMPARE_EE_GT, &e1, &*o2, 2 },
+ { Event::COMPARE_EE_LE, &e1, &*o2, 2 },
+ { Event::DESTRUCT, &e1, nullptr, 2 },
+ { Event::DESTRUCT, &*o3, nullptr, 2 },
+ { Event::DESTRUCT, &*o2, nullptr, 2 },
+ { Event::DESTRUCT, &*o1, nullptr, 1 },
+ };
+ return true;
+}
+
+static bool testSwap(std::vector<Event>& expected)
+{
cm::optional<EventLogger> o1{ 4 };
auto const* v1 = &*o1;
cm::optional<EventLogger> o2{};
@@ -494,66 +618,30 @@ static bool testSwap(std::vector<Event>& expected)
o1.swap(o2);
auto const* v2 = &*o2;
- if (o1.has_value()) {
- std::cout << "o1 should not have value" << std::endl;
- retval = false;
- }
- if (!o2.has_value()) {
- std::cout << "o2 should have value" << std::endl;
- retval = false;
- }
- if (o2.value().Value != 4) {
- std::cout << "value of o2 should be 4" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(!o1.has_value());
+ ASSERT_TRUE(o2.has_value());
+ ASSERT_TRUE(o2.value().Value == 4);
o1.swap(o2);
- if (!o1.has_value()) {
- std::cout << "o1 should have value" << std::endl;
- retval = false;
- }
- if (o1.value().Value != 4) {
- std::cout << "value of o1 should be 4" << std::endl;
- retval = false;
- }
- if (o2.has_value()) {
- std::cout << "o2 should not have value" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(o1.has_value());
+ ASSERT_TRUE(o1.value().Value == 4);
+ ASSERT_TRUE(!o2.has_value());
o2.emplace(5);
o1.swap(o2);
- if (!o1.has_value()) {
- std::cout << "o1 should have value" << std::endl;
- retval = false;
- }
- if (o1.value().Value != 5) {
- std::cout << "value of o1 should be 5" << std::endl;
- retval = false;
- }
- if (!o2.has_value()) {
- std::cout << "o2 should not have value" << std::endl;
- retval = false;
- }
- if (o2.value().Value != 4) {
- std::cout << "value of o2 should be 4" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(o1.has_value());
+ ASSERT_TRUE(o1.value().Value == 5);
+ ASSERT_TRUE(o2.has_value());
+ ASSERT_TRUE(o2.value().Value == 4);
o1.reset();
o2.reset();
o1.swap(o2);
- if (o1.has_value()) {
- std::cout << "o1 should not have value" << std::endl;
- retval = false;
- }
- if (o2.has_value()) {
- std::cout << "o2 should not have value" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(!o1.has_value());
+ ASSERT_TRUE(!o2.has_value());
expected = {
{ Event::VALUE_CONSTRUCT, v1, nullptr, 4 },
@@ -566,22 +654,17 @@ static bool testSwap(std::vector<Event>& expected)
{ Event::DESTRUCT, v1, nullptr, 5 },
{ Event::DESTRUCT, v2, nullptr, 4 },
};
- return retval;
+ return true;
}
static bool testReset(std::vector<Event>& expected)
{
- bool retval = true;
-
cm::optional<EventLogger> o{ 4 };
auto const* v = &*o;
o.reset();
- if (o.has_value()) {
- std::cout << "o should not have value" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(!o.has_value());
o.reset();
@@ -589,7 +672,7 @@ static bool testReset(std::vector<Event>& expected)
{ Event::VALUE_CONSTRUCT, v, nullptr, 4 },
{ Event::DESTRUCT, v, nullptr, 4 },
};
- return retval;
+ return true;
}
static bool testEmplace(std::vector<Event>& expected)
@@ -630,8 +713,6 @@ static bool testMakeOptional(std::vector<Event>& expected)
static bool testMemoryRange(std::vector<Event>& expected)
{
- bool retval = true;
-
cm::optional<EventLogger> o{ 4 };
auto* ostart = &o;
@@ -639,17 +720,14 @@ static bool testMemoryRange(std::vector<Event>& expected)
auto* estart = &o.value();
auto* eend = estart + 1;
- if (static_cast<void*>(estart) < static_cast<void*>(ostart) ||
- static_cast<void*>(eend) > static_cast<void*>(oend)) {
- std::cout << "value is not within memory range of optional" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(static_cast<void*>(estart) >= static_cast<void*>(ostart) &&
+ static_cast<void*>(eend) <= static_cast<void*>(oend));
expected = {
{ Event::VALUE_CONSTRUCT, &*o, nullptr, 4 },
{ Event::DESTRUCT, &*o, nullptr, 4 },
};
- return retval;
+ return true;
}
int testOptional(int /*unused*/, char* /*unused*/ [])
@@ -691,6 +769,7 @@ int testOptional(int /*unused*/, char* /*unused*/ [])
DO_EVENT_TEST(testHasValue);
DO_EVENT_TEST(testValue);
DO_TEST(testValueOr);
+ DO_EVENT_TEST(testComparison);
DO_EVENT_TEST(testSwap);
DO_EVENT_TEST(testReset);
DO_EVENT_TEST(testEmplace);
diff --git a/Tests/CMakeLib/testStringAlgorithms.cxx b/Tests/CMakeLib/testStringAlgorithms.cxx
index 63826cf..c2706c1 100644
--- a/Tests/CMakeLib/testStringAlgorithms.cxx
+++ b/Tests/CMakeLib/testStringAlgorithms.cxx
@@ -226,5 +226,15 @@ int testStringAlgorithms(int /*unused*/, char* /*unused*/ [])
"cmStrToULong rejects trailing content.");
}
+ // ----------------------------------------------------------------------
+ // Test cmStrLen
+ {
+ constexpr auto len = cmStrLen("Hello world!");
+ assert_ok(len == 12,
+ "cmStrLen returns length of non-empty literal string");
+ assert_ok(cmStrLen("") == 0,
+ "cmStrLen returns length of empty literal string");
+ }
+
return failed;
}
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 5d4ffae..95162ec 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1483,6 +1483,10 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
add_subdirectory(CudaOnly)
endif()
+ if(CMake_TEST_ISPC)
+ add_subdirectory(ISPC)
+ endif()
+
if(CMake_TEST_FindGTest)
add_subdirectory(FindGTest)
add_subdirectory(GoogleTest)
diff --git a/Tests/ISPC/CMakeLists.txt b/Tests/ISPC/CMakeLists.txt
new file mode 100644
index 0000000..c13271a
--- /dev/null
+++ b/Tests/ISPC/CMakeLists.txt
@@ -0,0 +1,16 @@
+
+
+macro (add_ispc_test_macro name)
+ add_test_macro("${name}" ${ARGN})
+ set_property(TEST "${name}" APPEND
+ PROPERTY LABELS "ISPC")
+endmacro ()
+
+add_ispc_test_macro(ISPC.ChainedStaticLibraries ISPCChainedStaticLibraries)
+add_ispc_test_macro(ISPC.Defines ISPCDefines)
+add_ispc_test_macro(ISPC.DynamicLibrary ISPCDynamicLibrary)
+add_ispc_test_macro(ISPC.ObjectGenex ISPCObjectGenex)
+add_ispc_test_macro(ISPC.ObjectLibrary ISPCObjectLibrary)
+add_ispc_test_macro(ISPC.ResponseAndDefine ISPCResponseAndDefine)
+add_ispc_test_macro(ISPC.StaticLibrary ISPCStaticLibrary)
+add_ispc_test_macro(ISPC.TryCompile ISPCTryCompile)
diff --git a/Tests/ISPC/ChainedStaticLibraries/CMakeLists.txt b/Tests/ISPC/ChainedStaticLibraries/CMakeLists.txt
new file mode 100644
index 0000000..9a255a0
--- /dev/null
+++ b/Tests/ISPC/ChainedStaticLibraries/CMakeLists.txt
@@ -0,0 +1,22 @@
+
+cmake_minimum_required(VERSION 3.18)
+project(ISPCChainedStaticLibraries CXX ISPC)
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(CMAKE_ISPC_FLAGS "--arch=x86")
+endif()
+
+
+add_library(ispc_objects1 STATIC extra.ispc extra.cxx)
+add_library(ispc_objects2 STATIC simple.ispc)
+
+set_target_properties(ispc_objects1 PROPERTIES POSITION_INDEPENDENT_CODE ON)
+set_target_properties(ispc_objects1 PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;avx1-i32x16;avx2-i32x4")
+
+set_target_properties(ispc_objects2 PROPERTIES POSITION_INDEPENDENT_CODE ON)
+set_target_properties(ispc_objects2 PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4")
+
+target_link_libraries(ispc_objects2 PRIVATE ispc_objects1)
+
+add_executable(ISPCChainedStaticLibraries main.cxx)
+target_link_libraries(ISPCChainedStaticLibraries PUBLIC ispc_objects2)
diff --git a/Tests/ISPC/ChainedStaticLibraries/extra.cxx b/Tests/ISPC/ChainedStaticLibraries/extra.cxx
new file mode 100644
index 0000000..88ef3a7
--- /dev/null
+++ b/Tests/ISPC/ChainedStaticLibraries/extra.cxx
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+#include "extra.ispc.h"
+
+int extra()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::extra(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: extra(%f) = %f\n", i, vin[i], vout[i]);
+
+ return 0;
+}
diff --git a/Tests/ISPC/ChainedStaticLibraries/extra.ispc b/Tests/ISPC/ChainedStaticLibraries/extra.ispc
new file mode 100644
index 0000000..5a4a442
--- /dev/null
+++ b/Tests/ISPC/ChainedStaticLibraries/extra.ispc
@@ -0,0 +1,12 @@
+
+export void extra(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < 3.)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/ChainedStaticLibraries/main.cxx b/Tests/ISPC/ChainedStaticLibraries/main.cxx
new file mode 100644
index 0000000..4f1c9be
--- /dev/null
+++ b/Tests/ISPC/ChainedStaticLibraries/main.cxx
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+#include "simple.ispc.h"
+
+int main()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::simple(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]);
+}
diff --git a/Tests/ISPC/ChainedStaticLibraries/simple.ispc b/Tests/ISPC/ChainedStaticLibraries/simple.ispc
new file mode 100644
index 0000000..70cb588
--- /dev/null
+++ b/Tests/ISPC/ChainedStaticLibraries/simple.ispc
@@ -0,0 +1,12 @@
+
+export void simple(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < 3.)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/Defines/CMakeLists.txt b/Tests/ISPC/Defines/CMakeLists.txt
new file mode 100644
index 0000000..7645804
--- /dev/null
+++ b/Tests/ISPC/Defines/CMakeLists.txt
@@ -0,0 +1,16 @@
+cmake_minimum_required(VERSION 3.18)
+project(ISPCDefines CXX ISPC)
+
+set(CMAKE_ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4;avx512knl-i32x16;avx512skx-i32x8")
+set(CMAKE_ISPC_FLAGS -DM_PI=3.1415926535f)
+add_compile_definitions([==[STRUCT_DEFINE=struct{uniform int a]==])
+
+add_executable(ISPCDefines
+ main.cxx
+ simple.ispc
+ )
+
+set_target_properties(ISPCDefines PROPERTIES POSITION_INDEPENDENT_CODE ON)
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set_source_files_properties(simple.ispc PROPERTIES COMPILE_OPTIONS "--arch=x86")
+endif()
diff --git a/Tests/ISPC/Defines/main.cxx b/Tests/ISPC/Defines/main.cxx
new file mode 100644
index 0000000..4f1c9be
--- /dev/null
+++ b/Tests/ISPC/Defines/main.cxx
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+#include "simple.ispc.h"
+
+int main()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::simple(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]);
+}
diff --git a/Tests/ISPC/Defines/simple.ispc b/Tests/ISPC/Defines/simple.ispc
new file mode 100644
index 0000000..d8d6465
--- /dev/null
+++ b/Tests/ISPC/Defines/simple.ispc
@@ -0,0 +1,15 @@
+
+//textual error if STRUCT_DEFINE not set
+STRUCT_DEFINE;};
+
+export void simple(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < M_PI)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/DynamicLibrary/CMakeLists.txt b/Tests/ISPC/DynamicLibrary/CMakeLists.txt
new file mode 100644
index 0000000..cbfbb3e
--- /dev/null
+++ b/Tests/ISPC/DynamicLibrary/CMakeLists.txt
@@ -0,0 +1,20 @@
+
+cmake_minimum_required(VERSION 3.18)
+project(ISPCDynamicLibrary CXX ISPC)
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(CMAKE_ISPC_FLAGS "--arch=x86")
+endif()
+
+
+add_library(ispc_objects1 STATIC extra.ispc extra.cxx)
+add_library(ispc_objects2 SHARED simple.ispc)
+
+set_target_properties(ispc_objects1 PROPERTIES POSITION_INDEPENDENT_CODE ON)
+set_target_properties(ispc_objects1 PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;avx1-i32x16;avx2-i32x4")
+set_target_properties(ispc_objects2 PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4")
+
+target_link_libraries(ispc_objects2 PRIVATE ispc_objects1)
+
+add_executable(ISPCDynamicLibrary main.cxx)
+target_link_libraries(ISPCDynamicLibrary PUBLIC ispc_objects2)
diff --git a/Tests/ISPC/DynamicLibrary/extra.cxx b/Tests/ISPC/DynamicLibrary/extra.cxx
new file mode 100644
index 0000000..88ef3a7
--- /dev/null
+++ b/Tests/ISPC/DynamicLibrary/extra.cxx
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+#include "extra.ispc.h"
+
+int extra()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::extra(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: extra(%f) = %f\n", i, vin[i], vout[i]);
+
+ return 0;
+}
diff --git a/Tests/ISPC/DynamicLibrary/extra.ispc b/Tests/ISPC/DynamicLibrary/extra.ispc
new file mode 100644
index 0000000..5a4a442
--- /dev/null
+++ b/Tests/ISPC/DynamicLibrary/extra.ispc
@@ -0,0 +1,12 @@
+
+export void extra(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < 3.)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/DynamicLibrary/main.cxx b/Tests/ISPC/DynamicLibrary/main.cxx
new file mode 100644
index 0000000..4f1c9be
--- /dev/null
+++ b/Tests/ISPC/DynamicLibrary/main.cxx
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+#include "simple.ispc.h"
+
+int main()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::simple(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]);
+}
diff --git a/Tests/ISPC/DynamicLibrary/simple.ispc b/Tests/ISPC/DynamicLibrary/simple.ispc
new file mode 100644
index 0000000..70cb588
--- /dev/null
+++ b/Tests/ISPC/DynamicLibrary/simple.ispc
@@ -0,0 +1,12 @@
+
+export void simple(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < 3.)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/ObjectGenex/CMakeLists.txt b/Tests/ISPC/ObjectGenex/CMakeLists.txt
new file mode 100644
index 0000000..bc0cbf6
--- /dev/null
+++ b/Tests/ISPC/ObjectGenex/CMakeLists.txt
@@ -0,0 +1,45 @@
+cmake_minimum_required(VERSION 3.18)
+project(ISPCObjectGenex CXX ISPC)
+
+set(CMAKE_ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4;avx512knl-i32x16;avx512skx-i32x8")
+
+add_library(ispc_objects OBJECT
+ simple.ispc
+ )
+target_compile_definitions(ispc_objects PRIVATE
+ $<$<COMPILE_LANG_AND_ID:ISPC,Intel>:M_PI=3.1415926535f>
+)
+set_target_properties(ispc_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set_source_files_properties(simple.ispc PROPERTIES COMPILE_OPTIONS "--arch=x86")
+endif()
+
+
+#Test ObjectFiles with file(GENERATE)
+file(GENERATE
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gen_$<LOWER_CASE:$<CONFIG>/>path_to_objs.h
+ CONTENT [[
+#ifndef path_to_objs
+#define path_to_objs
+
+#include <string>
+
+static std::string obj_paths = "$<TARGET_OBJECTS:ispc_objects>";
+
+#endif
+
+]]
+)
+
+
+add_executable(ISPCObjectGenex main.cxx)
+add_dependencies(ISPCObjectGenex ispc_objects)
+
+list(LENGTH CMAKE_ISPC_INSTRUCTION_SETS numberOfTargets)
+math(EXPR numberOfTargets "${numberOfTargets}+1")
+target_compile_definitions(ISPCObjectGenex PRIVATE
+ "ExpectedISPCObjects=${numberOfTargets}"
+ "CONFIG_TYPE=gen_$<LOWER_CASE:$<CONFIG>>"
+ )
+target_include_directories(ISPCObjectGenex PRIVATE ${CMAKE_CURRENT_BINARY_DIR} )
+target_compile_features(ISPCObjectGenex PRIVATE cxx_std_11)
diff --git a/Tests/ISPC/ObjectGenex/main.cxx b/Tests/ISPC/ObjectGenex/main.cxx
new file mode 100644
index 0000000..143e74e
--- /dev/null
+++ b/Tests/ISPC/ObjectGenex/main.cxx
@@ -0,0 +1,87 @@
+#include <stdio.h>
+
+/*
+ Define GENERATED_HEADER macro to allow c++ files to include headers
+ generated based on different configuration types.
+*/
+
+/* clang-format off */
+#define GENERATED_HEADER(x) GENERATED_HEADER0(CONFIG_TYPE/x)
+/* clang-format on */
+#define GENERATED_HEADER0(x) GENERATED_HEADER1(x)
+#define GENERATED_HEADER1(x) <x>
+
+#include GENERATED_HEADER(path_to_objs.h)
+
+#include <vector>
+std::vector<std::string> expandList(std::string const& arg)
+{
+ std::vector<std::string> output;
+ // If argument is empty or no `;` just copy the current string
+ if (arg.empty() || arg.find(';') == std::string::npos) {
+ output.emplace_back(arg);
+ return output;
+ }
+
+ std::string newArg;
+ // Break the string at non-escaped semicolons not nested in [].
+ int squareNesting = 0;
+ auto last = arg.begin();
+ auto const cend = arg.end();
+ for (auto c = last; c != cend; ++c) {
+ switch (*c) {
+ case '\\': {
+ // We only want to allow escaping of semicolons. Other
+ // escapes should not be processed here.
+ auto cnext = c + 1;
+ if ((cnext != cend) && *cnext == ';') {
+ newArg.append(last, c);
+ // Skip over the escape character
+ last = cnext;
+ c = cnext;
+ }
+ } break;
+ case '[': {
+ ++squareNesting;
+ } break;
+ case ']': {
+ --squareNesting;
+ } break;
+ case ';': {
+ // Break the string here if we are not nested inside square
+ // brackets.
+ if (squareNesting == 0) {
+ newArg.append(last, c);
+ // Skip over the semicolon
+ last = c + 1;
+ if (!newArg.empty()) {
+ // Add the last argument if the string is not empty.
+ output.push_back(newArg);
+ newArg.clear();
+ }
+ }
+ } break;
+ default: {
+ // Just append this character.
+ } break;
+ }
+ }
+ newArg.append(last, cend);
+ if (!newArg.empty()) {
+ // Add the last argument if the string is not empty.
+ output.push_back(std::move(newArg));
+ }
+
+ return output;
+}
+
+int main()
+{
+ // determine that the number of object files specified in obj_paths
+ // is equal to the number of arch's
+
+ std::vector<std::string> paths = expandList(obj_paths);
+ const bool correctSize = (paths.size() == ExpectedISPCObjects);
+
+ return (correctSize) ? 0 : 1;
+}
diff --git a/Tests/ISPC/ObjectGenex/simple.ispc b/Tests/ISPC/ObjectGenex/simple.ispc
new file mode 100644
index 0000000..a76b76c
--- /dev/null
+++ b/Tests/ISPC/ObjectGenex/simple.ispc
@@ -0,0 +1,12 @@
+
+export void simple(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < M_PI)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/ObjectLibrary/CMakeLists.txt b/Tests/ISPC/ObjectLibrary/CMakeLists.txt
new file mode 100644
index 0000000..4767d7e
--- /dev/null
+++ b/Tests/ISPC/ObjectLibrary/CMakeLists.txt
@@ -0,0 +1,18 @@
+
+cmake_minimum_required(VERSION 3.18)
+project(ISPCObjectLibrary CXX ISPC)
+
+set(CMAKE_NINJA_FORCE_RESPONSE_FILE ON)
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(CMAKE_ISPC_FLAGS "--arch=x86")
+endif()
+
+
+add_library(ispc_objects OBJECT simple.ispc extra.ispc)
+
+set_target_properties(ispc_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
+set_target_properties(ispc_objects PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i8x16")
+
+
+add_executable(ISPCObjectLibrary main.cxx extra.cxx)
+target_link_libraries(ISPCObjectLibrary PRIVATE ispc_objects)
diff --git a/Tests/ISPC/ObjectLibrary/extra.cxx b/Tests/ISPC/ObjectLibrary/extra.cxx
new file mode 100644
index 0000000..88ef3a7
--- /dev/null
+++ b/Tests/ISPC/ObjectLibrary/extra.cxx
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+#include "extra.ispc.h"
+
+int extra()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::extra(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: extra(%f) = %f\n", i, vin[i], vout[i]);
+
+ return 0;
+}
diff --git a/Tests/ISPC/ObjectLibrary/extra.ispc b/Tests/ISPC/ObjectLibrary/extra.ispc
new file mode 100644
index 0000000..5a4a442
--- /dev/null
+++ b/Tests/ISPC/ObjectLibrary/extra.ispc
@@ -0,0 +1,12 @@
+
+export void extra(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < 3.)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/ObjectLibrary/main.cxx b/Tests/ISPC/ObjectLibrary/main.cxx
new file mode 100644
index 0000000..4f1c9be
--- /dev/null
+++ b/Tests/ISPC/ObjectLibrary/main.cxx
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+#include "simple.ispc.h"
+
+int main()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::simple(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]);
+}
diff --git a/Tests/ISPC/ObjectLibrary/simple.ispc b/Tests/ISPC/ObjectLibrary/simple.ispc
new file mode 100644
index 0000000..70cb588
--- /dev/null
+++ b/Tests/ISPC/ObjectLibrary/simple.ispc
@@ -0,0 +1,12 @@
+
+export void simple(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < 3.)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/ResponseAndDefine/CMakeLists.txt b/Tests/ISPC/ResponseAndDefine/CMakeLists.txt
new file mode 100644
index 0000000..7539209
--- /dev/null
+++ b/Tests/ISPC/ResponseAndDefine/CMakeLists.txt
@@ -0,0 +1,28 @@
+cmake_minimum_required(VERSION 3.18)
+project(ispc_spaces_in_path ISPC CXX)
+
+set(CMAKE_NINJA_FORCE_RESPONSE_FILE ON)
+
+# Make sure we can handle an arg file with tricky defines including spaces in -I include
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/path with spaces/simple_include.h"
+"
+ typedef float FLOAT_TYPE;
+"
+)
+
+add_executable(ISPCResponseAndDefine main.cxx simple.ispc)
+set_target_properties(ISPCResponseAndDefine PROPERTIES POSITION_INDEPENDENT_CODE ON)
+target_include_directories(ISPCResponseAndDefine PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
+
+target_compile_options(ISPCResponseAndDefine PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>")
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ target_compile_options(ISPCResponseAndDefine PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>")
+endif()
+
+
+
+target_compile_definitions(ISPCResponseAndDefine PRIVATE
+ "$<$<COMPILE_LANGUAGE:ISPC>:STRUCT_DEFINE=struct{uniform int a>;M_PI=3.14159f")
+target_include_directories(ISPCResponseAndDefine PRIVATE
+ "$<$<COMPILE_LANGUAGE:ISPC>:${CMAKE_CURRENT_BINARY_DIR}/fake path with spaces>"
+ "$<$<COMPILE_LANGUAGE:ISPC>:${CMAKE_CURRENT_BINARY_DIR}/path with spaces>")
diff --git a/Tests/ISPC/ResponseAndDefine/main.cxx b/Tests/ISPC/ResponseAndDefine/main.cxx
new file mode 100644
index 0000000..4f1c9be
--- /dev/null
+++ b/Tests/ISPC/ResponseAndDefine/main.cxx
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+#include "simple.ispc.h"
+
+int main()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::simple(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]);
+}
diff --git a/Tests/ISPC/ResponseAndDefine/simple.ispc b/Tests/ISPC/ResponseAndDefine/simple.ispc
new file mode 100644
index 0000000..81fd7ca
--- /dev/null
+++ b/Tests/ISPC/ResponseAndDefine/simple.ispc
@@ -0,0 +1,16 @@
+
+STRUCT_DEFINE;};
+
+#include "simple_include.h"
+
+export void simple(uniform FLOAT_TYPE vin[], uniform FLOAT_TYPE vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ FLOAT_TYPE v = vin[index];
+ if (v < M_PI)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/StaticLibrary/CMakeLists.txt b/Tests/ISPC/StaticLibrary/CMakeLists.txt
new file mode 100644
index 0000000..ebe5960
--- /dev/null
+++ b/Tests/ISPC/StaticLibrary/CMakeLists.txt
@@ -0,0 +1,15 @@
+
+cmake_minimum_required(VERSION 3.18)
+project(ISPCStaticLibrary CXX ISPC)
+
+add_library(ispc_objects STATIC simple.ispc)
+
+target_compile_options(ispc_objects PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>")
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ target_compile_options(ispc_objects PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>")
+endif()
+
+set_target_properties(ispc_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
+
+add_executable(ISPCStaticLibrary main.cxx)
+target_link_libraries(ISPCStaticLibrary PRIVATE ispc_objects)
diff --git a/Tests/ISPC/StaticLibrary/main.cxx b/Tests/ISPC/StaticLibrary/main.cxx
new file mode 100644
index 0000000..4f1c9be
--- /dev/null
+++ b/Tests/ISPC/StaticLibrary/main.cxx
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+#include "simple.ispc.h"
+
+int main()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::simple(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]);
+}
diff --git a/Tests/ISPC/StaticLibrary/simple.ispc b/Tests/ISPC/StaticLibrary/simple.ispc
new file mode 100644
index 0000000..70cb588
--- /dev/null
+++ b/Tests/ISPC/StaticLibrary/simple.ispc
@@ -0,0 +1,12 @@
+
+export void simple(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < 3.)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/TryCompile/CMakeLists.txt b/Tests/ISPC/TryCompile/CMakeLists.txt
new file mode 100644
index 0000000..742f511
--- /dev/null
+++ b/Tests/ISPC/TryCompile/CMakeLists.txt
@@ -0,0 +1,16 @@
+
+cmake_minimum_required(VERSION 3.18)
+project(ISPCTryCompile ISPC CXX)
+
+set(CMAKE_NINJA_FORCE_RESPONSE_FILE ON)
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(CMAKE_ISPC_FLAGS "--arch=x86")
+endif()
+
+#Verify we can use try_compile with ISPC
+try_compile(result "${CMAKE_CURRENT_BINARY_DIR}"
+ SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/simple.ispc"
+ COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/result.o")
+
+add_executable(ISPCTryCompile main.cxx )
+target_link_libraries(ISPCTryCompile "${CMAKE_CURRENT_BINARY_DIR}/result.o")
diff --git a/Tests/ISPC/TryCompile/main.cxx b/Tests/ISPC/TryCompile/main.cxx
new file mode 100644
index 0000000..c8d1ed6
--- /dev/null
+++ b/Tests/ISPC/TryCompile/main.cxx
@@ -0,0 +1,19 @@
+#include <stdio.h>
+
+namespace ispc {
+extern "C" {
+void simple(float*, float*, int);
+}
+}
+
+int main()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::simple(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]);
+}
diff --git a/Tests/ISPC/TryCompile/simple.ispc b/Tests/ISPC/TryCompile/simple.ispc
new file mode 100644
index 0000000..70cb588
--- /dev/null
+++ b/Tests/ISPC/TryCompile/simple.ispc
@@ -0,0 +1,12 @@
+
+export void simple(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < 3.)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/QtAutogen/RerunMocOnAddFile/CMakeLists.txt b/Tests/QtAutogen/RerunMocOnAddFile/CMakeLists.txt
new file mode 100644
index 0000000..2677659
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnAddFile/CMakeLists.txt
@@ -0,0 +1,96 @@
+# This test checks whether adding a source file to the project triggers an AUTOMOC re-run.
+
+cmake_minimum_required(VERSION 3.10)
+project(RerunMocOnAddFile)
+include("../AutogenCoreTest.cmake")
+
+# Create an executable to generate a clean target
+set(main_source "${CMAKE_CURRENT_BINARY_DIR}/generated_main.cpp")
+file(WRITE "${main_source}" "int main() {}")
+add_executable(exe "${main_source}")
+
+# Utility variables
+set(timeformat "%Y.%j.%H.%M%S")
+set(testProjectTemplateDir "${CMAKE_CURRENT_SOURCE_DIR}/MocOnAddFile")
+set(testProjectSrc "${CMAKE_CURRENT_BINARY_DIR}/MocOnAddFile")
+set(testProjectBinDir "${CMAKE_CURRENT_BINARY_DIR}/MocOnAddFile-build")
+
+# Utility macros
+macro(sleep)
+ message(STATUS "Sleeping for a few seconds.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+endmacro()
+
+macro(acquire_timestamp When)
+ file(TIMESTAMP "${mocBasicBin}" time${When} "${timeformat}")
+endmacro()
+
+macro(rebuild buildName)
+ message(STATUS "Starting build ${buildName}.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${testProjectBinDir}" RESULT_VARIABLE result)
+ if (result)
+ message(FATAL_ERROR "Build ${buildName} failed.")
+ else()
+ message(STATUS "Build ${buildName} finished.")
+ endif()
+endmacro()
+
+macro(require_change)
+ if (timeAfter VERSION_GREATER timeBefore)
+ message(STATUS "As expected the file ${mocBasicBin} changed.")
+ else()
+ message(SEND_ERROR "Unexpectedly the file ${mocBasicBin} did not change!\nTimestamp pre: ${timeBefore}\nTimestamp aft: ${timeAfter}\n")
+ endif()
+endmacro()
+
+macro(require_change_not)
+ if (timeAfter VERSION_GREATER timeBefore)
+ message(SEND_ERROR "Unexpectedly the file ${mocBasicBin} changed!\nTimestamp pre: ${timeBefore}\nTimestamp aft: ${timeAfter}\n")
+ else()
+ message(STATUS "As expected the file ${mocBasicBin} did not change.")
+ endif()
+endmacro()
+
+# Create the test project from the template
+unset(additional_project_sources)
+unset(main_cpp_includes)
+configure_file("${testProjectTemplateDir}/CMakeLists.txt.in" "${testProjectSrc}/CMakeLists.txt")
+configure_file("${testProjectTemplateDir}/main.cpp.in" "${testProjectSrc}/main.cpp")
+
+# Initial build
+try_compile(MOC_RERUN
+ "${testProjectBinDir}"
+ "${testProjectSrc}"
+ MocOnAddFile
+ CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
+ "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
+ OUTPUT_VARIABLE output
+)
+if (NOT MOC_RERUN)
+ message(FATAL_ERROR "Initial build of mocOnAddFile failed. Output: ${output}")
+endif()
+
+# Sleep to ensure new timestamps
+sleep()
+
+# Add a QObject class (defined in header) to the project and build
+set(additional_project_sources myobject.cpp)
+set(main_cpp_includes "#include \"myobject.h\"")
+configure_file("${testProjectTemplateDir}/CMakeLists.txt.in" "${testProjectSrc}/CMakeLists.txt"
+ @ONLY)
+configure_file("${testProjectTemplateDir}/main.cpp.in" "${testProjectSrc}/main.cpp" @ONLY)
+configure_file("${testProjectTemplateDir}/myobject.h" "${testProjectSrc}/myobject.h" COPYONLY)
+configure_file("${testProjectTemplateDir}/myobject.cpp" "${testProjectSrc}/myobject.cpp" COPYONLY)
+rebuild(2)
+
+# Sleep to ensure new timestamps
+sleep()
+
+# Add a QObject class (defined in source) to the project and build
+set(additional_project_sources myobject.cpp anotherobject.cpp)
+configure_file("${testProjectTemplateDir}/CMakeLists.txt.in" "${testProjectSrc}/CMakeLists.txt"
+ @ONLY)
+configure_file("${testProjectTemplateDir}/anotherobject.cpp" "${testProjectSrc}/anotherobject.cpp"
+ COPYONLY)
+rebuild(3)
diff --git a/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/CMakeLists.txt.in b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/CMakeLists.txt.in
new file mode 100644
index 0000000..9e5e21c
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/CMakeLists.txt.in
@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 3.10)
+project(MocOnAddFile)
+include("@CMAKE_CURRENT_LIST_DIR@/../AutogenCoreTest.cmake")
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+
+add_executable(mocOnAddFile main.cpp @additional_project_sources@)
+target_link_libraries(mocOnAddFile ${QT_QTCORE_TARGET})
diff --git a/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/anotherobject.cpp b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/anotherobject.cpp
new file mode 100644
index 0000000..45c5af6
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/anotherobject.cpp
@@ -0,0 +1,15 @@
+#include <qobject.h>
+
+class AnotherObject : public QObject
+{
+ Q_OBJECT
+public:
+ AnotherObject() {}
+};
+
+AnotherObject* createAnotherObject()
+{
+ return new AnotherObject();
+}
+
+#include "anotherobject.moc"
diff --git a/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/main.cpp.in b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/main.cpp.in
new file mode 100644
index 0000000..f62027a
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/main.cpp.in
@@ -0,0 +1,6 @@
+@main_cpp_includes@
+
+int main(int argc, char *argv[])
+{
+ return 0;
+}
diff --git a/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.cpp b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.cpp
new file mode 100644
index 0000000..7a15300
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.cpp
@@ -0,0 +1,6 @@
+#include "myobject.h"
+
+MyObject::MyObject(QObject* parent)
+ : QObject(parent)
+{
+}
diff --git a/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.h b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.h
new file mode 100644
index 0000000..e373ee8
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.h
@@ -0,0 +1,13 @@
+#ifndef MYOBJECT_H
+#define MYOBJECT_H
+
+#include <qobject.h>
+
+class MyObject : public QObject
+{
+ Q_OBJECT
+public:
+ MyObject(QObject* parent = 0);
+};
+
+#endif
diff --git a/Tests/QtAutogen/RerunMocOnMissingDependency/CMakeLists.txt b/Tests/QtAutogen/RerunMocOnMissingDependency/CMakeLists.txt
new file mode 100644
index 0000000..c5811eb
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnMissingDependency/CMakeLists.txt
@@ -0,0 +1,80 @@
+# This test checks whether a missing dependency of the moc output triggers an AUTOMOC re-run.
+
+cmake_minimum_required(VERSION 3.10)
+project(RerunMocOnMissingDependency)
+include("../AutogenCoreTest.cmake")
+
+# Create an executable to generate a clean target
+set(main_source "${CMAKE_CURRENT_BINARY_DIR}/generated_main.cpp")
+file(WRITE "${main_source}" "int main() {}")
+add_executable(exe "${main_source}")
+
+# Utility variables
+set(testProjectTemplateDir "${CMAKE_CURRENT_SOURCE_DIR}/MocOnMissingDependency")
+set(testProjectSrc "${CMAKE_CURRENT_BINARY_DIR}/MocOnMissingDependency")
+set(testProjectBinDir "${CMAKE_CURRENT_BINARY_DIR}/MocOnMissingDependency-build")
+if(DEFINED Qt5Core_VERSION AND Qt5Core_VERSION VERSION_GREATER_EQUAL "5.15.0")
+ set(moc_depfiles_supported TRUE)
+else()
+ set(moc_depfiles_supported FALSE)
+endif()
+
+# Utility macros
+macro(sleep)
+ message(STATUS "Sleeping for a few seconds.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+endmacro()
+
+macro(rebuild buildName)
+ message(STATUS "Starting build ${buildName}.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${testProjectBinDir}"
+ RESULT_VARIABLE result OUTPUT_VARIABLE output)
+ if (result)
+ message(FATAL_ERROR "Build ${buildName} failed.")
+ else()
+ message(STATUS "Build ${buildName} finished.")
+ endif()
+endmacro()
+
+# Create the test project from the template
+file(COPY "${testProjectTemplateDir}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
+configure_file("${testProjectTemplateDir}/CMakeLists.txt.in" "${testProjectSrc}/CMakeLists.txt" @ONLY)
+
+# Initial build
+file(REMOVE_RECURSE "${testProjectBinDir}")
+try_compile(MOC_RERUN
+ "${testProjectBinDir}"
+ "${testProjectSrc}"
+ MocOnMissingDependency
+ CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_AUTOGEN_VERBOSE=ON"
+ "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
+ OUTPUT_VARIABLE output
+)
+if (NOT MOC_RERUN)
+ message(FATAL_ERROR "Initial build of mocOnMissingDependency failed. Output: ${output}")
+endif()
+
+# Sleep to ensure new timestamps
+sleep()
+
+if(moc_depfiles_supported)
+ # Remove the dependency inc1/foo.h and build again.
+ # We expect that the moc_XXX.cpp file gets re-generated. But only if we have depfile support.
+ file(REMOVE_RECURSE "${testProjectSrc}/inc1")
+ rebuild(2)
+ if(NOT output MATCHES "AutoMoc: Generating \"[^\"]*moc_myobject.cpp\"")
+ message(FATAL_ERROR "moc_myobject.cpp was not re-generated "
+ "after removing one of its dependencies")
+ endif()
+endif()
+
+# Sleep to ensure new timestamps
+sleep()
+
+# The next build should *not* re-renerate any moc outputs
+rebuild(3)
+if(output MATCHES "AutoMoc: Generating")
+ message(FATAL_ERROR "moc_myobject.cpp was not re-generated "
+ "after removing one of its dependencies")
+endif()
diff --git a/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/CMakeLists.txt.in b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/CMakeLists.txt.in
new file mode 100644
index 0000000..2155f45
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/CMakeLists.txt.in
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.18)
+project(MocOnMissingDependency)
+include("@CMAKE_CURRENT_LIST_DIR@/../AutogenCoreTest.cmake")
+set(CMAKE_AUTOMOC ON)
+add_executable(MocOnMissingDependency main.cpp myobject.cpp)
+target_include_directories(MocOnMissingDependency PRIVATE inc1 inc2)
+target_link_libraries(MocOnMissingDependency PRIVATE ${QT_QTCORE_TARGET})
diff --git a/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/inc1/foo.h b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/inc1/foo.h
new file mode 100644
index 0000000..cd8b2f9
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/inc1/foo.h
@@ -0,0 +1,2 @@
+
+#include <qobject.h>
diff --git a/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/inc2/foo.h b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/inc2/foo.h
new file mode 100644
index 0000000..cd8b2f9
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/inc2/foo.h
@@ -0,0 +1,2 @@
+
+#include <qobject.h>
diff --git a/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/main.cpp b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/main.cpp
new file mode 100644
index 0000000..36d51fa
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/main.cpp
@@ -0,0 +1,9 @@
+#include <iostream>
+
+#include "myobject.h"
+
+int main(int argc, char* argv[])
+{
+ MyObject obj;
+ return 0;
+}
diff --git a/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/myobject.cpp b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/myobject.cpp
new file mode 100644
index 0000000..7a15300
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/myobject.cpp
@@ -0,0 +1,6 @@
+#include "myobject.h"
+
+MyObject::MyObject(QObject* parent)
+ : QObject(parent)
+{
+}
diff --git a/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/myobject.h b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/myobject.h
new file mode 100644
index 0000000..25176cc
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/myobject.h
@@ -0,0 +1,10 @@
+#pragma once
+
+#include <foo.h>
+
+class MyObject : public QObject
+{
+ Q_OBJECT
+public:
+ MyObject(QObject* parent = 0);
+};
diff --git a/Tests/QtAutogen/Tests.cmake b/Tests/QtAutogen/Tests.cmake
index dfa5ea0..b1337d6 100644
--- a/Tests/QtAutogen/Tests.cmake
+++ b/Tests/QtAutogen/Tests.cmake
@@ -20,6 +20,8 @@ ADD_AUTOGEN_TEST(RccOffMocLibrary)
ADD_AUTOGEN_TEST(RccOnly rccOnly)
ADD_AUTOGEN_TEST(RccSkipSource)
ADD_AUTOGEN_TEST(RerunMocBasic)
+ADD_AUTOGEN_TEST(RerunMocOnAddFile)
+ADD_AUTOGEN_TEST(RerunMocOnMissingDependency)
ADD_AUTOGEN_TEST(RerunRccConfigChange)
ADD_AUTOGEN_TEST(RerunRccDepends)
ADD_AUTOGEN_TEST(SameName sameName)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 88d0004..e586961 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -144,14 +144,14 @@ if(CMAKE_GENERATOR MATCHES "Ninja")
list(APPEND Ninja_ARGS -DTEST_Fortran=1)
endif()
if(CMake_TEST_Qt5 AND Qt5Core_FOUND)
- list(APPEND Ninja_ARGS -DCMake_TEST_Qt5=1 -DCMAKE_TEST_Qt5Core_Version=${Qt5Core_VERSION})
+ list(APPEND Ninja_ARGS -DCMake_TEST_Qt5=1 -DQt5Core_DIR=${Qt5Core_DIR} -DCMAKE_TEST_Qt5Core_Version=${Qt5Core_VERSION})
endif()
add_RunCMake_test(Ninja)
set(NinjaMultiConfig_ARGS
-DCYGWIN=${CYGWIN}
)
if(CMake_TEST_Qt5 AND Qt5Core_FOUND)
- list(APPEND NinjaMultiConfig_ARGS -DCMake_TEST_Qt5=1)
+ list(APPEND NinjaMultiConfig_ARGS -DCMake_TEST_Qt5=1 -DQt5Core_DIR=${Qt5Core_DIR} -DCMAKE_TEST_Qt5Core_Version=${Qt5Core_VERSION})
endif()
if(DEFINED CMake_TEST_CUDA)
list(APPEND NinjaMultiConfig_ARGS -DCMake_TEST_CUDA=${CMake_TEST_CUDA})
@@ -305,6 +305,7 @@ add_RunCMake_test(export)
add_RunCMake_test(cmake_language)
add_RunCMake_test(cmake_minimum_required)
add_RunCMake_test(cmake_parse_arguments)
+add_RunCMake_test(cmake_path)
add_RunCMake_test(continue)
add_executable(color_warning color_warning.c)
add_RunCMake_test(ctest_build -DCOLOR_WARNING=$<TARGET_FILE:color_warning>)
@@ -322,6 +323,7 @@ add_RunCMake_test(ctest_update)
add_RunCMake_test(ctest_upload)
add_RunCMake_test(ctest_fixtures)
add_RunCMake_test(file)
+add_RunCMake_test(file-CHMOD)
add_RunCMake_test(find_file)
add_RunCMake_test(find_library -DCYGWIN=${CYGWIN})
add_RunCMake_test(find_package)
@@ -385,6 +387,7 @@ function(add_RunCMake_test_try_compile)
CMAKE_CXX_COMPILER_VERSION
CMAKE_CXX_STANDARD_DEFAULT
CMake_TEST_CUDA
+ CMake_TEST_ISPC
CMake_TEST_FILESYSTEM_1S
CMAKE_OBJC_STANDARD_DEFAULT
CMAKE_OBJCXX_STANDARD_DEFAULT
@@ -395,7 +398,7 @@ function(add_RunCMake_test_try_compile)
endforeach()
add_RunCMake_test(try_compile)
set_property(TEST RunCMake.try_compile APPEND
- PROPERTY LABELS "CUDA")
+ PROPERTY LABELS "CUDA;ISPC")
endfunction()
add_RunCMake_test_try_compile()
@@ -550,7 +553,10 @@ add_RunCMake_test(install -DNO_NAMELINK=${NO_NAMELINK} -DCYGWIN=${CYGWIN}
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-DCMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG=${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}
-DCMAKE_EXECUTABLE_FORMAT=${CMAKE_EXECUTABLE_FORMAT}
+ -DCMake_TEST_ISPC=${CMake_TEST_ISPC}
)
+set_property(TEST RunCMake.install APPEND
+ PROPERTY LABELS "ISPC")
add_RunCMake_test(file-GET_RUNTIME_DEPENDENCIES
-DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
@@ -628,6 +634,9 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
if(DEFINED CMake_TEST_CUDA)
list(APPEND CompilerLauncher_ARGS -DCMake_TEST_CUDA=${CMake_TEST_CUDA})
endif()
+ if(DEFINED CMake_TEST_ISPC)
+ list(APPEND CompilerLauncher_ARGS -DCMake_TEST_ISPC=${CMake_TEST_ISPC})
+ endif()
if(CMAKE_Fortran_COMPILER)
list(APPEND CompilerLauncher_ARGS -DCMake_TEST_Fortran=1)
endif()
@@ -636,7 +645,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
endif()
add_RunCMake_test(CompilerLauncher)
set_property(TEST RunCMake.CompilerLauncher APPEND
- PROPERTY LABELS "CUDA")
+ PROPERTY LABELS "CUDA;ISPC")
add_RunCMake_test(ctest_labels_for_subprojects)
add_RunCMake_test(CompilerArgs)
endif()
diff --git a/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt
index cf2c087..f6d72a9 100644
--- a/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt
+++ b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt
@@ -1,8 +1,19 @@
add_custom_command(
- OUTPUT output.txt
- COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt
+ OUTPUT output1.txt
+ COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output1.txt
)
-add_custom_target(CustomTarget ALL DEPENDS output.txt)
-add_custom_target(CustomTarget2 ALL DEPENDS output.txt)
-add_custom_target(CustomTarget3 ALL DEPENDS output.txt)
+add_custom_target(CustomTarget ALL DEPENDS output1.txt)
+
+add_custom_command(
+ OUTPUT output2.txt
+ COMMAND ${CMAKE_COMMAND} -E echo CustomCommand2 > output2.txt
+ )
+add_custom_target(CustomTarget2 ALL DEPENDS output2.txt)
+
+add_custom_command(
+ OUTPUT output3.txt
+ COMMAND ${CMAKE_COMMAND} -E echo CustomCommand2 > output3.txt
+ )
+add_custom_target(CustomTarget3 ALL DEPENDS output3.txt)
+
add_custom_target(CustomTargetFail COMMAND DoesNotExist)
diff --git a/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt b/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt
index fc62914..0fee56c 100644
--- a/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt
+++ b/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt
@@ -1,9 +1,20 @@
cmake_minimum_required(VERSION 3.14)
project(ExplicitDirs NONE)
+
add_custom_command(
- OUTPUT output.txt
- COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt
+ OUTPUT output1.txt
+ COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output1.txt
)
-add_custom_target(CustomTarget ALL DEPENDS output.txt)
-add_custom_target(CustomTarget2 ALL DEPENDS output.txt)
-add_custom_target(CustomTarget3 ALL DEPENDS output.txt)
+add_custom_target(CustomTarget ALL DEPENDS output1.txt)
+
+add_custom_command(
+ OUTPUT output2.txt
+ COMMAND ${CMAKE_COMMAND} -E echo CustomCommand2 > output2.txt
+ )
+add_custom_target(CustomTarget2 ALL DEPENDS output2.txt)
+
+add_custom_command(
+ OUTPUT output3.txt
+ COMMAND ${CMAKE_COMMAND} -E echo CustomCommand2 > output3.txt
+ )
+add_custom_target(CustomTarget3 ALL DEPENDS output3.txt)
diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/ISPC-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/ISPC-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-common.cmake b/Tests/RunCMake/CompilerLauncher/ISPC-common.cmake
new file mode 100644
index 0000000..5beff3d
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/ISPC-common.cmake
@@ -0,0 +1,4 @@
+enable_language(ISPC)
+enable_language(CXX)
+set(CMAKE_VERBOSE_MAKEFILE TRUE)
+add_executable(main main.cxx test.ispc)
diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-env-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/ISPC-env-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/ISPC-env-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-env-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/ISPC-env-launch-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/ISPC-env-launch-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-env.cmake b/Tests/RunCMake/CompilerLauncher/ISPC-env.cmake
new file mode 100644
index 0000000..4afd919
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/ISPC-env.cmake
@@ -0,0 +1 @@
+include(ISPC-common.cmake)
diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/ISPC-launch-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/ISPC-launch-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-launch-env.cmake b/Tests/RunCMake/CompilerLauncher/ISPC-launch-env.cmake
new file mode 100644
index 0000000..f50fb65
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/ISPC-launch-env.cmake
@@ -0,0 +1,3 @@
+set(CTEST_USE_LAUNCHERS 1)
+include(CTestUseLaunchers)
+include(ISPC-env.cmake)
diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-launch.cmake b/Tests/RunCMake/CompilerLauncher/ISPC-launch.cmake
new file mode 100644
index 0000000..b0cafbe
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/ISPC-launch.cmake
@@ -0,0 +1,3 @@
+set(CTEST_USE_LAUNCHERS 1)
+include(CTestUseLaunchers)
+include(ISPC.cmake)
diff --git a/Tests/RunCMake/CompilerLauncher/ISPC.cmake b/Tests/RunCMake/CompilerLauncher/ISPC.cmake
new file mode 100644
index 0000000..83efa80
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/ISPC.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_ISPC_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1")
+include(ISPC-common.cmake)
diff --git a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake
index 69fff20..293d711 100644
--- a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake
@@ -29,6 +29,9 @@ endif()
if(CMake_TEST_Fortran)
list(APPEND langs Fortran)
endif()
+if(CMake_TEST_ISPC)
+ list(APPEND langs ISPC)
+endif()
if(CMake_TEST_OBJC)
list(APPEND langs OBJC OBJCXX)
endif()
diff --git a/Tests/RunCMake/CompilerLauncher/test.ispc b/Tests/RunCMake/CompilerLauncher/test.ispc
new file mode 100644
index 0000000..b061f40
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/test.ispc
@@ -0,0 +1,4 @@
+
+float func(float a, float b) {
+ return a + b / 2.;
+}
diff --git a/Tests/RunCMake/ExternalProject/DownloadServer.py b/Tests/RunCMake/ExternalProject/DownloadServer.py
index 3738317..63b7fa7 100644
--- a/Tests/RunCMake/ExternalProject/DownloadServer.py
+++ b/Tests/RunCMake/ExternalProject/DownloadServer.py
@@ -8,8 +8,11 @@ import threading
args = None
outerthread = None
+barrier = threading.Barrier(2)
+
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
+ barrier.wait()
self.send_response(200)
self.end_headers()
data = b'D'
@@ -46,4 +49,5 @@ if __name__ == "__main__":
serverThread = threading.Thread(target=runServer,args=(args.file,))
serverThread.daemon = True
serverThread.start()
- serverThread.join(15)
+ barrier.wait(60)
+ serverThread.join(20)
diff --git a/Tests/RunCMake/ExternalProject/MultiCommand.cmake b/Tests/RunCMake/ExternalProject/MultiCommand.cmake
index a8dbfea..c8d0457 100644
--- a/Tests/RunCMake/ExternalProject/MultiCommand.cmake
+++ b/Tests/RunCMake/ExternalProject/MultiCommand.cmake
@@ -20,10 +20,6 @@ ExternalProject_Add(multiCommand
COMMAND "${CMAKE_COMMAND}" -E echo "install 2"
)
-# Workaround for issue 17229 (missing dependency between update and patch steps)
-ExternalProject_Add_StepTargets(multiCommand NO_DEPENDS update)
-ExternalProject_Add_StepDependencies(multiCommand patch multiCommand-update)
-
# Force all steps to be re-run by removing timestamps from any previous run
ExternalProject_Get_Property(multiCommand STAMP_DIR)
file(REMOVE_RECURSE "${STAMP_DIR}")
diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake
index ccec633..55b0f9b 100644
--- a/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake
@@ -2,8 +2,10 @@ include(RunCMake)
run_cmake(TARGET_FILE-recursion)
run_cmake(OUTPUT_NAME-recursion)
-run_cmake(TARGET_FILE_PREFIX)
+run_cmake(TARGET_FILE_DIR-dependency)
+run_cmake(TARGET_FILE_DIR-no-dependency)
run_cmake(TARGET_FILE_PREFIX-imported-target)
+run_cmake(TARGET_FILE_PREFIX)
run_cmake(TARGET_FILE_PREFIX-non-valid-target)
run_cmake(TARGET_LINKER_FILE_PREFIX-non-valid-target)
run_cmake(TARGET_FILE_SUFFIX)
diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-stderr.txt
new file mode 100644
index 0000000..0a79032
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-stderr.txt
@@ -0,0 +1,6 @@
+.*Policy CMP0112 is not set.*
+.*Dependency being added to target.*
+.*exec1.*
+CMake Error: The inter-target dependency graph.*
+.*"exec1" of type EXECUTABLE
+ depends on "copyFile" \(strong\)
diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency.cmake
new file mode 100644
index 0000000..e18ccd9
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency.cmake
@@ -0,0 +1,12 @@
+set(CMAKE_POLICY_WARNING_CMP0112 TRUE)
+
+enable_language (C)
+
+add_executable (exec1 empty.c)
+
+add_custom_target(copyFile
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ "${CMAKE_CURRENT_SOURCE_DIR}/empty.c"
+ "$<TARGET_FILE_DIR:exec1>/$<TARGET_FILE_BASE_NAME:exec1>_e.c"
+)
+add_dependencies(exec1 copyFile)
diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-no-dependency.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-no-dependency.cmake
new file mode 100644
index 0000000..e048e10
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-no-dependency.cmake
@@ -0,0 +1,12 @@
+cmake_policy(SET CMP0112 NEW)
+
+enable_language (C)
+
+add_executable (exec1 empty.c)
+
+add_custom_target(copyFile
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ "${CMAKE_CURRENT_SOURCE_DIR}/empty.c"
+ "$<TARGET_FILE_DIR:exec1>/$<TARGET_FILE_BASE_NAME:exec1>_e.c"
+)
+add_dependencies(exec1 copyFile)
diff --git a/Tests/RunCMake/Make/CMP0113-Common.cmake b/Tests/RunCMake/Make/CMP0113-Common.cmake
new file mode 100644
index 0000000..8ce26c4
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-Common.cmake
@@ -0,0 +1,17 @@
+add_custom_command(
+ OUTPUT output-not-created
+ COMMAND ${CMAKE_COMMAND} -E echo output-not-created
+ DEPENDS ${CMAKE_CURRENT_LIST_FILE}
+ VERBATIM
+ )
+
+add_custom_command(
+ OUTPUT output-created
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_FILE} output-created
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/output-not-created
+ VERBATIM
+ )
+
+add_custom_target(drive1 ALL DEPENDS output-not-created)
+add_custom_target(drive2 ALL DEPENDS output-created)
+add_dependencies(drive2 drive1)
diff --git a/Tests/RunCMake/Make/CMP0113-NEW-build-gnu-stderr.txt b/Tests/RunCMake/Make/CMP0113-NEW-build-gnu-stderr.txt
new file mode 100644
index 0000000..0af354a
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-NEW-build-gnu-stderr.txt
@@ -0,0 +1,5 @@
+No rule to make target [^
+]*output-not-created[^
+]*, needed by [^
+]*output-created[^
+]*
diff --git a/Tests/RunCMake/Make/CMP0113-NEW-build-result.txt b/Tests/RunCMake/Make/CMP0113-NEW-build-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-NEW-build-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/Make/CMP0113-NEW-build-stderr.txt b/Tests/RunCMake/Make/CMP0113-NEW-build-stderr.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-NEW-build-stderr.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/Make/CMP0113-NEW-build-stdout.txt b/Tests/RunCMake/Make/CMP0113-NEW-build-stdout.txt
new file mode 100644
index 0000000..a6b851e
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-NEW-build-stdout.txt
@@ -0,0 +1 @@
+Generating output-not-created.*Built target drive1
diff --git a/Tests/RunCMake/Make/CMP0113-NEW.cmake b/Tests/RunCMake/Make/CMP0113-NEW.cmake
new file mode 100644
index 0000000..a2d1db5
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0113 NEW)
+include(CMP0113-Common.cmake)
diff --git a/Tests/RunCMake/Make/CMP0113-OLD-build-stdout.txt b/Tests/RunCMake/Make/CMP0113-OLD-build-stdout.txt
new file mode 100644
index 0000000..f6e1f0f
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-OLD-build-stdout.txt
@@ -0,0 +1 @@
+Generating output-not-created.*Built target drive1.*Generating output-not-created.*Built target drive2
diff --git a/Tests/RunCMake/Make/CMP0113-OLD.cmake b/Tests/RunCMake/Make/CMP0113-OLD.cmake
new file mode 100644
index 0000000..b6ab120
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0113 OLD)
+include(CMP0113-Common.cmake)
diff --git a/Tests/RunCMake/Make/CMP0113-WARN-build-stdout.txt b/Tests/RunCMake/Make/CMP0113-WARN-build-stdout.txt
new file mode 100644
index 0000000..f6e1f0f
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-WARN-build-stdout.txt
@@ -0,0 +1 @@
+Generating output-not-created.*Built target drive1.*Generating output-not-created.*Built target drive2
diff --git a/Tests/RunCMake/Make/CMP0113-WARN.cmake b/Tests/RunCMake/Make/CMP0113-WARN.cmake
new file mode 100644
index 0000000..48e035a
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-WARN.cmake
@@ -0,0 +1,2 @@
+# Policy CMP0113 not set.
+include(CMP0113-Common.cmake)
diff --git a/Tests/RunCMake/Make/RunCMakeTest.cmake b/Tests/RunCMake/Make/RunCMakeTest.cmake
index 32aafca..5562aca 100644
--- a/Tests/RunCMake/Make/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Make/RunCMakeTest.cmake
@@ -41,3 +41,25 @@ run_VerboseBuild()
run_cmake(CustomCommandDepfile-ERROR)
run_cmake(IncludeRegexSubdir)
+
+function(run_CMP0113 val)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0113-${val}-build)
+ run_cmake(CMP0113-${val})
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(_backup_lang "$ENV{LANG}")
+ set(_backup_lc_Messages "$ENV{LC_MESSAGES}")
+ if(MAKE_IS_GNU)
+ set(RunCMake-stderr-file CMP0113-${val}-build-gnu-stderr.txt)
+ set(ENV{LANG} "C")
+ set(ENV{LC_MESSAGES} "C")
+ endif()
+ run_cmake_command(CMP0113-${val}-build ${CMAKE_COMMAND} --build .)
+ set(ENV{LANG} "${_backup_lang}")
+ set(ENV{LC_MESSAGES} "${_backup_lc_messages}")
+endfunction()
+
+if(NOT RunCMake_GENERATOR STREQUAL "Watcom WMake")
+ run_CMP0113(WARN)
+ run_CMP0113(OLD)
+ run_CMP0113(NEW)
+endif()
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index d43023b..e6f86a1 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -327,6 +327,7 @@ run_ChangeBuildType()
function(run_Qt5AutoMocDeps)
if(CMake_TEST_Qt5 AND CMAKE_TEST_Qt5Core_Version VERSION_GREATER_EQUAL 5.15.0)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Qt5AutoMocDeps-build)
+ set(RunCMake_TEST_OPTIONS "-DQt5Core_DIR=${Qt5Core_DIR}")
run_cmake(Qt5AutoMocDeps)
unset(RunCMake_TEST_OPTIONS)
# Build the project.
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-clean-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-clean-build-check.cmake
new file mode 100644
index 0000000..a6eb088
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-clean-build-check.cmake
@@ -0,0 +1,3 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+ INCLUDE
+ )
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-leaf-custom-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-leaf-custom-ninja-check.cmake
new file mode 100644
index 0000000..b142ed2
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-leaf-custom-ninja-check.cmake
@@ -0,0 +1,6 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+ INCLUDE
+ ${TARGET_BYPRODUCTS_LeafCustom}
+ ${TARGET_BYPRODUCTS_RootCustom}
+ ${TARGET_FILE_RootExe_Release}
+ )
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-leaf-exe-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-leaf-exe-ninja-check.cmake
new file mode 100644
index 0000000..3f51983
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-leaf-exe-ninja-check.cmake
@@ -0,0 +1,6 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+ INCLUDE
+ ${TARGET_FILE_LeafExe_Release}
+ ${TARGET_BYPRODUCTS_RootCustom}
+ ${TARGET_FILE_RootExe_Release}
+ )
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets.cmake
index b2b24e8..b6f1152 100644
--- a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets.cmake
@@ -34,6 +34,16 @@ add_subdirectory(CustomCommandsAndTargetsSubdir)
create_targets(Top)
+add_executable(RootExe main.c)
+add_custom_target(RootCustom COMMAND ${CMAKE_COMMAND} -E touch Root.txt BYPRODUCTS Root.txt)
+add_executable(LeafExe main.c)
+add_custom_target(LeafCustom COMMAND ${CMAKE_COMMAND} -E touch Leaf.txt BYPRODUCTS Leaf.txt DEPENDS RootCustom RootExe)
+add_dependencies(LeafExe RootExe RootCustom)
+file(APPEND "${CMAKE_BINARY_DIR}/target_files_custom.cmake"
+"set(TARGET_BYPRODUCTS_LeafCustom [==[${CMAKE_CURRENT_BINARY_DIR}/Leaf.txt]==])
+set(TARGET_BYPRODUCTS_RootCustom [==[${CMAKE_CURRENT_BINARY_DIR}/Root.txt]==])
+")
+
include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake)
-generate_output_files(TopPostBuild SubdirPostBuild)
+generate_output_files(TopPostBuild SubdirPostBuild RootExe LeafExe)
file(APPEND "${CMAKE_BINARY_DIR}/target_files.cmake" "include(\${CMAKE_CURRENT_LIST_DIR}/target_files_custom.cmake)\n")
diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
index 9249724..86d726b 100644
--- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
@@ -235,6 +235,10 @@ run_cmake_build(CustomCommandsAndTargets debug-in-release-graph-postbuild Releas
run_ninja(CustomCommandsAndTargets release-postbuild build-Release.ninja SubdirPostBuild)
run_cmake_build(CustomCommandsAndTargets debug-targetpostbuild Debug TopTargetPostBuild)
run_ninja(CustomCommandsAndTargets release-targetpostbuild build-Release.ninja SubdirTargetPostBuild)
+run_cmake_build(CustomCommandsAndTargets release-clean Release clean:all)
+run_ninja(CustomCommandsAndTargets release-leaf-custom build-Release.ninja Leaf.txt)
+run_cmake_build(CustomCommandsAndTargets release-clean Release clean:all)
+run_ninja(CustomCommandsAndTargets release-leaf-exe build-Release.ninja LeafExe)
unset(RunCMake_TEST_BINARY_DIR)
@@ -305,7 +309,7 @@ endif()
if(CMake_TEST_Qt5)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Qt5-build)
- set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all")
+ set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all" "-DQt5Core_DIR=${Qt5Core_DIR}")
run_cmake_configure(Qt5)
unset(RunCMake_TEST_OPTIONS)
include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt
index aecd4d3..141d66d 100644
--- a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt
+++ b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt
@@ -19,6 +19,6 @@ CMake Error at CMP0053-Dollar-OLD.cmake:6 \(message\):
-->\${\$}<--
- syntax error, unexpected \$, expecting } \(7\)
+ syntax error, unexpected \$, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt b/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt
index 7448b59..71b9c3c 100644
--- a/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt
@@ -7,6 +7,6 @@
\${var\\rwith\\rcarriagereturn}
- syntax error, unexpected cal_SYMBOL, expecting } \(7\)
+ syntax error, unexpected cal_SYMBOL, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt
index f5e03ed..c43e1be 100644
--- a/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt
@@ -7,6 +7,6 @@
\${var\\rwith\\rcarriagereturn}
- syntax error, unexpected cal_SYMBOL, expecting } \(7\)
+ syntax error, unexpected cal_SYMBOL, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt b/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt
index fa16a8a..3a26135 100644
--- a/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt
@@ -7,6 +7,6 @@
\${var\\ with\\ escaped\\ space}
- syntax error, unexpected cal_SYMBOL, expecting } \(7\)
+ syntax error, unexpected cal_SYMBOL, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt
index 07cbf24..0f40649 100644
--- a/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt
@@ -7,6 +7,6 @@
\${var\\ with\\ escaped\\ space}
- syntax error, unexpected cal_SYMBOL, expecting } \(7\)
+ syntax error, unexpected cal_SYMBOL, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt b/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt
index 5cc111b..77bd470 100644
--- a/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt
@@ -7,6 +7,6 @@
\${var\\nwith\\nnewline}
- syntax error, unexpected cal_SYMBOL, expecting } \(7\)
+ syntax error, unexpected cal_SYMBOL, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt
index 0067c2f..1d14b1d 100644
--- a/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt
@@ -7,6 +7,6 @@
\${var\\nwith\\nnewline}
- syntax error, unexpected cal_SYMBOL, expecting } \(7\)
+ syntax error, unexpected cal_SYMBOL, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt b/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt
index 04bc226..cf6dad5 100644
--- a/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt
@@ -7,6 +7,6 @@
\${var
- syntax error, unexpected \$end, expecting } \(5\)
+ syntax error, unexpected \$end, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt
index 66cf9a2..6e3744a 100644
--- a/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt
@@ -7,6 +7,6 @@
\${var with space}
- syntax error, unexpected cal_SYMBOL, expecting } \(17\)
+ syntax error, unexpected cal_SYMBOL, expecting } \(3\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt b/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt
index e888096..70e7c12 100644
--- a/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt
@@ -7,6 +7,6 @@
\${var
- syntax error, unexpected \$end, expecting } \(5\)
+ syntax error, unexpected \$end, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt
index b020074..e18268a 100644
--- a/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt
@@ -7,6 +7,6 @@
\${var with tab}
- syntax error, unexpected cal_SYMBOL, expecting } \(15\)
+ syntax error, unexpected cal_SYMBOL, expecting } \(3\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/ParenInENV-stderr.txt b/Tests/RunCMake/Syntax/ParenInENV-stderr.txt
index d7861e2..144b57c 100644
--- a/Tests/RunCMake/Syntax/ParenInENV-stderr.txt
+++ b/Tests/RunCMake/Syntax/ParenInENV-stderr.txt
@@ -15,6 +15,6 @@ CMake Error at ParenInENV.cmake:2 \(message\):
-->\$ENV{e
- syntax error, unexpected \$end, expecting } \(9\)
+ syntax error, unexpected \$end, expecting } \(10\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt b/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt
index 81b1717..18ca946 100644
--- a/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt
+++ b/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt
@@ -7,6 +7,6 @@ CMake Error at ParenInVarName1.cmake:4 \(message\):
-->\${e\(x\)}<--
- syntax error, unexpected cal_SYMBOL, expecting } \(10\)
+ syntax error, unexpected cal_SYMBOL, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt
index 1e0ce49..cf63dbe 100644
--- a/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt
+++ b/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt
@@ -7,6 +7,6 @@ CMake Error at UnterminatedBrace0.cmake:2 \(set\):
\${
- syntax error, unexpected \$end, expecting } \(2\)
+ syntax error, unexpected \$end, expecting } \(3\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt
index 4e3c2b5..0e6f786 100644
--- a/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt
+++ b/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt
@@ -7,7 +7,7 @@ CMake Warning \(dev\) at UnterminatedBrace1.cmake:3 \(set\):
\${
- syntax error, unexpected \$end, expecting } \(2\)
+ syntax error, unexpected \$end, expecting } \(3\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
index 2454f25..b3f3a5e 100644
--- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
+++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
@@ -32,6 +32,8 @@
\* CMP0104
\* CMP0105
\* CMP0108
+ \* CMP0112
+ \* CMP0113
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake b/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake
index 288735e..3d8fa17 100644
--- a/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake
+++ b/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake
@@ -5,15 +5,18 @@ project(DeploymentTarget C)
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(CMAKE_OSX_DEPLOYMENT_TARGET "9.1")
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO")
elseif(CMAKE_SYSTEM_NAME STREQUAL "watchOS")
set(CMAKE_OSX_DEPLOYMENT_TARGET "2.0")
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")
elseif(CMAKE_SYSTEM_NAME STREQUAL "tvOS")
set(CMAKE_OSX_DEPLOYMENT_TARGET "9.0")
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase.cmake
new file mode 100644
index 0000000..22a181f
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase.cmake
@@ -0,0 +1,87 @@
+enable_language(C)
+
+set(prototypes [[
+#include <stdio.h>
+#include <zlib.h>
+#include <resolv.h>
+int func1();
+int func2();
+int func3();
+int func4();
+int func5();
+]])
+set(impl [[
+{
+ printf("%p %p\n", compress, res_close);
+ return func1() + func2() + func3() + func4() + func5();
+}
+]])
+
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/mainOuter.c
+ "${prototypes}\nint main(int argc, char** argv) ${impl}"
+)
+
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/funcOuter.c
+ "${prototypes}\nint funcOuter() ${impl}"
+)
+
+foreach(i RANGE 1 5)
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/func${i}.c
+ "int func${i}() { return 32 + ${i}; }\n"
+ )
+endforeach()
+
+add_executable(app1 mainOuter.c)
+add_library(static1 STATIC funcOuter.c)
+add_library(shared1 SHARED funcOuter.c)
+add_library(module1 MODULE funcOuter.c)
+add_library(obj1 OBJECT funcOuter.c)
+add_library(staticFramework1 STATIC funcOuter.c)
+add_library(sharedFramework1 SHARED funcOuter.c)
+set_target_properties(staticFramework1 PROPERTIES FRAMEWORK TRUE)
+set_target_properties(sharedFramework1 PROPERTIES FRAMEWORK TRUE)
+
+add_library(static2 STATIC func1.c)
+add_library(shared2 SHARED func2.c)
+add_library(obj2 OBJECT func3.c)
+add_library(staticFramework2 STATIC func4.c)
+add_library(sharedFramework2 SHARED func5.c)
+set_target_properties(staticFramework2 PROPERTIES FRAMEWORK TRUE)
+set_target_properties(sharedFramework2 PROPERTIES FRAMEWORK TRUE)
+
+# Pick a couple of libraries that are always present in the Xcode SDK
+find_library(libz z REQUIRED)
+find_library(libresolv resolv REQUIRED)
+add_library(imported2 UNKNOWN IMPORTED)
+set_target_properties(imported2 PROPERTIES IMPORTED_LOCATION ${libz})
+
+# Save these for the check script to use
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/foundLibs.cmake "
+set(libz \"${libz}\")
+set(libresolv \"${libresolv}\")
+")
+
+set(mainTargets
+ app1
+ static1
+ shared1
+ module1
+ obj1
+ staticFramework1
+ sharedFramework1
+)
+set(linkToThings
+ static2
+ shared2
+ obj2
+ staticFramework2
+ sharedFramework2
+ imported2
+ ${libresolv}
+)
+
+foreach(mainTarget IN LISTS mainTargets)
+ foreach(linkTo IN LISTS linkToThings)
+ target_link_libraries(${mainTarget} PRIVATE ${linkTo})
+ endforeach()
+endforeach()
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY-check.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY-check.cmake
new file mode 100644
index 0000000..2b7edf5
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY-check.cmake
@@ -0,0 +1,19 @@
+include(${RunCMake_TEST_SOURCE_DIR}/LinkBinariesBuildPhase_Funcs.cmake)
+include(${RunCMake_TEST_BINARY_DIR}/foundLibs.cmake)
+
+# obj2 --> Embeds func3.o in the link flags, but obj2 is part of the path
+# ${libz} --> This is for imported2
+
+foreach(mainTarget IN ITEMS app1 shared1 module1 sharedFramework1)
+ checkFlags(OTHER_LDFLAGS ${mainTarget}
+ "obj2;${libz};${libresolv}"
+ "static2;shared2;staticFramework2;sharedFramework2"
+ )
+endforeach()
+
+foreach(mainTarget IN ITEMS static1 staticFramework1)
+ checkFlags(OTHER_LIBTOOLFLAGS ${mainTarget}
+ "obj2"
+ "static2;shared2;staticFramework2;sharedFramework2;${libz};${libresolv}"
+ )
+endforeach()
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY.cmake
new file mode 100644
index 0000000..f9dd643
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY.cmake
@@ -0,0 +1 @@
+include(${CMAKE_CURRENT_LIST_DIR}/LinkBinariesBuildPhase.cmake)
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_Funcs.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_Funcs.cmake
new file mode 100644
index 0000000..601e52f
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_Funcs.cmake
@@ -0,0 +1,55 @@
+macro(returnOnError errorMsg)
+ if(NOT "${errorMsg}" STREQUAL "")
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}\n${errorMsg}" PARENT_SCOPE)
+ return()
+ endif()
+endmacro()
+
+function(getTargetFlags mainTarget projFlagsVar flagsVar errorVar)
+ # The flags variables in the project file might span over multiple lines
+ # so we can't easily read the flags directly from there. Instead, we use
+ # the xcodebuild -showBuildSettings option to report it on a single line.
+ execute_process(
+ COMMAND ${CMAKE_COMMAND}
+ --build ${RunCMake_TEST_BINARY_DIR}
+ --target ${mainTarget}
+ --config Debug
+ --
+ -showBuildSettings
+ COMMAND grep ${projFlagsVar}
+ OUTPUT_VARIABLE flagsContents
+ RESULT_VARIABLE result
+ )
+
+ if(result)
+ set(${errorVar} "Failed to get flags for ${mainTarget}: ${result}" PARENT_SCOPE)
+ else()
+ unset(${errorVar} PARENT_SCOPE)
+ endif()
+ set(${flagsVar} "${flagsContents}" PARENT_SCOPE)
+endfunction()
+
+function(checkFlags projFlagsVar mainTarget present absent)
+ getTargetFlags(${mainTarget} ${projFlagsVar} flags errorMsg)
+ returnOnError("${errorMsg}")
+
+ foreach(linkTo IN LISTS present)
+ string(REGEX MATCH "${linkTo}" result "${flags}")
+ if("${result}" STREQUAL "")
+ string(APPEND RunCMake_TEST_FAILED
+ "\n${mainTarget} ${projFlagsVar} is missing ${linkTo}"
+ )
+ endif()
+ endforeach()
+
+ foreach(linkTo IN LISTS absent)
+ string(REGEX MATCH "${linkTo}" result "${flags}")
+ if(NOT "${result}" STREQUAL "")
+ string(APPEND RunCMake_TEST_FAILED
+ "\n${mainTarget} ${projFlagsVar} unexpectedly contains ${linkTo}"
+ )
+ endif()
+ endforeach()
+
+ set(RunCMake_TEST_FAILED ${RunCMake_TEST_FAILED} PARENT_SCOPE)
+endfunction()
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-result.txt b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-stderr.txt b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-stderr.txt
new file mode 100644
index 0000000..0664304
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-stderr.txt
@@ -0,0 +1 @@
+CMake Error: Invalid value for XCODE_LINK_BUILD_PHASE_MODE: INVALID
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID.cmake
new file mode 100644
index 0000000..0a20d20
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID.cmake
@@ -0,0 +1,4 @@
+enable_language(CXX)
+
+add_executable(app main.cpp)
+set_target_properties(app PROPERTIES XCODE_LINK_BUILD_PHASE_MODE INVALID)
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION-check.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION-check.cmake
new file mode 100644
index 0000000..b0d2f7f
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION-check.cmake
@@ -0,0 +1,19 @@
+include(${RunCMake_TEST_SOURCE_DIR}/LinkBinariesBuildPhase_Funcs.cmake)
+include(${RunCMake_TEST_BINARY_DIR}/foundLibs.cmake)
+
+# obj2 --> Embeds func3.o in the link flags, but obj2 is part of the path
+# ${libz} --> This is for imported2
+
+foreach(mainTarget IN ITEMS app1 shared1 module1 sharedFramework1)
+ checkFlags(OTHER_LDFLAGS ${mainTarget}
+ "obj2"
+ "static2;shared2;staticFramework2;sharedFramework2;${libz};${libresolv}"
+ )
+endforeach()
+
+foreach(mainTarget IN ITEMS static1 staticFramework1)
+ checkFlags(OTHER_LIBTOOLFLAGS ${mainTarget}
+ "obj2"
+ "static2;shared2;staticFramework2;sharedFramework2;${libz};${libresolv}"
+ )
+endforeach()
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION.cmake
new file mode 100644
index 0000000..f9dd643
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION.cmake
@@ -0,0 +1 @@
+include(${CMAKE_CURRENT_LIST_DIR}/LinkBinariesBuildPhase.cmake)
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE-check.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE-check.cmake
new file mode 100644
index 0000000..3074881
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE-check.cmake
@@ -0,0 +1,19 @@
+include(${RunCMake_TEST_SOURCE_DIR}/LinkBinariesBuildPhase_Funcs.cmake)
+include(${RunCMake_TEST_BINARY_DIR}/foundLibs.cmake)
+
+# obj2 --> Embeds func3.o in the link flags, but obj2 is part of the path
+# ${libz} --> This is for imported2
+
+foreach(mainTarget IN ITEMS app1 shared1 module1 sharedFramework1)
+ checkFlags(OTHER_LDFLAGS ${mainTarget}
+ "static2;shared2;staticFramework2;sharedFramework2;obj2;${libz};${libresolv}"
+ ""
+ )
+endforeach()
+
+foreach(mainTarget IN ITEMS static1 staticFramework1)
+ checkFlags(OTHER_LIBTOOLFLAGS ${mainTarget}
+ "obj2"
+ "static2;shared2;staticFramework2;sharedFramework2;${libz};${libresolv}"
+ )
+endforeach()
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE.cmake
new file mode 100644
index 0000000..f9dd643
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE.cmake
@@ -0,0 +1 @@
+include(${CMAKE_CURRENT_LIST_DIR}/LinkBinariesBuildPhase.cmake)
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index ed300bb..70eaaeb 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -19,6 +19,19 @@ endfunction()
XcodeGenerateTopLevelProjectOnlyWithObjectLibrary()
+function(LinkBinariesBuildPhase mode)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/LinkBinariesBuildPhase_${mode}-build)
+ set(RunCMake_TEST_OPTIONS "-DCMAKE_XCODE_LINK_BUILD_PHASE_MODE=${mode}")
+ run_cmake(LinkBinariesBuildPhase_${mode})
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(LinkBinariesBuildPhase_${mode}-build ${CMAKE_COMMAND} --build .)
+endfunction()
+
+LinkBinariesBuildPhase(NONE)
+LinkBinariesBuildPhase(BUILT_ONLY)
+LinkBinariesBuildPhase(KNOWN_LOCATION)
+run_cmake(LinkBinariesBuildPhase_INVALID)
+
run_cmake(XcodeObjectNeedsEscape)
run_cmake(XcodeObjectNeedsQuote)
run_cmake(XcodeOptimizationFlags)
diff --git a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake
index 8c0b470..bc14874 100644
--- a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake
@@ -4,12 +4,14 @@ cmake_minimum_required(VERSION 3.3)
enable_language(C)
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO")
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS")
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")
diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake
index c221033..19f8e2f 100644
--- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake
@@ -10,6 +10,7 @@ if(NOT IOS)
message(FATAL_ERROR "IOS variable is not set")
endif()
+set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf")
diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake
index 172f2e8..7d14d19 100644
--- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake
@@ -6,6 +6,7 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 9)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10)
endif()
+set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf")
diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake
index 038a890..974ae47 100644
--- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake
@@ -6,6 +6,7 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 9)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10)
endif()
+set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf")
diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake
new file mode 100644
index 0000000..4fd3c7d
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake
@@ -0,0 +1,39 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "../../a/d")
+cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f")
+if (NOT path STREQUAL "/x/y/a/f/../../a/d")
+ list (APPEND errors "'${path}' instead of '/x/y/a/f/../../a/d'")
+endif()
+
+set (path "../../a/d")
+cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f" NORMALIZE)
+if (NOT path STREQUAL "/x/y/a/d")
+ list (APPEND errors "'${path}' instead of '/x/y/a/d'")
+endif()
+
+set (path "../../a/d")
+cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f" NORMALIZE OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "../../a/d")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "/x/y/a/d")
+ list (APPEND errors "'${output}' instead of '/x/y/a/d'")
+endif()
+
+set (path "/a/d/../e")
+cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f")
+if (NOT path STREQUAL "/a/d/../e")
+ list (APPEND errors "'${path}' instead of '/a/d/../e'")
+endif()
+
+set (path "/a/d/../e")
+cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f" NORMALIZE)
+if (NOT path STREQUAL "/a/e")
+ list (APPEND errors "'${path}' instead of '/a/e'")
+endif()
+
+
+check_errors (ABSOLUTE_PATH ${errors})
diff --git a/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/APPEND-wrong-path-result.txt b/Tests/RunCMake/cmake_path/APPEND-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/APPEND-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/APPEND.cmake b/Tests/RunCMake/cmake_path/APPEND.cmake
new file mode 100644
index 0000000..565b26d
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/APPEND.cmake
@@ -0,0 +1,77 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+cmake_path (APPEND path "/a/b" "c")
+if (NOT path STREQUAL "/a/b/c")
+ list (APPEND errors "'${path}' instead of '/a/b/c'")
+endif()
+
+set (path "/a/b")
+cmake_path (APPEND path "c")
+if (NOT path STREQUAL "/a/b/c")
+ list (APPEND errors "'${path}' instead of '/a/b/c'")
+endif()
+
+cmake_path (APPEND path "x/y" "z" OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "/a/b/c")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "/a/b/c/x/y/z")
+ list (APPEND errors "'${output}' instead of '/a/b/c/x/y/z'")
+endif()
+
+set (path "a")
+cmake_path (APPEND path "")
+if (NOT path STREQUAL "a/")
+ list (APPEND errors "'${path}' instead of 'a/'")
+endif()
+
+cmake_path (APPEND path "/b")
+if (NOT path STREQUAL "/b")
+ list (APPEND errors "'${path}' instead of '/b'")
+endif()
+
+if (WIN32)
+ set (path "a")
+ cmake_path (APPEND path "c:/b")
+ if (NOT path STREQUAL "c:/b")
+ list (APPEND errors "'${path}' instead of 'c:/b'")
+ endif()
+
+ set (path "a")
+ cmake_path (APPEND path "c:")
+ if (NOT path STREQUAL "c:")
+ list (APPEND errors "'${path}' instead of 'c:'")
+ endif()
+ cmake_path (APPEND path "")
+ if (NOT path STREQUAL "c:")
+ list (APPEND errors "'${path}' instead of 'c:'")
+ endif()
+
+ set (path "c:a")
+ cmake_path (APPEND path "/b")
+ if (NOT path STREQUAL "c:/b")
+ list (APPEND errors "'${path}' instead of 'c:/b'")
+ endif()
+
+ set (path "c:a")
+ cmake_path (APPEND path "c:b")
+ if (NOT path STREQUAL "c:a/b")
+ list (APPEND errors "'${path}' instead of 'c:a/b'")
+ endif()
+
+ set (path "//host")
+ cmake_path (APPEND path "b")
+ if (NOT path STREQUAL "//host/b")
+ list (APPEND errors "'${path}' instead of '//host/b'")
+ endif()
+
+ set (path "//host/")
+ cmake_path (APPEND path "b")
+ if (NOT path STREQUAL "//host/b")
+ list (APPEND errors "'${path}' instead of '//host/b'")
+ endif()
+endif()
+
+check_errors (APPEND ${errors})
diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH.cmake b/Tests/RunCMake/cmake_path/CMAKE_PATH.cmake
new file mode 100644
index 0000000..b9320f3
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CMAKE_PATH.cmake
@@ -0,0 +1,43 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+cmake_path(CMAKE_PATH path "/x/y/z/../../a/d")
+if (NOT path STREQUAL "/x/y/z/../../a/d")
+ list (APPEND errors "'${path}' instead of '/x/y/z/../../a/d'")
+endif()
+cmake_path(CMAKE_PATH path NORMALIZE "/x/y/z/../../a/d")
+if (NOT path STREQUAL "/x/a/d")
+ list (APPEND errors "'${path}' instead of '/x/a/d'")
+endif()
+
+if (WIN32)
+ cmake_path(CMAKE_PATH path "/x\\y/z\\..\\../a/d")
+ if (NOT path STREQUAL "/x/y/z/../../a/d")
+ list (APPEND errors "'${path}' instead of '/x/y/z/../../a/d'")
+ endif()
+ cmake_path(CMAKE_PATH path NORMALIZE "/x\\y/z\\..\\../a/d")
+ if (NOT path STREQUAL "/x/a/d")
+ list (APPEND errors "'${path}' instead of '/x/a/d'")
+ endif()
+
+ cmake_path(CMAKE_PATH path "//?/c:/x\\y/z\\..\\../a/d")
+ if (NOT path STREQUAL "c:/x/y/z/../../a/d")
+ list (APPEND errors "'${path}' instead of 'c:/x/y/z/../../a/d'")
+ endif()
+ cmake_path(CMAKE_PATH path NORMALIZE "//?/c:/x\\y/z\\..\\../a/d")
+ if (NOT path STREQUAL "c:/x/a/d")
+ list (APPEND errors "'${path}' instead of 'c:/x/a/d'")
+ endif()
+
+ cmake_path(CMAKE_PATH path "\\\\?\\UNC/host/x\\y/z\\..\\../a/d")
+ if (NOT path STREQUAL "//host/x/y/z/../../a/d")
+ list (APPEND errors "'${path}' instead of '//host/x/y/z/../../a/d'")
+ endif()
+ cmake_path(CMAKE_PATH path NORMALIZE "\\\\?\\UNC\\host/x\\y/z\\..\\../a/d")
+ if (NOT path STREQUAL "//host/x/a/d")
+ list (APPEND errors "'${path}' instead of '//host/x/a/d'")
+ endif()
+endif()
+
+check_errors (CMAKE_PATH ${errors})
diff --git a/Tests/RunCMake/cmake_path/CMakeLists.txt b/Tests/RunCMake/cmake_path/CMakeLists.txt
new file mode 100644
index 0000000..1f195c6
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.18...3.19)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/cmake_path/COMPARE-EQUAL-invalid-output-result.txt b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/COMPARE-EQUAL-missing-output-result.txt b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/COMPARE-EQUAL-wrong-path-result.txt b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-invalid-output-result.txt b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-missing-output-result.txt b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-wrong-path-result.txt b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-result.txt b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-stderr.txt b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-stderr.txt
new file mode 100644
index 0000000..674d942
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at COMPARE-wrong-operator.cmake:[0-9]+ \(cmake_path\):
+ cmake_path COMPARE called with an unknown comparison operator: FOO.
diff --git a/Tests/RunCMake/cmake_path/COMPARE-wrong-operator.cmake b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator.cmake
new file mode 100644
index 0000000..7da5d29
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator.cmake
@@ -0,0 +1,3 @@
+
+set (path "/a/b")
+cmake_path(COMPARE path FOO "/other" output)
diff --git a/Tests/RunCMake/cmake_path/COMPARE.cmake b/Tests/RunCMake/cmake_path/COMPARE.cmake
new file mode 100644
index 0000000..bc6b9b4
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE.cmake
@@ -0,0 +1,22 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "a///b/c")
+cmake_path(COMPARE path EQUAL "a/b/c" output)
+if (NOT output)
+ list (APPEND errors "'${path}' not equal to 'a/b/c'")
+endif()
+
+set (path "a/b/d/../c")
+cmake_path(COMPARE path NOT_EQUAL "a/b/c" output)
+if (NOT output)
+ list (APPEND errors "'${path}' equal to 'a/b/c'")
+endif()
+cmake_path(NORMAL_PATH path)
+cmake_path(COMPARE path EQUAL "a/b/c" output)
+if (NOT output)
+ list (APPEND errors "'${path}' not equal to 'a/b/c'")
+endif()
+
+check_errors (COMPARE ${errors})
diff --git a/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONCAT-wrong-path-result.txt b/Tests/RunCMake/cmake_path/CONCAT-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONCAT-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONCAT.cmake b/Tests/RunCMake/cmake_path/CONCAT.cmake
new file mode 100644
index 0000000..62b5eb0
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONCAT.cmake
@@ -0,0 +1,20 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "/a/b")
+cmake_path (CONCAT path "cd")
+if (NOT path STREQUAL "/a/bcd")
+ list (APPEND errors "'${path}' instead of 'a/bcd'")
+endif()
+
+set (path "/a/b")
+cmake_path (CONCAT path "cd" "ef" OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "/a/b")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "/a/bcdef")
+ list (APPEND errors "'${output}' instead of 'a/bcdef'")
+endif()
+
+check_errors (CONCAT ${errors})
diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-invalid-output-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-missing-output-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-invalid-output-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-missing-output-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-result.txt b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-stderr.txt b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-stderr.txt
new file mode 100644
index 0000000..9aa75ec
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at CONVERT-wrong-operator.cmake:[0-9]+ \(cmake_path\):
+ cmake_path CONVERT called with an unknown action: FOO.
diff --git a/Tests/RunCMake/cmake_path/CONVERT-wrong-operator.cmake b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator.cmake
new file mode 100644
index 0000000..12ffccc
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator.cmake
@@ -0,0 +1,2 @@
+
+cmake_path(CONVERT "/a/b" FOO output)
diff --git a/Tests/RunCMake/cmake_path/CONVERT.cmake b/Tests/RunCMake/cmake_path/CONVERT.cmake
new file mode 100644
index 0000000..b08bc26
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT.cmake
@@ -0,0 +1,110 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+cmake_path(CONVERT "/x/y/z/../../a/d" TO_CMAKE_PATH_LIST output)
+if (NOT output STREQUAL "/x/y/z/../../a/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d'")
+endif()
+cmake_path(CONVERT "/x/y/z/../../a/d" TO_CMAKE_PATH_LIST output NORMALIZE)
+if (NOT output STREQUAL "/x/a/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d'")
+endif()
+
+if (WIN32)
+ cmake_path(CONVERT "/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output)
+ if (NOT output STREQUAL "/x/y/z/../../a/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d'")
+ endif()
+ cmake_path(CONVERT "/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "/x/a/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d'")
+ endif()
+
+ cmake_path(CONVERT "//?/c:/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output)
+ if (NOT output STREQUAL "c:/x/y/z/../../a/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of 'c:/x/y/z/../../a/d'")
+ endif()
+ cmake_path(CONVERT "//?/c:/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "c:/x/a/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of 'c:/x/a/d'")
+ endif()
+
+ cmake_path(CONVERT "//?/UNC/host/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output)
+ if (NOT output STREQUAL "//host/x/y/z/../../a/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '//host/x/y/z/../../a/d'")
+ endif()
+ cmake_path(CONVERT "//?/UNC/host/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "//host/x/a/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '//host/x/a/d'")
+ endif()
+endif()
+
+if (WIN32)
+ cmake_path(CONVERT "/x\\y/z/..\\../a\\d;c:\\a/b\\c/..\\d" TO_CMAKE_PATH_LIST output)
+ if (NOT output STREQUAL "/x/y/z/../../a/d;c:/a/b/c/../d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d;c:/a/b/c/../d'")
+ endif()
+ cmake_path(CONVERT "/x\\y/z/..\\../a\\d;c:\\a/b\\c/..\\d" TO_CMAKE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "/x/a/d;c:/a/b/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d;c:/a/b/d'")
+ endif()
+else()
+ cmake_path(CONVERT "/x/y/z/../../a/d:/a/b/c/../d" TO_CMAKE_PATH_LIST output)
+ if (NOT output STREQUAL "/x/y/z/../../a/d;/a/b/c/../d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${outputh}' instead of '/x/y/z/../../a/d;/a/b/c/../d'")
+ endif()
+ cmake_path(CONVERT "/x/y/z/../../a/d:/a/b/c/../d" TO_CMAKE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "/x/a/d;/a/b/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d;/a/b/d'")
+ endif()
+endif()
+
+
+if (WIN32)
+ cmake_path(CONVERT "c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output)
+ if (NOT output STREQUAL "c:\\a\\\\b\\c\\..\\d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of 'c:\\a\\\\b\\c\\..\\d'")
+ endif()
+ cmake_path(CONVERT "c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "c:\\a\\b\\d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of 'c:\\a\\b\\d'")
+ endif()
+
+ cmake_path(CONVERT "//host/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output)
+ if (NOT output STREQUAL "\\\\host\\a\\\\b\\c\\..\\d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\\\b\\c\\..\\d'")
+ endif()
+ cmake_path(CONVERT "//host/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "\\\\host\\a\\b\\d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\b\\d'")
+ endif()
+ cmake_path(CONVERT "//host/a//b\\c/..\\d;c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output)
+ if (NOT output STREQUAL "\\\\host\\a\\\\b\\c\\..\\d;c:\\a\\\\b\\c\\..\\d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\\\b\\c\\..\\d;c:\\a\\\\b\\c\\..\\d'")
+ endif()
+ cmake_path(CONVERT "//host/a//b\\c/..\\d;c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "\\\\host\\a\\b\\d;c:\\a\\b\\d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\b\\d;c:\\a\\b\\d'")
+ endif()
+else()
+ cmake_path(CONVERT "/a//b/c/../d" TO_NATIVE_PATH_LIST output)
+ if (NOT output STREQUAL "/a//b/c/../d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/a//b/c/../d'")
+ endif()
+ cmake_path(CONVERT "/a//b/c/../d" TO_NATIVE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "/a/b/d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/a/b/d'")
+ endif()
+ cmake_path(CONVERT "/x/y/z/../../a/d;/a/b/c/../d" TO_NATIVE_PATH_LIST output)
+ if (NOT output STREQUAL "/x/y/z/../../a/d:/a/b/c/../d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d:/a/b/c/../d'")
+ endif()
+ cmake_path(CONVERT "/x/y/z/../../a/d;/a/b/c/../d" TO_NATIVE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "/x/a/d:/a/b/d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/x/a/d:/a/b/d'")
+ endif()
+endif()
+
+
+check_errors (CONVERT ${errors})
diff --git a/Tests/RunCMake/cmake_path/GET-EXTENSION-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-EXTENSION-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-EXTENSION-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-EXTENSION-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-EXTENSION-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-EXTENSION-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-EXTENSION-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-EXTENSION-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-EXTENSION-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-EXTENSION-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-EXTENSION-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-EXTENSION-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-FILENAME-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-FILENAME-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-FILENAME-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-FILENAME-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-FILENAME-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-FILENAME-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-FILENAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-FILENAME-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-FILENAME-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-FILENAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-FILENAME-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-FILENAME-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-PARENT_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-PARENT_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-PARENT_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-PARENT_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_NAME-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_NAME-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_NAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_NAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-STEM-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-STEM-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-STEM-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-STEM-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-STEM-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-STEM-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-STEM-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-STEM-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-STEM-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-STEM-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-STEM-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-STEM-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-wrong-operator-result.txt b/Tests/RunCMake/cmake_path/GET-wrong-operator-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-wrong-operator-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-wrong-operator-stderr.txt b/Tests/RunCMake/cmake_path/GET-wrong-operator-stderr.txt
new file mode 100644
index 0000000..71afc92
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-wrong-operator-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at GET-wrong-operator.cmake:[0-9]+ \(cmake_path\):
+ cmake_path GET called with an unknown action: FOO.
diff --git a/Tests/RunCMake/cmake_path/GET-wrong-operator.cmake b/Tests/RunCMake/cmake_path/GET-wrong-operator.cmake
new file mode 100644
index 0000000..e09d6d7
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-wrong-operator.cmake
@@ -0,0 +1,3 @@
+
+set (path "/a/b")
+cmake_path(GET path FOO output)
diff --git a/Tests/RunCMake/cmake_path/GET.cmake b/Tests/RunCMake/cmake_path/GET.cmake
new file mode 100644
index 0000000..e68e654
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET.cmake
@@ -0,0 +1,248 @@
+
+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 output)
+if (WIN32)
+ if (NOT output STREQUAL "C:")
+ list (APPEND errors "ROOT_NAME returns bad data: ${output}")
+ endif()
+else()
+ if (NOT output STREQUAL "")
+ list (APPEND errors "ROOT_NAME returns bad data: ${output}")
+ endif()
+endif()
+
+cmake_path(GET path ROOT_DIRECTORY output)
+if (NOT output STREQUAL "/")
+ list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_PATH output)
+if (WIN32)
+ if (NOT output STREQUAL "C:/")
+ list (APPEND errors "ROOT_PATH returns bad data: ${output}")
+ endif()
+else()
+ if (NOT output STREQUAL "/")
+ list (APPEND errors "ROOT_PATH returns bad data: ${output}")
+ endif()
+endif()
+
+cmake_path(GET path FILENAME output)
+if (NOT output STREQUAL "cc.ext1.ext2")
+ list (APPEND errors "FILENAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path EXTENSION output)
+if (NOT output STREQUAL ".ext1.ext2")
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+cmake_path(GET path EXTENSION LAST_ONLY output)
+if (NOT output STREQUAL ".ext2")
+ list (APPEND errors "EXTENSION LAST_ONLY returns bad data: ${output}")
+endif()
+
+cmake_path(GET path STEM output)
+if (NOT output STREQUAL "cc")
+ list (APPEND errors "STEM returns bad data: ${output}")
+endif()
+cmake_path(GET path STEM LAST_ONLY output)
+if (NOT output STREQUAL "cc.ext1")
+ list (APPEND errors "STEM LAST_ONLY returns bad data: ${output}")
+endif()
+
+cmake_path(GET path RELATIVE_PATH output)
+if (NOT output STREQUAL "aa/bb/cc.ext1.ext2")
+ list (APPEND errors "RELATIVE_PATH returns bad data: ${output}")
+endif()
+
+cmake_path(GET path PARENT_PATH output)
+if (WIN32)
+ if (NOT output STREQUAL "C:/aa/bb")
+ list (APPEND errors "PARENT_PATH returns bad data: ${output}")
+ endif()
+else()
+ if (NOT output STREQUAL "/aa/bb")
+ list (APPEND errors "PARENT_PATH returns bad data: ${output}")
+ endif()
+endif()
+
+######################################
+## second, tests with missing elements
+######################################
+set (path "aa/bb/")
+
+cmake_path(GET path ROOT_NAME output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "ROOT_NAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_DIRECTORY output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_PATH output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "ROOT_PATH returns bad data: ${output}")
+endif()
+
+cmake_path(GET path FILENAME output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "FILENAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path EXTENSION output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+
+cmake_path(GET path STEM output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "STEM returns bad data: ${output}")
+endif()
+
+cmake_path(GET path RELATIVE_PATH output)
+if (NOT output STREQUAL path)
+ list (APPEND errors "RELATIVE_PATH returns bad data: ${output}")
+endif()
+
+cmake_path(GET path PARENT_PATH output)
+if (NOT output STREQUAL "aa/bb")
+ list (APPEND errors "PARENT_PATH returns bad data: ${output}")
+endif()
+
+##################################
+set (path "/aa/bb/")
+
+cmake_path(GET path ROOT_NAME output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "ROOT_NAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_DIRECTORY output)
+if (NOT output STREQUAL "/")
+ list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_PATH output)
+if (NOT output STREQUAL "/")
+ list (APPEND errors "ROOT_PATH returns bad data: ${output}")
+endif()
+
+###################################
+set (path "/")
+
+cmake_path(GET path ROOT_NAME output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "ROOT_NAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_DIRECTORY output)
+if (NOT output STREQUAL "/")
+ list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_PATH output)
+if (NOT output STREQUAL "/")
+ list (APPEND errors "ROOT_PATH returns bad data: ${output}")
+endif()
+
+cmake_path(GET path FILENAME output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "FILENAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path EXTENSION output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+
+cmake_path(GET path STEM output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "STEM returns bad data: ${output}")
+endif()
+
+cmake_path(GET path RELATIVE_PATH output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "RELATIVE_PATH returns bad data: ${output}")
+endif()
+
+cmake_path(GET path PARENT_PATH output)
+if (NOT output STREQUAL "/")
+ list (APPEND errors "PARENT_PATH returns bad data: ${output}")
+endif()
+
+###################################
+set (path ".file")
+
+cmake_path(GET path FILENAME output)
+if (NOT output STREQUAL ".file")
+ list (APPEND errors "FILENAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path EXTENSION output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+
+cmake_path(GET path STEM output)
+if (NOT output STREQUAL ".file")
+ list (APPEND errors "STEM returns bad data: ${output}")
+endif()
+
+###################################
+set (path ".file.ext")
+
+cmake_path(GET path FILENAME output)
+if (NOT output STREQUAL ".file.ext")
+ list (APPEND errors "FILENAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path EXTENSION output)
+if (NOT output STREQUAL ".ext")
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+cmake_path(GET path EXTENSION LAST_ONLY output)
+if (NOT output STREQUAL ".ext")
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+
+cmake_path(GET path STEM output)
+if (NOT output STREQUAL ".file")
+ list (APPEND errors "STEM returns bad data: ${output}")
+endif()
+
+###################################
+set (path ".file.ext1.ext2")
+
+cmake_path(GET path FILENAME output)
+if (NOT output STREQUAL ".file.ext1.ext2")
+ list (APPEND errors "FILENAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path EXTENSION output)
+if (NOT output STREQUAL ".ext1.ext2")
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+cmake_path(GET path EXTENSION LAST_ONLY output)
+if (NOT output STREQUAL ".ext2")
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+
+cmake_path(GET path STEM output)
+if (NOT output STREQUAL ".file")
+ list (APPEND errors "STEM returns bad data: ${output}")
+endif()
+
+check_errors (GET ${errors})
diff --git a/Tests/RunCMake/cmake_path/HASH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HASH-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HASH-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HASH-missing-output-result.txt b/Tests/RunCMake/cmake_path/HASH-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HASH-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HASH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HASH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HASH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HASH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HASH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HASH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HASH.cmake b/Tests/RunCMake/cmake_path/HASH.cmake
new file mode 100644
index 0000000..dfcf2b2
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HASH.cmake
@@ -0,0 +1,27 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path1 "a///b/c")
+cmake_path(HASH path1 hash1)
+set (path2 "a/b////c")
+cmake_path(HASH path2 hash2)
+if (NOT hash1 STREQUAL hash2)
+ list (APPEND errors "'hash values not equal for '${path1}' and '${path2}'")
+endif()
+
+set (path1 "a///b/c/../d")
+cmake_path(HASH path1 hash1)
+set (path2 "a/b////d")
+cmake_path(HASH path2 hash2)
+if (hash1 STREQUAL hash2)
+ list (APPEND errors "'hash values equal for '${path1}' and '${path2}'")
+endif()
+cmake_path(HASH path1 hash1 NORMALIZE)
+cmake_path(HASH path2 NORMALIZE hash2)
+if (NOT hash1 STREQUAL hash2)
+ list (APPEND errors "'hash values not equal for '${path1}' and '${path2}'")
+endif()
+
+
+check_errors (HASH ${errors})
diff --git a/Tests/RunCMake/cmake_path/HAS_EXTENSION-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_EXTENSION-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_EXTENSION-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_EXTENSION-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_EXTENSION-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_EXTENSION-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_EXTENSION-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_EXTENSION-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_EXTENSION-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_EXTENSION-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_EXTENSION-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_EXTENSION-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_FILENAME-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_FILENAME-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_FILENAME-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_FILENAME-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_FILENAME-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_FILENAME-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_FILENAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_FILENAME-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_FILENAME-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_FILENAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_FILENAME-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_FILENAME-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ITEM.cmake b/Tests/RunCMake/cmake_path/HAS_ITEM.cmake
new file mode 100644
index 0000000..eb73bd5
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ITEM.cmake
@@ -0,0 +1,232 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "/a/b")
+cmake_path(HAS_ROOT_NAME path output)
+if (output)
+ list (APPEND errors "ROOT_NAME: ${path} has root name")
+endif()
+cmake_path(HAS_ROOT_DIRECTORY path output)
+if (NOT output)
+ list (APPEND errors "ROOT_DIRECTORY: ${path} does not have root directory")
+endif()
+cmake_path(HAS_ROOT_PATH path output)
+if (NOT output)
+ list (APPEND errors "ROOT_PATH: ${path} does not have root path")
+endif()
+
+set (path "a/b")
+cmake_path(HAS_ROOT_PATH path output)
+if (output)
+ list (APPEND errors "ROOT_PATH: ${path} has root path")
+endif()
+
+set (path "/a/b")
+cmake_path(HAS_FILENAME path output)
+if (NOT output)
+ list (APPEND errors "FILENAME: ${path} does not have filename")
+endif()
+set (path "a.b")
+cmake_path(HAS_FILENAME path output)
+if (NOT output)
+ list (APPEND errors "FILENAME: ${path} does not have filename")
+endif()
+set (path "/a/b/")
+cmake_path(HAS_FILENAME path output)
+if (output)
+ list (APPEND errors "FILENAME: ${path} has filename")
+endif()
+set (path "/")
+cmake_path(HAS_FILENAME path output)
+if (output)
+ list (APPEND errors "FILENAME: ${path} has filename")
+endif()
+
+set (path "/a/b")
+cmake_path(HAS_STEM path output)
+if (NOT output)
+ list (APPEND errors "STEM: ${path} does not have stem")
+endif()
+set (path "a.b")
+cmake_path(HAS_STEM path output)
+if (NOT output)
+ list (APPEND errors "STEM: ${path} does not have stem")
+endif()
+set (path ".a")
+cmake_path(HAS_STEM path output)
+if (NOT output)
+ list (APPEND errors "STEM: ${path} does not have stem")
+endif()
+set (path "/a/")
+cmake_path(HAS_STEM path output)
+if (output)
+ list (APPEND errors "STEM: ${path} has stem")
+endif()
+set (path "/")
+cmake_path(HAS_STEM path output)
+if (output)
+ list (APPEND errors "STEM: ${path} has stem")
+endif()
+
+set (path "/a/b.c")
+cmake_path(HAS_EXTENSION path output)
+if (NOT output)
+ list (APPEND errors "EXTENSION: ${path} does not have extension")
+endif()
+set (path "b.c")
+cmake_path(HAS_EXTENSION path output)
+if (NOT output)
+ list (APPEND errors "EXTENSION: ${path} does not have extension")
+endif()
+set (path "/.a")
+cmake_path(HAS_EXTENSION path output)
+if (output)
+ list (APPEND errors "EXTENSION: ${path} has extension")
+endif()
+set (path "/a/")
+cmake_path(HAS_EXTENSION path output)
+if (output)
+ list (APPEND errors "EXTENSION: ${path} has extension")
+endif()
+set (path "/")
+cmake_path(HAS_EXTENSION path output)
+if (output)
+ list (APPEND errors "EXTENSION: ${path} has extension")
+endif()
+
+set (path "/a/b")
+cmake_path(HAS_RELATIVE_PATH path output)
+if (NOT output)
+ list (APPEND errors "RELATIVE_PATH: ${path} does not have relative path")
+endif()
+set (path "/")
+cmake_path(HAS_RELATIVE_PATH path output)
+if (output)
+ list (APPEND errors "RELATIVE_PATH: ${path} has relative path")
+endif()
+
+set (path "/a/b")
+cmake_path(HAS_PARENT_PATH path output)
+if (NOT output)
+ list (APPEND errors "PARENT_PATH: ${path} does not have parent path")
+endif()
+set (path "/")
+cmake_path(HAS_PARENT_PATH path output)
+if (NOT output)
+ list (APPEND errors "PARENT_PATH: ${path} does not have parent path")
+endif()
+set (path "a")
+cmake_path(HAS_PARENT_PATH path output)
+if (output)
+ list (APPEND errors "PARENT_PATH: ${path} has parent path")
+endif()
+
+if (WIN32)
+ set (path "c:/a/b")
+ cmake_path(HAS_ROOT_NAME path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_NAME: ${path} does not have root name")
+ endif()
+ cmake_path(HAS_ROOT_DIRECTORY path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_DIRECTORY: ${path} does not have root directory")
+ endif()
+ cmake_path(HAS_ROOT_PATH path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_PATH: ${path} does not have root path")
+ endif()
+
+ set (path "c:a/b")
+ cmake_path(HAS_ROOT_NAME path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_NAME: ${path} does not have root name")
+ endif()
+ cmake_path(HAS_ROOT_DIRECTORY path output)
+ if (output)
+ list (APPEND errors "ROOT_DIRECTORY: ${path} has root directory")
+ endif()
+ cmake_path(HAS_ROOT_PATH path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_PATH: ${path} does not have root path")
+ endif()
+
+ set (path "//host/b")
+ cmake_path(HAS_ROOT_NAME path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_NAME: ${path} does not have root name")
+ endif()
+ cmake_path(HAS_ROOT_DIRECTORY path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_DIRECTORY: ${path} does not have root directory")
+ endif()
+ cmake_path(HAS_ROOT_PATH path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_PATH: ${path} does not have root path")
+ endif()
+
+ set (path "//host")
+ cmake_path(HAS_ROOT_NAME path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_NAME: ${path} does not have root name")
+ endif()
+ cmake_path(HAS_ROOT_DIRECTORY path output)
+ if (output)
+ list (APPEND errors "ROOT_DIRECTORY: ${path} has root directory")
+ endif()
+ cmake_path(HAS_ROOT_PATH path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_PATH: ${path} does not have root path")
+ endif()
+
+ set (path "c:/a/b")
+ cmake_path(HAS_RELATIVE_PATH path output)
+ if (NOT output)
+ list (APPEND errors "RELATIVE_PATH: ${path} does not have relative path")
+ endif()
+
+ set (path "c:a/b")
+ cmake_path(HAS_RELATIVE_PATH path output)
+ if (NOT output)
+ list (APPEND errors "RELATIVE_PATH: ${path} does not have relative path")
+ endif()
+
+ set (path "//host/b")
+ cmake_path(HAS_RELATIVE_PATH path output)
+ if (NOT output)
+ list (APPEND errors "RELATIVE_PATH: ${path} does not have relative path")
+ endif()
+
+ set (path "c:/a/b")
+ cmake_path(HAS_PARENT_PATH path output)
+ if (NOT output)
+ list (APPEND errors "PARENT_PATH: ${path} does not have parent path")
+ endif()
+
+ set (path "c:/")
+ cmake_path(HAS_PARENT_PATH path output)
+ if (NOT output)
+ list (APPEND errors "PARENT_PATH: ${path} does not have parent path")
+ endif()
+
+ set (path "c:")
+ cmake_path(HAS_PARENT_PATH path output)
+ if (NOT output)
+ list (APPEND errors "PARENT_PATH: ${path} does not have parent path")
+ endif()
+
+ set (path "//host/")
+ cmake_path(HAS_PARENT_PATH path output)
+ if (NOT output)
+ list (APPEND errors "PARENT_PATH: ${path} does not have parent path")
+ endif()
+
+ set (path "//host")
+ cmake_path(HAS_PARENT_PATH path output)
+ if (NOT output)
+ list (APPEND errors "PARENT_PATH: ${path} does not have parent path")
+ endif()
+endif()
+
+
+check_errors (HAS ${errors})
diff --git a/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_STEM-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_STEM-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_STEM-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_STEM-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_STEM-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_STEM-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_STEM-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_STEM-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_STEM-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_STEM-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_STEM-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_STEM-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE-invalid-output-result.txt b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE-missing-output-result.txt b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE-wrong-path-result.txt b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE.cmake b/Tests/RunCMake/cmake_path/IS_ABSOLUTE.cmake
new file mode 100644
index 0000000..794e786
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE.cmake
@@ -0,0 +1,48 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+if (WIN32)
+ set (path "c:/a")
+else()
+ set (path "/a")
+endif()
+cmake_path(IS_ABSOLUTE path output)
+if (NOT output)
+ list (APPEND errors "'${path} is not absolute")
+endif()
+
+set (path "a/b")
+cmake_path(IS_ABSOLUTE path output)
+if (output)
+ list (APPEND errors "'${path} is absolute")
+endif()
+
+if (WIN32)
+ set (path "c:/a/b")
+ cmake_path(IS_ABSOLUTE path output)
+ if (NOT output)
+ list (APPEND errors "'${path} is not absolute")
+ endif()
+
+ set (path "//host/b")
+ cmake_path(IS_ABSOLUTE path output)
+ if (NOT output)
+ list (APPEND errors "'${path} is not absolute")
+ endif()
+
+ set (path "/a")
+ cmake_path(IS_ABSOLUTE path output)
+ if (output)
+ list (APPEND errors "'${path} is absolute")
+ endif()
+
+ set (path "c:a")
+ cmake_path(IS_ABSOLUTE path output)
+ if (output)
+ list (APPEND errors "'${path} is absolute")
+ endif()
+endif()
+
+
+check_errors (IS_ABSOLUTE ${errors})
diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX-invalid-output-result.txt b/Tests/RunCMake/cmake_path/IS_PREFIX-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_PREFIX-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX-missing-output-result.txt b/Tests/RunCMake/cmake_path/IS_PREFIX-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_PREFIX-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/IS_PREFIX-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_PREFIX-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX-wrong-path-result.txt b/Tests/RunCMake/cmake_path/IS_PREFIX-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_PREFIX-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX.cmake b/Tests/RunCMake/cmake_path/IS_PREFIX.cmake
new file mode 100644
index 0000000..53da93b
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_PREFIX.cmake
@@ -0,0 +1,22 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "a///b/c")
+cmake_path(IS_PREFIX path "a/b/c/d" output)
+if (NOT output)
+ list (APPEND errors "'${path} is not prefix of 'a/b/c/d'")
+endif()
+
+set (path "a///b/c/../d")
+cmake_path(IS_PREFIX path "a/b/d/e" output)
+if (output)
+ list (APPEND errors "'${path} is prefix of 'a/b/d/e'")
+endif()
+cmake_path(IS_PREFIX path "a/b/d/e" NORMALIZE output)
+if (NOT output)
+ list (APPEND errors "'${path} is not prefix of 'a/b/d/e'")
+endif()
+
+
+check_errors (IS_PREFIX ${errors})
diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE-invalid-output-result.txt b/Tests/RunCMake/cmake_path/IS_RELATIVE-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_RELATIVE-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE-missing-output-result.txt b/Tests/RunCMake/cmake_path/IS_RELATIVE-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_RELATIVE-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/IS_RELATIVE-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_RELATIVE-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE-wrong-path-result.txt b/Tests/RunCMake/cmake_path/IS_RELATIVE-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_RELATIVE-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE.cmake b/Tests/RunCMake/cmake_path/IS_RELATIVE.cmake
new file mode 100644
index 0000000..ad12253
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_RELATIVE.cmake
@@ -0,0 +1,48 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+if (WIN32)
+ set (path "c:/a")
+else()
+ set (path "/a")
+endif()
+cmake_path(IS_RELATIVE path output)
+if (output)
+ list (APPEND errors "'${path} is relative")
+endif()
+
+set (path "a/b")
+cmake_path(IS_RELATIVE path output)
+if (NOT output)
+ list (APPEND errors "'${path} is not relative")
+endif()
+
+if (WIN32)
+ set (path "c:/a/b")
+ cmake_path(IS_RELATIVE path output)
+ if (output)
+ list (APPEND errors "'${path} is relative")
+ endif()
+
+ set (path "//host/b")
+ cmake_path(IS_RELATIVE path output)
+ if (output)
+ list (APPEND errors "'${path} is relative")
+ endif()
+
+ set (path "/a")
+ cmake_path(IS_RELATIVE path output)
+ if (NOT output)
+ list (APPEND errors "'${path} is not relative")
+ endif()
+
+ set (path "c:a")
+ cmake_path(IS_RELATIVE path output)
+ if (NOT output)
+ list (APPEND errors "'${path} is not relative")
+ endif()
+endif()
+
+
+check_errors (IS_RELATIVE ${errors})
diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH.cmake b/Tests/RunCMake/cmake_path/NATIVE_PATH.cmake
new file mode 100644
index 0000000..066c44d
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NATIVE_PATH.cmake
@@ -0,0 +1,37 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+if (WIN32)
+ set (path "c:/a//b\\c/..\\d")
+ cmake_path(NATIVE_PATH path output)
+ if (NOT output STREQUAL "c:\\a\\\\b\\c\\..\\d")
+ list (APPEND errors "'${output}' instead of 'c:\\a\\\\b\\c\\..\\d'")
+ endif()
+ cmake_path(NATIVE_PATH path output NORMALIZE)
+ if (NOT output STREQUAL "c:\\a\\b\\d")
+ list (APPEND errors "'${output}' instead of 'c:\\a\\b\\d'")
+ endif()
+
+ set (path "//host/a//b\\c/..\\d")
+ cmake_path(NATIVE_PATH path output)
+ if (NOT output STREQUAL "\\\\host\\a\\\\b\\c\\..\\d")
+ list (APPEND errors "'${output}' instead of '\\\\host\\a\\\\b\\c\\..\\d'")
+ endif()
+ cmake_path(NATIVE_PATH path output NORMALIZE)
+ if (NOT output STREQUAL "\\\\host\\a\\b\\d")
+ list (APPEND errors "'${output}' instead of '\\\\host\\a\\b\\d'")
+ endif()
+else()
+ set (path "/a//b/c/../d")
+ cmake_path(NATIVE_PATH path output)
+ if (NOT output STREQUAL "/a//b/c/../d")
+ list (APPEND errors "'${output}' instead of '/a//b/c/../d'")
+ endif()
+ cmake_path(NATIVE_PATH path NORMALIZE output)
+ if (NOT output STREQUAL "/a/b/d")
+ list (APPEND errors "'${output}' instead of '/a/b/d'")
+ endif()
+endif()
+
+check_errors (NATIVE_PATH ${errors})
diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/NORMAL_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NORMAL_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/NORMAL_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NORMAL_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH.cmake b/Tests/RunCMake/cmake_path/NORMAL_PATH.cmake
new file mode 100644
index 0000000..88db76a
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NORMAL_PATH.cmake
@@ -0,0 +1,46 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "a/./b/..")
+cmake_path(NORMAL_PATH path)
+if (NOT path STREQUAL "a/")
+ list (APPEND errors "'${path}' instead of 'a/'")
+endif()
+
+set (path "a/.///b/../")
+cmake_path(NORMAL_PATH path)
+if (NOT path STREQUAL "a/")
+ list (APPEND errors "'${path}' instead of 'a/'")
+endif()
+
+set (path "a/.///b/../")
+cmake_path(NORMAL_PATH path OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "a/.///b/../")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "a/")
+ list (APPEND errors "'${output}' instead of 'a/'")
+endif()
+
+if (WIN32)
+ set (path "//host/./b/..")
+ cmake_path(NORMAL_PATH path)
+ if (NOT path STREQUAL "//host/")
+ list (APPEND errors "'${path}' instead of '//host/'")
+ endif()
+
+ set (path "//host/./b/../")
+ cmake_path(NORMAL_PATH path)
+ if (NOT path STREQUAL "//host/")
+ list (APPEND errors "'${path}' instead of '//host/'")
+ endif()
+
+ set (path "c://a/.///b/../")
+ cmake_path(NORMAL_PATH path)
+ if (NOT path STREQUAL "c:/a/")
+ list (APPEND errors "'${path}' instead of 'c:/a/'")
+ endif()
+endif()
+
+check_errors (NORMAL_PATH ${errors})
diff --git a/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt
new file mode 100644
index 0000000..e1d6592
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\):
+ cmake_path OUTPUT_VARIABLE requires an argument.
diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH.cmake b/Tests/RunCMake/cmake_path/PROXIMATE_PATH.cmake
new file mode 100644
index 0000000..ad23377
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH.cmake
@@ -0,0 +1,41 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+if (WIN32)
+ set (path "c:/a/d")
+ cmake_path(PROXIMATE_PATH path BASE_DIRECTORY "e/d/c")
+ if (NOT path STREQUAL "c:/a/d")
+ list (APPEND errors "'${path}' instead of 'c:/a/d'")
+ endif()
+else()
+ set (path "/a/d")
+ cmake_path(PROXIMATE_PATH path BASE_DIRECTORY "e/d/c")
+ if (NOT path STREQUAL "/a/d")
+ list (APPEND errors "'${path}' instead of '/a/d'")
+ endif()
+endif()
+
+set (path "/a/d")
+cmake_path(PROXIMATE_PATH path BASE_DIRECTORY "/a/b/c" OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "/a/d")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "../../d")
+ list (APPEND errors "'${output}' instead of '../../d'")
+endif()
+
+set (path "${CMAKE_CURRENT_SOURCE_DIR}/a/d")
+cmake_path(PROXIMATE_PATH path)
+if (NOT path STREQUAL "a/d")
+ list (APPEND errors "'${path}' instead of 'a/d'")
+endif()
+
+set (path "a/b/c")
+cmake_path(PROXIMATE_PATH path)
+if (NOT path STREQUAL "a/b/c")
+ list (APPEND errors "'${path}' instead of 'a/b/c'")
+endif()
+
+
+check_errors (PROXIMATE_PATH ${errors})
diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/RELATIVE_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/RELATIVE_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH.cmake b/Tests/RunCMake/cmake_path/RELATIVE_PATH.cmake
new file mode 100644
index 0000000..522a899
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH.cmake
@@ -0,0 +1,76 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "/a//d")
+cmake_path(RELATIVE_PATH path BASE_DIRECTORY "/a/b/c")
+if (NOT path STREQUAL "../../d")
+ list (APPEND errors "'${path}' instead of '../../d'")
+endif()
+
+set (path "/a//b///c")
+cmake_path(RELATIVE_PATH path BASE_DIRECTORY "/a/d")
+if (NOT path STREQUAL "../b/c")
+ list (APPEND errors "'${path}' instead of '../b/c'")
+endif()
+
+set (path "a/b/c")
+cmake_path(RELATIVE_PATH path BASE_DIRECTORY "a")
+if (NOT path STREQUAL "b/c")
+ list (APPEND errors "'${path}' instead of 'b/c'")
+endif()
+
+set (path "a/b/c")
+cmake_path(RELATIVE_PATH path BASE_DIRECTORY "a/b/c/x/y")
+if (NOT path STREQUAL "../..")
+ list (APPEND errors "'${path}' instead of '../..'")
+endif()
+
+set (path "a/b/c")
+cmake_path(RELATIVE_PATH path BASE_DIRECTORY "a/b/c")
+if (NOT path STREQUAL ".")
+ list (APPEND errors "'${path}' instead of '.'")
+endif()
+
+set (path "a/b")
+cmake_path(RELATIVE_PATH path BASE_DIRECTORY "c/d")
+if (NOT path STREQUAL "../../a/b")
+ list (APPEND errors "'${path}' instead of '../../a/b'")
+endif()
+
+set (path "${CMAKE_CURRENT_SOURCE_DIR}/../../b")
+cmake_path(RELATIVE_PATH path)
+if (NOT path STREQUAL "../../b")
+ list (APPEND errors "'${path}' instead of '../../b'")
+endif()
+
+set (path "${CMAKE_CURRENT_SOURCE_DIR}/../../b")
+cmake_path(RELATIVE_PATH path OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/../../b")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "../../b")
+ list (APPEND errors "'${output}' instead of '../../b'")
+endif()
+
+if (WIN32)
+ set (path "/a/d")
+ cmake_path(RELATIVE_PATH path BASE_DIRECTORY "e/d/c")
+ if (NOT path STREQUAL "/a/d")
+ list (APPEND errors "'${path}' instead of '/a/d'")
+ endif()
+
+ set (path "c:/a/d")
+ cmake_path(RELATIVE_PATH path BASE_DIRECTORY "e/d/c")
+ if (NOT path STREQUAL "")
+ list (APPEND errors "'${path}' instead of ''")
+ endif()
+elseif()
+ set (path "/a/d")
+ cmake_path(RELATIVE_PATH path BASE_DIRECTORY "e/d/c")
+ if (NOT path STREQUAL "")
+ list (APPEND errors "'${path}' instead of ''")
+ endif()
+endif()
+
+check_errors (RELATIVE_PATH ${errors})
diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-wrong-path-result.txt b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION.cmake b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION.cmake
new file mode 100644
index 0000000..ac06fde
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION.cmake
@@ -0,0 +1,52 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "a/b/c.e.f")
+cmake_path (REMOVE_EXTENSION path)
+if (NOT path STREQUAL "a/b/c")
+ list (APPEND errors "'${path}' instead of 'a/b/c'")
+endif()
+
+set (path "a/b/c.e.f")
+cmake_path (REMOVE_EXTENSION path LAST_ONLY)
+if (NOT path STREQUAL "a/b/c.e")
+ list (APPEND errors "'${path}' instead of 'a/b/c.e'")
+endif()
+cmake_path (REMOVE_EXTENSION path)
+if (NOT path STREQUAL "a/b/c")
+ list (APPEND errors "'${path}' instead of 'a/b/c'")
+endif()
+
+set (path "a/b/c.e.f")
+cmake_path (REMOVE_EXTENSION path OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "a/b/c.e.f")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "a/b/c")
+ list (APPEND errors "'${output}' instead of 'a/b/'")
+endif()
+
+set (path "a/b/c")
+cmake_path (REMOVE_EXTENSION path)
+if (NOT path STREQUAL "a/b/c")
+ list (APPEND errors "'${path}' instead of 'a/b/c'")
+endif()
+
+set (path "a/b/.c")
+cmake_path (REMOVE_EXTENSION path)
+if (NOT path STREQUAL "a/b/.c")
+ list (APPEND errors "'${path}' instead of 'a/b/.c'")
+endif()
+cmake_path (REMOVE_EXTENSION path LAST_ONLY)
+if (NOT path STREQUAL "a/b/.c")
+ list (APPEND errors "'${path}' instead of 'a/b/.c'")
+endif()
+
+set (path "a/b/.")
+cmake_path (REMOVE_EXTENSION path LAST_ONLY)
+if (NOT path STREQUAL "a/b/.")
+ list (APPEND errors "'${path}' instead of 'a/b/.'")
+endif()
+
+check_errors (REMOVE_EXTENSION ${errors})
diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME.cmake b/Tests/RunCMake/cmake_path/REMOVE_FILENAME.cmake
new file mode 100644
index 0000000..385dcd0
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME.cmake
@@ -0,0 +1,25 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "a/b/c.e.f")
+cmake_path (REMOVE_FILENAME path)
+if (NOT path STREQUAL "a/b/")
+ list (APPEND errors "'${path}' instead of 'a/b/'")
+endif()
+
+cmake_path (REMOVE_FILENAME path)
+if (NOT path STREQUAL "a/b/")
+ list (APPEND errors "'${path}' instead of 'a/b/'")
+endif()
+
+set (path "a/b/c.e.f")
+cmake_path (REMOVE_FILENAME path OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "a/b/c.e.f")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "a/b/")
+ list (APPEND errors "'${output}' instead of 'a/b/'")
+endif()
+
+check_errors (REMOVE_FILENAME ${errors})
diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-wrong-path-result.txt b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION.cmake b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION.cmake
new file mode 100644
index 0000000..45c1575
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION.cmake
@@ -0,0 +1,58 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "a/b/c.e.f")
+cmake_path (REPLACE_EXTENSION path ".x")
+if (NOT path STREQUAL "a/b/c.x")
+ list (APPEND errors "'${path}' instead of 'a/b/c.x'")
+endif()
+cmake_path (REPLACE_EXTENSION path ".y")
+if (NOT path STREQUAL "a/b/c.y")
+ list (APPEND errors "'${path}' instead of 'a/b/c.y'")
+endif()
+cmake_path (REPLACE_EXTENSION path "")
+if (NOT path STREQUAL "a/b/c")
+ list (APPEND errors "'${path}' instead of 'a/b/c'")
+endif()
+
+set (path "a/b/c.e.f")
+cmake_path (REPLACE_EXTENSION path ".x" LAST_ONLY)
+if (NOT path STREQUAL "a/b/c.e.x")
+ list (APPEND errors "'${path}' instead of 'a/b/c.e.x'")
+endif()
+cmake_path (REPLACE_EXTENSION path ".y" LAST_ONLY)
+if (NOT path STREQUAL "a/b/c.e.y")
+ list (APPEND errors "'${path}' instead of 'a/b/c.e.y'")
+endif()
+cmake_path (REPLACE_EXTENSION path "" LAST_ONLY)
+if (NOT path STREQUAL "a/b/c.e")
+ list (APPEND errors "'${path}' instead of 'a/b/c.e'")
+endif()
+
+set (path "/a/.b")
+cmake_path (REPLACE_EXTENSION path ".x")
+if (NOT path STREQUAL "/a/.b.x")
+ list (APPEND errors "'${path}' instead of '/a/.b.x'")
+endif()
+cmake_path (REPLACE_EXTENSION path ".x" LAST_ONLY)
+if (NOT path STREQUAL "/a/.b.x")
+ list (APPEND errors "'${path}' instead of '/a/.b.x'")
+endif()
+
+set (path "/a/b")
+cmake_path (REPLACE_EXTENSION path ".x")
+if (NOT path STREQUAL "/a/b.x")
+ list (APPEND errors "'${path}' instead of '/a/b.x'")
+endif()
+
+set (path "/a/b/")
+cmake_path (REPLACE_EXTENSION path ".x" OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "/a/b/")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "/a/b/.x")
+ list (APPEND errors "'${output}' instead of '/a/b/.x'")
+endif()
+
+check_errors (REPLACE_EXTENSION ${errors})
diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME.cmake b/Tests/RunCMake/cmake_path/REPLACE_FILENAME.cmake
new file mode 100644
index 0000000..f7a9600
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME.cmake
@@ -0,0 +1,26 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "a/b/c.e.f")
+cmake_path (REPLACE_FILENAME path "x.y")
+if (NOT path STREQUAL "a/b/x.y")
+ list (APPEND errors "'${path}' instead of 'a/b/x.y'")
+endif()
+
+set (path "a/b/")
+cmake_path (REPLACE_FILENAME path "x.y")
+if (NOT path STREQUAL "a/b/")
+ list (APPEND errors "'${path}' instead of 'a/b/'")
+endif()
+
+set (path "a/b/c.e.f")
+cmake_path (REPLACE_FILENAME path "" OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "a/b/c.e.f")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "a/b/")
+ list (APPEND errors "'${output}' instead of 'a/b/'")
+endif()
+
+check_errors (REPLACE_FILENAME ${errors})
diff --git a/Tests/RunCMake/cmake_path/RunCMakeTest.cmake b/Tests/RunCMake/cmake_path/RunCMakeTest.cmake
new file mode 100644
index 0000000..ca9cba6
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/RunCMakeTest.cmake
@@ -0,0 +1,191 @@
+include(RunCMake)
+
+# Validate parsing arguments
+
+## input path is not a variable
+set (RunCMake-stderr-file "wrong-path-stderr.txt")
+
+### GET sub-command
+foreach (subcommand IN ITEMS ROOT_NAME ROOT_DIRECTORY ROOT_PATH FILENAME EXTENSION
+ STEM RELATIVE_PATH PARENT_PATH)
+ run_cmake_command (GET-${subcommand}-wrong-path "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=GET wrong_path ${subcommand} output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+### COMPARE sub-command
+foreach (subcommand IN ITEMS EQUAL NOT_EQUAL)
+ run_cmake_command (COMPARE-${subcommand}-wrong-path "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=COMPARE wrong_path ${subcommand} path2 output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+foreach (command IN ITEMS CONCAT REMOVE_FILENAME REPLACE_FILENAME
+ REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH
+ RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH)
+ run_cmake_command (${command}-wrong-path "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} wrong_path" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+foreach (command IN ITEMS NATIVE_PATH
+ HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH
+ HAS_FILENAME HAS_EXTENSION HAS_STEM
+ HAS_RELATIVE_PATH HAS_PARENT_PATH
+ IS_ABSOLUTE IS_RELATIVE IS_PREFIX HASH)
+ if (command STREQUAL "IS_PREFIX")
+ set (extra_args path2)
+ else()
+ unset (extra_args)
+ endif()
+ run_cmake_command (${command}-wrong-path "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} wrong_path ${extra_args} output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+
+## missing output parameter
+set (RunCMake-stderr-file "missing-output-stderr.txt")
+
+### GET sub-command
+foreach (subcommand IN ITEMS ROOT_NAME ROOT_DIRECTORY ROOT_PATH FILENAME EXTENSION
+ STEM RELATIVE_PATH PARENT_PATH)
+ run_cmake_command (GET-${subcommand}-missing-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=GET path ${subcommand}" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+### CONVERT sub-command
+foreach (subcommand IN ITEMS TO_CMAKE_PATH_LIST TO_NATIVE_PATH_LIST)
+ run_cmake_command (CONVERT-${subcommand}-missing-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=CONVERT path ${subcommand}" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+### COMPARE sub-command
+foreach (subcommand IN ITEMS EQUAL NOT_EQUAL)
+ run_cmake_command (COMPARE-${subcommand}-missing-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=COMPARE path ${subcommand} path2" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+foreach (command IN ITEMS CMAKE_PATH NATIVE_PATH
+ HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH
+ HAS_FILENAME HAS_EXTENSION HAS_STEM
+ HAS_RELATIVE_PATH HAS_PARENT_PATH
+ IS_ABSOLUTE IS_RELATIVE IS_PREFIX HASH)
+ if (command STREQUAL "IS_PREFIX")
+ set (extra_args path2)
+ else()
+ unset (extra_args)
+ endif()
+ run_cmake_command (${command}-missing-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args}" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+
+## OUTPUT_VARIABLE without argument
+set (RunCMake-stderr-file "OUTPUT_VARIABLE-no-arg-stderr.txt")
+
+foreach (command IN ITEMS APPEND CONCAT REMOVE_FILENAME REPLACE_FILENAME
+ REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH
+ RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH)
+ run_cmake_command (${command}-OUTPUT_VARIABLE-no-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path OUTPUT_VARIABLE" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+
+## Invalid output variable
+set (RunCMake-stderr-file "invalid-output-var-stderr.txt")
+
+### GET sub-command
+foreach (subcommand IN ITEMS ROOT_NAME ROOT_DIRECTORY ROOT_PATH FILENAME EXTENSION
+ STEM RELATIVE_PATH PARENT_PATH)
+ run_cmake_command (GET-${subcommand}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=GET path ${subcommand}" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+### CONVERT sub-command
+foreach (subcommand IN ITEMS TO_CMAKE_PATH_LIST TO_NATIVE_PATH_LIST)
+ run_cmake_command (CONVERT-${subcommand}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=CONVERT path ${subcommand}" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+### COMPARE sub-command
+foreach (subcommand IN ITEMS EQUAL NOT_EQUAL)
+ run_cmake_command (COMPARE-${subcommand}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=COMPARE path ${subcommand} path2" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+foreach (command IN ITEMS CMAKE_PATH NATIVE_PATH
+ HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH
+ HAS_FILENAME HAS_EXTENSION HAS_STEM
+ HAS_RELATIVE_PATH HAS_PARENT_PATH
+ IS_ABSOLUTE IS_RELATIVE IS_PREFIX HASH)
+ if (command STREQUAL "IS_PREFIX")
+ set (extra_args path2)
+ else()
+ unset (extra_args)
+ endif()
+ run_cmake_command (${command}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args}" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+foreach (command IN ITEMS APPEND CONCAT REMOVE_FILENAME REPLACE_FILENAME
+ REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH
+ RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH)
+ run_cmake_command (${command}-OUTPUT_VARIABLE-invalid-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path OUTPUT_VARIABLE" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+
+## Unexpected arguments
+set (RunCMake-stderr-file "unexpected-arg-stderr.txt")
+
+### GET sub-command
+foreach (subcommand IN ITEMS ROOT_NAME ROOT_DIRECTORY ROOT_PATH FILENAME EXTENSION
+ STEM RELATIVE_PATH PARENT_PATH)
+ if (subcommand STREQUAL "EXTENSION" OR subcommand STREQUAL "STEM")
+ set (extra_args LAST_ONLY)
+ else()
+ unset (extra_args)
+ endif()
+ run_cmake_command (GET-${subcommand}-unexpected-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=GET path ${subcommand} ${extra_args} unexpected output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+### CONVERT sub-command
+foreach (subcommand IN ITEMS TO_CMAKE_PATH_LIST TO_NATIVE_PATH_LIST)
+ run_cmake_command (CONVERT-${subcommand}-unexpected-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=CONVERT path ${subcommand} output unexpected" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+foreach (command IN ITEMS REMOVE_FILENAME REPLACE_FILENAME
+ REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH
+ RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH)
+ if (command STREQUAL "REPLACE_FILENAME" OR command STREQUAL "REPLACE_EXTENSION")
+ set (extra_args input)
+ else()
+ unset (extra_args)
+ endif()
+ run_cmake_command (${command}-unexpected-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args} unexpected" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+foreach (command IN ITEMS CMAKE_PATH NATIVE_PATH
+ HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH
+ HAS_FILENAME HAS_EXTENSION HAS_STEM
+ HAS_RELATIVE_PATH HAS_PARENT_PATH
+ IS_ABSOLUTE IS_RELATIVE IS_PREFIX
+ HASH)
+ if (command STREQUAL "IS_PREFIX")
+ set (extra_args input)
+ else()
+ unset (extra_args)
+ endif()
+ run_cmake_command (${command}-unexpected-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args} unexpected output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+unset (RunCMake-stderr-file)
+
+run_cmake(GET-wrong-operator)
+run_cmake(CONVERT-wrong-operator)
+run_cmake(COMPARE-wrong-operator)
+
+set (RunCMake_TEST_OPTIONS "-DRunCMake_SOURCE_DIR=${RunCMake_SOURCE_DIR}")
+
+run_cmake(GET)
+run_cmake(APPEND)
+run_cmake(CONCAT)
+run_cmake(REMOVE_FILENAME)
+run_cmake(REPLACE_FILENAME)
+run_cmake(REMOVE_EXTENSION)
+run_cmake(REPLACE_EXTENSION)
+run_cmake(NORMAL_PATH)
+run_cmake(RELATIVE_PATH)
+run_cmake(PROXIMATE_PATH)
+run_cmake(ABSOLUTE_PATH)
+run_cmake(CMAKE_PATH)
+run_cmake(NATIVE_PATH)
+run_cmake(CONVERT)
+run_cmake(COMPARE)
+run_cmake(HAS_ITEM)
+run_cmake(IS_ABSOLUTE)
+run_cmake(IS_RELATIVE)
+run_cmake(IS_PREFIX)
+run_cmake(HASH)
diff --git a/Tests/RunCMake/cmake_path/call-cmake_path.cmake b/Tests/RunCMake/cmake_path/call-cmake_path.cmake
new file mode 100644
index 0000000..70fd6f5
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/call-cmake_path.cmake
@@ -0,0 +1,19 @@
+
+cmake_minimum_required(VERSION 3.18...3.19)
+
+# define input variable
+set (path "")
+
+separate_arguments(CMAKE_PATH_ARGUMENTS UNIX_COMMAND "${CMAKE_PATH_ARGUMENTS}")
+
+if (CHECK_INVALID_OUTPUT)
+ # special handling for CMAKE_PATH
+ list(GET CMAKE_PATH_ARGUMENTS 0 command)
+ if (command STREQUAL "CMAKE_PATH")
+ cmake_path(CMAKE_PATH "" "input")
+ else()
+ cmake_path(${CMAKE_PATH_ARGUMENTS} "")
+ endif()
+else()
+ cmake_path(${CMAKE_PATH_ARGUMENTS})
+endif()
diff --git a/Tests/RunCMake/cmake_path/check_errors.cmake b/Tests/RunCMake/cmake_path/check_errors.cmake
new file mode 100644
index 0000000..d136971
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/check_errors.cmake
@@ -0,0 +1,12 @@
+
+function (CHECK_ERRORS command)
+ set (errors ${ARGN})
+ 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/cmake_path/invalid-output-var-stderr.txt b/Tests/RunCMake/cmake_path/invalid-output-var-stderr.txt
new file mode 100644
index 0000000..32a8948
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/invalid-output-var-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at .+/call-cmake_path.cmake:[0-9]+ \(cmake_path\):
+ cmake_path Invalid name for output variable.
diff --git a/Tests/RunCMake/cmake_path/missing-output-stderr.txt b/Tests/RunCMake/cmake_path/missing-output-stderr.txt
new file mode 100644
index 0000000..8ac049b
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/missing-output-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\):
+ cmake_path [A-Z_]+ must be called with ((at least )?(two|three|four)|two or three|three or four) arguments.
diff --git a/Tests/RunCMake/cmake_path/unexpected-arg-stderr.txt b/Tests/RunCMake/cmake_path/unexpected-arg-stderr.txt
new file mode 100644
index 0000000..8f0e2f2
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/unexpected-arg-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\):
+ cmake_path [A-Z_]+ (called with unexpected|must be called with two) arguments.
diff --git a/Tests/RunCMake/cmake_path/wrong-path-stderr.txt b/Tests/RunCMake/cmake_path/wrong-path-stderr.txt
new file mode 100644
index 0000000..c42b5a2
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/wrong-path-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\):
+ cmake_path undefined variable for input path.
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt
new file mode 100644
index 0000000..b22387b
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at CHMOD-all-perms\.cmake:[0-9]+ \(file\):
+ file Remove either PERMISSIONS or FILE_PERMISSIONS or DIRECTORY_PERMISSIONS
+ from the invocation
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake
new file mode 100644
index 0000000..b49583d
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake
@@ -0,0 +1,6 @@
+file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_READ
+ FILE_PERMISSIONS OWNER_READ DIRECTORY_PERMISSIONS OWNER_READ)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt
new file mode 100644
index 0000000..8d09e35
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at CHMOD-invalid-path\.cmake:[0-9]+ \(file\):
+ file does not exist:
+
+ .*/chmod-tests/I_dont_exist
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake
new file mode 100644
index 0000000..36915c1
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake
@@ -0,0 +1,4 @@
+file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/I_dont_exist PERMISSIONS OWNER_READ)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt
new file mode 100644
index 0000000..84ba2a2
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at CHMOD-invalid-perms\.cmake:[0-9]+ \(file\):
+ file INVALID_PERMISSION is an invalid permission specifier
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake
new file mode 100644
index 0000000..22cab0b
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake
@@ -0,0 +1,5 @@
+file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS INVALID_PERMISSION)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt
new file mode 100644
index 0000000..2c248f8
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at CHMOD-no-keyword\.cmake:[0-9]+ \(file\):
+ file No permissions given
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake
new file mode 100644
index 0000000..8b62106
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake
@@ -0,0 +1,5 @@
+file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt
new file mode 100644
index 0000000..a18609f
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at CHMOD-no-perms\.cmake:[0-9]+ \(file\):
+ file No permissions given
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake
new file mode 100644
index 0000000..9fbd359
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake
@@ -0,0 +1,5 @@
+file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake
new file mode 100644
index 0000000..87e3e57
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake
@@ -0,0 +1,5 @@
+file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_READ)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-override.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-override.cmake
new file mode 100644
index 0000000..d9226b8
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-override.cmake
@@ -0,0 +1,6 @@
+file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_READ
+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt
new file mode 100644
index 0000000..1c87a59
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at CHMOD-write-only\.cmake:[0-9]+ \(file\):
+ file failed to open for reading \(Permission denied\):
+
+ .*/chmod-tests/a
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake
new file mode 100644
index 0000000..1289efc
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake
@@ -0,0 +1,6 @@
+file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a "CONTENT")
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_WRITE)
+file(READ ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a content)
diff --git a/Tests/RunCMake/file-CHMOD/CMakeLists.txt b/Tests/RunCMake/file-CHMOD/CMakeLists.txt
new file mode 100644
index 0000000..2897109
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.0)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake b/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake
new file mode 100644
index 0000000..c7bff15
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake
@@ -0,0 +1,19 @@
+include(RunCMake)
+
+run_cmake(CHMOD-no-perms)
+run_cmake(CHMOD-no-keyword)
+run_cmake(CHMOD-all-perms)
+run_cmake(CHMOD-invalid-perms)
+run_cmake(CHMOD-invalid-path)
+run_cmake(CHMOD-ok)
+run_cmake(CHMOD-override)
+
+if(UNIX)
+ execute_process(COMMAND id -u $ENV{USER}
+ OUTPUT_VARIABLE uid
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif()
+
+if(NOT WIN32 AND NOT "${uid}" STREQUAL "0")
+ run_cmake(CHMOD-write-only)
+endif()
diff --git a/Tests/RunCMake/file/REAL_PATH-no-base-dir-result.txt b/Tests/RunCMake/file/REAL_PATH-no-base-dir-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH-no-base-dir-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt b/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt
new file mode 100644
index 0000000..7c58aeb
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at REAL_PATH-no-base-dir.cmake:[0-9]+ \(file\):
+ file BASE_DIRECTORY requires a value
diff --git a/Tests/RunCMake/file/REAL_PATH-no-base-dir.cmake b/Tests/RunCMake/file/REAL_PATH-no-base-dir.cmake
new file mode 100644
index 0000000..132aee6
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH-no-base-dir.cmake
@@ -0,0 +1,2 @@
+
+file(REAL_PATH "some-path" real_path BASE_DIRECTORY)
diff --git a/Tests/RunCMake/file/REAL_PATH-unexpected-arg-result.txt b/Tests/RunCMake/file/REAL_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/REAL_PATH-unexpected-arg-stderr.txt b/Tests/RunCMake/file/REAL_PATH-unexpected-arg-stderr.txt
new file mode 100644
index 0000000..301db75
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH-unexpected-arg-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at REAL_PATH-unexpected-arg.cmake:[0-9]+ \(file\):
+ file REAL_PATH called with unexpected arguments
diff --git a/Tests/RunCMake/file/REAL_PATH-unexpected-arg.cmake b/Tests/RunCMake/file/REAL_PATH-unexpected-arg.cmake
new file mode 100644
index 0000000..144f30b
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH-unexpected-arg.cmake
@@ -0,0 +1,2 @@
+
+file(REAL_PATH "some-path" real_path extra_arg)
diff --git a/Tests/RunCMake/file/REAL_PATH.cmake b/Tests/RunCMake/file/REAL_PATH.cmake
new file mode 100644
index 0000000..be25706
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH.cmake
@@ -0,0 +1,14 @@
+
+file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/test.txt")
+file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/test.sym")
+file(CREATE_LINK "test.txt" "${CMAKE_CURRENT_BINARY_DIR}/test.sym" SYMBOLIC)
+
+file(REAL_PATH "${CMAKE_CURRENT_BINARY_DIR}/test.sym" real_path)
+if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/test.txt")
+ message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/test.txt\"")
+endif()
+
+file(REAL_PATH "test.sym" real_path BASE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
+if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/test.txt")
+ message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/test.txt\"")
+endif()
diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake
index 8d84943..22813eb 100644
--- a/Tests/RunCMake/file/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file/RunCMakeTest.cmake
@@ -72,6 +72,9 @@ if(NOT WIN32 OR CYGWIN)
run_cmake(READ_SYMLINK-noexist)
run_cmake(READ_SYMLINK-notsymlink)
run_cmake(INSTALL-FOLLOW_SYMLINK_CHAIN)
+ run_cmake(REAL_PATH-unexpected-arg)
+ run_cmake(REAL_PATH-no-base-dir)
+ run_cmake(REAL_PATH)
endif()
if(RunCMake_GENERATOR MATCHES "Ninja")
diff --git a/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake
new file mode 100644
index 0000000..8750a76
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake
@@ -0,0 +1,11 @@
+
+set(objs obj1 obj2)
+set(targets sse2 sse4 avx avx2)
+foreach(o IN LISTS objs)
+ set(item "objs/${o}\\.ispc\\.(o|obj)")
+ check_installed("${item}")
+ foreach(t IN LISTS targets)
+ set(item "objs/${o}\\.ispc_${t}\\.(o|obj)")
+ check_installed("${item}")
+ endforeach()
+endforeach()
diff --git a/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake
new file mode 100644
index 0000000..ad542ed
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake
@@ -0,0 +1,4 @@
+enable_language(ISPC)
+add_library(objs OBJECT obj1.ispc obj2.ispc)
+set_target_properties(objs PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4")
+install(FILES $<TARGET_OBJECTS:objs> DESTINATION objs)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index d83a07c..3573fbd 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -96,6 +96,11 @@ if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES}
run_install_test(FILES-TARGET_OBJECTS)
endif()
+if(CMake_TEST_ISPC)
+ run_install_test(FILES-EXTRA_ISPC_TARGET_OBJECTS)
+endif()
+
+
run_install_test(TARGETS-InstallFromSubDir)
run_install_test(TARGETS-OPTIONAL)
run_install_test(FILES-OPTIONAL)
diff --git a/Tests/RunCMake/install/obj1.ispc b/Tests/RunCMake/install/obj1.ispc
new file mode 100644
index 0000000..0dc983c
--- /dev/null
+++ b/Tests/RunCMake/install/obj1.ispc
@@ -0,0 +1,4 @@
+
+float func1(float a, float b) {
+ return a + b / 2.;
+}
diff --git a/Tests/RunCMake/install/obj2.ispc b/Tests/RunCMake/install/obj2.ispc
new file mode 100644
index 0000000..7b2aeb9
--- /dev/null
+++ b/Tests/RunCMake/install/obj2.ispc
@@ -0,0 +1,4 @@
+
+float func2(float a, float b) {
+ return a + b / 2.;
+}
diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTarget-stderr.txt b/Tests/RunCMake/try_compile/ISPCDuplicateTarget-stderr.txt
new file mode 100644
index 0000000..7dcb1de
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCDuplicateTarget-stderr.txt
@@ -0,0 +1 @@
+.*Error: Can't compile to multiple variants of avx512skx target!.*
diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake b/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake
new file mode 100644
index 0000000..6d29069
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake
@@ -0,0 +1,8 @@
+enable_language(ISPC)
+set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16
+ avx512skx-i32x16)
+try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
+ OUTPUT_VARIABLE out
+ )
+message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-result.txt b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-stderr.txt b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-stderr.txt
new file mode 100644
index 0000000..99248bf
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-stderr.txt
@@ -0,0 +1 @@
+.*ninja: error: .* multiple rules generate.*src.ispc_avx512skx.o.*
diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake
new file mode 100644
index 0000000..7f59c14
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake
@@ -0,0 +1,11 @@
+enable_language(ISPC)
+set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16
+ avx512skx-i32x16)
+try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
+ OUTPUT_VARIABLE out
+ )
+message("try_compile output:\n${out}")
+if(NOT result)
+ message(FATAL_ERROR "making Ninja and Ninja Multi-Config behave the same")
+endif()
diff --git a/Tests/RunCMake/try_compile/ISPCInvalidTarget-stderr.txt b/Tests/RunCMake/try_compile/ISPCInvalidTarget-stderr.txt
new file mode 100644
index 0000000..44543ad
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCInvalidTarget-stderr.txt
@@ -0,0 +1 @@
+.*Error: Incorrect targets: avxknl-i32x16.*
diff --git a/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake b/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake
new file mode 100644
index 0000000..c1ab6f2
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake
@@ -0,0 +1,7 @@
+enable_language(ISPC)
+set(CMAKE_ISPC_INSTRUCTION_SETS "avxknl-i32x16")
+try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
+ OUTPUT_VARIABLE out
+ )
+message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt b/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt
new file mode 100644
index 0000000..72e0a01
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt
@@ -0,0 +1 @@
+.*Linking ISPC static library*
diff --git a/Tests/RunCMake/try_compile/ISPCTargets-stdout.txt b/Tests/RunCMake/try_compile/ISPCTargets-stdout.txt
new file mode 100644
index 0000000..a731d52
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCTargets-stdout.txt
@@ -0,0 +1 @@
+.*Detecting ISPC compiler ABI info - done.*
diff --git a/Tests/RunCMake/try_compile/ISPCTargets.cmake b/Tests/RunCMake/try_compile/ISPCTargets.cmake
new file mode 100644
index 0000000..0d3bd43
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCTargets.cmake
@@ -0,0 +1,7 @@
+enable_language(ISPC)
+set(CMAKE_ISPC_INSTRUCTION_SETS avx512knl-i32x16 avx512skx-i32x16)
+try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
+ OUTPUT_VARIABLE out
+ )
+message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index 82c55cc..5b849bf 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -51,6 +51,15 @@ endif()
if(CMake_TEST_CUDA)
run_cmake(CudaStandard)
endif()
+if(CMake_TEST_ISPC)
+ run_cmake(ISPCTargets)
+ run_cmake(ISPCInvalidTarget)
+ set(ninja "")
+ if(RunCMake_GENERATOR MATCHES "Ninja")
+ set(ninja "Ninja")
+ endif()
+ run_cmake(ISPCDuplicateTarget${ninja})
+endif()
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
run_cmake(CStandardGNU)
endif()
diff --git a/Tests/RunCMake/try_compile/src.ispc b/Tests/RunCMake/try_compile/src.ispc
new file mode 100644
index 0000000..b061f40
--- /dev/null
+++ b/Tests/RunCMake/try_compile/src.ispc
@@ -0,0 +1,4 @@
+
+float func(float a, float b) {
+ return a + b / 2.;
+}
diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt
index 7046fab..aee3338 100644
--- a/Tests/UseSWIG/CMakeLists.txt
+++ b/Tests/UseSWIG/CMakeLists.txt
@@ -101,6 +101,15 @@ add_test(NAME UseSWIG.MultiplePython COMMAND
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+add_test(NAME UseSWIG.MultipleFiles COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/UseSWIG/MultipleFiles"
+ "${CMake_BINARY_DIR}/Tests/UseSWIG/MultipleFiles"
+ ${build_generator_args}
+ --build-project TestMultipleFiles
+ --build-options ${build_options}
+ )
add_test(NAME UseSWIG.ModuleVersion2 COMMAND
diff --git a/Tests/UseSWIG/MultipleFiles/CMakeLists.txt b/Tests/UseSWIG/MultipleFiles/CMakeLists.txt
new file mode 100644
index 0000000..bf3d946
--- /dev/null
+++ b/Tests/UseSWIG/MultipleFiles/CMakeLists.txt
@@ -0,0 +1,30 @@
+cmake_minimum_required(VERSION 3.18)
+
+project(TestMultipleFiles CXX)
+
+find_package(SWIG REQUIRED)
+include(UseSWIG)
+
+unset(SWIG_LANG_TYPE)
+unset(SWIG_LANG_INCLUDE_DIRECTORIES)
+unset(SWIG_LANG_DEFINITIONS)
+unset(SWIG_LANG_OPTIONS)
+unset(SWIG_LANG_LIBRARIES)
+
+find_package(Python3 REQUIRED COMPONENTS Development)
+
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/add.i" PROPERTY CPLUSPLUS ON)
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/sub.i" PROPERTY CPLUSPLUS ON)
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/add.i" PROPERTY SWIG_MODULE_NAME _add)
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/sub.i" PROPERTY SWIG_MODULE_NAME _sub)
+
+
+swig_add_library(example
+ LANGUAGE python
+ TYPE MODULE
+ SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/add.i"
+ "${CMAKE_CURRENT_SOURCE_DIR}/sub.i"
+ "${CMAKE_CURRENT_SOURCE_DIR}/add.cxx"
+ "${CMAKE_CURRENT_SOURCE_DIR}/sub.cxx")
+target_include_directories(example PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
+target_link_libraries(example PRIVATE Python3::Module)
diff --git a/Tests/UseSWIG/MultipleFiles/add.cxx b/Tests/UseSWIG/MultipleFiles/add.cxx
new file mode 100644
index 0000000..a4dcca3
--- /dev/null
+++ b/Tests/UseSWIG/MultipleFiles/add.cxx
@@ -0,0 +1,6 @@
+#include "add.h"
+
+int add(int a, int b)
+{
+ return a + b;
+}
diff --git a/Tests/UseSWIG/MultipleFiles/add.h b/Tests/UseSWIG/MultipleFiles/add.h
new file mode 100644
index 0000000..6295ab9
--- /dev/null
+++ b/Tests/UseSWIG/MultipleFiles/add.h
@@ -0,0 +1 @@
+int add(int a, int b);
diff --git a/Tests/UseSWIG/MultipleFiles/add.i b/Tests/UseSWIG/MultipleFiles/add.i
new file mode 100644
index 0000000..2046397
--- /dev/null
+++ b/Tests/UseSWIG/MultipleFiles/add.i
@@ -0,0 +1,4 @@
+%{
+#include "add.h"
+%}
+%include "add.h"
diff --git a/Tests/UseSWIG/MultipleFiles/sub.cxx b/Tests/UseSWIG/MultipleFiles/sub.cxx
new file mode 100644
index 0000000..d6874ef
--- /dev/null
+++ b/Tests/UseSWIG/MultipleFiles/sub.cxx
@@ -0,0 +1,6 @@
+#include "sub.h"
+
+int sub(int a, int b)
+{
+ return a - b;
+}
diff --git a/Tests/UseSWIG/MultipleFiles/sub.h b/Tests/UseSWIG/MultipleFiles/sub.h
new file mode 100644
index 0000000..de77111
--- /dev/null
+++ b/Tests/UseSWIG/MultipleFiles/sub.h
@@ -0,0 +1 @@
+int sub(int a, int b);
diff --git a/Tests/UseSWIG/MultipleFiles/sub.i b/Tests/UseSWIG/MultipleFiles/sub.i
new file mode 100644
index 0000000..fc70f10
--- /dev/null
+++ b/Tests/UseSWIG/MultipleFiles/sub.i
@@ -0,0 +1,5 @@
+%{
+#include "sub.h"
+%}
+
+%include "sub.h"
diff --git a/Tests/XCTest/CMakeLists.txt b/Tests/XCTest/CMakeLists.txt
index d0b07ea..a070651 100644
--- a/Tests/XCTest/CMakeLists.txt
+++ b/Tests/XCTest/CMakeLists.txt
@@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.1)
project(XCTest C)
enable_testing()
+set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
+set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
+set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
+
find_package(XCTest REQUIRED)
# Framework