summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorJinWang An <jinwang.an@samsung.com>2022-12-27 17:20:24 +0900
committerJinWang An <jinwang.an@samsung.com>2022-12-27 17:20:24 +0900
commit58664688bb50990e7aa416a6d1ac4939fa589198 (patch)
treed37c80132bb51650ff7c70688c4ac572af42af30 /Tests
parentdf9806c0f5714ed294007ad149c001a983d1a73f (diff)
downloadcmake-58664688bb50990e7aa416a6d1ac4939fa589198.tar.gz
cmake-58664688bb50990e7aa416a6d1ac4939fa589198.tar.bz2
cmake-58664688bb50990e7aa416a6d1ac4939fa589198.zip
Imported Upstream version 3.25.0upstream/3.25.0
Diffstat (limited to 'Tests')
-rw-r--r--Tests/Assembler/CMakeLists.txt6
-rw-r--r--Tests/CMakeLib/CMakeLists.txt6
-rw-r--r--Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt6
-rw-r--r--Tests/CMakeLib/testArgumentParser.cxx340
-rw-r--r--Tests/CMakeLib/testCMExtEnumSet.cxx9
-rw-r--r--Tests/CMakeLists.txt392
-rw-r--r--Tests/CMakeOnly/AllFindModules/CMakeLists.txt13
-rw-r--r--Tests/CMakeTests/CMakeLists.txt15
-rw-r--r--Tests/CMakeTests/CheckSourceTreeTest.cmake.in365
-rw-r--r--Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in89
-rw-r--r--Tests/CTestCoverageCollectGCOV/test.cmake.in5
-rw-r--r--Tests/CTestTestFdSetSize/sleep.c14
-rw-r--r--Tests/CTestUpdateCommon.cmake6
-rw-r--r--Tests/CTestUpdateP4.cmake.in6
-rw-r--r--Tests/CheckSourceTree/CMakeLists.txt6
-rw-r--r--Tests/CheckSourceTree/check.cmake22
-rw-r--r--Tests/CheckSwift.cmake2
-rw-r--r--Tests/CompileFeatures/CMakeLists.txt1
-rw-r--r--Tests/CompileFeatures/genex_test.cpp3
-rw-r--r--Tests/Complex/CMakeLists.txt8
-rw-r--r--Tests/Complex/Executable/complex.cxx2
-rw-r--r--Tests/ComplexOneConfig/CMakeLists.txt8
-rw-r--r--Tests/ComplexOneConfig/Executable/complex.cxx2
-rw-r--r--Tests/Cuda/SeparableCompCXXOnly/CMakeLists.txt5
-rw-r--r--Tests/CudaOnly/CMakeLists.txt25
-rw-r--r--Tests/CudaOnly/DeviceLTO/CMakeLists.txt37
-rw-r--r--Tests/CudaOnly/DeviceLTO/file1.cu17
-rw-r--r--Tests/CudaOnly/DeviceLTO/file2.cu5
-rw-r--r--Tests/CudaOnly/DeviceLTO/file3.cu4
-rw-r--r--Tests/CudaOnly/DeviceLTO/main.cu62
-rw-r--r--Tests/CudaOnly/ToolkitMultipleDirs/CMakeLists.txt22
-rw-r--r--Tests/CudaOnly/ToolkitMultipleDirs/main.cu8
-rw-r--r--Tests/CudaOnly/ToolkitMultipleDirs/subdir/CMakeLists.txt2
-rw-r--r--Tests/EnforceConfig.cmake.in4
-rw-r--r--Tests/ExportImport/Export/CMakeLists.txt11
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt14
-rw-r--r--Tests/ExternalProject/CMakeLists.txt6
-rw-r--r--Tests/FindOpenAL/CMakeLists.txt10
-rw-r--r--Tests/FindOpenAL/Test/CMakeLists.txt14
-rw-r--r--Tests/FindOpenAL/Test/main.cxx13
-rw-r--r--Tests/FindOpenSP/CMakeLists.txt10
-rw-r--r--Tests/FindOpenSP/Test/CMakeLists.txt16
-rw-r--r--Tests/FindOpenSP/Test/main.cxx55
-rw-r--r--Tests/FindOpenSP/Test/test.sgml7
-rw-r--r--Tests/FindPackageTest/CMakeLists.txt2
-rw-r--r--Tests/FindVulkan/Test/CMakeLists.txt20
-rw-r--r--Tests/FindVulkan/Test/Run-dxc_exe.cmake20
-rw-r--r--Tests/FindVulkan/Test/main-dxc_lib.cxx23
-rw-r--r--Tests/FindVulkan/Test/main-volk.cxx14
-rw-r--r--Tests/FortranModules/Submodules/CMakeLists.txt1
-rw-r--r--Tests/FortranModules/Submodules/main.f907
-rw-r--r--Tests/FortranModules/Submodules/obfuscated_parent.f9033
-rw-r--r--Tests/FortranModules/test_module_main.f902
-rw-r--r--Tests/FunctionTest/CMakeLists.txt4
-rw-r--r--Tests/IncludeDirectories/CMakeLists.txt54
-rw-r--r--Tests/LoadCommand/CMakeCommands/cmTestCommand.c17
-rw-r--r--Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c17
-rw-r--r--Tests/MSVCDebugInformationFormat/CMakeLists.txt81
-rw-r--r--Tests/MSVCDebugInformationFormat/override-C.cmake7
-rw-r--r--Tests/MSVCDebugInformationFormat/override-CUDA.cmake6
-rw-r--r--Tests/MSVCDebugInformationFormat/override-CXX.cmake7
-rw-r--r--Tests/MSVCDebugInformationFormat/override-Fortran.cmake4
-rw-r--r--Tests/MSVCDebugInformationFormat/verify.F901
-rw-r--r--Tests/MSVCDebugInformationFormat/verify.c1
-rw-r--r--Tests/MSVCDebugInformationFormat/verify.cu1
-rw-r--r--Tests/MSVCDebugInformationFormat/verify.cxx1
-rw-r--r--Tests/MSVCDebugInformationFormat/verify.h29
-rw-r--r--Tests/Module/CheckIPOSupported-CUDA/CMakeLists.txt32
-rw-r--r--Tests/Module/CheckIPOSupported-CUDA/bar.cu12
-rw-r--r--Tests/Module/CheckIPOSupported-CUDA/foo.cu4
-rw-r--r--Tests/Module/CheckIPOSupported-CUDA/main.cu62
-rw-r--r--Tests/ModuleDefinition/CMakeLists.txt12
-rw-r--r--Tests/Preprocess/CMakeLists.txt7
-rw-r--r--Tests/Preprocess/preprocess.c2
-rw-r--r--Tests/Preprocess/preprocess.cxx2
-rw-r--r--Tests/RunCMake/AutoExportDll/AutoExport.cmake4
-rw-r--r--Tests/RunCMake/BuildDepends/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CMP0102/CMP0102-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/CMakeDependentOption/UseDotSymbol-stdout.txt1
-rw-r--r--Tests/RunCMake/CMakeDependentOption/UseDotSymbol.cmake4
-rw-r--r--Tests/RunCMake/CMakeLists.txt45
-rw-r--r--Tests/RunCMake/CMakePresets/Comment-stderr.txt9
-rw-r--r--Tests/RunCMake/CMakePresets/DocumentationExampleListAllPresets-stdout.txt22
-rw-r--r--Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt5
-rw-r--r--Tests/RunCMake/CMakePresets/GoodNoSCache.cmake1
-rw-r--r--Tests/RunCMake/CMakePresets/IncludeNotFound-stderr.txt5
-rw-r--r--Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt9
-rw-r--r--Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild-stdout.txt8
-rw-r--r--Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild.json.in14
-rw-r--r--Tests/RunCMake/CMakePresets/ListAllPresetsNoTest-stdout.txt8
-rw-r--r--Tests/RunCMake/CMakePresets/ListAllPresetsNoTest.json.in14
-rw-r--r--Tests/RunCMake/CMakePresets/ListPresetsInvalidType-result.txt (renamed from Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt)0
-rw-r--r--Tests/RunCMake/CMakePresets/ListPresetsInvalidType-stderr.txt3
-rw-r--r--Tests/RunCMake/CMakePresets/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/CMakeLists.txt.in3
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/Good-package-config-file-check.cmake6
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/Good-package-configurations-check.cmake18
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/Good-package-debug-stdout.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/Good-package-generators-check.cmake1
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/Good-package-no-environment-check.cmake7
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/Good-package-package-directory-check.cmake6
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/Good-package-package-name-check.cmake7
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/Good-package-package-version-check.cmake7
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/Good-package-variables-check.cmake6
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/Good-package-verbose-stdout.txt1
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/Good-package-with-environment-check.cmake7
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/Good.cmake31
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/Good.json.in135
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/ListPresets-package-x-stdout.txt4
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/ListPresets.cmake (renamed from Tests/RunCMake/CommandLine/DeprecateVS10-WARN-OFF.cmake)0
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/ListPresets.json.in20
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/RunCMakeTest.cmake102
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion-configure-x-result.txt (renamed from Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt)0
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion-configure-x-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion.json.in4
-rw-r--r--Tests/RunCMake/CMakePresetsPackage/check.cmake3
-rw-r--r--Tests/RunCMake/CMakePresetsTest/Good-test-outputJUnit-check.cmake4
-rw-r--r--Tests/RunCMake/CMakePresetsTest/Good-test-outputLog-check.cmake4
-rw-r--r--Tests/RunCMake/CMakePresetsTest/Good.json.in16
-rw-r--r--Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported-test-x-result.txt (renamed from Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt)0
-rw-r--r--Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported-test-x-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported.json.in17
-rw-r--r--Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported-test-x-result.txt (renamed from Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt)0
-rw-r--r--Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported-test-x-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported.json.in17
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/BadExitCode-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/BadExitCode-stderr.txt4
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/BadExitCode-stdout.txt17
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/BadExitCode.cmake8
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/BadExitCodeTest.cmake1
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/CMakeLists.txt.in3
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/ConfigureStepMismatch-result.txt (renamed from Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt)0
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/ConfigureStepMismatch-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/ConfigureStepMismatch.json.in32
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/FirstStepNotConfigure-result.txt (renamed from Tests/RunCMake/CommandLine/DeprecateVS10-WARN-ON.cmake)0
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/FirstStepNotConfigure-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/FirstStepNotConfigure.json.in27
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/Fresh.cmake4
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/Fresh.json.in21
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/Good-stdout.txt19
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/Good.cmake8
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/Good.json.in87
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/GoodUser-stdout.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/GoodUser.cmake1
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/GoodUser.json.in14
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-result.txt (renamed from Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt)0
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-stderr.txt6
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-stdout.txt1
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/ListPresets-stdout.txt4
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/ListPresets.json.in30
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/NoWorkflowSteps-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/NoWorkflowSteps-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/NoWorkflowSteps.json.in9
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/NonexistentStep-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/NonexistentStep-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/NonexistentStep.json.in14
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/RunCMakeTest.cmake89
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/SecondStepConfigure-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/SecondStepConfigure-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/SecondStepConfigure.json.in25
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/UnreachableStep-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/UnreachableStep-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/UnreachableStep.json.in14
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/UnreachableStepUser.json.in8
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/UnsupportedVersion-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/UnsupportedVersion-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/UnsupportedVersion.json.in4
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepDisabled-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepDisabled-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepDisabled.json.in23
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepHidden-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepHidden-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepHidden.json.in20
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepInvalidMacro-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepInvalidMacro-stderr.txt1
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepInvalidMacro.json.in20
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/check.cmake3
-rw-r--r--Tests/RunCMake/CMakePresetsWorkflow/cpack_staging.cmake.in1
-rw-r--r--Tests/RunCMake/CPack/DEB/Helpers.cmake4
-rw-r--r--Tests/RunCMake/CPack/DEB/Prerequirements.cmake6
-rw-r--r--Tests/RunCMake/CPack/RPM/Prerequirements.cmake6
-rw-r--r--Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake2
-rw-r--r--Tests/RunCMake/CTestTimeout/TestTimeout.c1
-rw-r--r--Tests/RunCMake/CUDA_architectures/architectures-suffix-stderr.txt2
-rw-r--r--Tests/RunCMake/CXXModules/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/CXXModules/ExportBuildCxxModules-check.cmake40
-rw-r--r--Tests/RunCMake/CXXModules/ExportBuildCxxModules-stderr.txt11
-rw-r--r--Tests/RunCMake/CXXModules/ExportBuildCxxModules.cmake22
-rw-r--r--Tests/RunCMake/CXXModules/ExportInstallCxxModules-check.cmake35
-rw-r--r--Tests/RunCMake/CXXModules/ExportInstallCxxModules-stderr.txt11
-rw-r--r--Tests/RunCMake/CXXModules/ExportInstallCxxModules.cmake22
-rw-r--r--Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterface-result.txt1
-rw-r--r--Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterface-stderr.txt12
-rw-r--r--Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterface.cmake8
-rw-r--r--Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported-stderr.txt6
-rw-r--r--Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported.cmake8
-rw-r--r--Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsPrivate-stderr.txt11
-rw-r--r--Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsPrivate.cmake13
-rw-r--r--Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsPublic-stderr.txt11
-rw-r--r--Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsPublic.cmake13
-rw-r--r--Tests/RunCMake/CXXModules/FileSetModulesInterface-result.txt1
-rw-r--r--Tests/RunCMake/CXXModules/FileSetModulesInterface-stderr.txt12
-rw-r--r--Tests/RunCMake/CXXModules/FileSetModulesInterface.cmake8
-rw-r--r--Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported-stderr.txt6
-rw-r--r--Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported.cmake8
-rw-r--r--Tests/RunCMake/CXXModules/FileSetModulesPrivate-stderr.txt11
-rw-r--r--Tests/RunCMake/CXXModules/FileSetModulesPrivate.cmake12
-rw-r--r--Tests/RunCMake/CXXModules/FileSetModulesPublic-stderr.txt11
-rw-r--r--Tests/RunCMake/CXXModules/FileSetModulesPublic.cmake12
-rw-r--r--Tests/RunCMake/CXXModules/InstallBMI-check.cmake24
-rw-r--r--Tests/RunCMake/CXXModules/InstallBMI-stderr.txt6
-rw-r--r--Tests/RunCMake/CXXModules/InstallBMI.cmake23
-rw-r--r--Tests/RunCMake/CXXModules/InstallBMIGenericArgs-check.cmake8
-rw-r--r--Tests/RunCMake/CXXModules/InstallBMIGenericArgs-stderr.txt6
-rw-r--r--Tests/RunCMake/CXXModules/InstallBMIGenericArgs.cmake9
-rw-r--r--Tests/RunCMake/CXXModules/InstallBMIIgnore-check.cmake13
-rw-r--r--Tests/RunCMake/CXXModules/InstallBMIIgnore-stderr.txt6
-rw-r--r--Tests/RunCMake/CXXModules/InstallBMIIgnore.cmake9
-rw-r--r--Tests/RunCMake/CXXModules/InstallBMINoGenericArgs-check.cmake8
-rw-r--r--Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-check.cmake34
-rw-r--r--Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-stderr.txt11
-rw-r--r--Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall.cmake76
-rw-r--r--Tests/RunCMake/CXXModules/NinjaDependInfoExport-check.cmake34
-rw-r--r--Tests/RunCMake/CXXModules/NinjaDependInfoExport-stderr.txt11
-rw-r--r--Tests/RunCMake/CXXModules/NinjaDependInfoExport.cmake85
-rw-r--r--Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-check.cmake34
-rw-r--r--Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-stderr.txt11
-rw-r--r--Tests/RunCMake/CXXModules/NinjaDependInfoFileSet.cmake59
-rw-r--r--Tests/RunCMake/CXXModules/NoCXX-result.txt1
-rw-r--r--Tests/RunCMake/CXXModules/NoCXX-stderr.txt20
-rw-r--r--Tests/RunCMake/CXXModules/NoCXX.cmake9
-rw-r--r--Tests/RunCMake/CXXModules/NoCXX20-result.txt1
-rw-r--r--Tests/RunCMake/CXXModules/NoCXX20-stderr.txt20
-rw-r--r--Tests/RunCMake/CXXModules/NoCXX20.cmake11
-rw-r--r--Tests/RunCMake/CXXModules/NoCXX20ModuleFlag-result.txt1
-rw-r--r--Tests/RunCMake/CXXModules/NoCXX20ModuleFlag-stderr.txt20
-rw-r--r--Tests/RunCMake/CXXModules/NoCXX20ModuleFlag.cmake12
-rw-r--r--Tests/RunCMake/CXXModules/NoDyndepSupport-result.txt1
-rw-r--r--Tests/RunCMake/CXXModules/NoDyndepSupport-stderr.txt30
-rw-r--r--Tests/RunCMake/CXXModules/NoDyndepSupport.cmake16
-rw-r--r--Tests/RunCMake/CXXModules/NotCXXSourceModuleHeaderUnits-result.txt1
-rw-r--r--Tests/RunCMake/CXXModules/NotCXXSourceModuleHeaderUnits-stderr.txt22
-rw-r--r--Tests/RunCMake/CXXModules/NotCXXSourceModuleHeaderUnits.cmake15
-rw-r--r--Tests/RunCMake/CXXModules/NotCXXSourceModules-result.txt1
-rw-r--r--Tests/RunCMake/CXXModules/NotCXXSourceModules-stderr.txt17
-rw-r--r--Tests/RunCMake/CXXModules/NotCXXSourceModules.cmake13
-rw-r--r--Tests/RunCMake/CXXModules/RunCMakeTest.cmake170
-rw-r--r--Tests/RunCMake/CXXModules/check-json.cmake160
-rw-r--r--Tests/RunCMake/CXXModules/compiler_introspection.cmake25
-rw-r--r--Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi-and-interfaces.cmake22
-rw-r--r--Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi.cmake27
-rw-r--r--Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake18
-rw-r--r--Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt9
-rw-r--r--Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt66
-rw-r--r--Tests/RunCMake/CXXModules/examples/deep-chain/a.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/deep-chain/b.cxx7
-rw-r--r--Tests/RunCMake/CXXModules/examples/deep-chain/c.cxx7
-rw-r--r--Tests/RunCMake/CXXModules/examples/deep-chain/d.cxx7
-rw-r--r--Tests/RunCMake/CXXModules/examples/deep-chain/e.cxx7
-rw-r--r--Tests/RunCMake/CXXModules/examples/deep-chain/main.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build-stderr.txt9
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/CMakeLists.txt56
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/forward.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/importable.cxx8
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/private.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt32
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install-stderr.txt9
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/CMakeLists.txt59
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/forward.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/importable.cxx8
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/private.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt32
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-interface-build-stderr.txt9
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-interface-build/CMakeLists.txt53
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-interface-build/forward.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-interface-build/importable.cxx8
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-interface-build/private.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt32
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-interface-install-stderr.txt9
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-interface-install/CMakeLists.txt56
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-interface-install/forward.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-interface-install/importable.cxx8
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-interface-install/private.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt32
-rw-r--r--Tests/RunCMake/CXXModules/examples/generated-stderr.txt9
-rw-r--r--Tests/RunCMake/CXXModules/examples/generated/CMakeLists.txt23
-rw-r--r--Tests/RunCMake/CXXModules/examples/generated/importable.cxx.in5
-rw-r--r--Tests/RunCMake/CXXModules/examples/generated/main.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces-stderr.txt9
-rw-r--r--Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/CMakeLists.txt27
-rw-r--r--Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/check-for-bmi.cmake7
-rw-r--r--Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/importable.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/install-bmi-stderr.txt9
-rw-r--r--Tests/RunCMake/CXXModules/examples/install-bmi/CMakeLists.txt25
-rw-r--r--Tests/RunCMake/CXXModules/examples/install-bmi/check-for-bmi.cmake4
-rw-r--r--Tests/RunCMake/CXXModules/examples/install-bmi/importable.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/internal-partitions-stderr.txt9
-rw-r--r--Tests/RunCMake/CXXModules/examples/internal-partitions/CMakeLists.txt31
-rw-r--r--Tests/RunCMake/CXXModules/examples/internal-partitions/importable.cxx9
-rw-r--r--Tests/RunCMake/CXXModules/examples/internal-partitions/main.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/internal-partitions/partition.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/library-shared-stderr.txt9
-rw-r--r--Tests/RunCMake/CXXModules/examples/library-static-stderr.txt9
-rw-r--r--Tests/RunCMake/CXXModules/examples/library/CMakeLists.txt30
-rw-r--r--Tests/RunCMake/CXXModules/examples/library/importable.cxx8
-rw-r--r--Tests/RunCMake/CXXModules/examples/library/main.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/partitions-stderr.txt9
-rw-r--r--Tests/RunCMake/CXXModules/examples/partitions/CMakeLists.txt31
-rw-r--r--Tests/RunCMake/CXXModules/examples/partitions/importable.cxx9
-rw-r--r--Tests/RunCMake/CXXModules/examples/partitions/main.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/partitions/partition.cxx8
-rw-r--r--Tests/RunCMake/CXXModules/examples/public-req-private-build-result.txt1
-rw-r--r--Tests/RunCMake/CXXModules/examples/public-req-private-build-stdout.txt1
-rw-r--r--Tests/RunCMake/CXXModules/examples/public-req-private-stderr.txt9
-rw-r--r--Tests/RunCMake/CXXModules/examples/public-req-private/CMakeLists.txt22
-rw-r--r--Tests/RunCMake/CXXModules/examples/public-req-private/priv.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/public-req-private/pub.cxx8
-rw-r--r--Tests/RunCMake/CXXModules/examples/simple-stderr.txt9
-rw-r--r--Tests/RunCMake/CXXModules/examples/simple/CMakeLists.txt18
-rw-r--r--Tests/RunCMake/CXXModules/examples/simple/importable.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/simple/main.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-private.json45
-rw-r--r--Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-public.json45
-rw-r--r--Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-private.json73
-rw-r--r--Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-public.json73
-rw-r--r--Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-private.json40
-rw-r--r--Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-public.json40
-rw-r--r--Tests/RunCMake/CXXModules/sources/c-anchor.c4
-rw-r--r--Tests/RunCMake/CXXModules/sources/cxx-anchor.cxx4
-rw-r--r--Tests/RunCMake/CXXModules/sources/module-header.h9
-rw-r--r--Tests/RunCMake/CXXModules/sources/module-impl.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/sources/module-internal-part-impl.cxx11
-rw-r--r--Tests/RunCMake/CXXModules/sources/module-internal-part.cxx3
-rw-r--r--Tests/RunCMake/CXXModules/sources/module-part-impl.cxx13
-rw-r--r--Tests/RunCMake/CXXModules/sources/module-part.cxx3
-rw-r--r--Tests/RunCMake/CXXModules/sources/module-use.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/sources/module.cxx5
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake38
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake27
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagC.cmake33
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagCUDA.cmake (renamed from Tests/RunCMake/CheckCompilerFlag/CheckCUDACompilerFlag.cmake)0
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagCXX.cmake26
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagFortran.cmake (renamed from Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake)0
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagHIP.cmake (renamed from Tests/RunCMake/CheckCompilerFlag/CheckHIPCompilerFlag.cmake)0
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagISPC.cmake (renamed from Tests/RunCMake/CheckCompilerFlag/CheckISPCCompilerFlag.cmake)0
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagOBJC.cmake (renamed from Tests/RunCMake/CheckCompilerFlag/CheckOBJCCompilerFlag.cmake)0
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagOBJCXX.cmake (renamed from Tests/RunCMake/CheckCompilerFlag/CheckOBJCXXCompilerFlag.cmake)0
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake16
-rw-r--r--Tests/RunCMake/CheckIPOSupported/default-lang-none-stderr.txt4
-rw-r--r--Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagC.cmake (renamed from Tests/RunCMake/CheckLinkerFlag/CheckCLinkerFlag.cmake)0
-rw-r--r--Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagCUDA.cmake (renamed from Tests/RunCMake/CheckLinkerFlag/CheckCUDALinkerFlag.cmake)0
-rw-r--r--Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagCXX.cmake (renamed from Tests/RunCMake/CheckLinkerFlag/CheckCXXLinkerFlag.cmake)0
-rw-r--r--Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagFortran.cmake (renamed from Tests/RunCMake/CheckLinkerFlag/CheckFortranLinkerFlag.cmake)0
-rw-r--r--Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagHIP.cmake (renamed from Tests/RunCMake/CheckLinkerFlag/CheckHIPLinkerFlag.cmake)0
-rw-r--r--Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagOBJC.cmake (renamed from Tests/RunCMake/CheckLinkerFlag/CheckOBJCLinkerFlag.cmake)0
-rw-r--r--Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagOBJCXX.cmake (renamed from Tests/RunCMake/CheckLinkerFlag/CheckOBJCXXLinkerFlag.cmake)0
-rw-r--r--Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake14
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckCSourceCompiles.cmake6
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckCXXSourceCompiles.cmake10
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckOBJCSourceCompiles.cmake9
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckOBJCXXSourceCompiles.cmake9
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesC.cmake15
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesCUDA.cmake (renamed from Tests/RunCMake/CheckSourceCompiles/CheckCUDASourceCompiles.cmake)0
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesCXX.cmake28
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesFortran.cmake (renamed from Tests/RunCMake/CheckSourceCompiles/CheckFortranSourceCompiles.cmake)0
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesHIP.cmake (renamed from Tests/RunCMake/CheckSourceCompiles/CheckHIPSourceCompiles.cmake)0
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesISPC.cmake (renamed from Tests/RunCMake/CheckSourceCompiles/CheckISPCSourceCompiles.cmake)0
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesOBJC.cmake16
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesOBJCXX.cmake19
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/CheckSourceRuns/CheckCSourceRuns.cmake10
-rw-r--r--Tests/RunCMake/CheckSourceRuns/CheckCXXSourceRuns.cmake10
-rw-r--r--Tests/RunCMake/CheckSourceRuns/CheckOBJCSourceRuns.cmake9
-rw-r--r--Tests/RunCMake/CheckSourceRuns/CheckOBJCXXSourceRuns.cmake9
-rw-r--r--Tests/RunCMake/CheckSourceRuns/CheckSourceRunsC.cmake15
-rw-r--r--Tests/RunCMake/CheckSourceRuns/CheckSourceRunsCUDA.cmake (renamed from Tests/RunCMake/CheckSourceRuns/CheckCUDASourceRuns.cmake)0
-rw-r--r--Tests/RunCMake/CheckSourceRuns/CheckSourceRunsCXX.cmake22
-rw-r--r--Tests/RunCMake/CheckSourceRuns/CheckSourceRunsFortran.cmake (renamed from Tests/RunCMake/CheckSourceRuns/CheckFortranSourceRuns.cmake)0
-rw-r--r--Tests/RunCMake/CheckSourceRuns/CheckSourceRunsHIP.cmake (renamed from Tests/RunCMake/CheckSourceRuns/CheckHIPSourceRuns.cmake)0
-rw-r--r--Tests/RunCMake/CheckSourceRuns/CheckSourceRunsOBJC.cmake16
-rw-r--r--Tests/RunCMake/CheckSourceRuns/CheckSourceRunsOBJCXX.cmake19
-rw-r--r--Tests/RunCMake/CheckSourceRuns/RunCMakeTest.cmake10
-rw-r--r--Tests/RunCMake/ClangTidy/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/ClangTidy/compdb.cmake7
-rw-r--r--Tests/RunCMake/CommandLine/DeprecateVS10-WARN-ON-stderr.txt5
-rw-r--r--Tests/RunCMake/CommandLine/DeprecateVS11-WARN-OFF.cmake0
-rw-r--r--Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON-stderr.txt5
-rw-r--r--Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON.cmake0
-rw-r--r--Tests/RunCMake/CommandLine/E_capabilities-stdout.txt2
-rw-r--r--Tests/RunCMake/CommandLine/E_env-equal.cmake15
-rw-r--r--Tests/RunCMake/CommandLine/E_env_modify-bad-operation-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_env_modify-bad-operation-stderr.txt3
-rw-r--r--Tests/RunCMake/CommandLine/E_env_modify-cmake_list-stdout.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_env_modify-path_list-stdout.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_env_modify-reset-stdout.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_env_modify-reset-to-unset-stdout.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_env_modify-set-stdout.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_env_modify-string-stdout.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_env_modify-unset-stdout.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_env_modify-with-double-dash-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_env_modify-without-double-dash-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_env_modify-without-double-dash-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLine/P_working-dir.cmake7
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake70
-rw-r--r--Tests/RunCMake/CommandLine/cmake_depends-stdout.txt2
-rw-r--r--Tests/RunCMake/CommandLine/debug-trycompile-stderr.txt11
-rw-r--r--Tests/RunCMake/CommandLine/debug-trycompile.cmake5
-rw-r--r--Tests/RunCMake/CommandLine/trycompile-clean.cmake8
-rw-r--r--Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CompilerTest/C-stdout.txt2
-rw-r--r--Tests/RunCMake/CompilerTest/C.cmake3
-rw-r--r--Tests/RunCMake/CompilerTest/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CompilerTest/CUDA-stdout.txt2
-rw-r--r--Tests/RunCMake/CompilerTest/CUDA.cmake3
-rw-r--r--Tests/RunCMake/CompilerTest/CXX-stdout.txt2
-rw-r--r--Tests/RunCMake/CompilerTest/CXX.cmake3
-rw-r--r--Tests/RunCMake/CompilerTest/Fortran-stdout.txt2
-rw-r--r--Tests/RunCMake/CompilerTest/Fortran.cmake3
-rw-r--r--Tests/RunCMake/CompilerTest/HIP-stdout.txt2
-rw-r--r--Tests/RunCMake/CompilerTest/HIP.cmake3
-rw-r--r--Tests/RunCMake/CompilerTest/ISPC-stdout.txt3
-rw-r--r--Tests/RunCMake/CompilerTest/ISPC.cmake3
-rw-r--r--Tests/RunCMake/CompilerTest/OBJC-stdout.txt2
-rw-r--r--Tests/RunCMake/CompilerTest/OBJC.cmake3
-rw-r--r--Tests/RunCMake/CompilerTest/OBJCXX-stdout.txt2
-rw-r--r--Tests/RunCMake/CompilerTest/OBJCXX.cmake3
-rw-r--r--Tests/RunCMake/CompilerTest/RunCMakeTest.cmake25
-rw-r--r--Tests/RunCMake/Configure/CopyFileABI-override.cmake (renamed from Tests/RunCMake/Configure/FailCopyFileABI-override.cmake)3
-rw-r--r--Tests/RunCMake/Configure/CopyFileABI-stdout.txt (renamed from Tests/RunCMake/Configure/FailCopyFileABI-stdout.txt)2
-rw-r--r--Tests/RunCMake/Configure/CopyFileABI.cmake (renamed from Tests/RunCMake/Configure/FailCopyFileABI.cmake)2
-rw-r--r--Tests/RunCMake/Configure/FailCopyFileABI-check.cmake14
-rw-r--r--Tests/RunCMake/Configure/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build1-stdout.txt6
-rw-r--r--Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build2-stdout.txt2
-rw-r--r--Tests/RunCMake/ExternalProject/BUILD_ALWAYS.cmake20
-rw-r--r--Tests/RunCMake/ExternalProject/RunCMakeTest.cmake22
-rw-r--r--Tests/RunCMake/FPHSA/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/FPHSA/empty_version-result.txt1
-rw-r--r--Tests/RunCMake/FPHSA/empty_version-stderr.txt9
-rw-r--r--Tests/RunCMake/FPHSA/empty_version.cmake1
-rw-r--r--Tests/RunCMake/FPHSA/exact_1_no_version_var-stdout.txt1
-rw-r--r--Tests/RunCMake/FPHSA/exact_1_no_version_var.cmake1
-rw-r--r--Tests/RunCMake/FetchContent/IncludesNonSystem/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/FetchContent/IncludesNonSystem/bar.cpp0
-rw-r--r--Tests/RunCMake/FetchContent/IncludesNonSystem/foo.cpp0
-rw-r--r--Tests/RunCMake/FetchContent/IncludesSystem/CMakeLists.txt20
-rw-r--r--Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/bar.cpp0
-rw-r--r--Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/foo.cpp0
-rw-r--r--Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/zot.cpp0
-rw-r--r--Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/bar.cpp0
-rw-r--r--Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/foo.cpp0
-rw-r--r--Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/zot.cpp0
-rw-r--r--Tests/RunCMake/FetchContent/IncludesSystem/bar.cpp0
-rw-r--r--Tests/RunCMake/FetchContent/IncludesSystem/foo.cpp0
-rw-r--r--Tests/RunCMake/FetchContent/IncludesSystem/zot.cpp0
-rw-r--r--Tests/RunCMake/FetchContent/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/FetchContent/System.cmake37
-rw-r--r--Tests/RunCMake/FileAPI/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/FileAPI/ClientStateful-check.py6
-rw-r--r--Tests/RunCMake/FileAPI/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-check.py12
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json2
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json2
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json2
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json2
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json2
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json2
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json2
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json2
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json2
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/subdir.json11
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json32
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json4
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json4
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json4
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_lib.json2
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json6
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json150
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json2
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json4
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_lib.json2
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json6
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2.cmake3
-rw-r--r--Tests/RunCMake/FileAPI/subdir/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/FileAPI/subdir/empty.c0
-rw-r--r--Tests/RunCMake/File_Archive/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/File_Archive/create-missing-args-result.txt1
-rw-r--r--Tests/RunCMake/File_Archive/create-missing-args-stderr.txt19
-rw-r--r--Tests/RunCMake/File_Archive/create-missing-args.cmake8
-rw-r--r--Tests/RunCMake/File_Archive/extract-missing-args-result.txt1
-rw-r--r--Tests/RunCMake/File_Archive/extract-missing-args-stderr.txt11
-rw-r--r--Tests/RunCMake/File_Archive/extract-missing-args.cmake5
-rw-r--r--Tests/RunCMake/File_Configure/BadArgContent-stderr.txt5
-rw-r--r--Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt5
-rw-r--r--Tests/RunCMake/File_Configure/NoArgContent-result.txt1
-rw-r--r--Tests/RunCMake/File_Configure/NoArgContent-stderr.txt4
-rw-r--r--Tests/RunCMake/File_Configure/NoArgContent.cmake1
-rw-r--r--Tests/RunCMake/File_Configure/NoArgOutput-result.txt1
-rw-r--r--Tests/RunCMake/File_Configure/NoArgOutput-stderr.txt4
-rw-r--r--Tests/RunCMake/File_Configure/NoArgOutput.cmake1
-rw-r--r--Tests/RunCMake/File_Configure/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt5
-rw-r--r--Tests/RunCMake/File_Generate/InputAndContent-check.cmake8
-rw-r--r--Tests/RunCMake/File_Generate/InputAndContent-input.txt1
-rw-r--r--Tests/RunCMake/File_Generate/InputAndContent.cmake10
-rw-r--r--Tests/RunCMake/File_Generate/NewLineStyle-NoArg-stderr.txt5
-rw-r--r--Tests/RunCMake/File_Generate/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake25
-rw-r--r--Tests/RunCMake/Framework/FrameworkConsumption.cmake18
-rw-r--r--Tests/RunCMake/Framework/main2.c9
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-result.txt1
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-stderr.txt5
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW.cmake2
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NoEffect.cmake4
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-OLD.cmake2
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-WARN.cmake2
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-common.cmake31
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/empty.cxx0
-rw-r--r--Tests/RunCMake/Ninja/QtAutoMocSkipPch.cmake17
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake25
-rw-r--r--Tests/RunCMake/Ninja/ShowIncludes-54936-check.cmake3
-rw-r--r--Tests/RunCMake/Ninja/ShowIncludes-54936-stdout.txt1
-rw-r--r--Tests/RunCMake/Ninja/ShowIncludes-54936.cmake2
-rw-r--r--Tests/RunCMake/Ninja/ShowIncludes-65001-check.cmake3
-rw-r--r--Tests/RunCMake/Ninja/ShowIncludes-65001-stdout.txt1
-rw-r--r--Tests/RunCMake/Ninja/ShowIncludes-65001.cmake2
-rw-r--r--Tests/RunCMake/Ninja/ShowIncludes-check.cmake17
-rw-r--r--Tests/RunCMake/Ninja/ShowIncludes-cmake.cmake7
-rw-r--r--Tests/RunCMake/Ninja/ShowIncludes.cmake22
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake28
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CompileCommands.cmake3
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake1
-rw-r--r--Tests/RunCMake/PrecompileHeaders/DisabledPch.cmake3
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchDebugGenex.cmake3
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchIncludedAllLanguages.cmake4
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchIncludedOneLanguage.cmake4
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchInterface.cmake3
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe.cmake3
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake4
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchPrologueEpilogue.cmake5
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchReuseFrom-CMP0141-NEW-empty.cmake4
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchReuseFrom-CMP0141-NEW.cmake2
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchReuseFrom-CMP0141-OLD.cmake2
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchReuseFrom-common.cmake (renamed from Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake)3
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchReuseFromObjLib.cmake5
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchReuseFromPrefixed.cmake3
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchReuseFromSubdir.cmake3
-rw-r--r--Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/PrecompileHeaders/SkipPrecompileHeaders.cmake5
-rw-r--r--Tests/RunCMake/RunCMake.cmake11
-rw-r--r--Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt1
-rw-r--r--Tests/RunCMake/VS10Project/DebugInformationFormat-check.cmake46
-rw-r--r--Tests/RunCMake/VS10Project/DebugInformationFormat.cmake24
-rw-r--r--Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake9
-rw-r--r--Tests/RunCMake/VS10Project/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets-check.cmake2
-rw-r--r--Tests/RunCMake/VsDotnetSdk/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/VsDotnetSdk/VsDotnetSdk.cmake10
-rw-r--r--Tests/RunCMake/VsDotnetSdk/VsDotnetSdkDefines-check.cmake64
-rw-r--r--Tests/RunCMake/VsDotnetSdk/VsDotnetSdkDefines.cmake19
-rw-r--r--Tests/RunCMake/XcodeProject/Clean-build-check.cmake5
-rw-r--r--Tests/RunCMake/XcodeProject/Clean-clean-check.cmake5
-rw-r--r--Tests/RunCMake/XcodeProject/Clean.cmake2
-rw-r--r--Tests/RunCMake/XcodeProject/Clean/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/XcodeProject/Clean/empty.c0
-rw-r--r--Tests/RunCMake/XcodeProject/EffectivePlatformNameOFF.cmake12
-rw-r--r--Tests/RunCMake/XcodeProject/RunCMakeTest.cmake27
-rw-r--r--Tests/RunCMake/XcodeProject/SearchPaths-check.cmake14
-rw-r--r--Tests/RunCMake/XcodeProject/SearchPaths.cmake10
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake4
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake4
-rw-r--r--Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/add_subdirectory/System.cmake22
-rw-r--r--Tests/RunCMake/add_subdirectory/System/CMakeLists.txt11
-rw-r--r--Tests/RunCMake/add_subdirectory/System/SubSub1/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/add_subdirectory/System/SubSub1/bar.cpp0
-rw-r--r--Tests/RunCMake/add_subdirectory/System/SubSub1/foo.cpp0
-rw-r--r--Tests/RunCMake/add_subdirectory/System/SubSub1/zot.cpp0
-rw-r--r--Tests/RunCMake/add_subdirectory/System/SubSub2/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/add_subdirectory/System/SubSub2/bar.cpp0
-rw-r--r--Tests/RunCMake/add_subdirectory/System/SubSub2/foo.cpp0
-rw-r--r--Tests/RunCMake/add_subdirectory/System/SubSub2/zot.cpp0
-rw-r--r--Tests/RunCMake/add_subdirectory/System/bar.cpp0
-rw-r--r--Tests/RunCMake/add_subdirectory/System/foo.cpp0
-rw-r--r--Tests/RunCMake/add_subdirectory/System/zot.cpp0
-rw-r--r--Tests/RunCMake/block/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/block/EndAlone-result.txt1
-rw-r--r--Tests/RunCMake/block/EndAlone-stderr.txt4
-rw-r--r--Tests/RunCMake/block/EndAlone.cmake1
-rw-r--r--Tests/RunCMake/block/EndAloneWithArgument-result.txt1
-rw-r--r--Tests/RunCMake/block/EndAloneWithArgument-stderr.txt4
-rw-r--r--Tests/RunCMake/block/EndAloneWithArgument.cmake1
-rw-r--r--Tests/RunCMake/block/EndMissing-result.txt1
-rw-r--r--Tests/RunCMake/block/EndMissing-stderr.txt4
-rw-r--r--Tests/RunCMake/block/EndMissing.cmake1
-rw-r--r--Tests/RunCMake/block/EndWithArgument-stderr.txt9
-rw-r--r--Tests/RunCMake/block/EndWithArgument.cmake2
-rw-r--r--Tests/RunCMake/block/InvalidArgument-result.txt1
-rw-r--r--Tests/RunCMake/block/InvalidArgument-stderr.txt4
-rw-r--r--Tests/RunCMake/block/InvalidArgument.cmake2
-rw-r--r--Tests/RunCMake/block/InvalidNesting1-result.txt1
-rw-r--r--Tests/RunCMake/block/InvalidNesting1-stderr.txt4
-rw-r--r--Tests/RunCMake/block/InvalidNesting1.cmake6
-rw-r--r--Tests/RunCMake/block/InvalidNesting2-result.txt1
-rw-r--r--Tests/RunCMake/block/InvalidNesting2-stderr.txt4
-rw-r--r--Tests/RunCMake/block/InvalidNesting2.cmake6
-rw-r--r--Tests/RunCMake/block/InvalidNesting3-result.txt1
-rw-r--r--Tests/RunCMake/block/InvalidNesting3-stderr.txt4
-rw-r--r--Tests/RunCMake/block/InvalidNesting3.cmake5
-rw-r--r--Tests/RunCMake/block/InvalidNesting4-result.txt1
-rw-r--r--Tests/RunCMake/block/InvalidNesting4-stderr.txt4
-rw-r--r--Tests/RunCMake/block/InvalidNesting4.cmake5
-rw-r--r--Tests/RunCMake/block/InvalidNesting5-result.txt1
-rw-r--r--Tests/RunCMake/block/InvalidNesting5-stderr.txt4
-rw-r--r--Tests/RunCMake/block/InvalidNesting5.cmake5
-rw-r--r--Tests/RunCMake/block/InvalidNesting6-result.txt1
-rw-r--r--Tests/RunCMake/block/InvalidNesting6-stderr.txt4
-rw-r--r--Tests/RunCMake/block/InvalidNesting6.cmake5
-rw-r--r--Tests/RunCMake/block/MissingArgument-result.txt1
-rw-r--r--Tests/RunCMake/block/MissingArgument-stderr.txt7
-rw-r--r--Tests/RunCMake/block/MissingArgument.cmake2
-rw-r--r--Tests/RunCMake/block/RunCMakeTest.cmake22
-rw-r--r--Tests/RunCMake/block/Scope-POLICIES.cmake40
-rw-r--r--Tests/RunCMake/block/Scope-VARIABLES.cmake62
-rw-r--r--Tests/RunCMake/block/Scope.cmake62
-rw-r--r--Tests/RunCMake/block/Scope/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/block/Workflows.cmake78
-rw-r--r--Tests/RunCMake/block/WrongArgument-result.txt1
-rw-r--r--Tests/RunCMake/block/WrongArgument-stderr.txt4
-rw-r--r--Tests/RunCMake/block/WrongArgument.cmake2
-rw-r--r--Tests/RunCMake/block/WrongScope-result.txt1
-rw-r--r--Tests/RunCMake/block/WrongScope-stderr.txt4
-rw-r--r--Tests/RunCMake/block/WrongScope.cmake2
-rw-r--r--Tests/RunCMake/cmake_host_system_information/Registry_BadQuery2-stderr.txt6
-rw-r--r--Tests/RunCMake/cmake_host_system_information/Registry_BadView1-stderr.txt6
-rw-r--r--Tests/RunCMake/cmake_language/RunCMakeTest.cmake60
-rw-r--r--Tests/RunCMake/cmake_language/get_message_log_level.cmake5
-rw-r--r--Tests/RunCMake/cmake_language/get_message_log_level_cache-stdout.txt1
-rw-r--r--Tests/RunCMake/cmake_language/get_message_log_level_cli-stdout.txt1
-rw-r--r--Tests/RunCMake/cmake_language/get_message_log_level_cli_and_cache-stdout.txt1
-rw-r--r--Tests/RunCMake/cmake_language/get_message_log_level_cli_and_var-stdout.txt1
-rw-r--r--Tests/RunCMake/cmake_language/get_message_log_level_none-stdout.txt1
-rw-r--r--Tests/RunCMake/cmake_language/get_message_log_level_var-stdout.txt1
-rw-r--r--Tests/RunCMake/cmake_language/get_message_log_level_var_and_cache-stdout.txt1
-rw-r--r--Tests/RunCMake/cmake_path/BASE_DIRECTORY-no-arg-stderr.txt4
-rw-r--r--Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-empty-stderr.txt4
-rw-r--r--Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt4
-rw-r--r--Tests/RunCMake/cmake_path/RunCMakeTest.cmake11
-rw-r--r--Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-result.txt1
-rw-r--r--Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-stdout.txt1
-rw-r--r--Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop.cmake9
-rw-r--r--Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-result.txt1
-rw-r--r--Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-stdout.txt1
-rw-r--r--Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system.cmake9
-rw-r--r--Tests/RunCMake/ctest_environment/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/ctest_memcheck/testCudaSanitizer.cmake9
-rw-r--r--Tests/RunCMake/execute_process/EchoCommand3-stderr.txt4
-rw-r--r--Tests/RunCMake/execute_process/EncodingMissing-stderr.txt5
-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-stderr.txt6
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake4
-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-stderr.txt4
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake5
-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-stderr.txt6
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake6
-rw-r--r--Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake18
-rw-r--r--Tests/RunCMake/file-CHMOD/all-perms-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/all-perms-stderr.txt4
-rw-r--r--Tests/RunCMake/file-CHMOD/all-perms.cmake3
-rw-r--r--Tests/RunCMake/file-CHMOD/invalid-path-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/invalid-path-stderr.txt6
-rw-r--r--Tests/RunCMake/file-CHMOD/invalid-path.cmake1
-rw-r--r--Tests/RunCMake/file-CHMOD/invalid-perms-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/invalid-perms-stderr.txt3
-rw-r--r--Tests/RunCMake/file-CHMOD/invalid-perms.cmake2
-rw-r--r--Tests/RunCMake/file-CHMOD/missing-dir-perms-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/missing-dir-perms-stderr.txt5
-rw-r--r--Tests/RunCMake/file-CHMOD/missing-dir-perms.cmake2
-rw-r--r--Tests/RunCMake/file-CHMOD/missing-file-perms-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/missing-file-perms-stderr.txt5
-rw-r--r--Tests/RunCMake/file-CHMOD/missing-file-perms.cmake2
-rw-r--r--Tests/RunCMake/file-CHMOD/missing-perms-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/missing-perms-stderr.txt5
-rw-r--r--Tests/RunCMake/file-CHMOD/missing-perms.cmake2
-rw-r--r--Tests/RunCMake/file-CHMOD/no-perms-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/no-perms-stderr.txt3
-rw-r--r--Tests/RunCMake/file-CHMOD/no-perms.cmake2
-rw-r--r--Tests/RunCMake/file-CHMOD/ok.cmake2
-rw-r--r--Tests/RunCMake/file-CHMOD/override.cmake3
-rw-r--r--Tests/RunCMake/file-CHMOD/write-only-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/write-only-stderr.txt6
-rw-r--r--Tests/RunCMake/file-CHMOD/write-only.cmake3
-rw-r--r--Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2-stderr.txt20
-rw-r--r--Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt9
-rw-r--r--Tests/RunCMake/file/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/file/TIMESTAMP-stdout.txt1
-rw-r--r--Tests/RunCMake/file/TIMESTAMP.cmake2
-rw-r--r--Tests/RunCMake/find_file/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/find_file/VALIDATOR-no-function-result.txt1
-rw-r--r--Tests/RunCMake/find_file/VALIDATOR-no-function-stderr.txt4
-rw-r--r--Tests/RunCMake/find_file/VALIDATOR-no-function.cmake2
-rw-r--r--Tests/RunCMake/find_file/VALIDATOR-specify-macro-result.txt1
-rw-r--r--Tests/RunCMake/find_file/VALIDATOR-specify-macro-stderr.txt4
-rw-r--r--Tests/RunCMake/find_file/VALIDATOR-specify-macro.cmake5
-rw-r--r--Tests/RunCMake/find_file/VALIDATOR-stderr.txt3
-rw-r--r--Tests/RunCMake/find_file/VALIDATOR-stdout.txt3
-rw-r--r--Tests/RunCMake/find_file/VALIDATOR-undefined-function-result.txt1
-rw-r--r--Tests/RunCMake/find_file/VALIDATOR-undefined-function-stderr.txt4
-rw-r--r--Tests/RunCMake/find_file/VALIDATOR-undefined-function.cmake2
-rw-r--r--Tests/RunCMake/find_file/VALIDATOR.cmake39
-rw-r--r--Tests/RunCMake/find_library/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/find_library/VALIDATOR-no-function-result.txt1
-rw-r--r--Tests/RunCMake/find_library/VALIDATOR-no-function-stderr.txt4
-rw-r--r--Tests/RunCMake/find_library/VALIDATOR-no-function.cmake2
-rw-r--r--Tests/RunCMake/find_library/VALIDATOR-specify-macro-result.txt1
-rw-r--r--Tests/RunCMake/find_library/VALIDATOR-specify-macro-stderr.txt4
-rw-r--r--Tests/RunCMake/find_library/VALIDATOR-specify-macro.cmake5
-rw-r--r--Tests/RunCMake/find_library/VALIDATOR-stderr.txt3
-rw-r--r--Tests/RunCMake/find_library/VALIDATOR-stdout.txt3
-rw-r--r--Tests/RunCMake/find_library/VALIDATOR-undefined-function-result.txt1
-rw-r--r--Tests/RunCMake/find_library/VALIDATOR-undefined-function-stderr.txt4
-rw-r--r--Tests/RunCMake/find_library/VALIDATOR-undefined-function.cmake2
-rw-r--r--Tests/RunCMake/find_library/VALIDATOR.cmake41
-rw-r--r--Tests/RunCMake/find_package/RunCMakeTest.cmake16
-rw-r--r--Tests/RunCMake/find_package/SearchPaths.cmake2
-rw-r--r--Tests/RunCMake/find_package/SearchPaths/prefix/SearchPathsConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/SearchPaths/prefix_cmake/cmake/SearchPathsConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/SearchPaths/prefix_pkg/SearchPaths-1.2.3/SearchPathsConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1.2.3/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1.2.3/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1.2.3/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1.2.3/share/SearchPaths-1.2.3/SearchPathsConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1.2.3/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/share/SearchPaths-1.2.3/SearchPathsConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix-stderr.txt10
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix.cmake1
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_cmake-stderr.txt12
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_cmake.cmake1
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg-stderr.txt12
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg.cmake1
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg-stderr.txt12
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg.cmake1
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake-stderr.txt12
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake.cmake1
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_pkg-stderr.txt12
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_pkg.cmake1
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake-stderr.txt14
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake.cmake1
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg-stderr.txt14
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg.cmake1
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg-stderr.txt14
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg.cmake1
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg-stderr.txt14
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg.cmake1
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake-stderr.txt14
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake.cmake1
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg-stderr.txt14
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg.cmake1
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg-stderr.txt14
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg.cmake1
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake-stderr.txt14
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake.cmake1
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg-stderr.txt12
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg.cmake1
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg-stderr.txt12
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg.cmake1
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake-stderr.txt12
-rw-r--r--Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake.cmake1
-rw-r--r--Tests/RunCMake/find_path/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/find_path/VALIDATOR-no-function-result.txt1
-rw-r--r--Tests/RunCMake/find_path/VALIDATOR-no-function-stderr.txt4
-rw-r--r--Tests/RunCMake/find_path/VALIDATOR-no-function.cmake2
-rw-r--r--Tests/RunCMake/find_path/VALIDATOR-specify-macro-result.txt1
-rw-r--r--Tests/RunCMake/find_path/VALIDATOR-specify-macro-stderr.txt4
-rw-r--r--Tests/RunCMake/find_path/VALIDATOR-specify-macro.cmake5
-rw-r--r--Tests/RunCMake/find_path/VALIDATOR-stderr.txt3
-rw-r--r--Tests/RunCMake/find_path/VALIDATOR-stdout.txt3
-rw-r--r--Tests/RunCMake/find_path/VALIDATOR-undefined-function-result.txt1
-rw-r--r--Tests/RunCMake/find_path/VALIDATOR-undefined-function-stderr.txt4
-rw-r--r--Tests/RunCMake/find_path/VALIDATOR-undefined-function.cmake2
-rw-r--r--Tests/RunCMake/find_path/VALIDATOR.cmake39
-rw-r--r--Tests/RunCMake/find_program/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/find_program/VALIDATOR-no-function-result.txt1
-rw-r--r--Tests/RunCMake/find_program/VALIDATOR-no-function-stderr.txt4
-rw-r--r--Tests/RunCMake/find_program/VALIDATOR-no-function.cmake2
-rw-r--r--Tests/RunCMake/find_program/VALIDATOR-specify-macro-result.txt1
-rw-r--r--Tests/RunCMake/find_program/VALIDATOR-specify-macro-stderr.txt4
-rw-r--r--Tests/RunCMake/find_program/VALIDATOR-specify-macro.cmake5
-rw-r--r--Tests/RunCMake/find_program/VALIDATOR-stderr.txt3
-rw-r--r--Tests/RunCMake/find_program/VALIDATOR-stdout.txt3
-rw-r--r--Tests/RunCMake/find_program/VALIDATOR-undefined-function-result.txt1
-rw-r--r--Tests/RunCMake/find_program/VALIDATOR-undefined-function-stderr.txt4
-rw-r--r--Tests/RunCMake/find_program/VALIDATOR-undefined-function.cmake2
-rw-r--r--Tests/RunCMake/find_program/VALIDATOR.cmake39
-rw-r--r--Tests/RunCMake/install/DIRECTORY-symlink-clobber-all-result.txt1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-symlink-clobber-all-stderr.txt12
-rw-r--r--Tests/RunCMake/install/DIRECTORY-symlink-clobber-all-stdout.txt12
-rw-r--r--Tests/RunCMake/install/DIRECTORY-symlink-clobber.cmake11
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/project/LanguagesDuplicate-check.cmake10
-rw-r--r--Tests/RunCMake/project/LanguagesDuplicate.cmake11
-rw-r--r--Tests/RunCMake/project/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/pseudo_tidy.c10
-rw-r--r--Tests/RunCMake/return/CMP0140-NEW.cmake13
-rw-r--r--Tests/RunCMake/return/CMP0140-OLD.cmake8
-rw-r--r--Tests/RunCMake/return/CMP0140-WARN-result.txt1
-rw-r--r--Tests/RunCMake/return/CMP0140-WARN-stderr.txt12
-rw-r--r--Tests/RunCMake/return/CMP0140-WARN.cmake8
-rw-r--r--Tests/RunCMake/return/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/return/PropagateFromDirectory.cmake10
-rw-r--r--Tests/RunCMake/return/PropagateFromFunction.cmake142
-rw-r--r--Tests/RunCMake/return/PropagateNothing.cmake2
-rw-r--r--Tests/RunCMake/return/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/return/WrongArgument-result.txt1
-rw-r--r--Tests/RunCMake/return/WrongArgument-stderr.txt4
-rw-r--r--Tests/RunCMake/return/WrongArgument.cmake2
-rw-r--r--Tests/RunCMake/return/subdir/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/showIncludes.c33
-rw-r--r--Tests/RunCMake/string/JSON.cmake6
-rw-r--r--Tests/RunCMake/target_compile_options/CMP0101-BEFORE_keyword-stderr.txt10
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake10
-rw-r--r--Tests/RunCMake/target_link_libraries-LINK_LIBRARY/apple_framework.cmake30
-rw-r--r--Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental-stderr.txt12
-rw-r--r--Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake6
-rw-r--r--Tests/RunCMake/target_sources/FileSetWrongTypeExperimental-result.txt1
-rw-r--r--Tests/RunCMake/target_sources/FileSetWrongTypeExperimental-stderr.txt12
-rw-r--r--Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake6
-rw-r--r--Tests/RunCMake/target_sources/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/BadLinkLibraries.cmake6
-rw-r--r--Tests/RunCMake/try_compile/BadSources1-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/BadSources1.cmake4
-rw-r--r--Tests/RunCMake/try_compile/BadSources2-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/BadSources2.cmake7
-rw-r--r--Tests/RunCMake/try_compile/BinDirEmpty-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/BinDirEmpty-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/BinDirEmpty.cmake1
-rw-r--r--Tests/RunCMake/try_compile/BinDirRelative-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/BinDirRelative-stderr.txt6
-rw-r--r--Tests/RunCMake/try_compile/BinDirRelative.cmake1
-rw-r--r--Tests/RunCMake/try_compile/BuildType.cmake8
-rw-r--r--Tests/RunCMake/try_compile/BuildTypeAsFlag.cmake9
-rw-r--r--Tests/RunCMake/try_compile/CStandard-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/CStandard.cmake8
-rw-r--r--Tests/RunCMake/try_compile/CStandardGNU.cmake15
-rw-r--r--Tests/RunCMake/try_compile/CStandardNoDefault.cmake8
-rw-r--r--Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake4
-rw-r--r--Tests/RunCMake/try_compile/CudaStandard-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/CudaStandard.cmake8
-rw-r--r--Tests/RunCMake/try_compile/CxxStandard-stderr.txt15
-rw-r--r--Tests/RunCMake/try_compile/CxxStandard.cmake8
-rw-r--r--Tests/RunCMake/try_compile/CxxStandardGNU.cmake15
-rw-r--r--Tests/RunCMake/try_compile/CxxStandardNoDefault.cmake8
-rw-r--r--Tests/RunCMake/try_compile/EmptyListArgs.cmake11
-rw-r--r--Tests/RunCMake/try_compile/EmptyValueArgs-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt9
-rw-r--r--Tests/RunCMake/try_compile/EmptyValueArgs.cmake7
-rw-r--r--Tests/RunCMake/try_compile/EnvConfig.cmake6
-rw-r--r--Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake12
-rw-r--r--Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake13
-rw-r--r--Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake9
-rw-r--r--Tests/RunCMake/try_compile/ISPCTargets.cmake9
-rw-r--r--Tests/RunCMake/try_compile/NoArgs-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/NoCStandard-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/NoCStandard-stderr.txt7
-rw-r--r--Tests/RunCMake/try_compile/NoCStandard.cmake4
-rw-r--r--Tests/RunCMake/try_compile/NoCopyFile-stderr.txt7
-rw-r--r--Tests/RunCMake/try_compile/NoCopyFile.cmake4
-rw-r--r--Tests/RunCMake/try_compile/NoCopyFile2-stderr.txt7
-rw-r--r--Tests/RunCMake/try_compile/NoCopyFile2.cmake4
-rw-r--r--Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt7
-rw-r--r--Tests/RunCMake/try_compile/NoCopyFileError.cmake4
-rw-r--r--Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt7
-rw-r--r--Tests/RunCMake/try_compile/NoOutputVariable.cmake4
-rw-r--r--Tests/RunCMake/try_compile/NoOutputVariable2-stderr.txt7
-rw-r--r--Tests/RunCMake/try_compile/NoOutputVariable2.cmake4
-rw-r--r--Tests/RunCMake/try_compile/NoSources-stderr.txt7
-rw-r--r--Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/ObjCStandard-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/ObjCStandard.cmake8
-rw-r--r--Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/ObjCxxStandard.cmake8
-rw-r--r--Tests/RunCMake/try_compile/OldProjectBinDirEmpty-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/OldProjectBinDirEmpty-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/OldProjectBinDirEmpty.cmake1
-rw-r--r--Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/OldProjectSrcDirEmpty.cmake1
-rw-r--r--Tests/RunCMake/try_compile/OneArg-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/OutputDirAsFlag.cmake9
-rw-r--r--Tests/RunCMake/try_compile/PlatformVariables-stderr.txt11
-rw-r--r--Tests/RunCMake/try_compile/ProjectBinDirEmpty-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/ProjectBinDirEmpty-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/ProjectBinDirEmpty.cmake4
-rw-r--r--Tests/RunCMake/try_compile/ProjectCopyFile-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/ProjectCopyFile-stderr.txt7
-rw-r--r--Tests/RunCMake/try_compile/ProjectCopyFile.cmake4
-rw-r--r--Tests/RunCMake/try_compile/ProjectSrcDirEmpty-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/ProjectSrcDirEmpty-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/ProjectSrcDirEmpty.cmake1
-rw-r--r--Tests/RunCMake/try_compile/ProjectSrcDirMissing-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/ProjectSrcDirMissing-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/ProjectSrcDirMissing.cmake1
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake72
-rw-r--r--Tests/RunCMake/try_compile/SourceFromBadFile-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/SourceFromBadFile-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/SourceFromBadFile.cmake1
-rw-r--r--Tests/RunCMake/try_compile/SourceFromBadName-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/SourceFromBadName-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/SourceFromBadName.cmake1
-rw-r--r--Tests/RunCMake/try_compile/SourceFromOneArg-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/SourceFromOneArg-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/SourceFromOneArg.cmake1
-rw-r--r--Tests/RunCMake/try_compile/SourceFromThreeArgs-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/SourceFromThreeArgs-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/SourceFromThreeArgs.cmake1
-rw-r--r--Tests/RunCMake/try_compile/TargetTypeExe.cmake10
-rw-r--r--Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/TargetTypeInvalid.cmake6
-rw-r--r--Tests/RunCMake/try_compile/TargetTypeStatic.cmake10
-rw-r--r--Tests/RunCMake/try_compile/TryRunArgs-stderr.txt18
-rw-r--r--Tests/RunCMake/try_compile/TryRunArgs.cmake14
-rw-r--r--Tests/RunCMake/try_compile/TwoArgs-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/WarnDeprecated-stderr.txt11
-rw-r--r--Tests/RunCMake/try_compile/new_signature.cmake2
-rw-r--r--Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake66
-rw-r--r--Tests/RunCMake/try_compile/old_signature.cmake2
-rw-r--r--Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt2
-rw-r--r--Tests/RunCMake/try_run/BadLinkLibraries.cmake7
-rw-r--r--Tests/RunCMake/try_run/BinDirEmpty-result.txt1
-rw-r--r--Tests/RunCMake/try_run/BinDirEmpty-stderr.txt4
-rw-r--r--Tests/RunCMake/try_run/BinDirEmpty.cmake1
-rw-r--r--Tests/RunCMake/try_run/BinDirRelative-result.txt1
-rw-r--r--Tests/RunCMake/try_run/BinDirRelative-stderr.txt6
-rw-r--r--Tests/RunCMake/try_run/BinDirRelative.cmake1
-rw-r--r--Tests/RunCMake/try_run/NoCompileOutputVariable-result.txt1
-rw-r--r--Tests/RunCMake/try_run/NoCompileOutputVariable-stderr.txt7
-rw-r--r--Tests/RunCMake/try_run/NoCompileOutputVariable.cmake6
-rw-r--r--Tests/RunCMake/try_run/NoOutputCompileVariable-result.txt1
-rw-r--r--Tests/RunCMake/try_run/NoOutputVariable-result.txt1
-rw-r--r--Tests/RunCMake/try_run/NoOutputVariable-stderr.txt7
-rw-r--r--Tests/RunCMake/try_run/NoOutputVariable.cmake4
-rw-r--r--Tests/RunCMake/try_run/NoRunOutputVariable-result.txt1
-rw-r--r--Tests/RunCMake/try_run/NoRunOutputVariable-stderr.txt7
-rw-r--r--Tests/RunCMake/try_run/NoRunOutputVariable.cmake6
-rw-r--r--Tests/RunCMake/try_run/NoRunStdErrVariable-result.txt1
-rw-r--r--Tests/RunCMake/try_run/NoRunStdErrVariable-stderr.txt7
-rw-r--r--Tests/RunCMake/try_run/NoRunStdErrVariable.cmake7
-rw-r--r--Tests/RunCMake/try_run/NoRunStdOutVariable-result.txt1
-rw-r--r--Tests/RunCMake/try_run/NoRunStdOutVariable-stderr.txt7
-rw-r--r--Tests/RunCMake/try_run/NoRunStdOutVariable.cmake7
-rw-r--r--Tests/RunCMake/try_run/NoWorkingDirectory-result.txt1
-rw-r--r--Tests/RunCMake/try_run/NoWorkingDirectory-stderr.txt7
-rw-r--r--Tests/RunCMake/try_run/NoWorkingDirectory.cmake6
-rw-r--r--Tests/RunCMake/try_run/RunCMakeTest.cmake14
-rw-r--r--Tests/RunCMake/try_run/WorkingDirArg.cmake8
-rw-r--r--Tests/RunCMake/try_run/new_signature.cmake2
-rw-r--r--Tests/RunCMake/try_run/old_and_new_signature_tests.cmake20
-rw-r--r--Tests/RunCMake/try_run/old_signature.cmake2
-rw-r--r--Tests/SwiftMix/CMain.c13
-rw-r--r--Tests/SwiftMix/CMakeLists.txt1
-rw-r--r--Tests/SwiftMix/SwiftMain.swift20
-rw-r--r--Tests/SwiftMixLib/CMakeLists.txt6
-rw-r--r--Tests/SwiftMixLib/lib.c4
-rw-r--r--Tests/SwiftMixLib/lib.cpp4
-rw-r--r--Tests/SwiftMixLib/lib.swift3
-rw-r--r--Tests/SwiftMixLib/main.swift3
-rw-r--r--Tests/SwiftOnly/CMakeLists.txt4
-rw-r--r--Tests/SwiftOnly/SubA/CMakeLists.txt2
-rw-r--r--Tests/SwiftOnly/SubA/SubA.swift0
-rw-r--r--Tests/SwiftOnly/SubB/CMakeLists.txt2
-rw-r--r--Tests/SwiftOnly/SubB/SubB.swift1
-rw-r--r--Tests/SwiftOnly/main.swift6
-rw-r--r--Tests/TryCompile/CMakeLists.txt457
-rw-r--r--Tests/TryCompile/exit_with_error.c2
-rw-r--r--Tests/TryCompile/old_and_new_signature_tests.cmake276
-rw-r--r--Tests/TryCompile/stdout_and_stderr.c8
-rw-r--r--Tests/VSGNUFortran/CMakeLists.txt2
-rw-r--r--Tests/VSWinStorePhone/VerifyAppPackage.cmake2
1006 files changed, 9716 insertions, 1517 deletions
diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt
index 1b7e57d28..8f6b35568 100644
--- a/Tests/Assembler/CMakeLists.txt
+++ b/Tests/Assembler/CMakeLists.txt
@@ -24,6 +24,12 @@ if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode|Ninja" AND
elseif("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
list(APPEND C_FLAGS -arch arm64)
endif()
+ if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ # Just in case the user is passing -flto, we need to pass -fno-lto to
+ # clang when generating the assembly file, or else clang will generate
+ # LLVM IR instead of assembly.
+ list(APPEND C_FLAGS -fno-lto)
+ endif()
# Clang on OS X, and perhaps other compilers, do not support -g
# for both generating and assembling, so drop it from generating.
list(REMOVE_ITEM C_FLAGS -g)
diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt
index 1d45162d0..612d4b4d8 100644
--- a/Tests/CMakeLib/CMakeLists.txt
+++ b/Tests/CMakeLib/CMakeLists.txt
@@ -47,12 +47,10 @@ if(WIN32)
list(APPEND CMakeLib_TESTS
testVisualStudioSlnParser.cxx
)
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testVisualStudioSlnParser.h.in
- ${CMAKE_CURRENT_BINARY_DIR}/testVisualStudioSlnParser.h @ONLY)
+ configure_file(testVisualStudioSlnParser.h.in testVisualStudioSlnParser.h @ONLY)
endif()
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testXMLParser.h.in
- ${CMAKE_CURRENT_BINARY_DIR}/testXMLParser.h @ONLY)
+configure_file(testXMLParser.h.in testXMLParser.h @ONLY)
create_test_sourcelist(CMakeLib_TEST_SRCS CMakeLibTests.cxx ${CMakeLib_TESTS})
add_executable(CMakeLibTests ${CMakeLib_TEST_SRCS})
diff --git a/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt b/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt
index 4bef6c5e0..b4bc92179 100644
--- a/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt
+++ b/Tests/CMakeLib/PseudoMemcheck/CMakeLists.txt
@@ -1,6 +1,6 @@
-foreach (_retval 0 1)
- configure_file("${CMAKE_CURRENT_SOURCE_DIR}/memtester.cxx.in" "${CMAKE_CURRENT_BINARY_DIR}/ret${_retval}.cxx" @ONLY)
-endforeach ()
+foreach(_retval IN ITEMS 0 1)
+ configure_file(memtester.cxx.in ret${_retval}.cxx @ONLY)
+endforeach()
include_directories(${CMake_SOURCE_DIR}/Source ${CMake_BINARY_DIR}/Source)
diff --git a/Tests/CMakeLib/testArgumentParser.cxx b/Tests/CMakeLib/testArgumentParser.cxx
index 965690c37..e044794ba 100644
--- a/Tests/CMakeLib/testArgumentParser.cxx
+++ b/Tests/CMakeLib/testArgumentParser.cxx
@@ -1,57 +1,182 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
+#include <functional>
#include <initializer_list>
#include <iostream>
+#include <map>
#include <string>
+#include <utility>
#include <vector>
+#include <cm/optional>
#include <cm/string_view>
#include <cmext/string_view>
#include "cmArgumentParser.h"
+#include "cmArgumentParserTypes.h"
namespace {
-struct Result
+struct Result : public ArgumentParser::ParseResult
{
bool Option1 = false;
bool Option2 = false;
std::string String1;
- std::string String2;
+ cm::optional<std::string> String2;
+ cm::optional<std::string> String3;
+ ArgumentParser::Maybe<std::string> String4;
+ ArgumentParser::NonEmpty<std::string> String5;
+ ArgumentParser::NonEmpty<std::string> String6;
- std::vector<std::string> List1;
- std::vector<std::string> List2;
- std::vector<std::string> List3;
+ ArgumentParser::NonEmpty<std::vector<std::string>> List1;
+ ArgumentParser::NonEmpty<std::vector<std::string>> List2;
+ cm::optional<ArgumentParser::NonEmpty<std::vector<std::string>>> List3;
+ cm::optional<ArgumentParser::NonEmpty<std::vector<std::string>>> List4;
+ cm::optional<ArgumentParser::NonEmpty<std::vector<std::string>>> List5;
+ cm::optional<ArgumentParser::MaybeEmpty<std::vector<std::string>>> List6;
std::vector<std::vector<std::string>> Multi1;
std::vector<std::vector<std::string>> Multi2;
- std::vector<std::vector<std::string>> Multi3;
+ cm::optional<std::vector<std::vector<std::string>>> Multi3;
+ cm::optional<std::vector<std::vector<std::string>>> Multi4;
+
+ cm::optional<std::string> Pos0;
+ cm::optional<std::string> Pos1;
+ cm::optional<std::string> Pos2;
+
+ bool Func0_ = false;
+ ArgumentParser::Continue Func0(cm::string_view)
+ {
+ Func0_ = true;
+ return ArgumentParser::Continue::No;
+ }
+
+ std::string Func1_;
+ ArgumentParser::Continue Func1(cm::string_view arg)
+ {
+ Func1_ = std::string(arg);
+ return ArgumentParser::Continue::No;
+ }
+
+ std::map<std::string, std::vector<std::string>> Func2_;
+ ArgumentParser::Continue Func2(cm::string_view key, cm::string_view arg)
+ {
+ Func2_[std::string(key)].emplace_back(arg);
+ return key == "FUNC_2b" ? ArgumentParser::Continue::Yes
+ : ArgumentParser::Continue::No;
+ }
+
+ std::vector<std::string> Func3_;
+ ArgumentParser::Continue Func3(cm::string_view arg)
+ {
+ Func3_.emplace_back(arg);
+ return ArgumentParser::Continue::Yes;
+ }
+
+ std::map<std::string, std::vector<std::string>> Func4_;
+ ArgumentParser::Continue Func4(cm::string_view key, cm::string_view arg)
+ {
+ Func4_[std::string(key)].emplace_back(arg);
+ return key == "FUNC_4b" ? ArgumentParser::Continue::Yes
+ : ArgumentParser::Continue::No;
+ }
+
+ ArgumentParser::Maybe<std::string> UnboundMaybe{ 'u', 'n', 'b', 'o',
+ 'u', 'n', 'd' };
+ ArgumentParser::MaybeEmpty<std::vector<std::string>> UnboundMaybeEmpty{
+ 1, "unbound"
+ };
+ ArgumentParser::NonEmpty<std::vector<std::string>> UnboundNonEmpty{
+ 1, "unbound"
+ };
+ ArgumentParser::NonEmpty<std::string> UnboundNonEmptyStr{ 'u', 'n', 'b', 'o',
+ 'u', 'n', 'd' };
+
+ std::vector<cm::string_view> ParsedKeywords;
};
std::initializer_list<cm::string_view> const args = {
/* clang-format off */
+ "pos0", // position index 0
"OPTION_1", // option
+ "pos2", // position index 2, ignored because after keyword
+ // "OPTION_2", // option that is not present
"STRING_1", // string arg missing value
- "STRING_2", "foo", "bar", // string arg + unparsed value
+ "STRING_2", "foo", "bar", // string arg + unparsed value, presence captured
+ // "STRING_3", // string arg that is not present
+ "STRING_4", // string arg allowed to be missing value
+ "STRING_5", "foo", // string arg that is not empty
+ "STRING_6", "", // string arg that is empty
"LIST_1", // list arg missing values
"LIST_2", "foo", "bar", // list arg with 2 elems
"LIST_3", "bar", // list arg ...
"LIST_3", "foo", // ... with continuation
+ "LIST_4", // list arg missing values, presence captured
+ // "LIST_5", // list arg that is not present
+ "LIST_6", // list arg allowed to be empty
"MULTI_2", // multi list with 0 lists
"MULTI_3", "foo", "bar", // multi list with first list with two elems
"MULTI_3", "bar", "foo", // multi list with second list with two elems
+ // "MULTI_4", // multi list arg that is not present
+ "FUNC_0", // callback arg missing value
+ "FUNC_1", "foo", "ign1", // callback with one arg + unparsed value
+ "FUNC_2a", "foo", "ign2", // callback with keyword-dependent arg count
+ "FUNC_2b", "bar", "zot", // callback with keyword-dependent arg count
+ "FUNC_3", "foo", "bar", // callback with list arg ...
+ "FUNC_4a", "foo", "ign4", // callback with keyword-dependent arg count
+ "FUNC_4b", "bar", "zot", // callback with keyword-dependent arg count
/* clang-format on */
};
bool verifyResult(Result const& result,
- std::vector<std::string> const& unparsedArguments,
- std::vector<std::string> const& keywordsMissingValue)
+ std::vector<std::string> const& unparsedArguments)
{
static std::vector<std::string> const foobar = { "foo", "bar" };
static std::vector<std::string> const barfoo = { "bar", "foo" };
- static std::vector<std::string> const missing = { "STRING_1", "LIST_1" };
+ static std::vector<std::string> const unbound = { "unbound" };
+ static std::vector<cm::string_view> const parsedKeywords = {
+ /* clang-format off */
+ "OPTION_1",
+ "STRING_1",
+ "STRING_2",
+ "STRING_4",
+ "STRING_5",
+ "STRING_6",
+ "LIST_1",
+ "LIST_2",
+ "LIST_3",
+ "LIST_3",
+ "LIST_4",
+ "LIST_6",
+ "MULTI_2",
+ "MULTI_3",
+ "MULTI_3",
+ "FUNC_0",
+ "FUNC_1",
+ "FUNC_2a",
+ "FUNC_2b",
+ "FUNC_3",
+ "FUNC_4a",
+ "FUNC_4b",
+ /* clang-format on */
+ };
+ static std::map<std::string, std::vector<std::string>> const func2map = {
+ { "FUNC_2a", { "foo" } }, { "FUNC_2b", { "bar", "zot" } }
+ };
+ static std::map<std::string, std::vector<std::string>> const func4map = {
+ { "FUNC_4a", { "foo" } }, { "FUNC_4b", { "bar", "zot" } }
+ };
+ static std::map<cm::string_view, std::string> const keywordErrors = {
+ { "STRING_1"_s, " missing required value\n" },
+ { "STRING_6"_s, " empty string not allowed\n" },
+ { "LIST_1"_s, " missing required value\n" },
+ { "LIST_4"_s, " missing required value\n" },
+ { "FUNC_0"_s, " missing required value\n" }
+ };
+ static std::vector<std::string> const unparsed = { "pos2", "bar", "ign1",
+ "ign2", "ign4" };
#define ASSERT_TRUE(x) \
do { \
@@ -61,26 +186,63 @@ bool verifyResult(Result const& result,
} \
} while (false)
+ ASSERT_TRUE(!result);
+
ASSERT_TRUE(result.Option1);
ASSERT_TRUE(!result.Option2);
ASSERT_TRUE(result.String1.empty());
- ASSERT_TRUE(result.String2 == "foo");
+ ASSERT_TRUE(result.String2);
+ ASSERT_TRUE(*result.String2 == "foo");
+ ASSERT_TRUE(!result.String3);
+ ASSERT_TRUE(result.String4.empty());
+ ASSERT_TRUE(result.String5 == "foo");
+ ASSERT_TRUE(result.String6.empty());
ASSERT_TRUE(result.List1.empty());
ASSERT_TRUE(result.List2 == foobar);
- ASSERT_TRUE(result.List3 == barfoo);
+ ASSERT_TRUE(result.List3);
+ ASSERT_TRUE(*result.List3 == barfoo);
+ ASSERT_TRUE(result.List4);
+ ASSERT_TRUE(result.List4->empty());
+ ASSERT_TRUE(!result.List5);
+ ASSERT_TRUE(result.List6);
+ ASSERT_TRUE(result.List6->empty());
ASSERT_TRUE(result.Multi1.empty());
ASSERT_TRUE(result.Multi2.size() == 1);
ASSERT_TRUE(result.Multi2[0].empty());
- ASSERT_TRUE(result.Multi3.size() == 2);
- ASSERT_TRUE(result.Multi3[0] == foobar);
- ASSERT_TRUE(result.Multi3[1] == barfoo);
+ ASSERT_TRUE(result.Multi3);
+ ASSERT_TRUE((*result.Multi3).size() == 2);
+ ASSERT_TRUE((*result.Multi3)[0] == foobar);
+ ASSERT_TRUE((*result.Multi3)[1] == barfoo);
+ ASSERT_TRUE(!result.Multi4);
+
+ ASSERT_TRUE(result.Pos0 == "pos0");
+ ASSERT_TRUE(!result.Pos1);
+ ASSERT_TRUE(!result.Pos2);
+
+ ASSERT_TRUE(result.Func0_ == false);
+ ASSERT_TRUE(result.Func1_ == "foo");
+ ASSERT_TRUE(result.Func2_ == func2map);
+ ASSERT_TRUE(result.Func3_ == foobar);
+ ASSERT_TRUE(result.Func4_ == func4map);
+
+ ASSERT_TRUE(unparsedArguments == unparsed);
- ASSERT_TRUE(unparsedArguments.size() == 1);
- ASSERT_TRUE(unparsedArguments[0] == "bar");
- ASSERT_TRUE(keywordsMissingValue == missing);
+ ASSERT_TRUE(result.UnboundMaybe == "unbound");
+ ASSERT_TRUE(result.UnboundMaybeEmpty == unbound);
+ ASSERT_TRUE(result.UnboundNonEmpty == unbound);
+ ASSERT_TRUE(result.UnboundNonEmptyStr == "unbound");
+
+ ASSERT_TRUE(result.ParsedKeywords == parsedKeywords);
+
+ ASSERT_TRUE(result.GetKeywordErrors().size() == keywordErrors.size());
+ for (auto const& ke : result.GetKeywordErrors()) {
+ auto const ki = keywordErrors.find(ke.first);
+ ASSERT_TRUE(ki != keywordErrors.end());
+ ASSERT_TRUE(ke.second == ki->second);
+ }
return true;
}
@@ -89,45 +251,116 @@ bool testArgumentParserDynamic()
{
Result result;
std::vector<std::string> unparsedArguments;
- std::vector<std::string> keywordsMissingValue;
-
- cmArgumentParser<void>{}
- .Bind("OPTION_1"_s, result.Option1)
- .Bind("OPTION_2"_s, result.Option2)
- .Bind("STRING_1"_s, result.String1)
- .Bind("STRING_2"_s, result.String2)
- .Bind("LIST_1"_s, result.List1)
- .Bind("LIST_2"_s, result.List2)
- .Bind("LIST_3"_s, result.List3)
- .Bind("MULTI_1"_s, result.Multi1)
- .Bind("MULTI_2"_s, result.Multi2)
- .Bind("MULTI_3"_s, result.Multi3)
- .Parse(args, &unparsedArguments, &keywordsMissingValue);
-
- return verifyResult(result, unparsedArguments, keywordsMissingValue);
+
+ std::function<ArgumentParser::Continue(cm::string_view, cm::string_view)>
+ func4 = [&result](cm::string_view key,
+ cm::string_view arg) -> ArgumentParser::Continue {
+ return result.Func4(key, arg);
+ };
+
+ static_cast<ArgumentParser::ParseResult&>(result) =
+ cmArgumentParser<void>{}
+ .Bind(0, result.Pos0)
+ .Bind(1, result.Pos1)
+ .Bind(2, result.Pos2)
+ .Bind("OPTION_1"_s, result.Option1)
+ .Bind("OPTION_2"_s, result.Option2)
+ .Bind("STRING_1"_s, result.String1)
+ .Bind("STRING_2"_s, result.String2)
+ .Bind("STRING_3"_s, result.String3)
+ .Bind("STRING_4"_s, result.String4)
+ .Bind("STRING_5"_s, result.String5)
+ .Bind("STRING_6"_s, result.String6)
+ .Bind("LIST_1"_s, result.List1)
+ .Bind("LIST_2"_s, result.List2)
+ .Bind("LIST_3"_s, result.List3)
+ .Bind("LIST_4"_s, result.List4)
+ .Bind("LIST_5"_s, result.List5)
+ .Bind("LIST_6"_s, result.List6)
+ .Bind("MULTI_1"_s, result.Multi1)
+ .Bind("MULTI_2"_s, result.Multi2)
+ .Bind("MULTI_3"_s, result.Multi3)
+ .Bind("MULTI_4"_s, result.Multi4)
+ .Bind("FUNC_0"_s,
+ [&result](cm::string_view arg) -> ArgumentParser::Continue {
+ return result.Func0(arg);
+ })
+ .Bind("FUNC_1"_s,
+ [&result](cm::string_view arg) -> ArgumentParser::Continue {
+ return result.Func1(arg);
+ })
+ .Bind("FUNC_2a"_s,
+ [&result](cm::string_view key, cm::string_view arg)
+ -> ArgumentParser::Continue { return result.Func2(key, arg); })
+ .Bind("FUNC_2b"_s,
+ [&result](cm::string_view key, cm::string_view arg)
+ -> ArgumentParser::Continue { return result.Func2(key, arg); })
+ .Bind("FUNC_3"_s,
+ [&result](cm::string_view arg) -> ArgumentParser::Continue {
+ return result.Func3(arg);
+ })
+ .Bind("FUNC_4a"_s, func4)
+ .Bind("FUNC_4b"_s, func4)
+ .BindParsedKeywords(result.ParsedKeywords)
+ .Parse(args, &unparsedArguments);
+
+ return verifyResult(result, unparsedArguments);
}
+static auto const parserStaticFunc4 =
+ [](Result& result, cm::string_view key,
+ cm::string_view arg) -> ArgumentParser::Continue {
+ return result.Func4(key, arg);
+};
+static auto const parserStatic = //
+ cmArgumentParser<Result>{}
+ .Bind(0, &Result::Pos0)
+ .Bind(1, &Result::Pos1)
+ .Bind(2, &Result::Pos2)
+ .Bind("OPTION_1"_s, &Result::Option1)
+ .Bind("OPTION_2"_s, &Result::Option2)
+ .Bind("STRING_1"_s, &Result::String1)
+ .Bind("STRING_2"_s, &Result::String2)
+ .Bind("STRING_3"_s, &Result::String3)
+ .Bind("STRING_4"_s, &Result::String4)
+ .Bind("STRING_5"_s, &Result::String5)
+ .Bind("STRING_6"_s, &Result::String6)
+ .Bind("LIST_1"_s, &Result::List1)
+ .Bind("LIST_2"_s, &Result::List2)
+ .Bind("LIST_3"_s, &Result::List3)
+ .Bind("LIST_4"_s, &Result::List4)
+ .Bind("LIST_5"_s, &Result::List5)
+ .Bind("LIST_6"_s, &Result::List6)
+ .Bind("MULTI_1"_s, &Result::Multi1)
+ .Bind("MULTI_2"_s, &Result::Multi2)
+ .Bind("MULTI_3"_s, &Result::Multi3)
+ .Bind("MULTI_4"_s, &Result::Multi4)
+ .Bind("FUNC_0"_s, &Result::Func0)
+ .Bind("FUNC_1"_s, &Result::Func1)
+ .Bind("FUNC_2a"_s, &Result::Func2)
+ .Bind("FUNC_2b"_s, &Result::Func2)
+ .Bind("FUNC_3"_s,
+ [](Result& result, cm::string_view arg) -> ArgumentParser::Continue {
+ return result.Func3(arg);
+ })
+ .Bind("FUNC_4a"_s, parserStaticFunc4)
+ .Bind("FUNC_4b"_s, parserStaticFunc4)
+ .BindParsedKeywords(&Result::ParsedKeywords)
+ /* keep semicolon on own line */;
+
bool testArgumentParserStatic()
{
- static auto const parser = //
- cmArgumentParser<Result>{}
- .Bind("OPTION_1"_s, &Result::Option1)
- .Bind("OPTION_2"_s, &Result::Option2)
- .Bind("STRING_1"_s, &Result::String1)
- .Bind("STRING_2"_s, &Result::String2)
- .Bind("LIST_1"_s, &Result::List1)
- .Bind("LIST_2"_s, &Result::List2)
- .Bind("LIST_3"_s, &Result::List3)
- .Bind("MULTI_1"_s, &Result::Multi1)
- .Bind("MULTI_2"_s, &Result::Multi2)
- .Bind("MULTI_3"_s, &Result::Multi3);
-
std::vector<std::string> unparsedArguments;
- std::vector<std::string> keywordsMissingValue;
- Result const result =
- parser.Parse(args, &unparsedArguments, &keywordsMissingValue);
+ Result const result = parserStatic.Parse(args, &unparsedArguments);
+ return verifyResult(result, unparsedArguments);
+}
- return verifyResult(result, unparsedArguments, keywordsMissingValue);
+bool testArgumentParserStaticBool()
+{
+ std::vector<std::string> unparsedArguments;
+ Result result;
+ ASSERT_TRUE(parserStatic.Parse(result, args, &unparsedArguments) == false);
+ return verifyResult(result, unparsedArguments);
}
} // namespace
@@ -144,5 +377,10 @@ int testArgumentParser(int /*unused*/, char* /*unused*/ [])
return -1;
}
+ if (!testArgumentParserStaticBool()) {
+ std::cout << "While executing testArgumentParserStaticBool().\n";
+ return -1;
+ }
+
return 0;
}
diff --git a/Tests/CMakeLib/testCMExtEnumSet.cxx b/Tests/CMakeLib/testCMExtEnumSet.cxx
index 64c437b29..dbb0a542e 100644
--- a/Tests/CMakeLib/testCMExtEnumSet.cxx
+++ b/Tests/CMakeLib/testCMExtEnumSet.cxx
@@ -191,6 +191,15 @@ void testEdition()
++failed;
}
}
+ {
+ cm::enum_set<Test> testSet1;
+ cm::enum_set<Test> testSet2{ Test::A, Test::C, Test::B };
+
+ testSet1 = { Test::A, Test::C, Test::B };
+ if (testSet1.size() != 3 || testSet1 != testSet2) {
+ ++failed;
+ }
+ }
}
}
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 3e400c2f3..6e35df90d 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -40,10 +40,10 @@ set(ENV{HOME} \"${TEST_HOME}\")
endif()
# Suppress generator deprecation warnings in test suite.
-if(CMAKE_GENERATOR MATCHES "^Visual Studio 10 2010")
- set(TEST_WARN_VS10_CODE "set(ENV{CMAKE_WARN_VS10} OFF)")
+if(CMAKE_GENERATOR MATCHES "^Visual Studio 11 2012")
+ set(TEST_WARN_VS11_CODE "set(ENV{CMAKE_WARN_VS11} OFF)")
else()
- set(TEST_WARN_VS10_CODE "")
+ set(TEST_WARN_VS11_CODE "")
endif()
# 3.9 or later provides a definitive answer to whether we are multi-config
@@ -89,7 +89,7 @@ if(BUILD_TESTING)
endif()
endif()
- set(MAKE_IS_GNU )
+ set(MAKE_IS_GNU)
if(CMAKE_MAKE_PROGRAM MATCHES make)
execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} no_such_target --version
RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out)
@@ -101,7 +101,7 @@ if(BUILD_TESTING)
endif()
# some old versions of make simply cannot handle spaces in paths
- if (MAKE_IS_GNU OR
+ if(MAKE_IS_GNU OR
CMAKE_MAKE_PROGRAM MATCHES "nmake|gmake|wmake" OR
CMAKE_GENERATOR MATCHES "Visual Studio|Xcode|Borland|Ninja")
set(MAKE_SUPPORTS_SPACES 1)
@@ -181,7 +181,7 @@ if(BUILD_TESTING)
ERROR_VARIABLE my_err)
string(REGEX REPLACE "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Wow6432Node\\\\Microsoft\\\\Windows CE Tools\\\\SDKs\\\\" ";" sdk_list "${sdk_reg}")
list(LENGTH sdk_list sdk_list_len)
- if (${sdk_list_len} GREATER 1)
+ if(${sdk_list_len} GREATER 1)
list(GET sdk_list 1 _sdk) # The first entry is always empty due to the regex replace above
string(STRIP ${_sdk} _sdk) # Make sure there is no newline in the SDK name
endif()
@@ -205,7 +205,7 @@ if(BUILD_TESTING)
select_wince_sdk(reg_wince wince_sdk)
set(reg_tegra "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;sdkRoot]")
set(reg_nasm "[HKEY_CURRENT_USER\\SOFTWARE\\nasm]")
- foreach(reg vs10 vs11 vs12 vs14 ws80 ws81 ws10_0 wp80 wp81 wince tegra nasm)
+ foreach(reg IN ITEMS vs10 vs11 vs12 vs14 ws80 ws81 ws10_0 wp80 wp81 wince tegra nasm)
get_filename_component(r "${reg_${reg}}" ABSOLUTE)
if(IS_DIRECTORY "${r}" AND NOT "${r}" STREQUAL "/registry")
set(${reg} 1)
@@ -227,7 +227,7 @@ if(BUILD_TESTING)
set(vs_versions vs15)
endif()
endif()
- foreach(info ${vs_versions})
+ foreach(info IN LISTS vs_versions)
cmake_host_system_information(RESULT found QUERY "${info_${info}}")
if(found)
set(${info} 1)
@@ -287,12 +287,12 @@ if(BUILD_TESTING)
"Should the long tests be run (such as Bootstrap)." ON)
mark_as_advanced(CMAKE_RUN_LONG_TESTS)
- if (CMAKE_RUN_LONG_TESTS)
+ if(CMAKE_RUN_LONG_TESTS)
option(CTEST_TEST_CTEST
"Should the tests that run a full sub ctest process be run?"
OFF)
mark_as_advanced(CTEST_TEST_CTEST)
- endif ()
+ endif()
option(CTEST_TEST_CPACK
"Should the tests that use '--build-target package' be run?"
@@ -367,9 +367,9 @@ if(BUILD_TESTING)
if(CMake_TEST_RESOURCES)
ADD_TEST_MACRO(VSResource VSResource)
- if (CMAKE_GENERATOR MATCHES "Ninja")
+ if(CMAKE_GENERATOR MATCHES "Ninja")
add_test_macro(VSResourceNinjaForceRSP VSResourceNinjaForceRSP)
- endif ()
+ endif()
endif()
if(_isMultiConfig)
set(MSManifest_CTEST_OPTIONS -C $<CONFIGURATION>)
@@ -394,6 +394,9 @@ if(BUILD_TESTING)
if(CMake_TEST_XCODE_SWIFT)
ADD_TEST_MACRO(SwiftMix SwiftMix)
endif()
+ if(CMAKE_Swift_COMPILER_VERSION VERSION_GREATER_EQUAL 5.1)
+ ADD_TEST_MACRO(SwiftMixLib Swifty)
+ endif()
endif()
if(CMAKE_Fortran_COMPILER)
ADD_TEST_MACRO(FortranOnly FortranOnly)
@@ -431,7 +434,7 @@ if(BUILD_TESTING)
if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])")
ADD_TEST_MACRO(CSharpOnly CSharpOnly)
- if(NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64")
+ if(NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64")
ADD_TEST_MACRO(CSharpLinkToCxx CSharpLinkToCxx)
ADD_TEST_MACRO(CSharpLinkFromCxx CSharpLinkFromCxx)
endif()
@@ -499,7 +502,7 @@ if(BUILD_TESTING)
endif()
ADD_TEST_MACRO(SourcesProperty SourcesProperty)
ADD_TEST_MACRO(SourceFileProperty SourceFileProperty)
- if (NOT CMAKE_GENERATOR STREQUAL "Xcode")
+ if(NOT CMAKE_GENERATOR STREQUAL "Xcode")
ADD_TEST_MACRO(SourceFileIncludeDirProperty SourceFileIncludeDirProperty)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "LCC" OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
@@ -618,6 +621,11 @@ if(BUILD_TESTING)
set(Module.CheckIPOSupported-CXX_BUILD_OPTIONS -DCMake_TEST_IPO_WORKS_CXX=${CMake_TEST_IPO_WORKS_CXX})
ADD_TEST_MACRO(Module.CheckIPOSupported-CXX CheckIPOSupported-CXX)
+ if(CMake_TEST_CUDA)
+ ADD_TEST_MACRO(Module.CheckIPOSupported-CUDA CheckIPOSupported-CUDA)
+ set_property(TEST Module.CheckIPOSupported-CUDA APPEND PROPERTY LABELS "CUDA")
+ endif()
+
if(CMAKE_Fortran_COMPILER)
set(Module.CheckIPOSupported-Fortran_BUILD_OPTIONS -DCMake_TEST_IPO_WORKS_Fortran=${CMake_TEST_IPO_WORKS_Fortran})
ADD_TEST_MACRO(Module.CheckIPOSupported-Fortran CheckIPOSupported-Fortran)
@@ -641,11 +649,11 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(Module.WriteCompilerDetectionHeader WriteCompilerDetectionHeader)
- if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "LCC")
+ if(APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "LCC")
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-fPIE run_pic_test)
else()
- if (CMAKE_CXX_COMPILER_ID MATCHES "PGI"
+ if(CMAKE_CXX_COMPILER_ID MATCHES "PGI"
OR CMAKE_CXX_COMPILER_ID MATCHES "PathScale"
OR CMAKE_CXX_COMPILER_ID MATCHES "Intel")
set(run_pic_test 0)
@@ -654,7 +662,7 @@ if(BUILD_TESTING)
endif()
endif()
- if (run_pic_test)
+ if(run_pic_test)
ADD_TEST_MACRO(PositionIndependentTargets PositionIndependentTargets)
endif()
@@ -725,13 +733,15 @@ if(BUILD_TESTING)
# mainly it tests that cmake doesn't crash when generating these project files.
if(CMAKE_GENERATOR MATCHES "^(Unix Makefiles|Ninja)$"
AND NOT "${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
- foreach(extraGenerator
+ foreach(
+ extraGenerator
+ IN ITEMS
"CodeBlocks"
"CodeLite"
"Eclipse CDT4"
"Kate"
"Sublime Text 2"
- )
+ )
string(REPLACE " " "" extraGeneratorTestName "Simple_${extraGenerator}Generator")
add_test(${extraGeneratorTestName} ${CMAKE_CTEST_COMMAND}
--build-and-test
@@ -786,7 +796,7 @@ if(BUILD_TESTING)
--build-exe-dir "${CMake_BINARY_DIR}/Tests/SubProject/foo"
--test-command foo
)
- set_tests_properties ( SubProject-Stage2 PROPERTIES DEPENDS SubProject)
+ set_tests_properties(SubProject-Stage2 PROPERTIES DEPENDS SubProject)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubProject")
endif()
@@ -1056,8 +1066,11 @@ if(BUILD_TESTING)
endif()
endif()
if(NSIS_MAKENSIS_EXECUTABLE)
- set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS}
- -DCPACK_BINARY_NSIS:BOOL=ON)
+ execute_process(COMMAND ${NSIS_MAKENSIS_EXECUTABLE} "-VERSION" ERROR_QUIET OUTPUT_QUIET RESULT_VARIABLE NSIS_OK)
+ if("${NSIS_OK}" STREQUAL "0")
+ set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS}
+ -DCPACK_BINARY_NSIS:BOOL=ON)
+ endif()
endif()
add_test(CPackComponents ${CMAKE_CTEST_COMMAND}
@@ -1119,7 +1132,7 @@ if(BUILD_TESTING)
set(CPACK_GENERATOR_STRING_${CPackGen} ${CPackGen})
endif()
set(CPackRun_CPackGen "-DCPackGen=${CPACK_GENERATOR_STRING_${CPackGen}}")
- foreach(CPackComponentWay ${CWAYLST})
+ foreach(CPackComponentWay IN LISTS CWAYLST)
set(CPackRun_CPackComponentWay "-DCPackComponentWay=${CPackComponentWay}")
add_test(CPackComponentsForAll-${CPackGen}-${CPackComponentWay}
${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
@@ -1153,7 +1166,6 @@ if(BUILD_TESTING)
"components-source"
"components-shlibdeps1"
"components-depend1"
- "components-depend2"
"compression")
# Run additional tests if dpkg-shlibdeps is available (and is new enough version)
find_program(SHLIBDEPS_EXECUTABLE NAMES dpkg-shlibdeps)
@@ -1173,6 +1185,11 @@ if(BUILD_TESTING)
list(APPEND DEB_CONFIGURATIONS_TO_TEST "shlibdeps-with-private-lib-failure"
"shlibdeps-with-private-lib-success")
endif()
+ # Check if distro has symbols or shlibs data
+ file(GLOB SHLIBS_FILES_EXIST "/var/lib/dpkg/info/*.shlibs" "/var/lib/dpkg/info/*.symbols")
+ if(SHLIBS_FILES_EXIST)
+ list(APPEND DEB_CONFIGURATIONS_TO_TEST "components-depend2")
+ endif()
endif()
set(CPackGen "DEB")
@@ -1338,7 +1355,7 @@ if(BUILD_TESTING)
--test-command complex)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ComplexOneConfig")
# because of the registry write these tests depend on each other
- set_tests_properties ( complex PROPERTIES DEPENDS complexOneConfig)
+ set_tests_properties(complex PROPERTIES DEPENDS complexOneConfig)
add_test(Environment ${CMAKE_CTEST_COMMAND}
--build-and-test
@@ -1421,62 +1438,66 @@ if(BUILD_TESTING)
endif()
# test for Find modules, simple cases
- foreach(_mod IN ITEMS
- ALSA
- Boost
- BLAS
- BZip2
- CURL
- Cups
- Doxygen
- DevIL
- EnvModules
- EXPAT
- Fontconfig
- Freetype
- GDAL
- GIF
- Git
- GLEW
- GLUT
- GnuTLS
- GSL
- GTK2
- Iconv
- ICU
- Intl
- Jasper
- JNI
- JPEG
- JsonCpp
- LAPACK
- LibArchive
- LibLZMA
- LibRHash
- Libinput
- LibUV
- LibXml2
- LibXslt
- LTTngUST
- ODBC
- OpenACC
- OpenCL
- OpenGL
- OpenMP
- OpenSSL
- MPI
- PNG
- Patch
- PostgreSQL
- Protobuf
- SDL
- SQLite3
- TIFF
- Vulkan
- X11
- XalanC
- XercesC
- )
+ foreach(
+ _mod
+ IN ITEMS
+ ALSA
+ BLAS
+ Boost
+ BZip2
+ Cups
+ CURL
+ DevIL
+ Doxygen
+ EnvModules
+ EXPAT
+ Fontconfig
+ Freetype
+ GDAL
+ GIF
+ Git
+ GLEW
+ GLUT
+ GnuTLS
+ GSL
+ GTK2
+ Iconv
+ ICU
+ Intl
+ Jasper
+ JNI
+ JPEG
+ JsonCpp
+ LAPACK
+ LibArchive
+ Libinput
+ LibLZMA
+ LibRHash
+ LibUV
+ LibXml2
+ LibXslt
+ LTTngUST
+ MPI
+ ODBC
+ OpenACC
+ OpenAL
+ OpenCL
+ OpenGL
+ OpenMP
+ OpenSP
+ OpenSSL
+ Patch
+ PNG
+ PostgreSQL
+ Protobuf
+ SDL
+ SQLite3
+ TIFF
+ Vulkan
+ X11
+ XalanC
+ XercesC
+ )
if(CMake_TEST_Find${_mod})
add_subdirectory(Find${_mod})
endif()
@@ -1522,7 +1543,7 @@ if(BUILD_TESTING)
# CMake_TEST_FindMatlab_MCR_ROOT_DIR: indicates an optional root directory for the MCR, required on Linux
if(CMake_TEST_FindMatlab OR CMake_TEST_FindMatlab_ROOT_DIR OR
CMake_TEST_FindMatlab_MCR OR CMake_TEST_FindMatlab_MCR_ROOT_DIR)
- set(FindMatlab_additional_test_options )
+ set(FindMatlab_additional_test_options)
if(CMake_TEST_FindMatlab_MCR OR CMake_TEST_FindMatlab_MCR_ROOT_DIR)
set(FindMatlab_additional_test_options -DIS_MCR=TRUE)
endif()
@@ -1556,7 +1577,7 @@ if(BUILD_TESTING)
endif()
set(ExternalProject_BUILD_OPTIONS "")
- foreach(vcs CVS SVN GIT HG)
+ foreach(vcs IN ITEMS CVS SVN GIT HG)
if(DEFINED CMake_TEST_ExternalProject_${vcs})
list(APPEND ExternalProject_BUILD_OPTIONS -DEP_TEST_${vcs}=${CMake_TEST_ExternalProject_${vcs}})
endif()
@@ -1656,7 +1677,8 @@ if(BUILD_TESTING)
RUN_SERIAL 1
TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}
WORKING_DIRECTORY ${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate
- DEPENDS ExternalProjectUpdateSetup )
+ DEPENDS ExternalProjectUpdateSetup
+ )
execute_process(
COMMAND ${CMAKE_COMMAND}
@@ -1711,7 +1733,7 @@ if(BUILD_TESTING)
function(add_tutorial_test step_name use_mymath tutorial_arg pass_regex)
set(tutorial_test_name Tutorial${step_name})
set(tutorial_build_dir "${CMake_BINARY_DIR}/Tests/Tutorial/${step_name}")
- if (use_mymath)
+ if(use_mymath)
set(tutorial_build_options "")
else()
set(tutorial_test_name ${tutorial_test_name}_MYMATH)
@@ -1735,7 +1757,7 @@ if(BUILD_TESTING)
if(NOT CMake_TEST_EXTERNAL_CMAKE)
foreach(STP RANGE 2 12)
- if (STP EQUAL 6)
+ if(STP EQUAL 8)
set(pass_regex ".*using log and exp")
else()
set(pass_regex "The square root of 25 is 5")
@@ -1994,11 +2016,11 @@ if(BUILD_TESTING)
--test-command Exec2
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkLineOrder")
- set_tests_properties ( qtwrapping PROPERTIES DEPENDS wrapping)
- set_tests_properties ( testdriver1 PROPERTIES DEPENDS qtwrapping)
- set_tests_properties ( testdriver2 PROPERTIES DEPENDS testdriver1)
- set_tests_properties ( testdriver3 PROPERTIES DEPENDS testdriver2)
- set_tests_properties ( linkorder2 PROPERTIES DEPENDS linkorder1)
+ set_tests_properties(qtwrapping PROPERTIES DEPENDS wrapping)
+ set_tests_properties(testdriver1 PROPERTIES DEPENDS qtwrapping)
+ set_tests_properties(testdriver2 PROPERTIES DEPENDS testdriver1)
+ set_tests_properties(testdriver3 PROPERTIES DEPENDS testdriver2)
+ set_tests_properties(linkorder2 PROPERTIES DEPENDS linkorder1)
# Test static linking on toolchains known to support it.
if((CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "LCC")
@@ -2030,9 +2052,9 @@ if(BUILD_TESTING)
"${CMake_BINARY_DIR}/Tests/SubDirSpaces/testfromsubdir.obj"
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDirSpaces")
- endif ()
+ endif()
- if (WIN32)
+ if(WIN32)
add_test(SubDir ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/SubDir"
@@ -2044,7 +2066,7 @@ if(BUILD_TESTING)
"${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere"
"${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.obj"
)
- else ()
+ else()
add_test(SubDir ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/SubDir"
@@ -2056,7 +2078,7 @@ if(BUILD_TESTING)
"${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere"
"${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.o"
)
- endif ()
+ endif()
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDir")
if(MSVC OR (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_SIMULATE_ID STREQUAL "MSVC"))
@@ -2067,6 +2089,15 @@ if(BUILD_TESTING)
if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM")
ADD_TEST_MACRO(PrecompiledHeader foo)
endif()
+
+ set(MSVCDebugInformationFormat_BUILD_OPTIONS -DCMake_TEST_CUDA=${CMake_TEST_CUDA})
+ if(CMAKE_Fortran_COMPILER)
+ list(APPEND MSVCDebugInformationFormat_BUILD_OPTIONS -DCMake_TEST_Fortran=1)
+ endif()
+ ADD_TEST_MACRO(MSVCDebugInformationFormat)
+ set_property(TEST MSVCDebugInformationFormat APPEND
+ PROPERTY LABELS "CUDA")
+
set(MSVCRuntimeLibrary_BUILD_OPTIONS -DCMake_TEST_CUDA=${CMake_TEST_CUDA})
ADD_TEST_MACRO(MSVCRuntimeLibrary)
set_property(TEST MSVCRuntimeLibrary APPEND
@@ -2080,7 +2111,7 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(ModuleDefinition example_exe)
endif()
- if (CMAKE_C_COMPILER_ID MATCHES "Watcom" AND WIN32)
+ if(CMAKE_C_COMPILER_ID MATCHES "Watcom" AND WIN32)
ADD_TEST_MACRO(WatcomRuntimeLibrary)
endif()
@@ -2116,7 +2147,7 @@ if(BUILD_TESTING)
if(MSVC AND NOT MSVC_VERSION LESS 1310
AND (NOT CMAKE_GENERATOR MATCHES "Visual Studio 9 "
OR CMAKE_SIZEOF_VOID_P EQUAL 4)
- AND (NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64")
+ AND (NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64")
)
ADD_TEST_MACRO(VSMASM VSMASM)
endif()
@@ -2128,7 +2159,7 @@ if(BUILD_TESTING)
if(NOT "${CMAKE_GENERATOR}" MATCHES "Visual Studio 9 "
AND NOT CMAKE_GENERATOR_TOOLSET STREQUAL "v90"
- AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64")
+ AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64")
ADD_TEST_MACRO(VSWindowsFormsResx VSWindowsFormsResx)
ADD_TEST_MACRO(VSManagedCustomCommand)
endif()
@@ -2157,7 +2188,7 @@ if(BUILD_TESTING)
# The test (and tested property) works with .sln files, so it's skipped when:
# * cmake --build is set up to use MSBuild, since the MSBuild invocation does not use the .sln file
set(_last_test "")
- foreach(config ${CMAKE_CONFIGURATION_TYPES})
+ foreach(config IN LISTS CMAKE_CONFIGURATION_TYPES)
add_test(NAME VSExcludeFromDefaultBuild-${config} COMMAND ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/VSExcludeFromDefaultBuild"
@@ -2295,7 +2326,7 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(VSNASM VSNASM)
endif()
- if (CMake_TEST_GreenHillsMULTI)
+ if(CMake_TEST_GreenHillsMULTI)
macro(add_test_GhsMulti test_name test_dir bin_sub_dir build_opts)
separate_arguments(_ghs_build_opts UNIX_COMMAND ${build_opts})
separate_arguments(_ghs_toolset_extra UNIX_COMMAND ${ghs_toolset_extra})
@@ -2356,7 +2387,7 @@ if(BUILD_TESTING)
set(ghs_config_name "__default__")
endif()
# test integrity build
- if (NOT ghs_skip_integrity AND (NOT ghs_target_platform OR ghs_target_platform MATCHES "integrity"))
+ if(NOT ghs_skip_integrity AND (NOT ghs_target_platform OR ghs_target_platform MATCHES "integrity"))
add_test_GhsMulti(integrityDDInt GhsMultiIntegrity/GhsMultiIntegrityDDInt "" "")
add_test_GhsMulti(integrityMonolith GhsMultiIntegrity/GhsMultiIntegrityMonolith "" "")
add_test_GhsMulti(integrityDD GhsMultiIntegrity/GhsMultiIntegrityDD "" "")
@@ -2412,9 +2443,6 @@ if(BUILD_TESTING)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSAndroid/${name}")
endmacro()
if(tegra AND NOT "${CMake_SOURCE_DIR};${CMake_BINARY_DIR}" MATCHES " ")
- if(vs10)
- add_test_VSAndroid(vs10 "Visual Studio 10 2010" "Tegra-Android")
- endif()
if(vs11)
add_test_VSAndroid(vs11 "Visual Studio 11 2012" "Tegra-Android")
endif()
@@ -2438,8 +2466,8 @@ if(BUILD_TESTING)
add_test_VSAndroid(vs17 "Visual Studio 17 2022" "ARM")
endif()
- if (APPLE)
- if (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+ if(APPLE)
+ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(BundleTestInstallDir
"${CMake_BINARY_DIR}/Tests/BundleTest/InstallDirectory")
add_test(BundleTest ${CMAKE_CTEST_COMMAND}
@@ -2475,8 +2503,8 @@ if(BUILD_TESTING)
add_subdirectory(ObjC)
add_subdirectory(ObjCXX)
- endif ()
- endif ()
+ endif()
+ endif()
if(APPLE AND CTEST_TEST_CPACK)
add_test(BundleGeneratorTest ${CMAKE_CTEST_COMMAND}
@@ -2667,7 +2695,10 @@ if(BUILD_TESTING)
endif()
if(NOT DEFINED CMake_TEST_CTestUpdate_HG AND HG_EXECUTABLE
AND (UNIX OR NOT "${HG_EXECUTABLE}" MATCHES "cygwin"))
- set(CMake_TEST_CTestUpdate_HG 1)
+ execute_process(COMMAND "${HG_EXECUTABLE}" --version OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE HG_RV)
+ if(HG_RV EQUAL 0)
+ set(CMake_TEST_CTestUpdate_HG 1)
+ endif()
endif()
if(CMake_TEST_CTestUpdate_HG)
if(NOT HG_EXECUTABLE)
@@ -3195,24 +3226,24 @@ if(BUILD_TESTING)
--output-log "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/testOutput.log"
)
- if (CMAKE_TESTS_CDASH_SERVER)
+ if(CMAKE_TESTS_CDASH_SERVER)
set(regex "^([^:]+)://([^/]+)(.*)$")
- if ("${CMAKE_TESTS_CDASH_SERVER}" MATCHES "${regex}")
+ if("${CMAKE_TESTS_CDASH_SERVER}" MATCHES "${regex}")
set(protocol "${CMAKE_MATCH_1}")
set(server "${CMAKE_MATCH_2}")
set(path "${CMAKE_MATCH_3}")
- else ()
+ else()
set(protocol "http")
set(server "open.cdash.org")
set(path "")
message("warning: CMAKE_TESTS_CDASH_SERVER does not match expected regex...")
message(" ...using default url='${protocol}://${server}${path}' for CTestTest[23]")
- endif ()
- endif ()
+ endif()
+ endif()
- if (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS AND CMAKE_TESTS_CDASH_SERVER)
+ if(CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS AND CMAKE_TESTS_CDASH_SERVER)
configure_file("${CMake_SOURCE_DIR}/Tests/CTestTest/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" @ONLY ESCAPE_QUOTES)
add_test(CTestTest ${CMAKE_CTEST_COMMAND}
@@ -3254,19 +3285,19 @@ if(BUILD_TESTING)
# these tests take a long time, make sure they have it
# if timeouts have not already been set
get_test_property(CTestTest TIMEOUT PREVIOUS_TIMEOUT)
- if ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
- set_tests_properties ( CTestTest
+ if("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
+ set_tests_properties(CTestTest
PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
- endif ()
+ endif()
if(NOT CMake_TEST_EXTERNAL_CMAKE)
get_test_property(CTestTest2 TIMEOUT PREVIOUS_TIMEOUT)
if("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
- set_tests_properties ( CTestTest2
+ set_tests_properties(CTestTest2
PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
endif()
endif()
- endif ()
+ endif()
if(CMake_TEST_EXTERNAL_CMAKE)
set(CMAKE_SKIP_BOOTSTRAP_TEST 1)
@@ -3302,10 +3333,9 @@ if(BUILD_TESTING)
# provide more time for the bootstrap test
get_test_property(BootstrapTest TIMEOUT PREVIOUS_TIMEOUT)
- if ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
- set_tests_properties ( BootstrapTest
- PROPERTIES TIMEOUT 5400)
- endif ()
+ if("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
+ set_tests_properties(BootstrapTest PROPERTIES TIMEOUT 5400)
+ endif()
endif()
if(CMAKE_Fortran_COMPILER)
@@ -3369,56 +3399,70 @@ if(BUILD_TESTING)
set(JavaExportImport_BUILD_OPTIONS -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM})
ADD_TEST_MACRO(JavaExportImport JavaExportImport)
- get_filename_component(JNIPATH ${Java_JAVAC_EXECUTABLE} PATH)
+ get_filename_component(JAVACPATH ${Java_JAVAC_EXECUTABLE} REALPATH)
+ get_filename_component(JNIPATH ${JAVACPATH} PATH)
find_file(JNI_H jni.h
"${JNIPATH}/../include"
"${JNIPATH}/../java/include")
if(JNI_H AND EXISTS "${JNI_H}") # in case jni.h is a broken symlink
file(READ "${JNI_H}" JNI_FILE)
if("${JNI_FILE}" MATCHES "JDK1_2")
- add_test(NAME Java.Jar COMMAND ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/Java"
- "${CMake_BINARY_DIR}/Tests/JavaJar"
- ${build_generator_args}
- --build-project hello
- --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJar/"
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>)
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJar")
- # For next tests, java tool must have same architecture as toolchain
- math(EXPR _object_mode "${CMAKE_SIZEOF_VOID_P} * 8")
execute_process(
COMMAND "${Java_JAVA_EXECUTABLE}" -version
OUTPUT_VARIABLE _version ERROR_VARIABLE _version RESULT_VARIABLE _result
)
- if(_result EQUAL 0 AND _version MATCHES "${_object_mode}-Bit")
- ## next test is valid only if Java version is less than 1.10
- if ("${Java_VERSION}" VERSION_LESS 1.10)
- add_test(NAME Java.Javah COMMAND ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/JavaJavah"
- "${CMake_BINARY_DIR}/Tests/JavaJavah"
- ${build_generator_args}
- --build-project helloJavah
- --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJavah/"
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>)
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJavah")
+
+ # E2K has broken Java RVM before 3.5.2
+ if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "e2k" AND _result EQUAL 0)
+ string(REGEX MATCH "RVM ([0-9.]+)" RVMVER "${_version}")
+ # Consider empty match a broken version too
+ if("${CMAKE_MATCH_1}" VERSION_LESS "3.5.2")
+ set(BROKEN_RVM TRUE)
endif()
- ## next test is valid only if Java is, at least, version 1.8
- if (NOT "${Java_VERSION}" VERSION_LESS 1.8)
- add_test(NAME Java.NativeHeaders COMMAND ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/JavaNativeHeaders"
- "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders"
- ${build_generator_args}
- --build-project helloJavaNativeHeaders
- --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders/"
- --build-target install
- --build-options
- "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/JavaNativeHeaders/Install"
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>)
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders")
+ endif()
+
+ if(NOT BROKEN_RVM)
+ add_test(NAME Java.Jar COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/Java"
+ "${CMake_BINARY_DIR}/Tests/JavaJar"
+ ${build_generator_args}
+ --build-project hello
+ --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJar/"
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>)
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJar")
+
+ # For next tests, java tool must have same architecture as toolchain
+ math(EXPR _object_mode "${CMAKE_SIZEOF_VOID_P} * 8")
+ if(_result EQUAL 0 AND _version MATCHES "${_object_mode}-Bit")
+ ## next test is valid only if Java version is less than 1.10
+ if("${Java_VERSION}" VERSION_LESS 1.10)
+ add_test(NAME Java.Javah COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/JavaJavah"
+ "${CMake_BINARY_DIR}/Tests/JavaJavah"
+ ${build_generator_args}
+ --build-project helloJavah
+ --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJavah/"
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>)
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJavah")
+ endif()
+ ## next test is valid only if Java is, at least, version 1.8
+ if(NOT "${Java_VERSION}" VERSION_LESS 1.8)
+ add_test(NAME Java.NativeHeaders COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/JavaNativeHeaders"
+ "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders"
+ ${build_generator_args}
+ --build-project helloJavaNativeHeaders
+ --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders/"
+ --build-target install
+ --build-options
+ "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/JavaNativeHeaders/Install"
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>)
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders")
+ endif()
endif()
endif()
endif()
@@ -3480,18 +3524,18 @@ if(BUILD_TESTING)
endif()
if(CMAKE_TEST_PLPLOT_DIR)
- add_test(plplot ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_PLPLOT_DIR}/../../EasyDashboardScripts/plplot.cmake )
+ add_test(plplot ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_PLPLOT_DIR}/../../EasyDashboardScripts/plplot.cmake)
set_tests_properties ( plplot PROPERTIES TIMEOUT 5400)
endif()
if(CMAKE_TEST_CHICKEN_DIR)
- add_test(Chicken ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_CHICKEN_DIR}/../../EasyDashboardScripts/Chicken.cmake )
- set_tests_properties ( Chicken PROPERTIES TIMEOUT 5400)
+ add_test(Chicken ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_CHICKEN_DIR}/../../EasyDashboardScripts/Chicken.cmake)
+ set_tests_properties(Chicken PROPERTIES TIMEOUT 5400)
endif()
if(CMAKE_TEST_KDELIBS_ALPHA_1_DIR)
- add_test(KDELibsAlpha1 ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_KDELIBS_ALPHA_1_DIR}/../../EasyDashboardScripts/kdelibs.cmake )
- set_tests_properties ( KDELibsAlpha1 PROPERTIES TIMEOUT 5400)
+ add_test(KDELibsAlpha1 ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_KDELIBS_ALPHA_1_DIR}/../../EasyDashboardScripts/kdelibs.cmake)
+ set_tests_properties(KDELibsAlpha1 PROPERTIES TIMEOUT 5400)
endif()
# Define a set of "contract" tests, each activated by a cache entry
@@ -3501,11 +3545,7 @@ if(BUILD_TESTING)
# The directory should also contain a Configure.cmake file that
# sets "CMake_TEST_CONTRACT_<project>_<var>" variables to configure
# the code below.
- foreach(project
- PLplot
- Trilinos
- VTK
- )
+ foreach(project IN ITEMS PLplot Trilinos VTK)
if(CMake_TEST_CONTRACT_${project})
include(Contracts/${project}/Configure.cmake)
ADD_TEST_MACRO(Contracts.${project} ${CMake_TEST_CONTRACT_${project}_RUN_TEST})
@@ -3578,6 +3618,14 @@ if(BUILD_TESTING)
add_subdirectory(CMakeGUI)
endif()
+ # Run CheckSourceTree as the very last test in the CMake/CTest/CPack test
+ # suite. It detects if any changes have been made to the CMake source tree
+ # by any previous configure, build or test steps.
+ if(GIT_EXECUTABLE AND EXISTS "${CMake_SOURCE_DIR}/.git"
+ AND NOT "${CMake_SOURCE_DIR}" STREQUAL "${CMake_BINARY_DIR}")
+ add_subdirectory(CheckSourceTree)
+ endif()
+
# If this is not an in-source build, provide a target to wipe out
# all the test build directories. This must come at the end after
# all the above logic has finished adding to TEST_BUILD_DIRS
diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
index 49a4041b2..0907d0381 100644
--- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
+++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
@@ -56,6 +56,15 @@ macro(check_version_string MODULE_NAME VERSION_VAR)
if (NOT _exclude_pos EQUAL -1)
message(STATUS "excluding check of ${VERSION_VAR}='${${VERSION_VAR}}' due to local configuration")
elseif (${MODULE_NAME}_FOUND)
+
+ unset(SKIP_CHECK)
+ if(${MODULE_NAME} STREQUAL "HG")
+ execute_process(COMMAND "${HG_EXECUTABLE}" --version OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE HG_RV)
+ if(NOT HG_RV EQUAL 0)
+ message(WARNING "Broken HG executable detected, skipping")
+ set(SKIP_CHECK TRUE)
+ endif()
+ endif()
if (DEFINED ${VERSION_VAR})
message(STATUS "${VERSION_VAR}='${${VERSION_VAR}}'")
if (NOT ${VERSION_VAR} MATCHES "^[0-9]")
@@ -71,7 +80,9 @@ macro(check_version_string MODULE_NAME VERSION_VAR)
message(SEND_ERROR "unexpected: ${VERSION_VAR} is NOT VERSION_GREATER 0")
endif()
else()
- message(SEND_ERROR "${MODULE_NAME}_FOUND is set but version number variable ${VERSION_VAR} is NOT DEFINED")
+ if(NOT SKIP_CHECK)
+ message(SEND_ERROR "${MODULE_NAME}_FOUND is set but version number variable ${VERSION_VAR} is NOT DEFINED")
+ endif()
endif()
endif ()
endmacro()
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt
index 9e0b89101..bd2dd7e94 100644
--- a/Tests/CMakeTests/CMakeLists.txt
+++ b/Tests/CMakeTests/CMakeLists.txt
@@ -59,18 +59,3 @@ if(GIT_EXECUTABLE)
)
AddCMakeTest(PolicyCheck "${PolicyCheck_PreArgs}")
endif()
-
-# Run CheckSourceTree as the very last test in the CMake/CTest/CPack test
-# suite. It detects if any changes have been made to the CMake source tree
-# by any previous configure, build or test steps.
-#
-if(GIT_EXECUTABLE)
- string(REPLACE "\\" "/" ENV_HOME "$ENV{HOME}")
- set(CheckSourceTree_PreArgs
- "-DCMake_BINARY_DIR:PATH=${CMake_BINARY_DIR}"
- "-DCMake_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}"
- "-DGIT_EXECUTABLE:STRING=${GIT_EXECUTABLE}"
- "-DHOME:STRING=${ENV_HOME}"
- )
- AddCMakeTest(CheckSourceTree "${CheckSourceTree_PreArgs}")
-endif()
diff --git a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
deleted file mode 100644
index 4f2aaea9c..000000000
--- a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
+++ /dev/null
@@ -1,365 +0,0 @@
-# Check the CMake source tree and report anything suspicious...
-#
-message("=============================================================================")
-message("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
-message("")
-message("CMake_BINARY_DIR='${CMake_BINARY_DIR}'")
-message("CMake_SOURCE_DIR='${CMake_SOURCE_DIR}'")
-message("GIT_EXECUTABLE='${GIT_EXECUTABLE}'")
-message("HOME='${HOME}'")
-message("ENV{DASHBOARD_TEST_FROM_CTEST}='$ENV{DASHBOARD_TEST_FROM_CTEST}'")
-message("")
-string(REPLACE "\\" "\\\\" HOME "${HOME}")
-
-
-# Is the build directory the same as or underneath the source directory?
-# (i.e. - is it an "in source" build?)
-#
-set(in_source_build 0)
-set(build_under_source 0)
-
-string(FIND "${CMake_BINARY_DIR}" "${CMake_SOURCE_DIR}/" pos)
-if(pos EQUAL 0)
- message("build dir is *inside* source dir")
- set(build_under_source 1)
-elseif(CMake_SOURCE_DIR STREQUAL "${CMake_BINARY_DIR}")
- message("build dir *is* source dir")
- set(in_source_build 1)
-else()
- string(LENGTH "${CMake_SOURCE_DIR}" src_len)
- string(LENGTH "${CMake_BINARY_DIR}" bin_len)
-
- if(bin_len GREATER src_len)
- math(EXPR substr_len "${src_len}+1")
- string(SUBSTRING "${CMake_BINARY_DIR}" 0 ${substr_len} bin_dir)
- if(bin_dir STREQUAL "${CMake_SOURCE_DIR}/")
- message("build dir is under source dir")
- set(in_source_build 1)
- endif()
- endif()
-endif()
-
-message("src_len='${src_len}'")
-message("bin_len='${bin_len}'")
-message("substr_len='${substr_len}'")
-message("bin_dir='${bin_dir}'")
-message("in_source_build='${in_source_build}'")
-message("build_under_source='${build_under_source}'")
-message("")
-
-if(build_under_source)
- message(STATUS "Skipping rest of test because build tree is under source tree")
- return()
-endif()
-
-# If this does not appear to be a git checkout, just pass the test here
-# and now. (Do not let the test fail if it is run in a tree *exported* from a
-# repository or unpacked from a .zip file source installer...)
-#
-set(is_git_checkout 0)
-if(EXISTS "${CMake_SOURCE_DIR}/.git")
- set(is_git_checkout 1)
-endif()
-
-message("is_git_checkout='${is_git_checkout}'")
-message("")
-
-if(NOT is_git_checkout)
- message("source tree is not a git checkout... test passes by early return...")
- return()
-endif()
-
-# This test looks for the following types of changes in the source tree:
-#
-set(additions 0)
-set(conflicts 0)
-set(modifications 0)
-set(nonadditions 0)
-
-# ov == output variable... conditionally filled in by either git below:
-#
-set(cmd "")
-set(ov "")
-set(ev "")
-set(rv "")
-
-# If no GIT_EXECUTABLE, see if we can figure out which git was used
-# for the ctest_update step on this dashboard...
-#
-if(is_git_checkout AND NOT GIT_EXECUTABLE)
- set(ctest_ini_file "")
- set(exe "")
-
- # Use the old name:
- if(EXISTS "${CMake_BINARY_DIR}/DartConfiguration.tcl")
- set(ctest_ini_file "${CMake_BINARY_DIR}/DartConfiguration.tcl")
- endif()
-
- # But if it exists, prefer the new name:
- if(EXISTS "${CMake_BINARY_DIR}/CTestConfiguration.ini")
- set(ctest_ini_file "${CMake_BINARY_DIR}/CTestConfiguration.ini")
- endif()
-
- # If there is a ctest ini file, read the update command or git command
- # from it:
- #
- if(ctest_ini_file)
- file(STRINGS "${ctest_ini_file}" line REGEX "^GITCommand: (.*)$")
- string(REGEX REPLACE "^GITCommand: (.*)$" "\\1" line "${line}")
- if("${line}" MATCHES "^\"")
- string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}")
- else()
- string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}")
- endif()
- set(exe "${line}")
- if("${exe}" STREQUAL "GITCOMMAND-NOTFOUND")
- set(exe "")
- endif()
- if(exe)
- message("info: GIT_EXECUTABLE set by 'GITCommand:' from '${ctest_ini_file}'")
- endif()
-
- if(NOT exe)
- file(STRINGS "${ctest_ini_file}" line REGEX "^UpdateCommand: (.*)$")
- string(REGEX REPLACE "^UpdateCommand: (.*)$" "\\1" line "${line}")
- if("${line}" MATCHES "^\"")
- string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}")
- else()
- string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}")
- endif()
- set(exe "${line}")
- if("${exe}" STREQUAL "GITCOMMAND-NOTFOUND")
- set(exe "")
- endif()
- if(exe)
- message("info: GIT_EXECUTABLE set by 'UpdateCommand:' from '${ctest_ini_file}'")
- endif()
- endif()
- else()
- message("info: no DartConfiguration.tcl or CTestConfiguration.ini file...")
- endif()
-
- # If we have still not grokked the exe, look in the Update.xml file to see
- # if we can parse it from there...
- #
- if(NOT exe)
- file(GLOB_RECURSE update_xml_file "${CMake_BINARY_DIR}/Testing/Update.xml")
- if(update_xml_file)
- file(STRINGS "${update_xml_file}" line
- REGEX "^.*<UpdateCommand>(.*)</UpdateCommand>$" LIMIT_COUNT 1)
- string(REPLACE "&quot\;" "\"" line "${line}")
- string(REGEX REPLACE "^.*<UpdateCommand>(.*)</UpdateCommand>$" "\\1" line "${line}")
- if("${line}" MATCHES "^\"")
- string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}")
- else()
- string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}")
- endif()
- if(line)
- set(exe "${line}")
- endif()
- if(exe)
- message("info: GIT_EXECUTABLE set by '<UpdateCommand>' from '${update_xml_file}'")
- endif()
- else()
- message("info: no Update.xml file...")
- endif()
- endif()
-
- if(exe)
- set(GIT_EXECUTABLE "${exe}")
- message("GIT_EXECUTABLE='${GIT_EXECUTABLE}'")
- message("")
-
- if(NOT EXISTS "${GIT_EXECUTABLE}")
- message(FATAL_ERROR "GIT_EXECUTABLE does not exist...")
- endif()
- else()
- message(FATAL_ERROR "could not determine GIT_EXECUTABLE...")
- endif()
-endif()
-
-
-if(is_git_checkout AND GIT_EXECUTABLE)
- # Check with "git status" if there are any local modifications to the
- # CMake source tree:
- #
- message("=============================================================================")
- message("This is a git checkout, using git to verify source tree....")
- message("")
-
- execute_process(COMMAND ${GIT_EXECUTABLE} --version
- WORKING_DIRECTORY ${CMake_SOURCE_DIR}
- OUTPUT_VARIABLE version_output
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- message("=== output of 'git --version' ===")
- message("${version_output}")
- message("=== end output ===")
- message("")
-
- execute_process(COMMAND ${GIT_EXECUTABLE} branch -a
- WORKING_DIRECTORY ${CMake_SOURCE_DIR}
- OUTPUT_VARIABLE git_branch_output
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- message("=== output of 'git branch -a' ===")
- message("${git_branch_output}")
- message("=== end output ===")
- message("")
-
- execute_process(COMMAND ${GIT_EXECUTABLE} log -1
- WORKING_DIRECTORY ${CMake_SOURCE_DIR}
- OUTPUT_VARIABLE git_log_output
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- message("=== output of 'git log -1' ===")
- message("${git_log_output}")
- message("=== end output ===")
- message("")
-
- message("Copy/paste this command to reproduce:")
- message("cd \"${CMake_SOURCE_DIR}\" && \"${GIT_EXECUTABLE}\" status")
- message("")
-
- set(cmd ${GIT_EXECUTABLE} status)
-endif()
-
-
-if(cmd)
- # Use the HOME value passed in to the script for calling git so it can
- # find its user/global config settings...
- #
- set(original_ENV_HOME "$ENV{HOME}")
- set(ENV{HOME} "${HOME}")
-
- execute_process(COMMAND ${cmd}
- WORKING_DIRECTORY ${CMake_SOURCE_DIR}
- OUTPUT_VARIABLE ov
- ERROR_VARIABLE ev
- RESULT_VARIABLE rv)
-
- set(ENV{HOME} "${original_ENV_HOME}")
-
- message("Results of running ${cmd}")
- message("rv='${rv}'")
- message("ov='${ov}'")
- message("ev='${ev}'")
- message("")
-
- if(NOT rv STREQUAL 0)
- if(is_git_checkout AND (rv STREQUAL "1"))
- # Many builds of git return "1" from a "nothing is changed" git status call...
- # Do not fail with an error for rv==1 with git...
- else()
- message(FATAL_ERROR "error: ${cmd} attempt failed... (see output above)")
- endif()
- endif()
-else()
- message(FATAL_ERROR "error: no COMMAND to run to analyze source tree...")
-endif()
-
-
-# Analyze output:
-#
-if(NOT ov STREQUAL "")
- string(REPLACE ";" "\\\\;" lines "${ov}")
- string(REPLACE "\n" "E;" lines "${lines}")
-
- foreach(line ${lines})
- message("'${line}'")
-
- # But do not consider files that exist just because some user poked around
- # the file system with Windows Explorer or with the Finder from a Mac...
- # ('Thumbs.db' and '.DS_Store' files...)
- #
- set(consider 1)
- set(ignore_files_regex "^(. |.*(/|\\\\))(\\.DS_Store|Thumbs.db)E$")
- if(line MATCHES "${ignore_files_regex}")
- message(" line matches '${ignore_files_regex}' -- not considered")
- set(consider 0)
- endif()
-
- if(consider)
- if(is_git_checkout)
- if(line MATCHES "^#?[ \t]*modified:")
- message(" locally modified file detected...")
- set(modifications 1)
- endif()
-
- if(line MATCHES "^(# )?Untracked")
- message(" locally non-added file/directory detected...")
- set(nonadditions 1)
- endif()
- endif()
- endif()
- endforeach()
-endif()
-
-
-message("=============================================================================")
-message("additions='${additions}'")
-message("conflicts='${conflicts}'")
-message("modifications='${modifications}'")
-message("nonadditions='${nonadditions}'")
-message("")
-
-
-# Decide if the test passes or fails:
-#
-message("=============================================================================")
-
-if("$ENV{DASHBOARD_TEST_FROM_CTEST}" STREQUAL "")
-
- # developers are allowed to have local additions and modifications...
- message("interactive test run")
- message("")
-
-else()
-
- message("dashboard test run")
- message("")
-
- # but dashboard machines are not allowed to have local additions or modifications...
- if(additions)
- message(FATAL_ERROR "test fails: local source tree additions")
- endif()
-
- if(modifications)
- message(FATAL_ERROR "test fails: local source tree modifications")
- endif()
-
- #
- # It's a dashboard run if ctest was run with '-D ExperimentalTest' or some
- # other -D arg on its command line or if ctest is running a -S script to run
- # a dashboard... Running ctest like that sets the DASHBOARD_TEST_FROM_CTEST
- # env var.
- #
-
-endif()
-
-
-# ...and nobody is allowed to have local non-additions or conflicts...
-# Not even developers.
-#
-if(nonadditions)
- if(in_source_build)
- message("
-warning: test results confounded because this is an 'in-source' build - cannot
-distinguish between non-added files that are in-source build products and
-non-added source files that somebody forgot to 'git add'... - this is only ok
-if this is intentionally an in-source dashboard build... Developers should
-use out-of-source builds to verify a clean source tree with this test...
-
-Allowing test to pass despite the warning message...
-")
- else()
- message(FATAL_ERROR "test fails: local source tree non-additions: use git add before committing, or remove the files from the source tree")
- endif()
-endif()
-
-if(conflicts)
- message(FATAL_ERROR "test fails: local source tree conflicts: resolve before committing")
-endif()
-
-
-# Still here? Good then...
-#
-message("test passes")
-message("")
diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in
index 63c234acf..7acfcd911 100644
--- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in
+++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in
@@ -13,72 +13,84 @@ set(linux64_gcc_text " /usr/lib/gcc/x86_64-linux-gnu/4.3.3/collect2 --eh-frame-h
set(linux64_gcc_libs "gcc;gcc_s;c;gcc;gcc_s")
set(linux64_gcc_dirs "/usr/lib/gcc/x86_64-linux-gnu/4.3.3;/usr/lib;/lib;/usr/lib/x86_64-linux-gnu")
list(APPEND platforms linux64_gcc)
+list(APPEND langs C)
# g++ dummy.cxx -v
set(linux64_g++_text " /usr/lib/gcc/x86_64-linux-gnu/4.3.3/collect2 --eh-frame-hdr -m elf_x86_64 --hash-style=both -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../.. -L/usr/lib/x86_64-linux-gnu /tmp/ccalRBlq.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/4.3.3/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crtn.o")
set(linux64_g++_libs "stdc++;m;gcc_s;gcc;c;gcc_s;gcc")
set(linux64_g++_dirs "/usr/lib/gcc/x86_64-linux-gnu/4.3.3;/usr/lib;/lib;/usr/lib/x86_64-linux-gnu")
list(APPEND platforms linux64_g++)
+list(APPEND langs CXX)
# f95 dummy.f -v
set(linux64_f95_text " /usr/lib/gcc/x86_64-linux-gnu/4.3.3/collect2 --eh-frame-hdr -m elf_x86_64 --hash-style=both -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3 -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../.. -L/usr/lib/x86_64-linux-gnu /tmp/ccAVcN7N.o -lgfortranbegin -lgfortran -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/4.3.3/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/crtn.o")
set(linux64_f95_libs "gfortranbegin;gfortran;m;gcc_s;gcc;c;gcc_s;gcc")
set(linux64_f95_dirs "/usr/lib/gcc/x86_64-linux-gnu/4.3.3;/usr/lib;/lib;/usr/lib/x86_64-linux-gnu")
list(APPEND platforms linux64_f95)
+list(APPEND langs Fortran)
# suncc dummy.c '-#'
set(linux64_suncc_text "/usr/bin/ld --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /opt/sun/sunstudio12/prod/lib/amd64/crti.o /opt/sun/sunstudio12/prod/lib/amd64/crt1x.o /opt/sun/sunstudio12/prod/lib/amd64/values-xa.o dummy.o -Y \"/opt/sun/sunstudio12/prod/lib/amd64:/lib64:/usr/lib64\" -Qy -lc /opt/sun/sunstudio12/prod/lib/amd64/libc_supp.a /opt/sun/sunstudio12/prod/lib/amd64/crtn.o")
set(linux64_suncc_libs "c;/opt/sun/sunstudio12/prod/lib/amd64/libc_supp.a")
set(linux64_suncc_dirs "/opt/sun/sunstudio12/prod/lib/amd64;/lib64;/usr/lib64")
list(APPEND platforms linux64_suncc)
+list(APPEND langs C)
# sunCC dummy.cxx -v
set(linux64_sunCC_text "/opt/sun/sunstudio12/prod/lib/amd64/ld -u __1cH__CimplKcplus_init6F_v_ --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -R/opt/sun/sunstudio12/lib/rw7/amd64:/opt/sun/sunstudio12/lib/amd64:/opt/sun/sunstudio12/rtlibs/amd64:/opt/sun/lib/rtlibs/amd64:/opt/SUNWspro/lib/amd64:/lib64:/usr/lib64 -o a.out /opt/sun/sunstudio12/prod/lib/amd64/crti.o /opt/sun/sunstudio12/prod/lib/amd64/CCrti.o /opt/sun/sunstudio12/prod/lib/amd64/crt1x.o -Y P,/opt/sun/sunstudio12/lib/rw7/amd64:/opt/sun/sunstudio12/lib/amd64:/opt/sun/sunstudio12/rtlibs/amd64:/opt/sun/sunstudio12/prod/lib/rw7/amd64:/opt/sun/sunstudio12/prod/lib/amd64:/lib64:/usr/lib64 dummy.o -lCstd -lCrun -lm -lc /opt/sun/sunstudio12/prod/lib/amd64/libc_supp.a /opt/sun/sunstudio12/prod/lib/amd64/CCrtn.o /opt/sun/sunstudio12/prod/lib/amd64/crtn.o >&/tmp/ld.04973.2.err")
set(linux64_sunCC_libs "Cstd;Crun;m;c;/opt/sun/sunstudio12/prod/lib/amd64/libc_supp.a")
set(linux64_sunCC_dirs "/opt/sun/sunstudio12/lib/rw7/amd64;/opt/sun/sunstudio12/lib/amd64;/opt/sun/sunstudio12/rtlibs/amd64;/opt/sun/sunstudio12/prod/lib/rw7/amd64;/opt/sun/sunstudio12/prod/lib/amd64;/lib64;/usr/lib64")
list(APPEND platforms linux64_sunCC)
+list(APPEND langs CXX)
# sunf90 dummy.f -v
set(linux64_sunf90_text "/usr/bin/ld --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -R/opt/sun/sunstudio12/lib/amd64:/opt/sun/sunstudio12/rtlibs/amd64:/opt/sun/lib/rtlibs/amd64 -o a.out /opt/sun/sunstudio12/prod/lib/amd64/crti.o /opt/sun/sunstudio12/prod/lib/amd64/crt1x.o /opt/sun/sunstudio12/prod/lib/amd64/values-xi.o -Y P,/opt/sun/sunstudio12/lib/amd64:/opt/sun/sunstudio12/rtlibs/amd64:/opt/sun/sunstudio12/prod/lib/amd64:/lib64:/usr/lib64 dummy.o -lfui -lfai -lfsu -Bdynamic -lmtsk -lpthread -lm -lc /opt/sun/sunstudio12/prod/lib/amd64/libc_supp.a /opt/sun/sunstudio12/prod/lib/amd64/crtn.o")
set(linux64_sunf90_libs "fui;fai;fsu;mtsk;pthread;m;c;/opt/sun/sunstudio12/prod/lib/amd64/libc_supp.a")
set(linux64_sunf90_dirs "/opt/sun/sunstudio12/lib/amd64;/opt/sun/sunstudio12/rtlibs/amd64;/opt/sun/sunstudio12/prod/lib/amd64;/lib64;/usr/lib64")
list(APPEND platforms linux64_sunf90)
+list(APPEND langs Fortran)
# icc dummy.c -v
set(linux64_icc_text "ld /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crt1.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbegin.o --eh-frame-hdr -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /tmp/iccBP8OfN.o -L/opt/compiler/intel/compiler/11.0/lib/intel64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../.. -L/lib64 -L/lib -L/usr/lib64 -L/usr/lib -Bstatic -limf -lsvml -Bdynamic -lm -Bstatic -lipgo -ldecimal -lirc -Bdynamic -lgcc_s -lgcc -Bstatic -lirc -Bdynamic -lc -lgcc_s -lgcc -Bstatic -lirc_s -Bdynamic -ldl -lc /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtend.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crtn.o")
set(linux64_icc_libs "imf;svml;m;ipgo;decimal;irc;gcc_s;gcc;irc;c;gcc_s;gcc;irc_s;dl;c")
set(linux64_icc_dirs "/opt/compiler/intel/compiler/11.0/lib/intel64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2;/usr/lib64;/lib64;/usr/x86_64-suse-linux/lib;/lib;/usr/lib")
list(APPEND platforms linux64_icc)
+list(APPEND langs C)
# icxx dummy.cxx -v
set(linux64_icxx_text "ld /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crt1.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbegin.o --eh-frame-hdr -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /tmp/icpc270GoT.o -L/opt/compiler/intel/compiler/11.0/lib/intel64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../.. -L/lib64 -L/lib -L/usr/lib64 -L/usr/lib -Bstatic -limf -lsvml -Bdynamic -lm -Bstatic -lipgo -ldecimal -Bdynamic -lstdc++ -Bstatic -lirc -Bdynamic -lgcc_s -lgcc -Bstatic -lirc -Bdynamic -lc -lgcc_s -lgcc -Bstatic -lirc_s -Bdynamic -ldl -lc /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtend.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crtn.o")
set(linux64_icxx_libs "imf;svml;m;ipgo;decimal;stdc++;irc;gcc_s;gcc;irc;c;gcc_s;gcc;irc_s;dl;c")
set(linux64_icxx_dirs "/opt/compiler/intel/compiler/11.0/lib/intel64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2;/usr/lib64;/lib64;/usr/x86_64-suse-linux/lib;/lib;/usr/lib")
list(APPEND platforms linux64_icxx)
+list(APPEND langs CXX)
# ifort dummy.f -v
set(linux64_ifort_text "ld --eh-frame-hdr -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out -L/opt/compiler/intel/compiler/11.0/lib/intel64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../.. -L/lib64 -L/lib -L/usr/lib64 -L/usr/lib /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crt1.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbegin.o /opt/compiler/intel/compiler/11.0/lib/intel64/for_main.o dum.cxx -Bstatic -lifport -lifcore -limf -lsvml -Bdynamic -lm -Bstatic -lipgo -lirc -Bdynamic -lpthread -lc -lgcc_s -lgcc -Bstatic -lirc_s -Bdynamic -ldl -lc /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtend.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crtn.o")
set(linux64_ifort_libs "ifport;ifcore;imf;svml;m;ipgo;irc;pthread;c;gcc_s;gcc;irc_s;dl;c")
set(linux64_ifort_dirs "/opt/compiler/intel/compiler/11.0/lib/intel64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2;/usr/lib64;/lib64;/usr/x86_64-suse-linux/lib;/lib;/usr/lib")
list(APPEND platforms linux64_ifort)
+list(APPEND langs Fortran)
# pgcc dummy.c -v
set(linux64_pgcc_text "/usr/bin/ld /usr/lib64/crt1.o /usr/lib64/crti.o /opt/compiler/pgi/linux86-64/8.0-3/lib/trace_init.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbegin.o -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /opt/compiler/pgi/linux86-64/8.0-3/lib/pgi.ld -L/opt/compiler/pgi/linux86-64/8.0-3/lib -L/usr/lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 /tmp/pgcc7OscXa5ur7Zk.o -rpath /opt/compiler/pgi/linux86-64/8.0-3/lib -lnspgc -lpgc -lm -lgcc -lc -lgcc /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtend.o /usr/lib64/crtn.o")
set(linux64_pgcc_libs "nspgc;pgc;m;gcc;c;gcc")
set(linux64_pgcc_dirs "/opt/compiler/pgi/linux86-64/8.0-3/lib;/usr/lib64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2")
list(APPEND platforms linux64_pgcc)
+list(APPEND langs C)
# pgCC dummy.cxx -v
set(linux64_pgCC_text "/usr/bin/ld /usr/lib64/crt1.o /usr/lib64/crti.o /opt/compiler/pgi/linux86-64/8.0-3/lib/trace_init.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbegin.o -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /opt/compiler/pgi/linux86-64/8.0-3/lib/pgi.ld -L/opt/compiler/pgi/linux86-64/8.0-3/lib -L/usr/lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 /tmp/pgCCFhjcDt1fs1Ki.o -rpath /opt/compiler/pgi/linux86-64/8.0-3/lib -lstd -lC -lnspgc -lpgc -lm -lgcc -lc -lgcc /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtend.o /usr/lib64/crtn.o")
set(linux64_pgCC_libs "std;C;nspgc;pgc;m;gcc;c;gcc")
set(linux64_pgCC_dirs "/opt/compiler/pgi/linux86-64/8.0-3/lib;/usr/lib64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2")
list(APPEND platforms linux64_pgCC)
+list(APPEND langs CXX)
# pgf90 dummy.f -v
set(linux64_pgf90_text "/usr/bin/ld /usr/lib64/crt1.o /usr/lib64/crti.o /opt/compiler/pgi/linux86-64/8.0-3/lib/trace_init.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbegin.o /opt/compiler/pgi/linux86-64/8.0-3/lib/f90main.o -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /opt/compiler/pgi/linux86-64/8.0-3/lib/pgi.ld -L/opt/compiler/pgi/linux86-64/8.0-3/lib -L/usr/lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 /tmp/pgf90QOIc_eB9xY5h.o -rpath /opt/compiler/pgi/linux86-64/8.0-3/lib -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgf90rtl -lpgftnrtl -lnspgc -lpgc -lrt -lpthread -lm -lgcc -lc -lgcc /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtend.o /usr/lib64/crtn.o")
set(linux64_pgf90_libs "pgf90;pgf90_rpm1;pgf902;pgf90rtl;pgftnrtl;nspgc;pgc;rt;pthread;m;gcc;c;gcc")
set(linux64_pgf90_dirs "/opt/compiler/pgi/linux86-64/8.0-3/lib;/usr/lib64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2")
list(APPEND platforms linux64_pgf90)
+list(APPEND langs Fortran)
# nagfor dummy.f -Wl,-v
set(linux64_nagfor_text " /usr/libexec/gcc/x86_64-redhat-linux/4.4.5/collect2 --no-add-needed --eh-frame-hdr --build-id -m elf_x86_64 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.4.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../.. /usr/local/NAG/lib/f90_init.o /usr/local/NAG/lib/quickfit.o dummy.o -rpath /usr/local/NAG/lib /usr/local/NAG/lib/libf53.so /usr/local/NAG/lib/libf53.a -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.4.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64/crtn.o")
@@ -86,6 +98,7 @@ set(linux64_nagfor_libs "/usr/local/NAG/lib/f90_init.o;/usr/local/NAG/lib/quickf
set(linux64_nagfor_dirs "/usr/lib/gcc/x86_64-redhat-linux/4.4.5;/usr/lib64;/lib64;/usr/lib")
set(linux64_nagfor_obj_regex "^/usr/local/NAG/lib")
list(APPEND platforms linux64_nagfor)
+list(APPEND langs Fortran)
# absoft dummy.f -X -v
set(linux64_absoft_text "collect2 version 4.4.5 (x86-64 Linux/ELF)
@@ -93,6 +106,7 @@ set(linux64_absoft_text "collect2 version 4.4.5 (x86-64 Linux/ELF)
set(linux64_absoft_libs "af90math;afio;amisc;absoftmain;af77math;m;mv;pthread;gcc;gcc_s;c;gcc;gcc_s")
set(linux64_absoft_dirs "/opt/absoft11.1/lib64;/usr/lib/gcc/x86_64-linux-gnu/4.4.5;/usr/lib;/lib")
list(APPEND platforms linux64_absoft)
+list(APPEND langs Fortran)
# gcc dummy.c -v # in strange path
set(linux64_test1_text "
@@ -101,12 +115,14 @@ ${linux64_gcc_text}")
set(linux64_test1_libs "${linux64_gcc_libs}")
set(linux64_test1_dirs "${linux64_gcc_dirs}")
list(APPEND platforms linux64_test1)
+list(APPEND langs C)
# sunCC dummy.cxx -v # extra slashes
set(linux64_test2_text "/usr/bin/ld --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /opt/sun/sunstudio12/prod/lib/amd64//crti.o /opt/sun/sunstudio12/prod/lib/amd64/crt1x.o /opt/sun/sunstudio12/prod/lib/amd64/values-xa.o dummy.o -Y \"/opt/sun/sunstudio12/prod/lib//amd64:/lib64:/usr//lib64\" -Qy -lc /opt/sun/sunstudio12/prod/lib/amd64//libc_supp.a /opt/sun/sunstudio12/prod/lib/amd64/crtn.o")
set(linux64_test2_libs "c;/opt/sun/sunstudio12/prod/lib/amd64/libc_supp.a")
set(linux64_test2_dirs "/opt/sun/sunstudio12/prod/lib/amd64;/lib64;/usr/lib64")
list(APPEND platforms linux64_test2)
+list(APPEND langs CXX)
# -specs=redhat-hardened-ld
set(linux64_test3_text "COLLECT_GCC_OPTIONS='-specs=/usr/lib/rpm/redhat/redhat-hardened-ld' '-v' '-O2' '-g' '-pipe' '-Wall' '-Werror=format-security' '-fexceptions' '-fstack-protector-strong' '--param' 'ssp-buffer-size=4' '-grecord-gcc-switches' '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' '-m64' '-mtune=generic' '-I' '/usr/lib64/gfortran/modules' '-o' 'a.out' '-rdynamic' '-shared-libgcc' '-march=x86-64' '-pie'
@@ -114,12 +130,14 @@ set(linux64_test3_text "COLLECT_GCC_OPTIONS='-specs=/usr/lib/rpm/redhat/redhat-h
set(linux64_test3_libs "gfortran;m;gcc_s;gcc;quadmath;m;gcc_s;gcc;c;gcc_s;gcc")
set(linux64_test3_dirs "/usr/lib/gcc/x86_64-redhat-linux/5.1.1;/usr/lib64;/lib64;/usr/lib")
list(APPEND platforms linux64_test3)
+list(APPEND langs Fortran)
# clang -fsanitize=memory
set(linux64_clang_sanitize_memory_text [[ "/usr/bin/ld" --hash-style=both --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crt1.o /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crti.o /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/crtbegin.o -L/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../.. -L/usr/lib/llvm-3.8/bin/../lib -L/lib -L/usr/lib -whole-archive /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/lib/linux/libclang_rt.msan-x86_64.a -no-whole-archive --dynamic-list=/usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/lib/linux/libclang_rt.msan-x86_64.a.syms /tmp/dummy-27898d.o --no-as-needed -lpthread -lrt -lm -ldl -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/crtend.o /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crtn.o]])
set(linux64_clang_sanitize_memory_libs "pthread;rt;m;dl;gcc;gcc_s;c;gcc;gcc_s")
set(linux64_clang_sanitize_memory_dirs "/usr/lib/gcc/x86_64-linux-gnu/5.4.0;/usr/lib/x86_64-linux-gnu;/lib/x86_64-linux-gnu;/lib64;/usr/lib;/usr/lib/llvm-3.8/lib;/lib")
list(APPEND platforms linux64_clang_sanitize_memory)
+list(APPEND langs C)
#-----------------------------------------------------------------------------
# Mac
@@ -144,12 +162,14 @@ set(mac_i686_gcc_Wlv_libs "gcc")
set(mac_i686_gcc_Wlv_dirs "/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib")
set(mac_i686_gcc_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks")
list(APPEND platforms mac_i686_gcc_Wlv)
+list(APPEND langs C)
# gcc -arch i686 dummy.c -v
set(mac_i686_gcc_text " /usr/libexec/gcc/i686-apple-darwin10/4.2.1/collect2 -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.6.o -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /var/tmp//ccnhXAGL.o -lSystem -lgcc -lSystem")
set(mac_i686_gcc_libs "gcc")
set(mac_i686_gcc_dirs "/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib")
list(APPEND platforms mac_i686_gcc)
+list(APPEND langs C)
# g++ -arch i686 dummy.cxx -v -Wl,-v
set(mac_i686_g++_Wlv_text " /usr/libexec/gcc/i686-apple-darwin10/4.2.1/collect2 -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.6.o -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /var/tmp//ccEXXICh.o -lstdc++ -lSystem -lgcc -lSystem
@@ -171,12 +191,14 @@ set(mac_i686_g++_Wlv_libs "stdc++;gcc")
set(mac_i686_g++_Wlv_dirs "/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib")
set(mac_i686_g++_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks")
list(APPEND platforms mac_i686_g++_Wlv)
+list(APPEND langs CXX)
# g++ -arch i686 dummy.cxx -v
set(mac_i686_g++_text " /usr/libexec/gcc/i686-apple-darwin10/4.2.1/collect2 -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.6.o -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /var/tmp//ccEXXICh.o -lstdc++ -lSystem -lgcc -lSystem")
set(mac_i686_g++_libs "stdc++;gcc")
set(mac_i686_g++_dirs "/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib")
list(APPEND platforms mac_i686_g++)
+list(APPEND langs CXX)
# gfortran dummy.f -v -Wl,-v
set(mac_i686_gfortran_Wlv_text " /usr/local/libexec/gcc/i386-apple-darwin9.7.0/4.4.1/collect2 -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/local/lib/gcc/i386-apple-darwin9.7.0/4.4.1 -L/usr/local/lib/gcc/i386-apple-darwin9.7.0/4.4.1/../../.. /var/tmp//cc9zXNax.o -v -lgfortranbegin -lgfortran -lgcc_s.10.5 -lgcc -lSystem
@@ -195,12 +217,14 @@ set(mac_i686_gfortran_Wlv_libs "gfortranbegin;gfortran;gcc_s.10.5;gcc")
set(mac_i686_gfortran_Wlv_dirs "/usr/local/lib/gcc/i386-apple-darwin9.7.0/4.4.1;/usr/local/lib;/usr/lib")
set(mac_i686_gfortran_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks")
list(APPEND platforms mac_i686_gfortran_Wlv)
+list(APPEND langs Fortran)
# gfortran dummy.f -v
set(mac_i686_gfortran_text " /usr/libexec/gcc/i386-apple-darwin9.7.0/4.4.1/collect2 -dynamic -arch i386 -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/gcc/i386-apple-darwin9.7.0/4.4.1 -L/usr/lib/gcc -L/usr/lib/gcc/i386-apple-darwin9.7.0/4.4.1/../../.. /var/tmp//ccgqbX5P.o -lgfortranbegin -lgfortran -lgcc_s.10.5 -lgcc -lSystem")
set(mac_i686_gfortran_libs "gfortranbegin;gfortran;gcc_s.10.5;gcc")
set(mac_i686_gfortran_dirs "/usr/lib/gcc/i386-apple-darwin9.7.0/4.4.1;/usr/lib/gcc;/usr/lib")
list(APPEND platforms mac_i686_gfortran)
+list(APPEND langs Fortran)
# gcc -arch ppc dummy.c -v -Wl,-v
set(mac_ppc_gcc_Wlv_text " /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/collect2 -dynamic -arch ppc -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../../powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../.. /var/tmp//cclziQY4.o -v -lgcc -lSystemStubs -lSystem
@@ -222,12 +246,14 @@ set(mac_ppc_gcc_Wlv_libs "gcc")
set(mac_ppc_gcc_Wlv_dirs "/usr/lib/powerpc-apple-darwin10/4.2.1;/usr/lib/gcc/powerpc-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib")
set(mac_ppc_gcc_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks")
list(APPEND platforms mac_ppc_gcc_Wlv)
+list(APPEND langs C)
# gcc -arch ppc dummy.c -v
set(mac_ppc_gcc_text " /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/collect2 -dynamic -arch ppc -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../../powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../.. /var/tmp//ccdcolsP.o -lgcc -lSystemStubs -lSystem")
set(mac_ppc_gcc_libs "gcc")
set(mac_ppc_gcc_dirs "/usr/lib/powerpc-apple-darwin10/4.2.1;/usr/lib/gcc/powerpc-apple-darwin10/4.2.1;/usr/lib")
list(APPEND platforms mac_ppc_gcc)
+list(APPEND langs C)
# g++ -arch ppc dummy.cxx -v -Wl,-v
set(mac_ppc_g++_Wlv_text " /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/collect2 -dynamic -arch ppc -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../../powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../.. /var/tmp//ccaFTkwq.o -v -lstdc++ -lgcc -lSystemStubs -lSystem
@@ -249,12 +275,14 @@ set(mac_ppc_g++_Wlv_libs "stdc++;gcc")
set(mac_ppc_g++_Wlv_dirs "/usr/lib/powerpc-apple-darwin10/4.2.1;/usr/lib/gcc/powerpc-apple-darwin10/4.2.1;/usr/lib;/usr/local/lib")
set(mac_ppc_g++_Wlv_fwks "/Library/Frameworks;/System/Library/Frameworks")
list(APPEND platforms mac_ppc_g++_Wlv)
+list(APPEND langs CXX)
# g++ -arch ppc dummy.cxx -v
set(mac_ppc_g++_text " /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/collect2 -dynamic -arch ppc -macosx_version_min 10.6.0 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/usr/lib/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../../powerpc-apple-darwin10/4.2.1 -L/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/../../.. /var/tmp//ccbjB6Lj.o -lstdc++ -lgcc -lSystemStubs -lSystem")
set(mac_ppc_g++_libs "stdc++;gcc")
set(mac_ppc_g++_dirs "/usr/lib/powerpc-apple-darwin10/4.2.1;/usr/lib/gcc/powerpc-apple-darwin10/4.2.1;/usr/lib")
list(APPEND platforms mac_ppc_g++)
+list(APPEND langs CXX)
# absoft dummy.f -X -v
set(mac_absoft_text "collect2 version 4.2.1 (Apple Inc. build 5664) (i686 Darwin)
@@ -263,12 +291,14 @@ set(mac_absoft_text "collect2 version 4.2.1 (Apple Inc. build 5664) (i686 Darwin
set(mac_absoft_libs "af90math;afio;amisc;absoftmain;af77math;m;mv;gcc")
set(mac_absoft_dirs "/Applications/Absoft11.1/lib;/usr/lib/i686-apple-darwin10/4.2.1;/usr/lib/gcc/i686-apple-darwin10/4.2.1;/usr/lib")
list(APPEND platforms mac_absoft)
+list(APPEND langs Fortran)
# Xcode 8.3: clang++ dummy.cpp -v
set(mac_clang_v_text " \"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld\" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -no_deduplicate -dynamic -arch x86_64 -macosx_version_min 10.12.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -o a.out /var/folders/hc/95l7dhnx459c57g4yg_6yd8c0000gp/T/dummy-384ea1.o -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.1.0/lib/darwin/libclang_rt.osx.a")
set(mac_clang_v_libs "c++")
set(mac_clang_v_dirs "")
list(APPEND platforms mac_clang_v)
+list(APPEND langs CXX)
#-----------------------------------------------------------------------------
# Sun
@@ -278,24 +308,28 @@ set(sun_cc_text "/usr/ccs/bin/ld /opt/SUNWspro/prod/lib/crti.o /opt/SUNWspro/pro
set(sun_cc_libs "c")
set(sun_cc_dirs "/opt/SUNWspro/prod/lib/v8plus;/opt/SUNWspro/prod/lib;/usr/ccs/lib;/lib;/usr/lib")
list(APPEND platforms sun_cc)
+list(APPEND langs C)
# CC dummy.cxx -v
set(sun_CC_text "/usr/ccs/bin/ld -u __1cH__CimplKcplus_init6F_v_ -zld32=-S/opt/SUNWspro/prod/lib/libldstab_ws.so -zld64=-S/opt/SUNWspro/prod/lib/v9/libldstab_ws.so -zld32=-S/opt/SUNWspro/prod/lib/libCCexcept.so.1 -zld64=-S/opt/SUNWspro/prod/lib/v9/libCCexcept.so.1 -R/opt/SUNWspro/lib/rw7:/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/lib:/usr/ccs/lib:/lib:/usr/lib -o a.out /opt/SUNWspro/prod/lib/crti.o /opt/SUNWspro/prod/lib/CCrti.o /opt/SUNWspro/prod/lib/crt1.o /opt/SUNWspro/prod/lib/misalign.o /opt/SUNWspro/prod/lib/values-xa.o -Y P,/opt/SUNWspro/lib/rw7:/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/prod/lib/rw7:/opt/SUNWspro/prod/lib/v8plus:/opt/SUNWspro/lib:/opt/SUNWspro/prod/lib:/usr/ccs/lib:/lib:/usr/lib dummy.o -lCstd -lCrun -lm -lc /opt/SUNWspro/prod/lib/CCrtn.o /opt/SUNWspro/prod/lib/crtn.o >&/tmp/ld.14846.2.err")
set(sun_CC_libs "Cstd;Crun;m;c")
set(sun_CC_dirs "/opt/SUNWspro/lib/rw7;/opt/SUNWspro/lib/v8plus;/opt/SUNWspro/prod/lib/rw7;/opt/SUNWspro/prod/lib/v8plus;/opt/SUNWspro/lib;/opt/SUNWspro/prod/lib;/usr/ccs/lib;/lib;/usr/lib")
list(APPEND platforms sun_CC)
+list(APPEND langs CXX)
# f77 dummy.f -v
set(sun_f77_text "/usr/ccs/bin/ld -t -R/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/lib -o a.out /opt/SUNWspro/prod/lib/crti.o /opt/SUNWspro/prod/lib/crt1.o /opt/SUNWspro/prod/lib/misalign.o /opt/SUNWspro/prod/lib/values-xi.o -Y P,/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/prod/lib/v8plus:/opt/SUNWspro/lib:/opt/SUNWspro/prod/lib:/usr/ccs/lib:/lib:/usr/lib dummy.o -lf77compat -zallextract -lompstubs -zdefaultextract -lfui -lfai -lfai2 -lfsumai -lfprodai -lfminlai -lfmaxlai -lfminvai -lfmaxvai -lfsu -lsunmath -lm -lc /opt/SUNWspro/prod/lib/crtn.o")
set(sun_f77_libs "f77compat;-zallextract;ompstubs;-zdefaultextract;fui;fai;fai2;fsumai;fprodai;fminlai;fmaxlai;fminvai;fmaxvai;fsu;sunmath;m;c")
set(sun_f77_dirs "/opt/SUNWspro/lib/v8plus;/opt/SUNWspro/prod/lib/v8plus;/opt/SUNWspro/lib;/opt/SUNWspro/prod/lib;/usr/ccs/lib;/lib;/usr/lib")
list(APPEND platforms sun_f77)
+list(APPEND langs Fortran)
# f90 dummy.f -v
set(sun_f90_text "/usr/ccs/bin/ld -t -R/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/lib -o a.out /opt/SUNWspro/prod/lib/crti.o /opt/SUNWspro/prod/lib/crt1.o /opt/SUNWspro/prod/lib/misalign.o /opt/SUNWspro/prod/lib/values-xi.o -Y P,/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/prod/lib/v8plus:/opt/SUNWspro/lib:/opt/SUNWspro/prod/lib:/usr/ccs/lib:/lib:/usr/lib dummy.o -zallextract -lompstubs -zdefaultextract -lfui -lfai -lfai2 -lfsumai -lfprodai -lfminlai -lfmaxlai -lfminvai -lfmaxvai -lfsu -lsunmath -lm -lc /opt/SUNWspro/prod/lib/crtn.o")
set(sun_f90_libs "-zallextract;ompstubs;-zdefaultextract;fui;fai;fai2;fsumai;fprodai;fminlai;fmaxlai;fminvai;fmaxvai;fsu;sunmath;m;c")
set(sun_f90_dirs "/opt/SUNWspro/lib/v8plus;/opt/SUNWspro/prod/lib/v8plus;/opt/SUNWspro/lib;/opt/SUNWspro/prod/lib;/usr/ccs/lib;/lib;/usr/lib")
list(APPEND platforms sun_f90)
+list(APPEND langs Fortran)
#-----------------------------------------------------------------------------
# AIX
@@ -305,12 +339,14 @@ set(aix_xlc_32_text "/bin/ld -b32 /lib/crt0.o -bpT:0x10000000 -bpD:0x20000000 du
set(aix_xlc_32_libs "xlopt;xl;c")
set(aix_xlc_32_dirs "/usr/vac/lib")
list(APPEND platforms aix_xlc_32)
+list(APPEND langs C)
# xlc -q64 dummy.c -V
set(aix_xlc_64_text "/bin/ld -b64 /lib/crt0_64.o -bpT:0x100000000 -bpD:0x110000000 dummy.o -L/usr/vac/lib -lxlopt -lxl -lc")
set(aix_xlc_64_libs "xlopt;xl;c")
set(aix_xlc_64_dirs "/usr/vac/lib")
list(APPEND platforms aix_xlc_64)
+list(APPEND langs C)
# xlC -q32 dummy.cxx -V
set(aix_xlC_32_text "
@@ -319,6 +355,7 @@ set(aix_xlC_32_text "
set(aix_xlC_32_libs "xlopt;xl;C;m;c")
set(aix_xlC_32_dirs "/usr/vac/lib;/usr/vacpp/lib")
list(APPEND platforms aix_xlC_32)
+list(APPEND langs CXX)
# xlC -q64 dummy.cxx -V
set(aix_xlC_64_text "
@@ -327,36 +364,42 @@ set(aix_xlC_64_text "
set(aix_xlC_64_libs "xlopt;xl;C;m;c")
set(aix_xlC_64_dirs "/usr/vac/lib;/usr/vacpp/lib")
list(APPEND platforms aix_xlC_64)
+list(APPEND langs CXX)
# xlf -q32 dummy.f -V
set(aix_xlf_32_text "/bin/ld -b32 /lib/crt0.o -bpT:0x10000000 -bpD:0x20000000 -bh:4 -bh:4 -bh:4 -bh:4 dummy.o -lxlf90 -L/usr/lpp/xlf/lib -lxlopt -lxlf -lxlomp_ser -lm -lc")
set(aix_xlf_32_libs "xlf90;xlopt;xlf;xlomp_ser;m;c")
set(aix_xlf_32_dirs "/usr/lpp/xlf/lib")
list(APPEND platforms aix_xlf_32)
+list(APPEND langs Fortran)
# xlf -q64 dummy.f -V
set(aix_xlf_64_text "/bin/ld -b64 /lib/crt0_64.o -bpT:0x100000000 -bpD:0x110000000 -bh:4 -bh:4 -bh:4 -bh:4 dummy.o -lxlf90 -L/usr/lpp/xlf/lib -lxlopt -lxlf -lxlomp_ser -lm -lc")
set(aix_xlf_64_libs "xlf90;xlopt;xlf;xlomp_ser;m;c")
set(aix_xlf_64_dirs "/usr/lpp/xlf/lib")
list(APPEND platforms aix_xlf_64)
+list(APPEND langs Fortran)
# xlf90 -q32 dummy.f -V
set(aix_xlf90_32_text "/bin/ld -b32 /lib/crt0.o -bpT:0x10000000 -bpD:0x20000000 -bh:4 dummy.o -lxlf90 -L/usr/lpp/xlf/lib -lxlopt -lxlf -lxlomp_ser -lm -lc")
set(aix_xlf90_32_libs "xlf90;xlopt;xlf;xlomp_ser;m;c")
set(aix_xlf90_32_dirs "/usr/lpp/xlf/lib")
list(APPEND platforms aix_xlf90_32)
+list(APPEND langs Fortran)
# xlf90 -q64 dummy.f -V
set(aix_xlf90_64_text "/bin/ld -b64 /lib/crt0_64.o -bpT:0x100000000 -bpD:0x110000000 -bh:4 dummy.o -lxlf90 -L/usr/lpp/xlf/lib -lxlopt -lxlf -lxlomp_ser -lm -lc")
set(aix_xlf90_64_libs "xlf90;xlopt;xlf;xlomp_ser;m;c")
set(aix_xlf90_64_dirs "/usr/lpp/xlf/lib")
list(APPEND platforms aix_xlf90_64)
+list(APPEND langs Fortran)
# g++ dummy.c -v
set(aix_g++_text " /prefix/libexec/gcc/powerpc-ibm-aix7.2.0.0/7.2.0/collect2 -bpT:0x10000000 -bpD:0x20000000 -btextro /lib/crt0.o /prefix/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0/crtcxa.o /prefix/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0/crtdbase.o -L/prefix/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0 -L/prefix/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0/../../.. /tmp//ccKROJ1f.o -lstdc++ -lm -lgcc_s /prefix/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0/libgcc.a -lc -lgcc_s /prefix/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0/libgcc.a")
set(aix_g++_libs "stdc++;m;gcc_s;/prefix/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0/libgcc.a;c;gcc_s;/prefix/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0/libgcc.a")
set(aix_g++_dirs "/prefix/lib/gcc/powerpc-ibm-aix7.2.0.0/7.2.0;/prefix/lib")
list(APPEND platforms aix_g++)
+list(APPEND langs CXX)
#-----------------------------------------------------------------------------
# HP
@@ -367,6 +410,7 @@ set(hp_cc_old_text "cc: LPATH is /usr/lib/pa1.1:/usr/lib:/opt/langtools/lib:
set(hp_cc_old_libs "c")
set(hp_cc_old_dirs "/usr/lib/pa1.1;/usr/lib;/opt/langtools/lib")
list(APPEND platforms hp_cc_old)
+list(APPEND langs C)
# aCC dummy.cxx -v
set(hp_aCC_old_text "LPATH=/usr/lib/pa1.1:/usr/lib:/opt/langtools/lib
@@ -374,6 +418,7 @@ set(hp_aCC_old_text "LPATH=/usr/lib/pa1.1:/usr/lib:/opt/langtools/lib
set(hp_aCC_old_libs "std;stream;Csup;m;cl;c")
set(hp_aCC_old_dirs "/usr/lib/pa1.1;/usr/lib;/opt/langtools/lib;/opt/aCC/lib")
list(APPEND platforms hp_aCC_old)
+list(APPEND langs CXX)
# cc dummy.c -v
set(hp_cc_32_text "LPATH=/usr/lib/hpux32:/opt/langtools/lib/hpux32
@@ -381,6 +426,7 @@ set(hp_cc_32_text "LPATH=/usr/lib/hpux32:/opt/langtools/lib/hpux32
set(hp_cc_32_libs "c")
set(hp_cc_32_dirs "/usr/lib/hpux32;/opt/langtools/lib/hpux32")
list(APPEND platforms hp_cc_32)
+list(APPEND langs C)
# cc +DD64 dummy.c -v
set(hp_cc_64_text "LPATH=/usr/lib/hpux64:/opt/langtools/lib/hpux64
@@ -388,6 +434,7 @@ set(hp_cc_64_text "LPATH=/usr/lib/hpux64:/opt/langtools/lib/hpux64
set(hp_cc_64_libs "c")
set(hp_cc_64_dirs "/usr/lib/hpux64;/opt/langtools/lib/hpux64")
list(APPEND platforms hp_cc_64)
+list(APPEND langs C)
# aCC dummy.cxx -v
set(hp_aCC_32_text "LPATH=/usr/lib/hpux32:/opt/langtools/lib/hpux32
@@ -395,6 +442,7 @@ set(hp_aCC_32_text "LPATH=/usr/lib/hpux32:/opt/langtools/lib/hpux32
set(hp_aCC_32_libs "std_v2;Csup;m;unwind;Csup;c;dl")
set(hp_aCC_32_dirs "/usr/lib/hpux32;/opt/langtools/lib/hpux32;/opt/aCC/lib/hpux32")
list(APPEND platforms hp_aCC_32)
+list(APPEND langs CXX)
# aCC +DD64 dummy.cxx -v
set(hp_aCC_64_text "LPATH=/usr/lib/hpux64:/opt/langtools/lib/hpux64
@@ -402,6 +450,7 @@ set(hp_aCC_64_text "LPATH=/usr/lib/hpux64:/opt/langtools/lib/hpux64
set(hp_aCC_64_libs "std_v2;Csup;m;unwind;Csup;c;dl")
set(hp_aCC_64_dirs "/usr/lib/hpux64;/opt/langtools/lib/hpux64;/opt/aCC/lib/hpux64")
list(APPEND platforms hp_aCC_64)
+list(APPEND langs CXX)
# f90 dummy.f -v
set(hp_f90_32_text "LPATH is: /usr/lib/hpux32/:/opt/langtools/lib/hpux32/
@@ -409,6 +458,7 @@ set(hp_f90_32_text "LPATH is: /usr/lib/hpux32/:/opt/langtools/lib/hpux32/
set(hp_f90_32_libs "-l:libF90.a;-l:libIO77.a;m;c;unwind;uca")
set(hp_f90_32_dirs "/usr/lib/hpux32;/opt/langtools/lib/hpux32")
list(APPEND platforms hp_f90_32)
+list(APPEND langs Fortran)
# f90 +DD64 dummy.f -v
set(hp_f90_64_text "LPATH is: /usr/lib/hpux64/:/opt/langtools/lib/hpux64/
@@ -416,6 +466,7 @@ set(hp_f90_64_text "LPATH is: /usr/lib/hpux64/:/opt/langtools/lib/hpux64/
set(hp_f90_64_libs "-l:libF90.a;-l:libIO77.a;m;c;unwind;uca")
set(hp_f90_64_dirs "/usr/lib/hpux64;/opt/langtools/lib/hpux64")
list(APPEND platforms hp_f90_64)
+list(APPEND langs Fortran)
#-----------------------------------------------------------------------------
# Cygwin
@@ -425,12 +476,14 @@ set(cygwin_gcc_text " /usr/lib/gcc/i686-pc-cygwin/3.4.4/collect2.exe -Bdynamic -
set(cygwin_gcc_libs "gcc;cygwin;user32;kernel32;advapi32;shell32;gcc")
set(cygwin_gcc_dirs "/usr/lib/gcc/i686-pc-cygwin/3.4.4;/usr/lib")
list(APPEND platforms cygwin_gcc)
+list(APPEND langs C)
# g++ dummy.cxx -v
set(cygwin_g++_text " /usr/lib/gcc/i686-pc-cygwin/3.4.4/collect2.exe -Bdynamic --dll-search-prefix=cyg /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../crt0.o -L/usr/lib/gcc/i686-pc-cygwin/3.4.4 -L/usr/lib/gcc/i686-pc-cygwin/3.4.4 -L/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../.. /home/user/AppData/Local/Temp/ccsvcDO6.o -lstdc++ -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc")
set(cygwin_g++_libs "stdc++;gcc;cygwin;user32;kernel32;advapi32;shell32;gcc")
set(cygwin_g++_dirs "/usr/lib/gcc/i686-pc-cygwin/3.4.4;/usr/lib")
list(APPEND platforms cygwin_g++)
+list(APPEND langs CXX)
# gfortran dummy.f -v
set(cygwin_gfortran_text "Configured with: ... LD=/opt/gcc-tools/bin/ld.exe
@@ -439,6 +492,7 @@ set(cygwin_gfortran_text "Configured with: ... LD=/opt/gcc-tools/bin/ld.exe
set(cygwin_gfortran_libs "gfortranbegin;gfortran;gcc_s;gcc_s;gcc;cygwin;user32;kernel32;advapi32;shell32;gcc_s;gcc_s;gcc")
set(cygwin_gfortran_dirs "/usr/lib/gcc/i686-pc-cygwin/4.3.2;/usr/lib")
list(APPEND platforms cygwin_gfortran)
+list(APPEND langs Fortran)
#-----------------------------------------------------------------------------
# MSYS
@@ -448,18 +502,21 @@ set(msys_gcc_text " C:/some-mingw/bin/../libexec/gcc/mingw32/3.4.5/collect2.exe
set(msys_gcc_libs "mingw32;gcc;moldname;mingwex;user32;kernel32;advapi32;shell32;mingw32;gcc;moldname;mingwex")
set(msys_gcc_dirs "C:/some-mingw/lib/gcc/mingw32/3.4.5;C:/some-mingw/lib/gcc;/some-mingw/lib;C:/some-mingw/lib")
list(APPEND platforms msys_gcc)
+list(APPEND langs C)
# g++ dummy.cxx -v
set(msys_g++_text " C:/some-mingw/bin/../libexec/gcc/mingw32/3.4.5/collect2.exe -Bdynamic /some-mingw/lib/crt2.o C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtbegin.o -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5 -LC:/some-mingw/bin/../lib/gcc -L/some-mingw/lib -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/../../.. C:/home/user/AppData/Local/Temp/cci5hYPk.o -lstdc++ -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtend.o")
set(msys_g++_libs "stdc++;mingw32;gcc;moldname;mingwex;user32;kernel32;advapi32;shell32;mingw32;gcc;moldname;mingwex")
set(msys_g++_dirs "C:/some-mingw/lib/gcc/mingw32/3.4.5;C:/some-mingw/lib/gcc;/some-mingw/lib;C:/some-mingw/lib")
list(APPEND platforms msys_g++)
+list(APPEND langs CXX)
# g77 dummy.f -v
set(msys_g77_text " C:/some-mingw/bin/../libexec/gcc/mingw32/3.4.5/collect2.exe -Bdynamic /some-mingw/lib/crt2.o C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtbegin.o -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5 -LC:/some-mingw/bin/../lib/gcc -L/some-mingw/lib -LC:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/../../.. C:/home/user/AppData/Local/Temp/ccabRxQ1.o -lfrtbegin -lg2c -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt C:/some-mingw/bin/../lib/gcc/mingw32/3.4.5/crtend.o")
set(msys_g77_libs "frtbegin;g2c;mingw32;gcc;moldname;mingwex;user32;kernel32;advapi32;shell32;mingw32;gcc;moldname;mingwex")
set(msys_g77_dirs "C:/some-mingw/lib/gcc/mingw32/3.4.5;C:/some-mingw/lib/gcc;/some-mingw/lib;C:/some-mingw/lib")
list(APPEND platforms msys_g77)
+list(APPEND langs Fortran)
#-----------------------------------------------------------------------------
# MSYS2-runtime
@@ -469,18 +526,21 @@ set(msys2rt_gcc_text " /usr/lib/gcc/i686-pc-msys/6.4.0/collect2.exe -Bdynamic --
set(msys2rt_gcc_libs "msys-2.0;user32;kernel32;advapi32;shell32")
set(msys2rt_gcc_dirs "/usr/lib/gcc/i686-pc-msys/6.4.0;/usr/lib")
list(APPEND platforms msysrt_gcc)
+list(APPEND langs C)
# g++ dummy.cxx -v
set(msys2rt_g++_text " /usr/lib/gcc/i686-pc-msys/6.4.0/collect2.exe -Bdynamic --dll-search-prefix=msys- /usr/lib/gcc/i686-pc-msys/6.4.0/../../../crt0.o -L/usr/lib/gcc/i686-pc-msys/6.4.0 -L/usr/lib/gcc/i686-pc-msys/6.4.0 -L/usr/lib/gcc/i686-pc-msys/6.4.0/../../.. /home/user/AppData/Local/Temp/ccsvcDO6.o -lstdc++ -lgcc -lmsys-2.0 -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc")
set(msys2rt_g++_libs "stdc++;msys-2.0;user32;kernel32;advapi32;shell32")
set(msys2rt_g++_dirs "/usr/lib/gcc/i686-pc-msys/6.4.0;/usr/lib")
list(APPEND platforms msysrt_g++)
+list(APPEND langs CXX)
# g77 dummy.f -v
set(msys2rt_g77_text "Configured with: ... LD=/opt/gcc-tools/bin/ld.exe /usr/lib/gcc/i686-pc-msys/6.4.0/collect2.exe -Bdynamic --dll-search-prefix=msys- -u ___register_frame_info -u ___deregister_frame_info /usr/lib/gcc/i686-pc-msys/6.4.0/../../../crt0.o /usr/lib/gcc/i686-pc-msys/6.4.0/crtbegin.o -L/usr/lib/gcc/i686-pc-msys/6.4.0 -L/usr/lib/gcc/i686-pc-msys/6.4.0 -L/usr/lib/gcc/i686-pc-msys/6.4.0/../../.. /home/user/AppData/Local/Temp/ccqRWKWg.o -lgfortranbegin -lgfortran -lgcc_s -lgcc_s -lgcc -lmsys-2.0 -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc_s -lgcc_s -lgcc /usr/lib/gcc/i686-pc-msys/6.4.0/crtend.o")
set(msys2rt_g77_libs "stdc++;msys-2.0;user32;kernel32;advapi32;shell32")
set(msys2rt_g77_dirs "/usr/lib/gcc/i686-pc-msys/6.4.0;/usr/lib")
list(APPEND platforms msysrt_g77)
+list(APPEND langs Fortran)
#-----------------------------------------------------------------------------
# MSYS2-mingw
@@ -490,18 +550,21 @@ set(msys2_gcc_text " C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/c
set(msys2_gcc_libs "mingw32;gcc;moldname;mingwex;pthread;advapi32;shell32;user32;kernel32;mingw32;gcc;moldname;mingwex")
set(msys2_gcc_dirs "C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0;C:/msys64/mingw64/lib/gcc;C:/msys64/mingw64/x86_64-w64-mingw32/lib;C:/msys64/mingw64/lib")
list(APPEND platforms msys2_gcc)
+list(APPEND langs C)
# g++ dummy.cxx -v
set(msys2_g++_text " C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/collect2.exe -plugin C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/liblto_plugin-0.dll -plugin-opt=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/lto-wrapper.exe -plugin-opt=-fresolution=C:/msys64/tmp/ccJQgvbN.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -m i386pep -Bdynamic C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/crtbegin.o -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0 -LC:/msys64/mingw64/bin/../lib/gcc -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../.. C:/msys64/tmp/ccqPpuVS.o -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/default-manifest.o C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/crtend.o")
set(msys2_g++_libs "stdc++;mingw32;gcc_s;gcc;moldname;mingwex;pthread;advapi32;shell32;user32;kernel32;mingw32;gcc_s;gcc;moldname;mingwex")
set(msys2_g++_dirs "C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0;C:/msys64/mingw64/lib/gcc;C:/msys64/mingw64/x86_64-w64-mingw32/lib;C:/msys64/mingw64/lib")
list(APPEND platforms msys2_g++)
+list(APPEND langs CXX)
# gfortran dummy.f90 -v
set(msys2_gfortran_text " C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/collect2.exe -plugin C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/liblto_plugin-0.dll -plugin-opt=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/lto-wrapper.exe -plugin-opt=-fresolution=C:/msys64/tmp/cczOKIDy.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lquadmath -plugin-opt=-pass-through=-lm -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -m i386pep -Bdynamic C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/crtbegin.o -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0 -LC:/msys64/mingw64/bin/../lib/gcc -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../.. C:/msys64/tmp/ccyXuCgD.o -lgfortran -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lquadmath -lm -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/default-manifest.o C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/crtend.o")
set(msys2_gfortran_libs "gfortran;mingw32;gcc_s;gcc;moldname;mingwex;quadmath;m;mingw32;gcc_s;gcc;moldname;mingwex;pthread;advapi32;shell32;user32;kernel32;mingw32;gcc_s;gcc;moldname;mingwex")
set(msys2_gfortran_dirs "C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0;C:/msys64/mingw64/lib/gcc;C:/msys64/mingw64/x86_64-w64-mingw32/lib;C:/msys64/mingw64/lib")
list(APPEND platforms msys2_gfortran)
+list(APPEND langs Fortran)
#-----------------------------------------------------------------------------
# MSVC from NVIDIA CUDA
@@ -510,6 +573,18 @@ set(nvcc_msvc_text [[cuda-fake-ld cl.exe -nologo "tmp/a_dlink.obj" "tmp/CMakeCUD
set(nvcc_msvc_libs "cudadevrt.lib;cudart_static.lib")
set(nvcc_msvc_dirs "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/lib/x64")
list(APPEND platforms nvcc_msvc)
+list(APPEND langs CUDA)
+
+#-----------------------------------------------------------------------------
+# MSVC from NVIDIA CUDA custom compiler
+
+set(nvcc_msvc_cl_text [[cuda-fake-ld cl -nologo "tmp/a_dlink.obj" "tmp/CMakeCUDACompilerId.obj" -link -INCREMENTAL:NO "/LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/bin/../lib/x64" cudadevrt.lib cudart_static.lib -Fe"a.exe"]])
+set(nvcc_msvc_cl_libs "cudadevrt.lib;cudart_static.lib")
+set(nvcc_msvc_cl_dirs "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/lib/x64")
+set(nvcc_msvc_cl_compiler_id NVIDIA)
+set(nvcc_msvc_cl_compiler_sim_id MSVC)
+list(APPEND platforms nvcc_msvc_cl)
+list(APPEND langs CUDA)
#-----------------------------------------------------------------------------
# PGI on Windows
@@ -527,6 +602,7 @@ set(windows_pgf95_startfile "pgimain[mx][xpt]+[.]obj")
set(windows_pgf95_libs "libpgmp;pg;libpgf90rtl;libpgf90;libpgf90_rpm1;libpgf902;libpgf90rtl;libpgftnrtl;libpgc14;libnspgc;legacy_stdio_definitions;oldnames")
set(windows_pgf95_dirs "X:/NOT-PROGRAM-FILES-86/Microsoft Visual Studio 14.0/VC/Lib/AMD64;X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/ucrt/x64;X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/um/x64;X:/NOT-PROGRAM-FILES/PGICE/win64/17.4/lib")
list(APPEND platforms windows_pgf95)
+list(APPEND langs Fortran)
# pgf77 dummy.f77 -v
set(windows_pgf77_text [[Writing to file C:\temp\pgf776eC42buYRoCNJk.lnk
@@ -537,6 +613,7 @@ set(windows_pgf77_startfile "pgimain[mx][xpt]+[.]obj")
set(windows_pgf77_libs "libpgmp;libpgftnrtl;libpgc14;libnspgc;legacy_stdio_definitions;oldnames")
set(windows_pgf77_dirs "X:/NOT-PROGRAM-FILES-86/Microsoft Visual Studio 14.0/VC/Lib/AMD64;X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/ucrt/x64;X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/um/x64;X:/NOT-PROGRAM-FILES/PGICE/win64/17.4/lib")
list(APPEND platforms windows_pgf77)
+list(APPEND langs Fortran)
# pgcc dummy.c -v
set(windows_pgcc_text [[Writing to file C:\temp\pgcc6esqW26_ZNKyL.lnk
@@ -547,6 +624,7 @@ set(windows_pgcc_startfile "pgimain[mx][xpt]+[.]obj")
set(windows_pgcc_libs "libpgmp;libpgc14;libnspgc;legacy_stdio_definitions;oldnames")
set(windows_pgcc_dirs "X:/NOT-PROGRAM-FILES-86/Microsoft Visual Studio 14.0/VC/Lib/AMD64;X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/ucrt/x64;X:/NOT-PROGRAM-FILES-86/Windows Kits/10/Lib/10.0.15063.0/um/x64;X:/NOT-PROGRAM-FILES/PGICE/win64/17.4/lib")
list(APPEND platforms windows_pgcc)
+list(APPEND langs C)
endif()
@@ -554,13 +632,20 @@ endif()
# Test parsing for all above examples.
set(CMAKE_LINKER "not-a-linker[]().*+^$?")
-foreach(p IN LISTS platforms)
+foreach(p lang IN ZIP_LISTS platforms langs)
if(DEFINED ${p}_startfile)
set(CMAKE_LINK_STARTFILE "${${p}_startfile}")
else()
unset(CMAKE_LINK_STARTFILE)
endif()
- cmake_parse_implicit_link_info("${${p}_text}" libs dirs fwks log "${${p}_obj_regex}")
+ if(DEFINED ${p}_compiler_id)
+ set(CMAKE_${lang}_ID ${${p}_compiler_id})
+ endif()
+ if(DEFINED ${p}_compiler_sim_id)
+ set(CMAKE_${lang}_SIMULATE_ID ${${p}_compiler_sim_id})
+ endif()
+
+ cmake_parse_implicit_link_info("${${p}_text}" libs dirs fwks log "${${p}_obj_regex}" LANGUAGE ${lang})
foreach(v libs dirs fwks)
if(DEFINED "${p}_${v}" AND NOT "${${v}}" STREQUAL "${${p}_${v}}")
diff --git a/Tests/CTestCoverageCollectGCOV/test.cmake.in b/Tests/CTestCoverageCollectGCOV/test.cmake.in
index a36f3743b..7c7a3e5bb 100644
--- a/Tests/CTestCoverageCollectGCOV/test.cmake.in
+++ b/Tests/CTestCoverageCollectGCOV/test.cmake.in
@@ -34,9 +34,10 @@ set(expected_out
# then back to relative to get them in canonical form (or maybe this is a bug
# in how the tarball is generated?)
function(to_relative_paths real_paths paths)
+ file(REAL_PATH "${CTEST_BINARY_DIRECTORY}" base)
foreach(file ${paths})
- file(REAL_PATH "${file}" real_path BASE_DIRECTORY "${CTEST_BINARY_DIRECTORY}")
- file(RELATIVE_PATH relative_path "${CTEST_BINARY_DIRECTORY}" "${real_path}")
+ file(REAL_PATH "${file}" real_path BASE_DIRECTORY "${base}")
+ file(RELATIVE_PATH relative_path "${base}" "${real_path}")
list(APPEND local_real_paths "${relative_path}")
message(DEBUG "${file} -> ${real_path} -> ${relative_path}")
endforeach()
diff --git a/Tests/CTestTestFdSetSize/sleep.c b/Tests/CTestTestFdSetSize/sleep.c
index 2fb6490aa..d55cec661 100644
--- a/Tests/CTestTestFdSetSize/sleep.c
+++ b/Tests/CTestTestFdSetSize/sleep.c
@@ -1,7 +1,11 @@
#if defined(_WIN32)
# include <windows.h>
-#else
+#elif _XOPEN_SOURCE >= 500 || defined(_ALL_SOURCE)
# include <unistd.h>
+#else
+# include <time.h>
+
+# include <sys/select.h>
#endif
/* sleeps for 0.1 second */
@@ -9,8 +13,14 @@ int main(int argc, char** argv)
{
#if defined(_WIN32)
Sleep(100);
-#else
+#elif _XOPEN_SOURCE >= 500 || defined(_ALL_SOURCE)
usleep(100 * 1000);
+#else
+ struct timeval tv;
+ tv.tv_sec = 0;
+ tv.tv_usec = 100 * 1000;
+
+ select(0, NULL, NULL, NULL, &tv);
#endif
return 0;
}
diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake
index 0f8ec8e27..467b41a35 100644
--- a/Tests/CTestUpdateCommon.cmake
+++ b/Tests/CTestUpdateCommon.cmake
@@ -73,7 +73,7 @@ function(check_updates build)
string(REGEX REPLACE "${rev_regex}" "\\1" element "${r}")
set(element_${element} 1)
endforeach()
- foreach(element ${rev_elements})
+ foreach(element IN LISTS rev_elements)
if(NOT element_${element})
list(APPEND MISSING "global <${element}> element")
endif()
@@ -85,7 +85,7 @@ function(check_updates build)
if(MISSING)
# List the missing entries
string(APPEND MSG "Update.xml is missing expected entries:\n")
- foreach(f ${MISSING})
+ foreach(f IN LISTS MISSING)
string(APPEND MSG " ${f}\n")
endforeach()
else()
@@ -97,7 +97,7 @@ function(check_updates build)
if(EXTRA)
# List the extra entries
string(APPEND MSG "Update.xml has extra unexpected entries:\n")
- foreach(f ${EXTRA})
+ foreach(f IN LISTS EXTRA)
string(APPEND MSG " ${f}\n")
endforeach()
else()
diff --git a/Tests/CTestUpdateP4.cmake.in b/Tests/CTestUpdateP4.cmake.in
index 8a99e67f0..2ac01e271 100644
--- a/Tests/CTestUpdateP4.cmake.in
+++ b/Tests/CTestUpdateP4.cmake.in
@@ -109,7 +109,7 @@ list(APPEND P4CMD ${P4_CLIENT})
message("Adding files to repository")
file(GLOB_RECURSE files ${TOP}/user-source/*)
-foreach(filename ${files})
+foreach(filename IN LISTS files)
run_child(
WORKING_DIRECTORY ${TOP}/user-source
COMMAND ${P4CMD} add ${filename}
@@ -140,14 +140,14 @@ run_child(
# Make changes in the working tree.
message("Changing content...")
update_content(user-source files_added files_removed dirs_added)
-foreach(filename ${files_added})
+foreach(filename IN LISTS files_added)
message("add: ${filename}")
run_child(
WORKING_DIRECTORY ${TOP}/user-source
COMMAND ${P4CMD} add ${TOP}/user-source/${filename}
)
endforeach()
-foreach(filename ${files_removed})
+foreach(filename IN LISTS files_removed)
run_child(
WORKING_DIRECTORY ${TOP}/user-source
COMMAND ${P4CMD} delete ${TOP}/user-source/${filename}
diff --git a/Tests/CheckSourceTree/CMakeLists.txt b/Tests/CheckSourceTree/CMakeLists.txt
new file mode 100644
index 000000000..3abc6a924
--- /dev/null
+++ b/Tests/CheckSourceTree/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_test(NAME CMake.CheckSourceTree
+ COMMAND ${CMAKE_CMAKE_COMMAND} -D GIT_EXECUTABLE=${GIT_EXECUTABLE}
+ -D CMake_SOURCE_DIR=${CMake_SOURCE_DIR}
+ -P ${CMAKE_CURRENT_LIST_DIR}/check.cmake
+ )
+set_property(TEST CMake.CheckSourceTree PROPERTY RUN_SERIAL 1)
diff --git a/Tests/CheckSourceTree/check.cmake b/Tests/CheckSourceTree/check.cmake
new file mode 100644
index 000000000..c2e3529d6
--- /dev/null
+++ b/Tests/CheckSourceTree/check.cmake
@@ -0,0 +1,22 @@
+# Give Git access to the real home directory to get user's settings.
+if(DEFINED ENV{CTEST_REAL_HOME})
+ set(ENV{HOME} "$ENV{CTEST_REAL_HOME}")
+endif()
+
+execute_process(
+ COMMAND "${GIT_EXECUTABLE}" status
+ WORKING_DIRECTORY "${CMake_SOURCE_DIR}"
+ OUTPUT_VARIABLE output
+ ERROR_VARIABLE output
+ RESULT_VARIABLE result
+ )
+string(REPLACE "\n" "\n " output " ${output}")
+if(NOT result EQUAL 0)
+ message(FATAL_ERROR "'git status' failed (${result}):\n${output}")
+endif()
+
+if(output MATCHES "\n[ \t#]*(Changes |new file:|modified:|Untracked )")
+ message(FATAL_ERROR "The source tree is not clean. 'git status' reports:\n${output}")
+endif()
+
+message(STATUS "The source tree is clean.")
diff --git a/Tests/CheckSwift.cmake b/Tests/CheckSwift.cmake
index fcbae7ef9..099c298ee 100644
--- a/Tests/CheckSwift.cmake
+++ b/Tests/CheckSwift.cmake
@@ -14,6 +14,7 @@ if(NOT DEFINED CMAKE_Swift_COMPILER)
project(CheckSwift Swift)
file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
\"set(CMAKE_Swift_COMPILER \\\"\${CMAKE_Swift_COMPILER}\\\")\\n\"
+ \"set(CMAKE_Swift_COMPILER_VERSION \\\"\${CMAKE_Swift_COMPILER_VERSION}\\\")\\n\"
\"set(CMAKE_Swift_FLAGS \\\"\${CMAKE_Swift_FLAGS}\\\")\\n\")
")
@@ -54,6 +55,7 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
message(STATUS "${_desc} - ${CMAKE_Swift_COMPILER}")
set(CMAKE_Swift_COMPILER "${CMAKE_Swift_COMPILER}" CACHE FILEPATH "Swift compiler")
+ set(CMAKE_Swift_COMPILER_VERSION "${CMAKE_Swift_COMPILER_VERSION}" CACHE FILEPATH "Swift compiler version")
set(CMAKE_Swift_FLAGS "${CMAKE_Swift_FLAGS}" CACHE STRING "Swift flags")
mark_as_advanced(CMAKE_Swift_COMPILER)
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt
index c6d1e8a05..f3d3a73f1 100644
--- a/Tests/CompileFeatures/CMakeLists.txt
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -356,6 +356,7 @@ else()
HAVE_CXX_STD_17=$<COMPILE_FEATURES:cxx_std_17>
HAVE_CXX_STD_20=$<COMPILE_FEATURES:cxx_std_20>
HAVE_CXX_STD_23=$<COMPILE_FEATURES:cxx_std_23>
+ HAVE_CXX_STD_26=$<COMPILE_FEATURES:cxx_std_26>
)
endif()
diff --git a/Tests/CompileFeatures/genex_test.cpp b/Tests/CompileFeatures/genex_test.cpp
index 9c3910e03..048f3decd 100644
--- a/Tests/CompileFeatures/genex_test.cpp
+++ b/Tests/CompileFeatures/genex_test.cpp
@@ -27,6 +27,9 @@
# if HAVE_CXX_STD_23 && !defined(ALLOW_LATER_STANDARDS)
# error HAVE_CXX_STD_23 is true with CXX_STANDARD == 11
# endif
+# if HAVE_CXX_STD_26 && !defined(ALLOW_LATER_STANDARDS)
+# error HAVE_CXX_STD_26 is true with CXX_STANDARD == 11
+# endif
#endif
#if !HAVE_OVERRIDE_CONTROL
diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt
index 5df22d25f..9493a2fa4 100644
--- a/Tests/Complex/CMakeLists.txt
+++ b/Tests/Complex/CMakeLists.txt
@@ -5,6 +5,14 @@ cmake_minimum_required(VERSION 2.4)
cmake_policy(SET CMP0054 NEW)
project (Complex)
+# Inform the test if the debug configuration is getting built.
+string(APPEND CMAKE_C_FLAGS_RELEASE " -DCOMPLEX_NDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_RELEASE " -DCOMPLEX_NDEBUG")
+string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " -DCOMPLEX_NDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " -DCOMPLEX_NDEBUG")
+string(APPEND CMAKE_C_FLAGS_MINSIZEREL " -DCOMPLEX_NDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL " -DCOMPLEX_NDEBUG")
+
# Test that renaming a built-in works when configured multiple times.
message("message")
function(message)
diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx
index 49e97d585..67a164521 100644
--- a/Tests/Complex/Executable/complex.cxx
+++ b/Tests/Complex/Executable/complex.cxx
@@ -62,7 +62,7 @@ void cmPassed(const char* Message, const char* m2 = "")
# error This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work
#endif
-#if defined(NDEBUG) && !defined(CMAKE_IS_FUN_IN_RELEASE_MODE)
+#if defined(COMPLEX_NDEBUG) && !defined(CMAKE_IS_FUN_IN_RELEASE_MODE)
# error Per-configuration directory-level definition not inherited.
#endif
diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt
index 5a4134d21..e4fdc6833 100644
--- a/Tests/ComplexOneConfig/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/CMakeLists.txt
@@ -5,6 +5,14 @@ cmake_minimum_required(VERSION 2.4)
cmake_policy(SET CMP0054 NEW)
project (Complex)
+# Inform the test if the debug configuration is getting built.
+string(APPEND CMAKE_C_FLAGS_RELEASE " -DCOMPLEX_NDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_RELEASE " -DCOMPLEX_NDEBUG")
+string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " -DCOMPLEX_NDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " -DCOMPLEX_NDEBUG")
+string(APPEND CMAKE_C_FLAGS_MINSIZEREL " -DCOMPLEX_NDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL " -DCOMPLEX_NDEBUG")
+
# Try setting a new policy. The IF test is for coverage.
if(POLICY CMP0003)
cmake_policy(SET CMP0003 NEW)
diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx
index 54c18f4ab..097668bbf 100644
--- a/Tests/ComplexOneConfig/Executable/complex.cxx
+++ b/Tests/ComplexOneConfig/Executable/complex.cxx
@@ -62,7 +62,7 @@ void cmPassed(const char* Message, const char* m2 = "")
# error This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work
#endif
-#if defined(NDEBUG) && !defined(CMAKE_IS_FUN_IN_RELEASE_MODE)
+#if defined(COMPLEX_NDEBUG) && !defined(CMAKE_IS_FUN_IN_RELEASE_MODE)
# error Per-configuration directory-level definition not inherited.
#endif
diff --git a/Tests/Cuda/SeparableCompCXXOnly/CMakeLists.txt b/Tests/Cuda/SeparableCompCXXOnly/CMakeLists.txt
index 97670e392..447e137d4 100644
--- a/Tests/Cuda/SeparableCompCXXOnly/CMakeLists.txt
+++ b/Tests/Cuda/SeparableCompCXXOnly/CMakeLists.txt
@@ -1,3 +1,6 @@
-project(SeparableCompCXXOnly LANGUAGES CXX CUDA)
+# Set CMAKE_CUDA_SEPARABLE_COMPILATION before `project`
+# so we verify that compiler/linker verbose extraction
+# works as required when a `dlink` is part of it
set(CMAKE_CUDA_SEPARABLE_COMPILATION ON)
+project(SeparableCompCXXOnly LANGUAGES CXX CUDA)
add_executable(SeparableCompCXXOnly main.cpp)
diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt
index aa4755d30..39634ac87 100644
--- a/Tests/CudaOnly/CMakeLists.txt
+++ b/Tests/CudaOnly/CMakeLists.txt
@@ -7,13 +7,13 @@ endmacro ()
add_cuda_test_macro(CudaOnly.Architecture Architecture)
add_cuda_test_macro(CudaOnly.ArchSpecial CudaOnlyArchSpecial)
add_cuda_test_macro(CudaOnly.CompileFlags CudaOnlyCompileFlags)
-
add_cuda_test_macro(CudaOnly.EnableStandard CudaOnlyEnableStandard)
add_cuda_test_macro(CudaOnly.ExportPTX CudaOnlyExportPTX)
add_cuda_test_macro(CudaOnly.SharedRuntimePlusToolkit CudaOnlySharedRuntimePlusToolkit)
add_cuda_test_macro(CudaOnly.Standard98 CudaOnlyStandard98)
add_cuda_test_macro(CudaOnly.Toolkit CudaOnlyToolkit)
add_cuda_test_macro(CudaOnly.ToolkitBeforeLang CudaOnlyToolkitBeforeLang)
+add_cuda_test_macro(CudaOnly.ToolkitMultipleDirs CudaOnlyToolkitMultipleDirs)
add_cuda_test_macro(CudaOnly.WithDefs CudaOnlyWithDefs)
add_cuda_test_macro(CudaOnly.CircularLinkLine CudaOnlyCircularLinkLine)
add_cuda_test_macro(CudaOnly.ResolveDeviceSymbols CudaOnlyResolveDeviceSymbols)
@@ -28,6 +28,19 @@ if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang")
add_cuda_test_macro(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag)
endif()
+# The CUDA only ships the shared version of the toolkit libraries
+# on windows
+if(NOT WIN32)
+ add_cuda_test_macro(CudaOnly.StaticRuntimePlusToolkit CudaOnlyStaticRuntimePlusToolkit)
+endif()
+
+add_cuda_test_macro(CudaOnly.DeviceLTO CudaOnlyDeviceLTO)
+
+if(MSVC)
+ # Tests for features that only work with MSVC
+ add_cuda_test_macro(CudaOnly.PDB CudaOnlyPDB)
+endif()
+
add_test(NAME CudaOnly.DontResolveDeviceSymbols COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -41,16 +54,6 @@ add_test(NAME CudaOnly.DontResolveDeviceSymbols COMMAND
set_property(TEST "CudaOnly.DontResolveDeviceSymbols" APPEND
PROPERTY LABELS "CUDA")
-# The CUDA only ships the shared version of the toolkit libraries
-# on windows
-if(NOT WIN32)
- add_cuda_test_macro(CudaOnly.StaticRuntimePlusToolkit CudaOnlyStaticRuntimePlusToolkit)
-endif()
-
-if(MSVC)
- add_cuda_test_macro(CudaOnly.PDB CudaOnlyPDB)
-endif()
-
add_test(NAME CudaOnly.RuntimeControls COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
diff --git a/Tests/CudaOnly/DeviceLTO/CMakeLists.txt b/Tests/CudaOnly/DeviceLTO/CMakeLists.txt
new file mode 100644
index 000000000..653b35db7
--- /dev/null
+++ b/Tests/CudaOnly/DeviceLTO/CMakeLists.txt
@@ -0,0 +1,37 @@
+cmake_minimum_required(VERSION 3.18)
+project(DeviceLTO CUDA)
+
+# Goal:
+# Verify that we correctly compile with device LTO
+# Verify that device LTO requirements are propagated to
+# the final device link line
+
+add_library(CUDA_dlto STATIC file1.cu file2.cu file3.cu)
+add_executable(CudaOnlyDeviceLTO main.cu)
+
+set_target_properties(CUDA_dlto
+ PROPERTIES
+ CUDA_ARCHITECTURES "${CMAKE_CUDA_ARCHITECTURES_ALL}"
+ CUDA_SEPARABLE_COMPILATION ON
+ POSITION_INDEPENDENT_CODE ON)
+
+set_target_properties(CudaOnlyDeviceLTO
+ PROPERTIES
+ CUDA_SEPARABLE_COMPILATION ON
+ CUDA_ARCHITECTURES "${CMAKE_CUDA_ARCHITECTURES_ALL}"
+ )
+
+target_link_libraries(CudaOnlyDeviceLTO PRIVATE CUDA_dlto)
+
+include(CheckIPOSupported)
+check_ipo_supported(LANGUAGES CUDA RESULT ipo_supported)
+if(ipo_supported)
+ set_target_properties(CUDA_dlto
+ PROPERTIES
+ INTERPROCEDURAL_OPTIMIZATION ON)
+
+ # When non-LTO variants (i.e. virtual) are built together with LTO ones the
+ # linker warns about missing device LTO for the virtual architectures.
+ # Ignore these warnings.
+ target_link_options(CudaOnlyDeviceLTO PRIVATE "$<DEVICE_LINK:-w>")
+endif()
diff --git a/Tests/CudaOnly/DeviceLTO/file1.cu b/Tests/CudaOnly/DeviceLTO/file1.cu
new file mode 100644
index 000000000..703927cfd
--- /dev/null
+++ b/Tests/CudaOnly/DeviceLTO/file1.cu
@@ -0,0 +1,17 @@
+#ifdef _WIN32
+# define EXPORT __declspec(dllexport)
+#else
+# define EXPORT
+#endif
+
+extern __device__ int file2_func(int);
+void __global__ kernel(int x)
+{
+ file2_func(x);
+}
+
+EXPORT int launch_kernel(int x)
+{
+ kernel<<<1, 1>>>(x);
+ return x;
+}
diff --git a/Tests/CudaOnly/DeviceLTO/file2.cu b/Tests/CudaOnly/DeviceLTO/file2.cu
new file mode 100644
index 000000000..73d646819
--- /dev/null
+++ b/Tests/CudaOnly/DeviceLTO/file2.cu
@@ -0,0 +1,5 @@
+extern __device__ int file3_func(int);
+int __device__ file2_func(int x)
+{
+ return x + file3_func(x);
+}
diff --git a/Tests/CudaOnly/DeviceLTO/file3.cu b/Tests/CudaOnly/DeviceLTO/file3.cu
new file mode 100644
index 000000000..235ac0665
--- /dev/null
+++ b/Tests/CudaOnly/DeviceLTO/file3.cu
@@ -0,0 +1,4 @@
+int __device__ file3_func(int x)
+{
+ return x * x * x;
+}
diff --git a/Tests/CudaOnly/DeviceLTO/main.cu b/Tests/CudaOnly/DeviceLTO/main.cu
new file mode 100644
index 000000000..8ef487338
--- /dev/null
+++ b/Tests/CudaOnly/DeviceLTO/main.cu
@@ -0,0 +1,62 @@
+#include <iostream>
+
+#include "cuda.h"
+
+#ifdef _WIN32
+# define IMPORT __declspec(dllimport)
+#else
+# define IMPORT
+#endif
+
+IMPORT int launch_kernel(int x);
+
+int choose_cuda_device()
+{
+ int nDevices = 0;
+ cudaError_t err = cudaGetDeviceCount(&nDevices);
+ if (err != cudaSuccess) {
+ std::cerr << "Failed to retrieve the number of CUDA enabled devices"
+ << std::endl;
+ return 1;
+ }
+ for (int i = 0; i < nDevices; ++i) {
+ cudaDeviceProp prop;
+ cudaError_t err = cudaGetDeviceProperties(&prop, i);
+ if (err != cudaSuccess) {
+ std::cerr << "Could not retrieve properties from CUDA device " << i
+ << std::endl;
+ return 1;
+ }
+ std::cout << "prop.major: " << prop.major << std::endl;
+ err = cudaSetDevice(i);
+ if (err != cudaSuccess) {
+ std::cout << "Could not select CUDA device " << i << std::endl;
+ } else {
+ return 0;
+ }
+ }
+
+ std::cout << "Could not find a CUDA enabled card" << std::endl;
+
+ return 1;
+}
+
+int main()
+{
+ int ret = choose_cuda_device();
+ if (ret) {
+ return 0;
+ }
+
+ cudaError_t err;
+ launch_kernel(1);
+ err = cudaGetLastError();
+ if (err != cudaSuccess) {
+ std::cerr << "launch_kernel: kernel launch should have passed.\n "
+ "Error message: "
+ << cudaGetErrorString(err) << std::endl;
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/Tests/CudaOnly/ToolkitMultipleDirs/CMakeLists.txt b/Tests/CudaOnly/ToolkitMultipleDirs/CMakeLists.txt
new file mode 100644
index 000000000..92551499d
--- /dev/null
+++ b/Tests/CudaOnly/ToolkitMultipleDirs/CMakeLists.txt
@@ -0,0 +1,22 @@
+cmake_minimum_required(VERSION 3.15)
+project(CudaOnlyToolkitMultipleDirs CUDA)
+
+find_package(CUDAToolkit REQUIRED)
+
+add_subdirectory(subdir)
+
+if(NOT DEFINED CUDAToolkit_VERSION)
+ message(FATAL_ERROR "expected CUDAToolkit variable CUDAToolkit_VERSION not found")
+endif()
+
+message(STATUS "CUDAToolkit_VERSION: ${CUDAToolkit_VERSION}")
+message(STATUS "CUDAToolkit_VERSION_MAJOR: ${CUDAToolkit_VERSION_MAJOR}")
+message(STATUS "CUDAToolkit_VERSION_MINOR: ${CUDAToolkit_VERSION_MINOR}")
+message(STATUS "CUDAToolkit_VERSION_PATCH: ${CUDAToolkit_VERSION_PATCH}")
+message(STATUS "CUDAToolkit_BIN_DIR: ${CUDAToolkit_BIN_DIR}")
+message(STATUS "CUDAToolkit_INCLUDE_DIRS: ${CUDAToolkit_INCLUDE_DIRS}")
+message(STATUS "CUDAToolkit_LIBRARY_DIR: ${CUDAToolkit_LIBRARY_DIR}")
+message(STATUS "CUDAToolkit_NVCC_EXECUTABLE ${CUDAToolkit_NVCC_EXECUTABLE}")
+
+add_executable(CudaOnlyToolkitMultipleDirs main.cu)
+target_link_libraries(CudaOnlyToolkitMultipleDirs PRIVATE CUDA::toolkit)
diff --git a/Tests/CudaOnly/ToolkitMultipleDirs/main.cu b/Tests/CudaOnly/ToolkitMultipleDirs/main.cu
new file mode 100644
index 000000000..0f3ccdcc8
--- /dev/null
+++ b/Tests/CudaOnly/ToolkitMultipleDirs/main.cu
@@ -0,0 +1,8 @@
+// Only thing we care about is that these headers are found
+#include <cuda.h>
+#include <cuda_runtime_api.h>
+
+int main(int argc, char** argv)
+{
+ return 0;
+}
diff --git a/Tests/CudaOnly/ToolkitMultipleDirs/subdir/CMakeLists.txt b/Tests/CudaOnly/ToolkitMultipleDirs/subdir/CMakeLists.txt
new file mode 100644
index 000000000..f1f4b8925
--- /dev/null
+++ b/Tests/CudaOnly/ToolkitMultipleDirs/subdir/CMakeLists.txt
@@ -0,0 +1,2 @@
+
+find_package(CUDAToolkit REQUIRED)
diff --git a/Tests/EnforceConfig.cmake.in b/Tests/EnforceConfig.cmake.in
index 7c6f76a24..7722d7d5f 100644
--- a/Tests/EnforceConfig.cmake.in
+++ b/Tests/EnforceConfig.cmake.in
@@ -10,7 +10,7 @@ if(NOT CTEST_CONFIGURATION_TYPE)
set(CTEST_CMD "@CMAKE_CTEST_COMMAND@@CMAKE_EXECUTABLE_SUFFIX@")
get_filename_component(CTEST_DIR "${CTEST_CMD}" PATH)
get_filename_component(CTEST_EXE "${CTEST_CMD}" NAME)
- foreach(cfg Release Debug MinSizeRel RelWithDebInfo)
+ foreach(cfg IN ITEMS Release Debug MinSizeRel RelWithDebInfo)
if(NOT CTEST_CONFIGURATION_TYPE)
if(EXISTS "${CTEST_DIR}/${cfg}/${CTEST_EXE}")
set(CTEST_CONFIGURATION_TYPE ${cfg})
@@ -36,4 +36,4 @@ unset(ENV{CMAKE_GENERATOR_TOOLSET})
unset(ENV{CMAKE_EXPORT_COMPILE_COMMANDS})
@TEST_HOME_ENV_CODE@
-@TEST_WARN_VS10_CODE@
+@TEST_WARN_VS11_CODE@
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index c9e41f564..6f19c13c0 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -155,6 +155,15 @@ target_include_directories(testInterfaceIncludeUser
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/testInterfaceIncludeUser>"
)
set_property(TARGET testInterfaceIncludeUser PROPERTY IMPORTED_NO_SYSTEM 1)
+
+add_library(testInterfaceIncludeUser2 INTERFACE)
+target_include_directories(testInterfaceIncludeUser2
+ INTERFACE
+ "$<INSTALL_INTERFACE:include/testInterfaceIncludeUser>"
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/testInterfaceIncludeUser>"
+)
+set_property(TARGET testInterfaceIncludeUser2 PROPERTY EXPORT_NO_SYSTEM 1)
+
install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/include/testInterfaceIncludeUser/testInterfaceInclude.h"
@@ -562,6 +571,7 @@ install(
TopDirLib SubDirLinkA
systemlib
testInterfaceIncludeUser
+ testInterfaceIncludeUser2
EXPORT exp
RUNTIME DESTINATION $<1:bin>$<0:/wrong>
LIBRARY DESTINATION $<1:lib>$<0:/wrong> NAMELINK_SKIP
@@ -622,6 +632,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3
TopDirLib SubDirLinkA
systemlib
testInterfaceIncludeUser
+ testInterfaceIncludeUser2
NAMESPACE bld_
FILE ExportBuildTree.cmake
)
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 272c7a95b..5bafdf825 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -75,6 +75,10 @@ add_library(imp_testInterfaceInclude1 STATIC imp_testInterfaceInclude1.c)
target_include_directories(imp_testInterfaceInclude1 SYSTEM PRIVATE testInterfaceIncludeSystem)
target_link_libraries(imp_testInterfaceInclude1 PRIVATE exp_testInterfaceIncludeUser)
+add_library(imp_testInterfaceInclude1b STATIC imp_testInterfaceInclude1.c)
+target_include_directories(imp_testInterfaceInclude1b SYSTEM PRIVATE testInterfaceIncludeSystem)
+target_link_libraries(imp_testInterfaceInclude1b PRIVATE exp_testInterfaceIncludeUser2)
+
add_executable(imp_UseSharedLibWithHelper1 ../../../InterfaceLinkLibrariesDirect/UseSharedLibWithHelper.c)
target_link_libraries(imp_UseSharedLibWithHelper1 PRIVATE exp_testSharedLibWithHelper testSharedLibHelperExclude)
@@ -122,9 +126,13 @@ target_link_libraries(imp_testExe1b
bld_testStaticLibWithPlugin
)
-add_library(imp_testInterfaceInclude1b STATIC imp_testInterfaceInclude1.c)
-target_include_directories(imp_testInterfaceInclude1b SYSTEM PRIVATE testInterfaceIncludeSystem)
-target_link_libraries(imp_testInterfaceInclude1b PRIVATE bld_testInterfaceIncludeUser)
+add_library(imp_testInterfaceInclude1c STATIC imp_testInterfaceInclude1.c)
+target_include_directories(imp_testInterfaceInclude1c SYSTEM PRIVATE testInterfaceIncludeSystem)
+target_link_libraries(imp_testInterfaceInclude1c PRIVATE bld_testInterfaceIncludeUser)
+
+add_library(imp_testInterfaceInclude1d STATIC imp_testInterfaceInclude1.c)
+target_include_directories(imp_testInterfaceInclude1d SYSTEM PRIVATE testInterfaceIncludeSystem)
+target_link_libraries(imp_testInterfaceInclude1d PRIVATE bld_testInterfaceIncludeUser2)
add_custom_target(check_testLib1_genex ALL
COMMAND ${CMAKE_COMMAND} -DtestLib1=$<TARGET_FILE:exp_testLib1>
diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt
index e4c6c66ac..81d31e77b 100644
--- a/Tests/ExternalProject/CMakeLists.txt
+++ b/Tests/ExternalProject/CMakeLists.txt
@@ -45,7 +45,11 @@ if(NOT DEFINED EP_TEST_HG OR EP_TEST_HG)
find_package(Hg)
endif()
if(NOT DEFINED EP_TEST_HG AND Hg_FOUND)
- set(EP_TEST_HG 1)
+ # Check if hg executable is working
+ execute_process(COMMAND "${HG_EXECUTABLE}" --version OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE HG_RV)
+ if(HG_RV EQUAL 0)
+ set(EP_TEST_HG 1)
+ endif()
endif()
message(STATUS "EP_TEST_CVS='${EP_TEST_CVS}' CVS_EXECUTABLE='${CVS_EXECUTABLE}'")
diff --git a/Tests/FindOpenAL/CMakeLists.txt b/Tests/FindOpenAL/CMakeLists.txt
new file mode 100644
index 000000000..fc4803e2c
--- /dev/null
+++ b/Tests/FindOpenAL/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindOpenAL.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindOpenAL/Test"
+ "${CMake_BINARY_DIR}/Tests/FindOpenAL/Test"
+ ${build_generator_args}
+ --build-project TestFindOpenAL
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindOpenAL/Test/CMakeLists.txt b/Tests/FindOpenAL/Test/CMakeLists.txt
new file mode 100644
index 000000000..fa3e2638e
--- /dev/null
+++ b/Tests/FindOpenAL/Test/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.21)
+project(TestFindOpenAL CXX)
+include(CTest)
+
+find_package(OpenAL REQUIRED)
+
+add_executable(test_tgt main.cxx)
+target_link_libraries(test_tgt OpenAL::OpenAL)
+add_test(NAME test_tgt COMMAND test_tgt)
+
+add_executable(test_var main.cxx)
+target_include_directories(test_var PRIVATE ${OPENAL_INCLUDE_DIR})
+target_link_libraries(test_var PRIVATE ${OPENAL_LIBRARY})
+add_test(NAME test_var COMMAND test_var)
diff --git a/Tests/FindOpenAL/Test/main.cxx b/Tests/FindOpenAL/Test/main.cxx
new file mode 100644
index 000000000..bb45faf5b
--- /dev/null
+++ b/Tests/FindOpenAL/Test/main.cxx
@@ -0,0 +1,13 @@
+#include <AL/al.h>
+#include <AL/alc.h>
+#include <stdio.h>
+
+int main()
+{
+ /* Reference an AL symbol without requiring a context at runtime. */
+ printf("&alGetString = %p\n", &alGetString);
+
+ /* Reference an ALC symbol without requiring a context at runtime. */
+ printf("&alcGetString = %p\n", &alcGetString);
+ return 0;
+}
diff --git a/Tests/FindOpenSP/CMakeLists.txt b/Tests/FindOpenSP/CMakeLists.txt
new file mode 100644
index 000000000..26826d3f0
--- /dev/null
+++ b/Tests/FindOpenSP/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindOpenSP.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindOpenSP/Test"
+ "${CMake_BINARY_DIR}/Tests/FindOpenSP/Test"
+ ${build_generator_args}
+ --build-project TestFindOpenSP
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindOpenSP/Test/CMakeLists.txt b/Tests/FindOpenSP/Test/CMakeLists.txt
new file mode 100644
index 000000000..d8992d9af
--- /dev/null
+++ b/Tests/FindOpenSP/Test/CMakeLists.txt
@@ -0,0 +1,16 @@
+cmake_minimum_required(VERSION 3.4)
+project(TestFindOpenSP CXX)
+include(CTest)
+
+find_package(OpenSP REQUIRED)
+
+add_definitions(-DSP_MULTI_BYTE="${OpenSP_MULTI_BYTE}")
+
+add_executable(test_tgt main.cxx)
+target_link_libraries(test_tgt OpenSP::OpenSP)
+add_test(NAME test_tgt COMMAND test_tgt)
+
+add_executable(test_var main.cxx)
+target_include_directories(test_var PRIVATE ${OpenSP_INCLUDE_DIRS})
+target_link_libraries(test_var PRIVATE ${OpenSP_LIBRARIES})
+add_test(NAME test_var COMMAND test_var)
diff --git a/Tests/FindOpenSP/Test/main.cxx b/Tests/FindOpenSP/Test/main.cxx
new file mode 100644
index 000000000..ef8aa2c4e
--- /dev/null
+++ b/Tests/FindOpenSP/Test/main.cxx
@@ -0,0 +1,55 @@
+#include <cassert>
+#include <string>
+
+#include "ParserEventGeneratorKit.h"
+
+std::string CharStringtostring(const SGMLApplication::CharString source)
+{
+ // The CharString type might have multi-byte characters if SP_MULTI_BYTE was
+ // defined
+ std::string result;
+ result.resize(source.len);
+ for (size_t i = 0; i < source.len; i++) {
+ result[i] = static_cast<char>(source.ptr[i]);
+ }
+ return result;
+}
+
+class OutlineApplication : public SGMLApplication
+{
+public:
+ OutlineApplication()
+ : depth_(0)
+ {
+ }
+ void startElement(const StartElementEvent& event)
+ {
+ for (unsigned i = 0; i < depth_; i++)
+ parsedOutput += "\t";
+ parsedOutput += CharStringtostring(event.gi);
+ depth_++;
+ }
+ void endElement(const EndElementEvent&) { depth_--; }
+ std::string parsedOutput;
+
+private:
+ unsigned depth_;
+};
+
+int main()
+{
+ std::string expectedOutput = "TESTDOC\tTESTELEMENT";
+ char file_name[] = "test.sgml";
+ char* files[] = { file_name, 0 };
+
+ ParserEventGeneratorKit parserKit;
+ EventGenerator* egp = parserKit.makeEventGenerator(1, files);
+ OutlineApplication app;
+ unsigned nErrors = egp->run(app);
+
+ assert(nErrors == 0);
+ assert(app.parsedOutput.compare(expectedOutput) == 0);
+
+ delete egp;
+ return 0;
+}
diff --git a/Tests/FindOpenSP/Test/test.sgml b/Tests/FindOpenSP/Test/test.sgml
new file mode 100644
index 000000000..bbf0da6ae
--- /dev/null
+++ b/Tests/FindOpenSP/Test/test.sgml
@@ -0,0 +1,7 @@
+ <!DOCTYPE TESTDOC [
+<!ELEMENT TESTDOC - - (TESTELEMENT)+>
+<!ELEMENT TESTELEMENT - - (#PCDATA)>
+]>
+<TESTDOC>
+<TESTELEMENT>Hello</TESTELEMENT>
+</TESTDOC>
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index c25b2c304..e4143b940 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -20,7 +20,7 @@ find_package(OpenGL QUIET)
find_package(NotAPackage QUIET)
# Look for a package that has an advanced find module.
-find_package(VTK QUIET)
+find_package(Boost QUIET)
add_executable(FindPackageTest FindPackageTest.cxx)
diff --git a/Tests/FindVulkan/Test/CMakeLists.txt b/Tests/FindVulkan/Test/CMakeLists.txt
index 42543ac6f..dfcfc156a 100644
--- a/Tests/FindVulkan/Test/CMakeLists.txt
+++ b/Tests/FindVulkan/Test/CMakeLists.txt
@@ -7,7 +7,10 @@ set(components
glslang
shaderc_combined
SPIRV-Tools
+ volk
+ dxc
)
+
if(APPLE)
list(APPEND components MoltenVK)
endif()
@@ -75,6 +78,14 @@ if(APPLE)
add_test(NAME test_tgt_MoltenVK COMMAND test_tgt_MoltenVK)
endif()
+add_executable(test_tgt_volk main-volk.cxx)
+target_link_libraries(test_tgt_volk Vulkan::volk)
+add_test(NAME test_tgt_volk COMMAND test_tgt_volk)
+
+add_executable(test_tgt_dxc_lib main-dxc_lib.cxx)
+target_link_libraries(test_tgt_dxc_lib Vulkan::dxc_lib)
+add_test(NAME test_tgt_dxc_lib COMMAND test_tgt_dxc_lib)
+
if(Vulkan_GLSLC_EXECUTABLE)
add_test(NAME test_glslc
COMMAND ${CMAKE_COMMAND}
@@ -92,3 +103,12 @@ if(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE)
-P "${CMAKE_CURRENT_LIST_DIR}/Run-glslangValidator.cmake"
)
endif()
+
+if(Vulkan_dxc_EXECUTABLE)
+ add_test(NAME test_dxc_exe
+ COMMAND ${CMAKE_COMMAND}
+ "-DVULKAN_DXC_EXECUTABLE=${Vulkan_dxc_EXECUTABLE}"
+ "-DVULKAN_DXC_EXECUTABLE_TARGET=$<TARGET_FILE:Vulkan::dxc_exe>"
+ -P "${CMAKE_CURRENT_LIST_DIR}/Run-dxc_exe.cmake"
+ )
+endif()
diff --git a/Tests/FindVulkan/Test/Run-dxc_exe.cmake b/Tests/FindVulkan/Test/Run-dxc_exe.cmake
new file mode 100644
index 000000000..0d38855ee
--- /dev/null
+++ b/Tests/FindVulkan/Test/Run-dxc_exe.cmake
@@ -0,0 +1,20 @@
+cmake_minimum_required(VERSION 3.12)
+
+function(run_dxc_exe exe exe_display)
+ execute_process(COMMAND ${exe} --help
+ OUTPUT_VARIABLE output
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE result
+ )
+
+ if(NOT result EQUAL 0)
+ message(SEND_ERROR "Result of ${exe_display} --help is ${result}, should be 0")
+ endif()
+
+ if(NOT output MATCHES "^OVERVIEW: HLSL Compiler for ")
+ message(SEND_ERROR "Output of ${exe_display} --help is \"${output}\", should begin with \"OVERVIEW: HLSL Compiler for \"")
+ endif()
+endfunction()
+
+run_dxc_exe("${VULKAN_DXC_EXECUTABLE}" "\${VULKAN_DXC_EXECUTABLE}")
+run_dxc_exe("${VULKAN_DXC_EXECUTABLE_TARGET}" "Vulkan::dxc_exe")
diff --git a/Tests/FindVulkan/Test/main-dxc_lib.cxx b/Tests/FindVulkan/Test/main-dxc_lib.cxx
new file mode 100644
index 000000000..6ccb0dea0
--- /dev/null
+++ b/Tests/FindVulkan/Test/main-dxc_lib.cxx
@@ -0,0 +1,23 @@
+#include <cstdio>
+
+#include "dxc/dxcapi.h"
+#include "printf.h"
+
+int main()
+{
+ IDxcCompiler3* compiler;
+ DxcCreateInstance(CLSID_DxcCompiler, IID_PPV_ARGS(&compiler));
+
+ assert(compiler);
+
+ IDxcVersionInfo* version;
+ compiler->QueryInterface(&version);
+
+ uint32_t major, minor;
+ version->GetVersion(&major, &minor);
+ printf("DirectX Shader Compiler: %u.%u\n", major, minor);
+ version->Release();
+ compiler->Release();
+
+ return 0;
+}
diff --git a/Tests/FindVulkan/Test/main-volk.cxx b/Tests/FindVulkan/Test/main-volk.cxx
new file mode 100644
index 000000000..2ec9fb48b
--- /dev/null
+++ b/Tests/FindVulkan/Test/main-volk.cxx
@@ -0,0 +1,14 @@
+#include <iostream>
+
+#include <volk/volk.h>
+
+int main()
+{
+ if (volkInitialize() != VK_SUCCESS) {
+ std::cout << "volk initialization success!" << std::endl;
+ } else {
+ std::cout << "volk initialization failure!" << std::endl;
+ }
+
+ return 0;
+}
diff --git a/Tests/FortranModules/Submodules/CMakeLists.txt b/Tests/FortranModules/Submodules/CMakeLists.txt
index ab8e0f9e5..783af7e1a 100644
--- a/Tests/FortranModules/Submodules/CMakeLists.txt
+++ b/Tests/FortranModules/Submodules/CMakeLists.txt
@@ -16,6 +16,7 @@
add_executable(submod
main.f90
parent.f90
+ obfuscated_parent.f90
child.f90
grandchild.f90
greatgrandchild.f90
diff --git a/Tests/FortranModules/Submodules/main.f90 b/Tests/FortranModules/Submodules/main.f90
index 3cd29892c..67ffba877 100644
--- a/Tests/FortranModules/Submodules/main.f90
+++ b/Tests/FortranModules/Submodules/main.f90
@@ -1,7 +1,10 @@
program main
use parent, only : child_function,grandchild_subroutine
use parent, only : sibling_function,GreatGrandChild_subroutine
+ ! Using a module without postfix
+ use obfuscated_parent
implicit none
- if (child_function()) call grandchild_subroutine
- if (sibling_function()) call GreatGrandChild_subroutine
+ if (child_function()) call grandchild_subroutine
+ if (sibling_function()) call GreatGrandChild_subroutine
+ if (child_function_obf()) call grandchild_subroutine_obf
end program
diff --git a/Tests/FortranModules/Submodules/obfuscated_parent.f90 b/Tests/FortranModules/Submodules/obfuscated_parent.f90
new file mode 100644
index 000000000..f3e68be1e
--- /dev/null
+++ b/Tests/FortranModules/Submodules/obfuscated_parent.f90
@@ -0,0 +1,33 @@
+! This module has two procedures from the "parent" module
+! but it has different combinations 'module <word>' phrases
+! in breaked lines for test of modules dependencies detection
+
+! Module declaration on breaked line with reminder
+module &
+ obfuscated_parent; implicit none
+
+ interface
+
+ ! Boolean module function
+ module logical &
+ function child_function_obf() result(child_stuff)
+ end function
+
+ ! Module subroutine
+ module subroutine &
+ grandchild_subroutine_obf()
+ end subroutine
+
+ end interface
+
+ contains
+
+ module logical function child_function_obf() result(child_stuff)
+ child_stuff=.true.
+ end function
+
+ module subroutine grandchild_subroutine_obf()
+ print *,"Test passed."
+ end subroutine
+
+end module obfuscated_parent
diff --git a/Tests/FortranModules/test_module_main.f90 b/Tests/FortranModules/test_module_main.f90
index 6ac97fa91..958d0a293 100644
--- a/Tests/FortranModules/test_module_main.f90
+++ b/Tests/FortranModules/test_module_main.f90
@@ -1,4 +1,4 @@
PROGRAM MAINF90
- USE TEST_MODULE
+ USE TEST_MODULE, only : TEST_MODULE_FUNCTION
PRINT *,'Sum is',TEST_MODULE_FUNCTION(1., 2.)
END PROGRAM MAINF90
diff --git a/Tests/FunctionTest/CMakeLists.txt b/Tests/FunctionTest/CMakeLists.txt
index 64504470d..0660d0fa3 100644
--- a/Tests/FunctionTest/CMakeLists.txt
+++ b/Tests/FunctionTest/CMakeLists.txt
@@ -51,7 +51,7 @@ track_find_variable(testvar is_changed)
if ("${is_changed}" STREQUAL changed)
pass("same argument name test")
else ()
- pass("same argument name test")
+ fail("same argument name test" "Got: ${is_changed}")
endif ()
include("Util.cmake")
@@ -59,7 +59,7 @@ tester()
if (tester_res STREQUAL "${CMAKE_CURRENT_LIST_FILE}")
pass("CMAKE_CURRENT_LIST_FILE test")
else ()
- pass("CMAKE_CURRENT_LIST_FILE test")
+ fail("CMAKE_CURRENT_LIST_FILE test" "Got: ${tester_res}")
endif ()
diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt
index bb4b92c1b..e82cea2fe 100644
--- a/Tests/IncludeDirectories/CMakeLists.txt
+++ b/Tests/IncludeDirectories/CMakeLists.txt
@@ -121,12 +121,66 @@ add_library(ordertest ordertest.cpp)
target_include_directories(ordertest SYSTEM PUBLIC SystemIncludeDirectories/systemlib)
target_include_directories(ordertest PUBLIC SystemIncludeDirectories/userlib)
+# Test "IMPORTED_NO_SYSTEM" property and its interaction with "SYSTEM"
add_library(ordertest2 ordertest.cpp)
target_include_directories(ordertest2 SYSTEM PRIVATE SystemIncludeDirectories/systemlib)
target_link_libraries(ordertest2 PRIVATE ordertest2_userlib)
add_library(ordertest2_userlib INTERFACE IMPORTED)
target_include_directories(ordertest2_userlib INTERFACE SystemIncludeDirectories/userlib)
set_property(TARGET ordertest2_userlib PROPERTY IMPORTED_NO_SYSTEM 1)
+get_property(system_prop_value TARGET ordertest2_userlib PROPERTY SYSTEM)
+if (NOT system_prop_value)
+ message(SEND_ERROR "ordertest2_userlib SYSTEM property should be ON.")
+endif()
+
+# Test "SYSTEM" property of non-imported libraries
+add_library(ordertest3_systemlib INTERFACE)
+target_include_directories(ordertest3_systemlib INTERFACE SystemIncludeDirectories/systemlib)
+set_property(TARGET ordertest3_systemlib PROPERTY SYSTEM 1)
+add_library(ordertest3_userlib INTERFACE)
+target_include_directories(ordertest3_userlib INTERFACE SystemIncludeDirectories/userlib)
+add_library(ordertest3 ordertest.cpp)
+target_link_libraries(ordertest3 PRIVATE ordertest3_systemlib ordertest3_userlib)
+
+# Test "SYSTEM" property of imported libraries and its interaction with "IMPORTED_NO_SYSTEM"
+add_library(ordertest4 ordertest.cpp)
+target_include_directories(ordertest4 SYSTEM PRIVATE SystemIncludeDirectories/systemlib)
+target_link_libraries(ordertest4 PRIVATE ordertest4_userlib)
+add_library(ordertest4_userlib INTERFACE IMPORTED)
+target_include_directories(ordertest4_userlib INTERFACE SystemIncludeDirectories/userlib)
+set_property(TARGET ordertest4_userlib PROPERTY SYSTEM 0)
+get_property(imported_no_system_prop_value TARGET ordertest4_userlib PROPERTY IMPORTED_NO_SYSTEM)
+if (imported_no_system_prop_value)
+ message(SEND_ERROR "ordertest4_userlib IMPORTED_NO_SYSTEM property should be OFF.")
+endif()
+
+# Test the interaction between "SYSTEM" and "INTERFACE_SYSTEM_INCLUDE_DIRECTORIES"
+add_library(ordertest5_systemlib INTERFACE)
+target_include_directories(ordertest5_systemlib SYSTEM INTERFACE SystemIncludeDirectories/systemlib)
+# The default value of `SYSTEM` is already `OFF`. Here we explicitly set it again.
+set_property(TARGET ordertest5_systemlib PROPERTY SYSTEM 0)
+add_library(ordertest5_userlib INTERFACE)
+target_include_directories(ordertest5_userlib INTERFACE SystemIncludeDirectories/userlib)
+add_library(ordertest5 ordertest.cpp)
+target_link_libraries(ordertest5 PRIVATE ordertest5_systemlib ordertest5_userlib)
+
+# Test that the include of imported executable is treated as system by default.
+add_executable(ordertest6_systemexe IMPORTED)
+target_include_directories(ordertest6_systemexe INTERFACE SystemIncludeDirectories/systemlib)
+set_property(TARGET ordertest6_systemexe PROPERTY ENABLE_EXPORTS 1)
+add_library(ordertest6_userlib INTERFACE)
+target_include_directories(ordertest6_userlib INTERFACE SystemIncludeDirectories/userlib)
+add_library(ordertest6 ordertest.cpp)
+target_link_libraries(ordertest6 PRIVATE ordertest6_systemexe ordertest6_userlib)
+
+# Test that the include of imported executable is not treated as system if "SYSTEM" property is OFF.
+add_library(ordertest7 ordertest.cpp)
+target_include_directories(ordertest7 SYSTEM PRIVATE SystemIncludeDirectories/systemlib)
+target_link_libraries(ordertest7 PRIVATE ordertest7_userexe)
+add_library(ordertest7_userexe INTERFACE IMPORTED)
+target_include_directories(ordertest7_userexe INTERFACE SystemIncludeDirectories/userlib)
+set_property(TARGET ordertest7_userexe PROPERTY ENABLE_EXPORTS 1)
+set_property(TARGET ordertest7_userexe PROPERTY SYSTEM 0)
add_subdirectory(StandardIncludeDirectories)
add_subdirectory(TargetIncludeDirectories)
diff --git a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c
index af7b09259..7176ebe9d 100644
--- a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c
+++ b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c
@@ -75,10 +75,10 @@ static int CCONV InitialPass(void* inf, void* mf, int argc, char* argv[])
info->CAPI->DisplaySatus(mf, info->CAPI->GetStartOutputDirectory(mf));
info->CAPI->DisplaySatus(mf, info->CAPI->GetCurrentDirectory(mf));
info->CAPI->DisplaySatus(mf, info->CAPI->GetCurrentOutputDirectory(mf));
- sprintf(buffer, "Cache version: %d.%d, CMake version: %d.%d",
- info->CAPI->GetCacheMajorVersion(mf),
- info->CAPI->GetCacheMinorVersion(mf),
- info->CAPI->GetMajorVersion(mf), info->CAPI->GetMinorVersion(mf));
+ snprintf(
+ buffer, sizeof(buffer), "Cache version: %d.%d, CMake version: %d.%d",
+ info->CAPI->GetCacheMajorVersion(mf), info->CAPI->GetCacheMinorVersion(mf),
+ info->CAPI->GetMajorVersion(mf), info->CAPI->GetMinorVersion(mf));
info->CAPI->DisplaySatus(mf, buffer);
if (info->CAPI->CommandExists(mf, "SET")) {
info->CAPI->DisplaySatus(mf, "Command SET exists");
@@ -91,10 +91,12 @@ static int CCONV InitialPass(void* inf, void* mf, int argc, char* argv[])
source_file = info->CAPI->CreateNewSourceFile(mf);
cstr = info->CAPI->SourceFileGetSourceName(source_file);
- sprintf(buffer, "Should be empty (source file name): [%s]", cstr);
+ snprintf(buffer, sizeof(buffer), "Should be empty (source file name): [%s]",
+ cstr);
info->CAPI->DisplaySatus(mf, buffer);
cstr = info->CAPI->SourceFileGetFullPath(source_file);
- sprintf(buffer, "Should be empty (source file full path): [%s]", cstr);
+ snprintf(buffer, sizeof(buffer),
+ "Should be empty (source file full path): [%s]", cstr);
info->CAPI->DisplaySatus(mf, buffer);
info->CAPI->DefineSourceFileProperty(mf, "SOME_PROPERTY", "unused old prop",
"This property is no longer used", 0);
@@ -106,7 +108,8 @@ static int CCONV InitialPass(void* inf, void* mf, int argc, char* argv[])
"This property is for testing.", 0);
info->CAPI->SourceFileSetProperty(source_file, "SOME_PROPERTY2", "HERE");
cstr = info->CAPI->SourceFileGetProperty(source_file, "ABSTRACT");
- sprintf(buffer, "Should be 0 (source file abstract property): [%p]", cstr);
+ snprintf(buffer, sizeof(buffer),
+ "Should be 0 (source file abstract property): [%p]", cstr);
info->CAPI->DisplaySatus(mf, buffer);
info->CAPI->DestroySourceFile(source_file);
diff --git a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c b/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c
index af7b09259..7176ebe9d 100644
--- a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c
+++ b/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c
@@ -75,10 +75,10 @@ static int CCONV InitialPass(void* inf, void* mf, int argc, char* argv[])
info->CAPI->DisplaySatus(mf, info->CAPI->GetStartOutputDirectory(mf));
info->CAPI->DisplaySatus(mf, info->CAPI->GetCurrentDirectory(mf));
info->CAPI->DisplaySatus(mf, info->CAPI->GetCurrentOutputDirectory(mf));
- sprintf(buffer, "Cache version: %d.%d, CMake version: %d.%d",
- info->CAPI->GetCacheMajorVersion(mf),
- info->CAPI->GetCacheMinorVersion(mf),
- info->CAPI->GetMajorVersion(mf), info->CAPI->GetMinorVersion(mf));
+ snprintf(
+ buffer, sizeof(buffer), "Cache version: %d.%d, CMake version: %d.%d",
+ info->CAPI->GetCacheMajorVersion(mf), info->CAPI->GetCacheMinorVersion(mf),
+ info->CAPI->GetMajorVersion(mf), info->CAPI->GetMinorVersion(mf));
info->CAPI->DisplaySatus(mf, buffer);
if (info->CAPI->CommandExists(mf, "SET")) {
info->CAPI->DisplaySatus(mf, "Command SET exists");
@@ -91,10 +91,12 @@ static int CCONV InitialPass(void* inf, void* mf, int argc, char* argv[])
source_file = info->CAPI->CreateNewSourceFile(mf);
cstr = info->CAPI->SourceFileGetSourceName(source_file);
- sprintf(buffer, "Should be empty (source file name): [%s]", cstr);
+ snprintf(buffer, sizeof(buffer), "Should be empty (source file name): [%s]",
+ cstr);
info->CAPI->DisplaySatus(mf, buffer);
cstr = info->CAPI->SourceFileGetFullPath(source_file);
- sprintf(buffer, "Should be empty (source file full path): [%s]", cstr);
+ snprintf(buffer, sizeof(buffer),
+ "Should be empty (source file full path): [%s]", cstr);
info->CAPI->DisplaySatus(mf, buffer);
info->CAPI->DefineSourceFileProperty(mf, "SOME_PROPERTY", "unused old prop",
"This property is no longer used", 0);
@@ -106,7 +108,8 @@ static int CCONV InitialPass(void* inf, void* mf, int argc, char* argv[])
"This property is for testing.", 0);
info->CAPI->SourceFileSetProperty(source_file, "SOME_PROPERTY2", "HERE");
cstr = info->CAPI->SourceFileGetProperty(source_file, "ABSTRACT");
- sprintf(buffer, "Should be 0 (source file abstract property): [%p]", cstr);
+ snprintf(buffer, sizeof(buffer),
+ "Should be 0 (source file abstract property): [%p]", cstr);
info->CAPI->DisplaySatus(mf, buffer);
info->CAPI->DestroySourceFile(source_file);
diff --git a/Tests/MSVCDebugInformationFormat/CMakeLists.txt b/Tests/MSVCDebugInformationFormat/CMakeLists.txt
new file mode 100644
index 000000000..b09bc6c41
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/CMakeLists.txt
@@ -0,0 +1,81 @@
+cmake_minimum_required(VERSION 3.24)
+cmake_policy(SET CMP0141 NEW)
+
+# The debug information format flags do not change preprocessor definitions,
+# so override our table of flags to artificially add a definition we can check.
+set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/override-C.cmake)
+set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/override-CXX.cmake)
+set(CMAKE_USER_MAKE_RULES_OVERRIDE_CUDA ${CMAKE_CURRENT_SOURCE_DIR}/override-CUDA.cmake)
+set(CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran ${CMAKE_CURRENT_SOURCE_DIR}/override-Fortran.cmake)
+
+project(MSVCDebugInformationFormat)
+if(CMake_TEST_CUDA)
+ enable_language(CUDA)
+endif()
+if(CMake_TEST_Fortran)
+ enable_language(Fortran)
+endif()
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+if("${CMAKE_C_COMPILER_ID};${CMAKE_C_SIMULATE_ID};${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "Clang;MSVC;GNU")
+ set(verify_default VERIFY_Z7)
+ set(NO_COMPILER_PDB 1)
+elseif("${CMAKE_C_COMPILER_ID};${CMAKE_C_SIMULATE_ID};${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "Clang;MSVC;MSVC")
+ set(verify_default VERIFY_Zi)
+ set(NO_EDIT_AND_CONTINUE 1)
+else()
+ set(verify_default VERIFY_Zi)
+endif()
+
+set(verify_def_Embedded -DVERIFY_Z7)
+set(verify_def_ProgramDatabase -DVERIFY_Zi)
+set(verify_def_EditAndContinue -DVERIFY_ZI)
+
+function(verify_combination format lang src)
+ # Test that try_compile builds with this debug format.
+ set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "${format}")
+ set(CMAKE_TRY_COMPILE_CONFIGURATION "Debug")
+ set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
+ try_compile(${format}_COMPILES
+ ${CMAKE_CURRENT_BINARY_DIR}/try_compile/${format}
+ ${CMAKE_CURRENT_SOURCE_DIR}/${src}
+ COMPILE_DEFINITIONS ${verify_def_${format}}
+ CMAKE_FLAGS -DINCLUDE_DIRECTORIES=${CMAKE_CURRENT_SOURCE_DIR}
+ OUTPUT_VARIABLE ${format}_OUTPUT
+ )
+ if(${format}_COMPILES)
+ message(STATUS "try_compile ${lang} with ${format} worked")
+ else()
+ string(REPLACE "\n" "\n " ${format}_OUTPUT " ${${format}_OUTPUT}")
+ message(SEND_ERROR "try_compile ${lang} with ${format} failed:\n${${format}_OUTPUT}")
+ endif()
+
+ # Test that targets build with this debug format.
+ set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<BOOL:$<TARGET_PROPERTY:BOOL_TRUE>>:${format}>$<$<BOOL:$<TARGET_PROPERTY:BOOL_FALSE>>:BadContent>")
+ add_library(${format}-${lang} ${src})
+ set_property(TARGET ${format}-${lang} PROPERTY BOOL_TRUE TRUE)
+ target_compile_definitions(${format}-${lang} PRIVATE ${verify_def_${format}})
+endfunction()
+
+function(verify lang src)
+ add_library(default-${lang} ${src})
+ target_compile_definitions(default-${lang} PRIVATE "$<$<CONFIG:Debug,RelWithDebInfo>:${verify_default}>")
+
+ verify_combination(Embedded ${lang} ${src})
+ if(NOT NO_COMPILER_PDB)
+ verify_combination(ProgramDatabase ${lang} ${src})
+ if(NOT NO_EDIT_AND_CONTINUE AND NOT lang MATCHES "^(Fortran)$")
+ verify_combination(EditAndContinue ${lang} ${src})
+ endif()
+ endif()
+endfunction()
+
+verify(C verify.c)
+verify(CXX verify.cxx)
+if(CMake_TEST_CUDA)
+ verify(CUDA verify.cu)
+endif()
+if(CMake_TEST_Fortran)
+ verify(Fortran verify.F90)
+endif()
diff --git a/Tests/MSVCDebugInformationFormat/override-C.cmake b/Tests/MSVCDebugInformationFormat/override-C.cmake
new file mode 100644
index 000000000..e8f5ae41e
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/override-C.cmake
@@ -0,0 +1,7 @@
+set(var "CMAKE_C_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_Embedded")
+string(REPLACE "-Z7" "-Z7;-DTEST_Z7" "${var}" "${${var}}")
+string(REPLACE "-gcodeview" "-gcodeview;-DTEST_Z7" "${var}" "${${var}}")
+set(var "CMAKE_C_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_ProgramDatabase")
+string(REPLACE "-Zi" "-Zi;-DTEST_Zi" "${var}" "${${var}}")
+set(var "CMAKE_C_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_EditAndContinue")
+string(REPLACE "-ZI" "-ZI;-DTEST_ZI" "${var}" "${${var}}")
diff --git a/Tests/MSVCDebugInformationFormat/override-CUDA.cmake b/Tests/MSVCDebugInformationFormat/override-CUDA.cmake
new file mode 100644
index 000000000..f870775f5
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/override-CUDA.cmake
@@ -0,0 +1,6 @@
+set(var "CMAKE_CUDA_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_Embedded")
+string(REPLACE "-Z7" "-Z7;-DTEST_Z7" "${var}" "${${var}}")
+set(var "CMAKE_CUDA_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_ProgramDatabase")
+string(REPLACE "-Zi" "-Zi;-DTEST_Zi" "${var}" "${${var}}")
+set(var "CMAKE_CUDA_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_EditAndContinue")
+string(REPLACE "-ZI" "-ZI;-DTEST_ZI" "${var}" "${${var}}")
diff --git a/Tests/MSVCDebugInformationFormat/override-CXX.cmake b/Tests/MSVCDebugInformationFormat/override-CXX.cmake
new file mode 100644
index 000000000..caa23fe47
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/override-CXX.cmake
@@ -0,0 +1,7 @@
+set(var "CMAKE_CXX_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_Embedded")
+string(REPLACE "-Z7" "-Z7;-DTEST_Z7" "${var}" "${${var}}")
+string(REPLACE "-gcodeview" "-gcodeview;-DTEST_Z7" "${var}" "${${var}}")
+set(var "CMAKE_CXX_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_ProgramDatabase")
+string(REPLACE "-Zi" "-Zi;-DTEST_Zi" "${var}" "${${var}}")
+set(var "CMAKE_CXX_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_EditAndContinue")
+string(REPLACE "-ZI" "-ZI;-DTEST_ZI" "${var}" "${${var}}")
diff --git a/Tests/MSVCDebugInformationFormat/override-Fortran.cmake b/Tests/MSVCDebugInformationFormat/override-Fortran.cmake
new file mode 100644
index 000000000..5d2db58af
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/override-Fortran.cmake
@@ -0,0 +1,4 @@
+set(var "CMAKE_Fortran_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_Embedded")
+string(REPLACE "-Z7" "-Z7;-DTEST_Z7" "${var}" "${${var}}")
+set(var "CMAKE_Fortran_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_ProgramDatabase")
+string(REPLACE "-Zi" "-Zi;-DTEST_Zi" "${var}" "${${var}}")
diff --git a/Tests/MSVCDebugInformationFormat/verify.F90 b/Tests/MSVCDebugInformationFormat/verify.F90
new file mode 100644
index 000000000..741bca6b8
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/verify.F90
@@ -0,0 +1 @@
+#include "verify.h"
diff --git a/Tests/MSVCDebugInformationFormat/verify.c b/Tests/MSVCDebugInformationFormat/verify.c
new file mode 100644
index 000000000..741bca6b8
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/verify.c
@@ -0,0 +1 @@
+#include "verify.h"
diff --git a/Tests/MSVCDebugInformationFormat/verify.cu b/Tests/MSVCDebugInformationFormat/verify.cu
new file mode 100644
index 000000000..741bca6b8
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/verify.cu
@@ -0,0 +1 @@
+#include "verify.h"
diff --git a/Tests/MSVCDebugInformationFormat/verify.cxx b/Tests/MSVCDebugInformationFormat/verify.cxx
new file mode 100644
index 000000000..741bca6b8
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/verify.cxx
@@ -0,0 +1 @@
+#include "verify.h"
diff --git a/Tests/MSVCDebugInformationFormat/verify.h b/Tests/MSVCDebugInformationFormat/verify.h
new file mode 100644
index 000000000..4bd6529ea
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/verify.h
@@ -0,0 +1,29 @@
+#ifdef VERIFY_Z7
+# ifndef TEST_Z7
+# error "TEST_Z7 incorrectly not defined by debug format selection"
+# endif
+#else
+# ifdef TEST_Z7
+# error "TEST_Z7 incorrectly defined by non-debug format selection"
+# endif
+#endif
+
+#ifdef VERIFY_Zi
+# ifndef TEST_Zi
+# error "TEST_Zi incorrectly not defined by debug format selection"
+# endif
+#else
+# ifdef TEST_Zi
+# error "TEST_Zi incorrectly defined by non-debug format selection"
+# endif
+#endif
+
+#ifdef VERIFY_ZI
+# ifndef TEST_ZI
+# error "TEST_ZI incorrectly not defined by debug format selection"
+# endif
+#else
+# ifdef TEST_ZI
+# error "TEST_ZI incorrectly defined by non-debug format selection"
+# endif
+#endif
diff --git a/Tests/Module/CheckIPOSupported-CUDA/CMakeLists.txt b/Tests/Module/CheckIPOSupported-CUDA/CMakeLists.txt
new file mode 100644
index 000000000..9dd670e5a
--- /dev/null
+++ b/Tests/Module/CheckIPOSupported-CUDA/CMakeLists.txt
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 3.8)
+project(CheckIPOSupported-CUDA LANGUAGES CUDA)
+
+cmake_policy(SET CMP0069 NEW)
+
+include(CheckIPOSupported)
+check_ipo_supported(RESULT ipo_supported OUTPUT ipo_output)
+if(ipo_supported)
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
+endif()
+
+if(NOT ipo_supported AND CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA"
+ AND CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.2)
+ message(FATAL_ERROR "CheckIPOSupported failed to correctly identify NVIDIA CUDA IPO support")
+endif()
+
+set(CMAKE_CUDA_SEPARABLE_COMPILATION ON)
+
+add_library(foo STATIC foo.cu)
+set_target_properties(foo PROPERTIES
+ WINDOWS_EXPORT_ALL_SYMBOLS ON
+ POSITION_INDEPENDENT_CODE ON)
+
+add_library(bar SHARED bar.cu)
+set_target_properties(bar PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
+target_link_libraries(bar PRIVATE foo)
+
+add_executable(CheckIPOSupported-CUDA main.cu)
+target_link_libraries(CheckIPOSupported-CUDA PUBLIC bar)
+
+enable_testing()
+add_test(NAME CheckIPOSupported-CUDA COMMAND CheckIPOSupported-CUDA)
diff --git a/Tests/Module/CheckIPOSupported-CUDA/bar.cu b/Tests/Module/CheckIPOSupported-CUDA/bar.cu
new file mode 100644
index 000000000..79b276db2
--- /dev/null
+++ b/Tests/Module/CheckIPOSupported-CUDA/bar.cu
@@ -0,0 +1,12 @@
+__device__ int foo_func(int);
+
+void __global__ bar_kernel(int x)
+{
+ foo_func(x);
+}
+
+int launch_kernel(int x)
+{
+ bar_kernel<<<1, 1>>>(x);
+ return x;
+}
diff --git a/Tests/Module/CheckIPOSupported-CUDA/foo.cu b/Tests/Module/CheckIPOSupported-CUDA/foo.cu
new file mode 100644
index 000000000..416607bdd
--- /dev/null
+++ b/Tests/Module/CheckIPOSupported-CUDA/foo.cu
@@ -0,0 +1,4 @@
+extern __device__ int foo_func(int a)
+{
+ return a * 42 + 9;
+}
diff --git a/Tests/Module/CheckIPOSupported-CUDA/main.cu b/Tests/Module/CheckIPOSupported-CUDA/main.cu
new file mode 100644
index 000000000..8ef487338
--- /dev/null
+++ b/Tests/Module/CheckIPOSupported-CUDA/main.cu
@@ -0,0 +1,62 @@
+#include <iostream>
+
+#include "cuda.h"
+
+#ifdef _WIN32
+# define IMPORT __declspec(dllimport)
+#else
+# define IMPORT
+#endif
+
+IMPORT int launch_kernel(int x);
+
+int choose_cuda_device()
+{
+ int nDevices = 0;
+ cudaError_t err = cudaGetDeviceCount(&nDevices);
+ if (err != cudaSuccess) {
+ std::cerr << "Failed to retrieve the number of CUDA enabled devices"
+ << std::endl;
+ return 1;
+ }
+ for (int i = 0; i < nDevices; ++i) {
+ cudaDeviceProp prop;
+ cudaError_t err = cudaGetDeviceProperties(&prop, i);
+ if (err != cudaSuccess) {
+ std::cerr << "Could not retrieve properties from CUDA device " << i
+ << std::endl;
+ return 1;
+ }
+ std::cout << "prop.major: " << prop.major << std::endl;
+ err = cudaSetDevice(i);
+ if (err != cudaSuccess) {
+ std::cout << "Could not select CUDA device " << i << std::endl;
+ } else {
+ return 0;
+ }
+ }
+
+ std::cout << "Could not find a CUDA enabled card" << std::endl;
+
+ return 1;
+}
+
+int main()
+{
+ int ret = choose_cuda_device();
+ if (ret) {
+ return 0;
+ }
+
+ cudaError_t err;
+ launch_kernel(1);
+ err = cudaGetLastError();
+ if (err != cudaSuccess) {
+ std::cerr << "launch_kernel: kernel launch should have passed.\n "
+ "Error message: "
+ << cudaGetErrorString(err) << std::endl;
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/Tests/ModuleDefinition/CMakeLists.txt b/Tests/ModuleDefinition/CMakeLists.txt
index 567fb4b9f..483bd8b21 100644
--- a/Tests/ModuleDefinition/CMakeLists.txt
+++ b/Tests/ModuleDefinition/CMakeLists.txt
@@ -15,7 +15,17 @@ add_custom_command(OUTPUT example_dll_gen.def
add_library(example_dll_gen SHARED example_dll_gen.c example_dll_gen.def)
# Test /DEF:<file> flag recognition for VS.
-if(MSVC OR CMAKE_C_COMPILER_ID STREQUAL "Intel")
+if(MSVC AND CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM")
+ # IntelLLVM for MSVC frontend variant needs the /DEF flag wrapped to be sent
+ # to the linker, which happens automatically when the DEF file is added
+ # to the sources.
+ add_library(example_dll_2 SHARED
+ example_dll_2.c
+ "${ModuleDefinition_SOURCE_DIR}/example_dll_2.def"
+ )
+ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS EXAMPLE_DLL_2)
+ set(example_dll_2 example_dll_2)
+elseif(MSVC OR CMAKE_C_COMPILER_ID STREQUAL "Intel")
add_library(example_dll_2 SHARED example_dll_2.c)
set_property(TARGET example_dll_2 PROPERTY LINK_FLAGS
/DEF:"${ModuleDefinition_SOURCE_DIR}/example_dll_2.def")
diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt
index 4347459f1..84ca5e8a9 100644
--- a/Tests/Preprocess/CMakeLists.txt
+++ b/Tests/Preprocess/CMakeLists.txt
@@ -197,9 +197,14 @@ endif()
#-----------------------------------------------------------------------------
# Inform the test if the debug configuration is getting built.
-# The NDEBUG definition takes care of this for release.
string(APPEND CMAKE_C_FLAGS_DEBUG " -DPREPROCESS_DEBUG")
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -DPREPROCESS_DEBUG")
+string(APPEND CMAKE_C_FLAGS_RELEASE " -DPREPROCESS_NDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_RELEASE " -DPREPROCESS_NDEBUG")
+string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " -DPREPROCESS_NDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " -DPREPROCESS_NDEBUG")
+string(APPEND CMAKE_C_FLAGS_MINSIZEREL " -DPREPROCESS_NDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL " -DPREPROCESS_NDEBUG")
# Inform the test if it built from Xcode.
if(PP_XCODE)
diff --git a/Tests/Preprocess/preprocess.c b/Tests/Preprocess/preprocess.c
index b3117da5f..88f9e97e0 100644
--- a/Tests/Preprocess/preprocess.c
+++ b/Tests/Preprocess/preprocess.c
@@ -33,7 +33,7 @@ int check_defines_C(void)
result = 0;
}
}
-#ifdef NDEBUG
+#ifdef PREPROCESS_NDEBUG
# ifdef FILE_DEF_DEBUG
{
fprintf(stderr, "FILE_DEF_DEBUG should not be defined in C\n");
diff --git a/Tests/Preprocess/preprocess.cxx b/Tests/Preprocess/preprocess.cxx
index f2fffef72..50150d1cc 100644
--- a/Tests/Preprocess/preprocess.cxx
+++ b/Tests/Preprocess/preprocess.cxx
@@ -35,7 +35,7 @@ int check_defines_CXX()
result = 0;
}
}
-#ifdef NDEBUG
+#ifdef PREPROCESS_NDEBUG
# ifdef FILE_DEF_DEBUG
{
fprintf(stderr, "FILE_DEF_DEBUG should not be defined in CXX\n");
diff --git a/Tests/RunCMake/AutoExportDll/AutoExport.cmake b/Tests/RunCMake/AutoExportDll/AutoExport.cmake
index dbcf4b8a5..fe57d5661 100644
--- a/Tests/RunCMake/AutoExportDll/AutoExport.cmake
+++ b/Tests/RunCMake/AutoExportDll/AutoExport.cmake
@@ -7,7 +7,7 @@ set_property(TARGET objlib PROPERTY POSITION_INDEPENDENT_CODE 1)
add_library(autoexport SHARED hello.cxx world.cxx foo.c $<TARGET_OBJECTS:objlib>)
add_library(autoexport3 SHARED cppCLI.cxx)
if(MSVC AND NOT MSVC_VERSION VERSION_LESS 1600
- AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64")
+ AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64")
set_property(TARGET autoexport3 PROPERTY COMMON_LANGUAGE_RUNTIME "")
endif()
@@ -17,7 +17,7 @@ if(MSVC)
add_library(autoexport_for_exec SHARED hello2.c)
target_link_libraries(autoexport_for_exec say)
if(NOT MSVC_VERSION VERSION_LESS 1600 AND
- NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64")
+ NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64")
enable_language(ASM_MASM)
target_sources(autoexport PRIVATE nop.asm)
set_property(SOURCE nop.asm PROPERTY COMPILE_FLAGS /safeseh)
diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
index 06f416b8c..809907931 100644
--- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
+++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
@@ -60,8 +60,7 @@ set(run_BuildDepends_skip_step_3 1)
run_BuildDepends(C-Exe)
if(NOT RunCMake_GENERATOR STREQUAL "Xcode")
- if(RunCMake_GENERATOR MATCHES "Visual Studio 10" OR
- RunCMake_GENERATOR_TOOLSET MATCHES "^(v80|v90|v100)$")
+ if(RunCMake_GENERATOR_TOOLSET MATCHES "^(v80|v90|v100)$")
# VS 10 forgets to re-link when a manifest changes
set(run_BuildDepends_skip_step_2 1)
endif()
diff --git a/Tests/RunCMake/CMP0102/CMP0102-OLD-stderr.txt b/Tests/RunCMake/CMP0102/CMP0102-OLD-stderr.txt
new file mode 100644
index 000000000..5d09fcf58
--- /dev/null
+++ b/Tests/RunCMake/CMP0102/CMP0102-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0102-OLD.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0102 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake b/Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake
index 61e046f89..074db6556 100644
--- a/Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakeDependentOption/RunCMakeTest.cmake
@@ -4,3 +4,4 @@ run_cmake_script(Regex-CMP0127-NEW)
run_cmake_script(Regex-CMP0127-OLD)
run_cmake_script(Parentheses-CMP0127-NEW)
run_cmake_script(Parentheses-CMP0127-WARN)
+run_cmake_script(UseDotSymbol)
diff --git a/Tests/RunCMake/CMakeDependentOption/UseDotSymbol-stdout.txt b/Tests/RunCMake/CMakeDependentOption/UseDotSymbol-stdout.txt
new file mode 100644
index 000000000..15b56a10d
--- /dev/null
+++ b/Tests/RunCMake/CMakeDependentOption/UseDotSymbol-stdout.txt
@@ -0,0 +1 @@
+-- USE_FOO='ON'
diff --git a/Tests/RunCMake/CMakeDependentOption/UseDotSymbol.cmake b/Tests/RunCMake/CMakeDependentOption/UseDotSymbol.cmake
new file mode 100644
index 000000000..8f07c4814
--- /dev/null
+++ b/Tests/RunCMake/CMakeDependentOption/UseDotSymbol.cmake
@@ -0,0 +1,4 @@
+include(CMakeDependentOption)
+
+cmake_dependent_option(USE_FOO "Use Foo" ON "CMAKE_VERSION VERSION_GREATER_EQUAL 3.08" OFF)
+message(STATUS "USE_FOO='${USE_FOO}'")
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 09f248e55..3038ed846 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -197,6 +197,10 @@ if(CMAKE_GENERATOR MATCHES "Ninja")
${ninja_qt_args}
)
endif()
+ if(WIN32)
+ add_executable(showIncludes showIncludes.c)
+ list(APPEND Ninja_ARGS -DshowIncludes=$<TARGET_FILE:showIncludes>)
+ endif()
add_RunCMake_test(Ninja)
set(NinjaMultiConfig_ARGS
-DCYGWIN=${CYGWIN} -DMSYS=${MSYS}
@@ -295,6 +299,19 @@ if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja")
add_RunCMake_test(CompilerChange)
endif()
add_RunCMake_test(CompilerNotFound)
+if (APPLE AND CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
+ list(APPEND CompilerTest_ARGS -DCMake_TEST_OBJC=1)
+endif()
+if(CMAKE_Fortran_COMPILER)
+ list(APPEND CompilerTest_ARGS -DCMake_TEST_Fortran=1)
+endif()
+foreach(lang IN ITEMS CUDA HIP ISPC)
+ if(CMake_TEST_${lang})
+ list(APPEND CompilerTest_ARGS -DCMake_TEST_${lang}=1)
+ endif()
+endforeach()
+add_RunCMake_test(CompilerTest)
+set_property(TEST RunCMake.CompilerTest APPEND PROPERTY LABELS "CUDA" "HIP" "ISPC")
add_RunCMake_test(Configure -DMSVC_IDE=${MSVC_IDE})
add_RunCMake_test(DisallowedCommands)
if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja")
@@ -305,6 +322,9 @@ add_RunCMake_test(ExportImport)
add_RunCMake_test(ExternalData)
add_RunCMake_test(FeatureSummary)
add_RunCMake_test(FPHSA)
+if(CMAKE_USE_SYSTEM_JSONCPP)
+ list(APPEND FileAPI_ARGS -DJsonCpp_VERSION_STRING=${JsonCpp_VERSION_STRING})
+endif()
add_RunCMake_test(FileAPI -DPython_EXECUTABLE=${Python_EXECUTABLE}
-DCMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID})
add_RunCMake_test(FindBoost)
@@ -356,6 +376,7 @@ if(MSVC)
add_RunCMake_test(MSVCRuntimeLibrary)
add_RunCMake_test(MSVCRuntimeTypeInfo)
add_RunCMake_test(MSVCWarningFlags)
+ add_RunCMake_test(MSVCDebugInformationFormat)
endif()
if(XCODE_VERSION)
set(ObjectLibrary_ARGS -DXCODE_VERSION=${XCODE_VERSION})
@@ -453,6 +474,7 @@ add_RunCMake_test(find_path)
add_RunCMake_test(find_program -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
add_RunCMake_test(foreach)
add_RunCMake_test(function)
+add_RunCMake_test(block)
add_RunCMake_test(get_filename_component)
add_RunCMake_test(get_property)
add_RunCMake_test(if)
@@ -522,7 +544,9 @@ function(add_RunCMake_test_try_compile)
set(CMAKE_CXX_STANDARD_DEFAULT 14)
endif()
endif()
- foreach(var
+ foreach(
+ var
+ IN ITEMS
CMAKE_SYSTEM_NAME
CMAKE_C_COMPILER_ID
CMAKE_C_COMPILER_VERSION
@@ -536,7 +560,7 @@ function(add_RunCMake_test_try_compile)
CMake_TEST_FILESYSTEM_1S
CMAKE_OBJC_STANDARD_DEFAULT
CMAKE_OBJCXX_STANDARD_DEFAULT
- )
+ )
if(DEFINED ${var})
list(APPEND try_compile_ARGS -D${var}=${${var}})
endif()
@@ -566,6 +590,9 @@ if(CMake_TEST_CUDA)
endif()
add_RunCMake_test(DependencyGraph -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER})
+# Add C++ Module tests.
+add_RunCMake_test(CXXModules -DCMake_TEST_MODULE_COMPILATION=${CMake_TEST_MODULE_COMPILATION} -DCMake_TEST_MODULE_COMPILATION_RULES=${CMake_TEST_MODULE_COMPILATION_RULES})
+
# ctresalloc links against CMakeLib and CTestLib, which means it can't be built
# if CMake_TEST_EXTERNAL_CMAKE is activated (the compiler might be different.)
# So, it has to be provided in the original build tree.
@@ -689,6 +716,8 @@ add_RunCMake_test(target_link_libraries-LINK_LIBRARY -DCMAKE_SYSTEM_NAME=${CMAKE
-DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
-DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION}
-DMSVC_VERSION=${MSVC_VERSION}
+ -DXCODE=${XCODE}
+ -DXCODE_VERSION=${XCODE_VERSION}
-DCMAKE_SHARED_LIBRARY_PREFIX=${CMAKE_SHARED_LIBRARY_PREFIX}
-DCMAKE_SHARED_LIBRARY_SUFFIX=${CMAKE_SHARED_LIBRARY_SUFFIX}
-DCMAKE_IMPORT_LIBRARY_PREFIX=${CMAKE_IMPORT_LIBRARY_PREFIX}
@@ -948,7 +977,7 @@ if(CMake_TEST_ANDROID_NDK OR CMake_TEST_ANDROID_STANDALONE_TOOLCHAIN)
if(NOT "${CMAKE_GENERATOR}" MATCHES "Make|Ninja|Visual Studio 1[456]")
message(FATAL_ERROR "Android tests supported only by Makefile, Ninja, and Visual Studio >= 14 generators")
endif()
- foreach(v TEST_ANDROID_NDK TEST_ANDROID_STANDALONE_TOOLCHAIN)
+ foreach(v IN ITEMS TEST_ANDROID_NDK TEST_ANDROID_STANDALONE_TOOLCHAIN)
if(CMake_${v})
string(REPLACE ";" "|" ${v} "${CMake_${v}}")
list(APPEND Android_ARGS "-D${v}=${${v}}")
@@ -967,7 +996,7 @@ endif()
if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|9[0-9])")
add_RunCMake_test(CSharpCustomCommand)
- if(NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64")
+ if(NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64")
add_RunCMake_test(CSharpReferenceImport)
endif()
endif()
@@ -992,6 +1021,14 @@ add_RunCMake_test(CMakePresetsTest
-DPython_EXECUTABLE=${Python_EXECUTABLE}
-DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
)
+add_RunCMake_test(CMakePresetsPackage
+ -DPython_EXECUTABLE=${Python_EXECUTABLE}
+ -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
+ )
+add_RunCMake_test(CMakePresetsWorkflow
+ -DPython_EXECUTABLE=${Python_EXECUTABLE}
+ -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
+ )
add_RunCMake_test(VerifyHeaderSets)
diff --git a/Tests/RunCMake/CMakePresets/Comment-stderr.txt b/Tests/RunCMake/CMakePresets/Comment-stderr.txt
index 2f404bc45..b3b6b66d9 100644
--- a/Tests/RunCMake/CMakePresets/Comment-stderr.txt
+++ b/Tests/RunCMake/CMakePresets/Comment-stderr.txt
@@ -1,2 +1,9 @@
^CMake Error: Could not read presets from [^
-]*/Tests/RunCMake/CMakePresets/Comment: JSON parse error$
+]*/Tests/RunCMake/CMakePresets/Comment: JSON parse error
+Errors:
+[^
+]*Comment\/CMakePresets.json:
+\* Line 1, Column 1
+ Syntax error: value, object or array expected\.
+\* Line 2, Column 1
+ Extra non-whitespace after JSON value\.$
diff --git a/Tests/RunCMake/CMakePresets/DocumentationExampleListAllPresets-stdout.txt b/Tests/RunCMake/CMakePresets/DocumentationExampleListAllPresets-stdout.txt
new file mode 100644
index 000000000..57b714d74
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/DocumentationExampleListAllPresets-stdout.txt
@@ -0,0 +1,22 @@
+^Not searching for unused variables given on the command line\.
+Available configure presets:
+
+ "default" ?- Default Config
+ "ninja-multi" ?- Ninja Multi-Config(
+ "windows-only" - Windows-only configuration)?
+
+Available build presets:
+
+ "default"
+
+Available test presets:
+
+ "default"
+
+Available package presets:
+
+ "default"
+
+Available workflow presets:
+
+ "default"$
diff --git a/Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt
index 6970674c7..0d3c5001a 100644
--- a/Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt
+++ b/Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt
@@ -1,2 +1,5 @@
^CMake Error: Could not read presets from [^
-]*/Tests/RunCMake/CMakePresets/EmptyPresetName: Invalid preset$
+]*/Tests/RunCMake/CMakePresets/EmptyPresetName: Invalid preset
+Errors:
+[^
+]*/EmptyPresetName/CMakePresets.json$
diff --git a/Tests/RunCMake/CMakePresets/GoodNoSCache.cmake b/Tests/RunCMake/CMakePresets/GoodNoSCache.cmake
index df58e72e4..d9e399fbb 100644
--- a/Tests/RunCMake/CMakePresets/GoodNoSCache.cmake
+++ b/Tests/RunCMake/CMakePresets/GoodNoSCache.cmake
@@ -1,4 +1,5 @@
include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake)
get_filename_component(_parent "${CMAKE_SOURCE_DIR}" DIRECTORY)
+file(REAL_PATH "${_parent}" _parent)
test_variable(CMAKE_BINARY_DIR "" "${_parent}/GoodNoSCachePrep-build")
diff --git a/Tests/RunCMake/CMakePresets/IncludeNotFound-stderr.txt b/Tests/RunCMake/CMakePresets/IncludeNotFound-stderr.txt
index 7ccabab0f..85a2d7890 100644
--- a/Tests/RunCMake/CMakePresets/IncludeNotFound-stderr.txt
+++ b/Tests/RunCMake/CMakePresets/IncludeNotFound-stderr.txt
@@ -1,2 +1,5 @@
^CMake Error: Could not read presets from [^
-]*/Tests/RunCMake/CMakePresets/IncludeNotFound: File not found$
+]*/Tests/RunCMake/CMakePresets/IncludeNotFound: File not found
+Errors:
+[^
+]*/IncludeNotFound/NotFound.json: Failed to read file$
diff --git a/Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt b/Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt
index a43bf77be..89eff9fc5 100644
--- a/Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt
+++ b/Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt
@@ -1,2 +1,9 @@
^CMake Error: Could not read presets from [^
-]*/Tests/RunCMake/CMakePresets/JSONParseError: JSON parse error$
+]*/Tests/RunCMake/CMakePresets/JSONParseError: JSON parse error
+Errors:
+[^
+]*JSONParseError/CMakePresets.json:
+\* Line 1, Column 1
+ Syntax error: value, object or array expected\.
+\* Line 1, Column 1
+ A valid JSON document must be either an array or an object value\.$
diff --git a/Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild-stdout.txt b/Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild-stdout.txt
new file mode 100644
index 000000000..38f52aa5b
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild-stdout.txt
@@ -0,0 +1,8 @@
+^Not searching for unused variables given on the command line.
+Available configure presets:
+
+ "default"
+
+Available test presets:
+
+ "default"$
diff --git a/Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild.json.in b/Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild.json.in
new file mode 100644
index 000000000..92594777b
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/ListAllPresetsNoBuild.json.in
@@ -0,0 +1,14 @@
+{
+ "version": 3,
+ "configurePresets": [
+ {
+ "name": "default"
+ }
+ ],
+ "testPresets": [
+ {
+ "name": "default",
+ "configurePreset": "default"
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresets/ListAllPresetsNoTest-stdout.txt b/Tests/RunCMake/CMakePresets/ListAllPresetsNoTest-stdout.txt
new file mode 100644
index 000000000..8cac0a88a
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/ListAllPresetsNoTest-stdout.txt
@@ -0,0 +1,8 @@
+^Not searching for unused variables given on the command line.
+Available configure presets:
+
+ "default"
+
+Available build presets:
+
+ "default"$
diff --git a/Tests/RunCMake/CMakePresets/ListAllPresetsNoTest.json.in b/Tests/RunCMake/CMakePresets/ListAllPresetsNoTest.json.in
new file mode 100644
index 000000000..33fd0362a
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/ListAllPresetsNoTest.json.in
@@ -0,0 +1,14 @@
+{
+ "version": 3,
+ "configurePresets": [
+ {
+ "name": "default"
+ }
+ ],
+ "buildPresets": [
+ {
+ "name": "default",
+ "configurePreset": "default"
+ }
+ ]
+}
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt b/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-result.txt
index d00491fd7..d00491fd7 100644
--- a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt
+++ b/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-result.txt
diff --git a/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-stderr.txt b/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-stderr.txt
new file mode 100644
index 000000000..153abeea2
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/ListPresetsInvalidType-stderr.txt
@@ -0,0 +1,3 @@
+^CMake Error: Invalid value specified for --list-presets\.
+Valid values are configure, build, test, package, or all\. When no value is passed the default is configure\.
+CMake Error: Run 'cmake --help' for all supported options\.$
diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
index d097086db..efa838e82 100644
--- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
@@ -289,6 +289,7 @@ run_cmake_presets(UserInheritance)
# Test listing presets
set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/ListPresets.json.in")
run_cmake_presets(ListPresets --list-presets)
+run_cmake_presets(ListPresetsInvalidType --list-presets=invalid-type)
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/ListPresetsWorkingDir")
set(RunCMake_TEST_NO_CLEAN 1)
@@ -304,6 +305,12 @@ unset(RunCMake_TEST_BINARY_DIR)
run_cmake_presets(ListPresetsNoSuchPreset)
run_cmake_presets(ListPresetsHidden)
+set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/ListAllPresetsNoBuild.json.in")
+run_cmake_presets(ListAllPresetsNoBuild --list-presets=all)
+
+set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/ListAllPresetsNoTest.json.in")
+run_cmake_presets(ListAllPresetsNoTest --list-presets=all)
+
# Test warning and error flags
set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/Warnings.json.in")
set(CMakePresets_WARN_UNUSED_CLI 1)
@@ -401,4 +408,5 @@ set(CMakePresets_EXTRA_FILES
"${RunCMake_SOURCE_DIR}/moreThings.json.in"
)
run_cmake_presets(DocumentationExample --preset=default)
+run_cmake_presets(DocumentationExampleListAllPresets --list-presets=all)
unset(CMakePresets_EXTRA_FILES)
diff --git a/Tests/RunCMake/CMakePresetsPackage/CMakeLists.txt.in b/Tests/RunCMake/CMakePresetsPackage/CMakeLists.txt.in
new file mode 100644
index 000000000..129184a89
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/CMakeLists.txt.in
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.19)
+project("@CASE_NAME@" NONE)
+include("@CASE_SOURCE_DIR@/@CASE_NAME@.cmake")
diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-config-file-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-config-file-check.cmake
new file mode 100644
index 000000000..40240f97d
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-config-file-check.cmake
@@ -0,0 +1,6 @@
+include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake")
+
+set(filename "${RunCMake_TEST_BINARY_DIR}/default/_CPack_Packages/${CPACK_TOPLEVEL_TAG}/TGZ/config-file-alt.tar.gz")
+if(NOT EXISTS "${filename}")
+ set(RunCMake_TEST_FAILED "Expected ${filename} to exist but it does not")
+endif()
diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-configurations-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-configurations-check.cmake
new file mode 100644
index 000000000..3d684af87
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-configurations-check.cmake
@@ -0,0 +1,18 @@
+if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake")
+ set(cpack_dir "${RunCMake_TEST_BINARY_DIR}/default/_CPack_Packages/${CPACK_TOPLEVEL_TAG}")
+ set(contents [[Debug
+Release
+]])
+
+ file(GLOB dirs RELATIVE "${cpack_dir}" "${cpack_dir}/*")
+ foreach(dir IN LISTS dirs)
+ set(configs_file "${cpack_dir}/${dir}/${CPACK_PACKAGE_FILE_NAME}/configs.txt")
+ file(READ "${configs_file}" actual_contents)
+ if(NOT contents STREQUAL actual_contents)
+ string(REPLACE "\n" "\n " contents_formatted "${contents}")
+ string(REPLACE "\n" "\n " actual_contents_formatted "${actual_contents}")
+ string(APPEND RunCMake_TEST_FAILED "Expected contents of ${configs_file}:\n ${contents_formatted}\nActual contents:\n ${actual_contents_formatted}\n")
+ endif()
+ endforeach()
+endif()
diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-debug-stdout.txt b/Tests/RunCMake/CMakePresetsPackage/Good-package-debug-stdout.txt
new file mode 100644
index 000000000..be885b4cc
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-debug-stdout.txt
@@ -0,0 +1,2 @@
+CPack: [^
+]* Enable Debug
diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-generators-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-generators-check.cmake
new file mode 100644
index 000000000..aaa75e469
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-generators-check.cmake
@@ -0,0 +1 @@
+check_cpack_packages("TBZ2;TXZ" "")
diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-no-environment-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-no-environment-check.cmake
new file mode 100644
index 000000000..205e7b7d4
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-no-environment-check.cmake
@@ -0,0 +1,7 @@
+check_cpack_packages("TGZ;TXZ" [[TEST_ENV not defined
+TEST_ENV_REF=xx
+TEST_ENV_OVERRIDE not defined
+TEST_ENV_OVERRIDE_REF not defined
+]])
+
+include("${RunCMake_SOURCE_DIR}/check.cmake")
diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-package-directory-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-package-directory-check.cmake
new file mode 100644
index 000000000..8f4b771c5
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-package-directory-check.cmake
@@ -0,0 +1,6 @@
+include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake")
+
+set(filename "${RunCMake_TEST_BINARY_DIR}/default/package-directory/_CPack_Packages/${CPACK_TOPLEVEL_TAG}/TGZ/${CPACK_PACKAGE_FILE_NAME}.tar.gz")
+if(NOT EXISTS "${filename}")
+ set(RunCMake_TEST_FAILED "Expected ${filename} to exist but it does not")
+endif()
diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-package-name-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-package-name-check.cmake
new file mode 100644
index 000000000..fdc482496
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-package-name-check.cmake
@@ -0,0 +1,7 @@
+include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake")
+
+file(READ "${RunCMake_TEST_BINARY_DIR}/default/${CPACK_PACKAGE_FILE_NAME}.json" contents)
+string(JSON package_name GET "${contents}" packageName)
+if(NOT package_name STREQUAL "package-name")
+ set(RunCMake_TEST_FAILED "Expected package name to be \"package-name\" but it was \"${package_name}\"")
+endif()
diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-package-version-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-package-version-check.cmake
new file mode 100644
index 000000000..dba911093
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-package-version-check.cmake
@@ -0,0 +1,7 @@
+include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake")
+
+file(READ "${RunCMake_TEST_BINARY_DIR}/default/${CPACK_PACKAGE_FILE_NAME}.json" contents)
+string(JSON package_version GET "${contents}" packageVersion)
+if(NOT package_version STREQUAL "1.0")
+ set(RunCMake_TEST_FAILED "Expected package version to be \"1.0\" but it was \"${package_version}\"")
+endif()
diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-variables-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-variables-check.cmake
new file mode 100644
index 000000000..2858170fb
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-variables-check.cmake
@@ -0,0 +1,6 @@
+include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake")
+
+set(filename "${RunCMake_TEST_BINARY_DIR}/default/_CPack_Packages/${CPACK_TOPLEVEL_TAG}/TGZ/variables-package.tar.gz")
+if(NOT EXISTS "${filename}")
+ set(RunCMake_TEST_FAILED "Expected ${filename} to exist but it does not")
+endif()
diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-verbose-stdout.txt b/Tests/RunCMake/CMakePresetsPackage/Good-package-verbose-stdout.txt
new file mode 100644
index 000000000..22fd115a1
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-verbose-stdout.txt
@@ -0,0 +1 @@
+CPack: Enable Verbose
diff --git a/Tests/RunCMake/CMakePresetsPackage/Good-package-with-environment-check.cmake b/Tests/RunCMake/CMakePresetsPackage/Good-package-with-environment-check.cmake
new file mode 100644
index 000000000..a775e4d30
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/Good-package-with-environment-check.cmake
@@ -0,0 +1,7 @@
+check_cpack_packages("TGZ;TXZ" [[TEST_ENV=Environment variable
+TEST_ENV_REF=xEnvironment variablex
+TEST_ENV_OVERRIDE=Override
+TEST_ENV_OVERRIDE_REF=xOverridex
+]])
+
+include("${RunCMake_SOURCE_DIR}/check.cmake")
diff --git a/Tests/RunCMake/CMakePresetsPackage/Good.cmake b/Tests/RunCMake/CMakePresetsPackage/Good.cmake
new file mode 100644
index 000000000..d01944354
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/Good.cmake
@@ -0,0 +1,31 @@
+set(CPACK_PACKAGE_NAME Good)
+set(CPACK_GENERATOR "TGZ;TXZ")
+
+include(CPack)
+
+install(CODE [[
+function(print_env name)
+ if(DEFINED ENV{${name}})
+ file(APPEND $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/env.txt "${name}=$ENV{${name}}\n")
+ else()
+ file(APPEND $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/env.txt "${name} not defined\n")
+ endif()
+endfunction()
+
+file(REMOVE $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/env.txt)
+print_env(TEST_ENV)
+print_env(TEST_ENV_REF)
+print_env(TEST_ENV_OVERRIDE)
+print_env(TEST_ENV_OVERRIDE_REF)
+
+file(APPEND $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/configs.txt "$<CONFIG>\n")
+]])
+
+file(WRITE "${CMAKE_BINARY_DIR}/CPackConfigAlt.cmake" [[include(${CMAKE_CURRENT_LIST_DIR}/CPackConfig.cmake)
+set(CPACK_PACKAGE_FILE_NAME "config-file-alt")
+]])
+
+file(WRITE "${CMAKE_BINARY_DIR}/external_package.cmake" [[if(NOT CPACK_PACKAGE_VENDOR STREQUAL "some-vendor")
+ message(FATAL_ERROR "Expected vendor to be \"some-vendor\" but it was \"${CPACK_PACKAGE_VENDOR}\"")
+endif()
+]])
diff --git a/Tests/RunCMake/CMakePresetsPackage/Good.json.in b/Tests/RunCMake/CMakePresetsPackage/Good.json.in
new file mode 100644
index 000000000..0c0e7d916
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/Good.json.in
@@ -0,0 +1,135 @@
+{
+ "version": 6,
+ "configurePresets": [
+ {
+ "name": "default",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build/${presetName}",
+ "environment": {
+ "TEST_ENV": "Environment variable",
+ "TEST_ENV_OVERRIDE": "Overridden environment variable"
+ }
+ }
+ ],
+ "buildPresets": [
+ {
+ "name": "build-default-debug",
+ "configurePreset": "default",
+ "configuration": "Debug"
+ },
+ {
+ "name": "build-default-release",
+ "inherits": "build-default-debug",
+ "configuration": "Release"
+ }
+ ],
+ "packagePresets": [
+ {
+ "name": "minimal",
+ "configurePreset": "default"
+ },
+ {
+ "name": "defaults",
+ "hidden": false,
+ "inherits": [],
+ "vendor": {},
+ "displayName": "",
+ "description": "",
+ "environment": {},
+ "configurePreset": "default",
+ "inheritConfigureEnvironment": true
+ },
+ {
+ "name": "no-environment",
+ "configurePreset": "default",
+ "inheritConfigureEnvironment": false,
+ "environment": {
+ "TEST_ENV_REF": "x$env{TEST_ENV}x"
+ }
+ },
+ {
+ "name": "with-environment",
+ "inherits": "no-environment",
+ "inheritConfigureEnvironment": true,
+ "environment": {
+ "TEST_ENV_OVERRIDE": "Override",
+ "TEST_ENV_OVERRIDE_REF": "x$env{TEST_ENV_OVERRIDE}x",
+ "TEST_ENV_REF": "x$env{TEST_ENV}x"
+ }
+ },
+ {
+ "name": "generators",
+ "inherits": "minimal",
+ "generators": [
+ "TBZ2",
+ "TXZ"
+ ]
+ },
+ {
+ "name": "configurations",
+ "inherits": "minimal",
+ "configurations": [
+ "Debug",
+ "Release"
+ ]
+ },
+ {
+ "name": "variables",
+ "inherits": "minimal",
+ "variables": {
+ "CPACK_PACKAGE_FILE_NAME": "variables-package"
+ }
+ },
+ {
+ "name": "config-file",
+ "inherits": "minimal",
+ "configFile": "CPackConfigAlt.cmake"
+ },
+ {
+ "name": "debug",
+ "inherits": "minimal",
+ "output": {
+ "debug": true
+ }
+ },
+ {
+ "name": "verbose",
+ "inherits": "minimal",
+ "output": {
+ "verbose": true
+ }
+ },
+ {
+ "name": "package-name",
+ "inherits": "minimal",
+ "generators": [
+ "External"
+ ],
+ "packageName": "package-name"
+ },
+ {
+ "name": "package-version",
+ "inherits": "minimal",
+ "generators": [
+ "External"
+ ],
+ "packageVersion": "1.0"
+ },
+ {
+ "name": "package-directory",
+ "inherits": "minimal",
+ "packageDirectory": "${sourceDir}/build/default/package-directory"
+ },
+ {
+ "name": "vendor-name",
+ "inherits": "minimal",
+ "generators": [
+ "External"
+ ],
+ "variables": {
+ "CPACK_EXTERNAL_PACKAGE_SCRIPT": "${sourceDir}/build/default/external_package.cmake"
+ },
+ "vendorName": "some-vendor"
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsPackage/ListPresets-package-x-stdout.txt b/Tests/RunCMake/CMakePresetsPackage/ListPresets-package-x-stdout.txt
new file mode 100644
index 000000000..307ec0ae4
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/ListPresets-package-x-stdout.txt
@@ -0,0 +1,4 @@
+^Available package presets:
+
+ "default"
+ "with-description" - With Description$
diff --git a/Tests/RunCMake/CommandLine/DeprecateVS10-WARN-OFF.cmake b/Tests/RunCMake/CMakePresetsPackage/ListPresets.cmake
index e69de29bb..e69de29bb 100644
--- a/Tests/RunCMake/CommandLine/DeprecateVS10-WARN-OFF.cmake
+++ b/Tests/RunCMake/CMakePresetsPackage/ListPresets.cmake
diff --git a/Tests/RunCMake/CMakePresetsPackage/ListPresets.json.in b/Tests/RunCMake/CMakePresetsPackage/ListPresets.json.in
new file mode 100644
index 000000000..5f3cf4868
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/ListPresets.json.in
@@ -0,0 +1,20 @@
+{
+ "version": 6,
+ "configurePresets": [
+ {
+ "name": "default"
+ }
+ ],
+ "packagePresets": [
+ {
+ "name": "default",
+ "configurePreset": "default"
+ },
+ {
+ "name": "with-description",
+ "displayName": "With Description",
+ "description": "This preset has a description",
+ "configurePreset": "default"
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsPackage/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresetsPackage/RunCMakeTest.cmake
new file mode 100644
index 000000000..269fb6e03
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/RunCMakeTest.cmake
@@ -0,0 +1,102 @@
+include(RunCMake)
+
+# Presets do not support legacy VS generator name architecture suffix.
+if(RunCMake_GENERATOR MATCHES "^(Visual Studio [0-9]+ [0-9]+) ")
+ set(RunCMake_GENERATOR "${CMAKE_MATCH_1}")
+endif()
+
+function(run_cmake_package_presets name CMakePresetsPackage_CONFIGURE_PRESETS CMakePresetsPackage_BUILD_PRESETS CMakePresetsPackage_PACKAGE_PRESETS)
+ set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/${name}")
+ set(RunCMake_TEST_BINARY_DIR "${RunCMake_TEST_SOURCE_DIR}/build")
+ set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}")
+
+ set(RunCMake_TEST_NO_CLEAN TRUE)
+
+ file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+ set(CASE_NAME "${name}")
+ set(CASE_SOURCE_DIR "${RunCMake_SOURCE_DIR}")
+ configure_file("${RunCMake_SOURCE_DIR}/CMakeLists.txt.in" "${RunCMake_TEST_SOURCE_DIR}/CMakeLists.txt" @ONLY)
+
+ if(NOT CMakePresetsPackage_FILE)
+ set(CMakePresetsPackage_FILE "${RunCMake_SOURCE_DIR}/${name}.json.in")
+ endif()
+ if(EXISTS "${CMakePresetsPackage_FILE}")
+ configure_file("${CMakePresetsPackage_FILE}" "${RunCMake_TEST_SOURCE_DIR}/CMakePresets.json" @ONLY)
+ endif()
+
+ if(NOT CMakeUserPresets_FILE)
+ set(CMakeUserPresets_FILE "${RunCMake_SOURCE_DIR}/${name}User.json.in")
+ endif()
+ if(EXISTS "${CMakeUserPresets_FILE}")
+ configure_file("${CMakeUserPresets_FILE}" "${RunCMake_TEST_SOURCE_DIR}/CMakeUserPresets.json" @ONLY)
+ endif()
+
+ foreach(ASSET ${CMakePresetsPackage_ASSETS})
+ configure_file("${RunCMake_SOURCE_DIR}/${ASSET}" "${RunCMake_TEST_SOURCE_DIR}" COPYONLY)
+ endforeach()
+
+ if (NOT CMakePresetsPackage_NO_CONFIGURE)
+ foreach(CONFIGURE_PRESET ${CMakePresetsPackage_CONFIGURE_PRESETS})
+ run_cmake_command("${name}-configure-${CONFIGURE_PRESET}"
+ "${CMAKE_COMMAND}" "--preset" "${CONFIGURE_PRESET}")
+ endforeach()
+ endif()
+
+ if (NOT CMakePresetsPackage_NO_BUILD)
+ foreach(BUILD_PRESET ${CMakePresetsPackage_BUILD_PRESETS})
+ run_cmake_command("${name}-build-${BUILD_PRESET}"
+ "${CMAKE_COMMAND}" "--build" "--preset" "${BUILD_PRESET}")
+ endforeach()
+ endif()
+
+ set(eq 0)
+ foreach(PACKAGE_PRESET ${CMakePresetsPackage_PACKAGE_PRESETS})
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/default/_CPack_Packages")
+
+ if (EXISTS "${RunCMake_SOURCE_DIR}/${name}-package-${PACKAGE_PRESET}-check.cmake")
+ set(RunCMake-check-file "${name}-package-${PACKAGE_PRESET}-check.cmake")
+ else()
+ set(RunCMake-check-file "check.cmake")
+ endif()
+
+ if(eq)
+ run_cmake_command(${name}-package-${PACKAGE_PRESET}
+ ${CMAKE_CPACK_COMMAND} "--preset=${PACKAGE_PRESET}" ${ARGN})
+ set(eq 0)
+ else()
+ run_cmake_command(${name}-package-${PACKAGE_PRESET}
+ ${CMAKE_CPACK_COMMAND} "--preset" "${PACKAGE_PRESET}" ${ARGN})
+ set(eq 1)
+ endif()
+ endforeach()
+endfunction()
+
+function(check_cpack_packages generators contents)
+ include("${RunCMake_TEST_BINARY_DIR}/default/CPackConfig.cmake")
+
+ set(cpack_dir "${RunCMake_TEST_BINARY_DIR}/default/_CPack_Packages/${CPACK_TOPLEVEL_TAG}")
+ file(GLOB dirs RELATIVE "${cpack_dir}" "${cpack_dir}/*")
+ if(NOT dirs STREQUAL generators)
+ string(APPEND RunCMake_TEST_FAILED "Expected CPack generators: ${generators}\nActual CPack generators: ${dirs}\n")
+ endif()
+
+ if(contents)
+ foreach(dir IN LISTS dirs)
+ set(env_file "${cpack_dir}/${dir}/${CPACK_PACKAGE_FILE_NAME}/env.txt")
+ file(READ "${env_file}" actual_contents)
+ if(NOT contents STREQUAL actual_contents)
+ string(REPLACE "\n" "\n " contents_formatted "${contents}")
+ string(REPLACE "\n" "\n " actual_contents_formatted "${actual_contents}")
+ string(APPEND RunCMake_TEST_FAILED "Expected contents of ${env_file}:\n ${contents_formatted}\nActual contents:\n ${actual_contents_formatted}\n")
+ endif()
+ endforeach()
+ endif()
+
+ set(RunCMake_TEST_FAILED ${RunCMake_TEST_FAILED} PARENT_SCOPE)
+endfunction()
+
+run_cmake_package_presets(UnsupportedVersion "x" "" "")
+run_cmake_package_presets(Good "default" "build-default-debug" "no-environment;with-environment;generators;configurations;variables;config-file;debug;verbose;package-name;package-version;package-directory;vendor-name")
+run_cmake_package_presets(ListPresets "default" "" "x" "--list-presets")
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt b/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion-configure-x-result.txt
index d00491fd7..d00491fd7 100644
--- a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt
+++ b/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion-configure-x-result.txt
diff --git a/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion-configure-x-stderr.txt b/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion-configure-x-stderr.txt
new file mode 100644
index 000000000..4c461e3f8
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion-configure-x-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion: File version must be 6 or higher for package preset support$
diff --git a/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion.json.in b/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion.json.in
new file mode 100644
index 000000000..e5f724070
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/UnsupportedVersion.json.in
@@ -0,0 +1,4 @@
+{
+ "version": 5,
+ "packagePresets": []
+}
diff --git a/Tests/RunCMake/CMakePresetsPackage/check.cmake b/Tests/RunCMake/CMakePresetsPackage/check.cmake
new file mode 100644
index 000000000..e79c4f12a
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsPackage/check.cmake
@@ -0,0 +1,3 @@
+set(CMakePresets_VALIDATE_SCRIPT_PATH "${RunCMake_SOURCE_DIR}/../CMakePresets/validate_schema.py")
+include("${RunCMake_SOURCE_DIR}/../CMakePresets/validate_schema.cmake")
+include("${RunCMake_SOURCE_DIR}/../CMakePresets/check.cmake")
diff --git a/Tests/RunCMake/CMakePresetsTest/Good-test-outputJUnit-check.cmake b/Tests/RunCMake/CMakePresetsTest/Good-test-outputJUnit-check.cmake
new file mode 100644
index 000000000..e1788cb83
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/Good-test-outputJUnit-check.cmake
@@ -0,0 +1,4 @@
+include("${CMAKE_CURRENT_LIST_DIR}/check.cmake")
+if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/default/output.xml")
+ string(APPEND RunCMake_TEST_FAILED "Expected ${RunCMake_TEST_BINARY_DIR}/default/output.xml to exist but it does not\n")
+endif()
diff --git a/Tests/RunCMake/CMakePresetsTest/Good-test-outputLog-check.cmake b/Tests/RunCMake/CMakePresetsTest/Good-test-outputLog-check.cmake
new file mode 100644
index 000000000..e860d4218
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/Good-test-outputLog-check.cmake
@@ -0,0 +1,4 @@
+include("${CMAKE_CURRENT_LIST_DIR}/check.cmake")
+if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/default/output.log")
+ string(APPEND RunCMake_TEST_FAILED "Expected ${RunCMake_TEST_BINARY_DIR}/default/output.log to exist but it does not\n")
+endif()
diff --git a/Tests/RunCMake/CMakePresetsTest/Good.json.in b/Tests/RunCMake/CMakePresetsTest/Good.json.in
index d484a199f..a4b875a1d 100644
--- a/Tests/RunCMake/CMakePresetsTest/Good.json.in
+++ b/Tests/RunCMake/CMakePresetsTest/Good.json.in
@@ -1,5 +1,5 @@
{
- "version": 5,
+ "version": 6,
"configurePresets": [
{
"name": "default",
@@ -171,6 +171,20 @@
"execution": {
"showOnly": "human"
}
+ },
+ {
+ "name": "outputLog",
+ "inherits": "minimal",
+ "output": {
+ "outputLogFile": "${sourceDir}/build/default/output.log"
+ }
+ },
+ {
+ "name": "outputJUnit",
+ "inherits": "minimal",
+ "output": {
+ "outputJUnitFile": "${sourceDir}/build/default/output.xml"
+ }
}
]
}
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt b/Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported-test-x-result.txt
index d00491fd7..d00491fd7 100644
--- a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt
+++ b/Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported-test-x-result.txt
diff --git a/Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported-test-x-stderr.txt b/Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported-test-x-stderr.txt
new file mode 100644
index 000000000..acd578548
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported-test-x-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported: File version must be 6 or higher for CTest JUnit output support$
diff --git a/Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported.json.in b/Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported.json.in
new file mode 100644
index 000000000..93f6b0c20
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported.json.in
@@ -0,0 +1,17 @@
+{
+ "version": 5,
+ "configurePresets": [
+ {
+ "name": "default"
+ }
+ ],
+ "testPresets": [
+ {
+ "name": "unsupported",
+ "configurePreset": "default",
+ "output": {
+ "outputJUnitFile": "junit.xml"
+ }
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake
index bec0dd946..1c7b8360f 100644
--- a/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake
@@ -78,7 +78,7 @@ set(CMakePresetsTest_ASSETS "Good-indexFile.txt")
set(GoodTestPresets
"minimal;defaults;noEnvironment;withEnvironment"
"config-debug;config-release"
- "exclude;index;indexFile;showOnly")
+ "exclude;index;indexFile;showOnly;outputLog;outputJUnit")
run_cmake_test_presets(Good
"default"
""
@@ -105,6 +105,8 @@ run_cmake_test_presets(Invalid "" "" "hidden;vendorMacro")
set(CMakePresets_SCHEMA_EXPECTED_RESULT 1)
run_cmake_test_presets(PresetsUnsupported "" "" "x")
run_cmake_test_presets(ConditionFuture "" "" "x")
+run_cmake_test_presets(TestOutputTruncationUnsupported "" "" "x")
+run_cmake_test_presets(OutputJUnitUnsupported "" "" "x")
set(CMakePresets_SCHEMA_EXPECTED_RESULT 0)
run_cmake_test_presets(ConfigurePresetUnreachable "" "" "x")
set(CMakePresetsTest_NO_CONFIGURE 0)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt b/Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported-test-x-result.txt
index d00491fd7..d00491fd7 100644
--- a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt
+++ b/Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported-test-x-result.txt
diff --git a/Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported-test-x-stderr.txt b/Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported-test-x-stderr.txt
new file mode 100644
index 000000000..90ea7c3b2
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported-test-x-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported: File version must be 5 or higher for testOutputTruncation preset support\.$
diff --git a/Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported.json.in b/Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported.json.in
new file mode 100644
index 000000000..c116039af
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported.json.in
@@ -0,0 +1,17 @@
+{
+ "version": 4,
+ "configurePresets": [
+ {
+ "name": "default"
+ }
+ ],
+ "testPresets": [
+ {
+ "name": "default",
+ "configurePreset": "default",
+ "output": {
+ "testOutputTruncation": "tail"
+ }
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/BadExitCode-result.txt b/Tests/RunCMake/CMakePresetsWorkflow/BadExitCode-result.txt
new file mode 100644
index 000000000..45a4fb75d
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/BadExitCode-result.txt
@@ -0,0 +1 @@
+8
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/BadExitCode-stderr.txt b/Tests/RunCMake/CMakePresetsWorkflow/BadExitCode-stderr.txt
new file mode 100644
index 000000000..0690c694b
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/BadExitCode-stderr.txt
@@ -0,0 +1,4 @@
+^Errors while running CTest
+Output from these tests are in: [^
+]*/Tests/RunCMake/CMakePresetsWorkflow/BadExitCode/build/Testing/Temporary/LastTest\.log
+Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely\.$
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/BadExitCode-stdout.txt b/Tests/RunCMake/CMakePresetsWorkflow/BadExitCode-stdout.txt
new file mode 100644
index 000000000..2f23f8885
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/BadExitCode-stdout.txt
@@ -0,0 +1,17 @@
+^Executing workflow step 1 of 4: configure preset "default"
+
+.*Testing the configure step at [^
+]*/Tests/RunCMake/CMakePresetsWorkflow/BadExitCode/build.*
+
+Executing workflow step 2 of 4: build preset "default"
+
+.*Testing the build step at [^
+]*[\\/]Tests[\\/]RunCMake[\\/]CMakePresetsWorkflow[\\/]BadExitCode[\\/]build.*
+
+Executing workflow step 3 of 4: test preset "default"
+
+.*Testing the test step at [^
+]*/Tests/RunCMake/CMakePresetsWorkflow/BadExitCode/build.*
+
+The following tests FAILED:
+.* +1 - EchoTest \(Failed\)$
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/BadExitCode.cmake b/Tests/RunCMake/CMakePresetsWorkflow/BadExitCode.cmake
new file mode 100644
index 000000000..10b46e3f2
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/BadExitCode.cmake
@@ -0,0 +1,8 @@
+message(STATUS "Testing the configure step at ${CMAKE_BINARY_DIR}")
+
+add_custom_target(echo_test ALL COMMAND ${CMAKE_COMMAND} -E echo "Testing the build step at ${CMAKE_BINARY_DIR}")
+
+enable_testing()
+add_test(NAME EchoTest COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_LIST_DIR}/BadExitCodeTest.cmake")
+
+include(CPack)
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/BadExitCodeTest.cmake b/Tests/RunCMake/CMakePresetsWorkflow/BadExitCodeTest.cmake
new file mode 100644
index 000000000..59f683e60
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/BadExitCodeTest.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR " Testing the test step at ${CMAKE_BINARY_DIR}")
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/CMakeLists.txt.in b/Tests/RunCMake/CMakePresetsWorkflow/CMakeLists.txt.in
new file mode 100644
index 000000000..129184a89
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/CMakeLists.txt.in
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.19)
+project("@CASE_NAME@" NONE)
+include("@CASE_SOURCE_DIR@/@CASE_NAME@.cmake")
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt b/Tests/RunCMake/CMakePresetsWorkflow/ConfigureStepMismatch-result.txt
index d00491fd7..d00491fd7 100644
--- a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt
+++ b/Tests/RunCMake/CMakePresetsWorkflow/ConfigureStepMismatch-result.txt
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/ConfigureStepMismatch-stderr.txt b/Tests/RunCMake/CMakePresetsWorkflow/ConfigureStepMismatch-stderr.txt
new file mode 100644
index 000000000..22ca94d0d
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/ConfigureStepMismatch-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresetsWorkflow/ConfigureStepMismatch: Invalid workflow steps$
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/ConfigureStepMismatch.json.in b/Tests/RunCMake/CMakePresetsWorkflow/ConfigureStepMismatch.json.in
new file mode 100644
index 000000000..086414903
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/ConfigureStepMismatch.json.in
@@ -0,0 +1,32 @@
+{
+ "version": 6,
+ "configurePresets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "mismatch"
+ }
+ ],
+ "buildPresets": [
+ {
+ "name": "mismatch",
+ "configurePreset": "mismatch"
+ }
+ ],
+ "workflowPresets": [
+ {
+ "name": "default",
+ "steps": [
+ {
+ "type": "configure",
+ "name": "default"
+ },
+ {
+ "type": "build",
+ "name": "mismatch"
+ }
+ ]
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CommandLine/DeprecateVS10-WARN-ON.cmake b/Tests/RunCMake/CMakePresetsWorkflow/FirstStepNotConfigure-result.txt
index e69de29bb..e69de29bb 100644
--- a/Tests/RunCMake/CommandLine/DeprecateVS10-WARN-ON.cmake
+++ b/Tests/RunCMake/CMakePresetsWorkflow/FirstStepNotConfigure-result.txt
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/FirstStepNotConfigure-stderr.txt b/Tests/RunCMake/CMakePresetsWorkflow/FirstStepNotConfigure-stderr.txt
new file mode 100644
index 000000000..cbfee5a5c
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/FirstStepNotConfigure-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresetsWorkflow/FirstStepNotConfigure: Invalid workflow steps$
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/FirstStepNotConfigure.json.in b/Tests/RunCMake/CMakePresetsWorkflow/FirstStepNotConfigure.json.in
new file mode 100644
index 000000000..2c121a8b3
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/FirstStepNotConfigure.json.in
@@ -0,0 +1,27 @@
+{
+ "version": 6,
+ "configurePresets": [
+ {
+ "name": "default",
+ "binaryDir": "${sourceDir}/build",
+ "generator": "@RunCMake_GENERATOR@"
+ }
+ ],
+ "buildPresets": [
+ {
+ "name": "default",
+ "configurePreset": "default"
+ }
+ ],
+ "workflowPresets": [
+ {
+ "name": "default",
+ "steps": [
+ {
+ "type": "build",
+ "name": "default"
+ }
+ ]
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/Fresh.cmake b/Tests/RunCMake/CMakePresetsWorkflow/Fresh.cmake
new file mode 100644
index 000000000..4cf999f33
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/Fresh.cmake
@@ -0,0 +1,4 @@
+option(FRESH_CONFIGURE "" ON)
+if(NOT FRESH_CONFIGURE)
+ message(FATAL_ERROR "FRESH_CONFIGURE is ${FRESH_CONFIGURE}, should be ON")
+endif()
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/Fresh.json.in b/Tests/RunCMake/CMakePresetsWorkflow/Fresh.json.in
new file mode 100644
index 000000000..4ce0ca555
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/Fresh.json.in
@@ -0,0 +1,21 @@
+{
+ "version": 6,
+ "configurePresets": [
+ {
+ "name": "default",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build"
+ }
+ ],
+ "workflowPresets": [
+ {
+ "name": "Fresh",
+ "steps": [
+ {
+ "type": "configure",
+ "name": "default"
+ }
+ ]
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/Good-stdout.txt b/Tests/RunCMake/CMakePresetsWorkflow/Good-stdout.txt
new file mode 100644
index 000000000..a04d7ea14
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/Good-stdout.txt
@@ -0,0 +1,19 @@
+^Executing workflow step 1 of 4: configure preset "default"
+
+.*Testing the configure step at [^
+]*/Tests/RunCMake/CMakePresetsWorkflow/Good/build.*
+
+Executing workflow step 2 of 4: build preset "default"
+
+.*Testing the build step at [^
+]*[\\/]Tests[\\/]RunCMake[\\/]CMakePresetsWorkflow[\\/]Good[\\/]build.*
+
+Executing workflow step 3 of 4: test preset "default"
+
+.*Testing the test step at [^
+]*/Tests/RunCMake/CMakePresetsWorkflow/Good/build.*
+
+Executing workflow step 4 of 4: package preset "default"
+
+.*Testing the package step at [^
+]*/Tests/RunCMake/CMakePresetsWorkflow/Good/build.*
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/Good.cmake b/Tests/RunCMake/CMakePresetsWorkflow/Good.cmake
new file mode 100644
index 000000000..31ce7ffb2
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/Good.cmake
@@ -0,0 +1,8 @@
+message(STATUS "Testing the configure step at ${CMAKE_BINARY_DIR}")
+
+add_custom_target(echo_test ALL COMMAND ${CMAKE_COMMAND} -E echo "Testing the build step at ${CMAKE_BINARY_DIR}")
+
+enable_testing()
+add_test(NAME EchoTest COMMAND ${CMAKE_COMMAND} -E echo "Testing the test step at ${CMAKE_BINARY_DIR}")
+
+include(CPack)
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/Good.json.in b/Tests/RunCMake/CMakePresetsWorkflow/Good.json.in
new file mode 100644
index 000000000..87e29368f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/Good.json.in
@@ -0,0 +1,87 @@
+{
+ "version": 6,
+ "configurePresets": [
+ {
+ "name": "default",
+ "binaryDir": "${sourceDir}/build",
+ "generator": "@RunCMake_GENERATOR@"
+ }
+ ],
+ "buildPresets": [
+ {
+ "name": "default",
+ "configurePreset": "default",
+ "configuration": "Debug"
+ }
+ ],
+ "testPresets": [
+ {
+ "name": "default",
+ "configurePreset": "default",
+ "output": {
+ "verbosity": "verbose"
+ },
+ "configuration": "Debug"
+ }
+ ],
+ "packagePresets": [
+ {
+ "name": "default",
+ "configurePreset": "default",
+ "generators": [
+ "External"
+ ],
+ "variables": {
+ "CPACK_EXTERNAL_PACKAGE_SCRIPT": "${sourceDir}/cpack_staging.cmake"
+ },
+ "configurations": ["Debug"]
+ }
+ ],
+ "workflowPresets": [
+ {
+ "name": "Good",
+ "displayName": "Good Workflow Preset",
+ "description": "This workflow preset works properly.",
+ "vendor": {},
+ "steps": [
+ {
+ "type": "configure",
+ "name": "default"
+ },
+ {
+ "type": "build",
+ "name": "default"
+ },
+ {
+ "type": "test",
+ "name": "default"
+ },
+ {
+ "type": "package",
+ "name": "default"
+ }
+ ]
+ },
+ {
+ "name": "BadExitCode",
+ "steps": [
+ {
+ "type": "configure",
+ "name": "default"
+ },
+ {
+ "type": "build",
+ "name": "default"
+ },
+ {
+ "type": "test",
+ "name": "default"
+ },
+ {
+ "type": "package",
+ "name": "default"
+ }
+ ]
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/GoodUser-stdout.txt b/Tests/RunCMake/CMakePresetsWorkflow/GoodUser-stdout.txt
new file mode 100644
index 000000000..101491569
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/GoodUser-stdout.txt
@@ -0,0 +1,2 @@
+-- Testing the configure step at [^
+]*/Tests/RunCMake/CMakePresetsWorkflow/GoodUser/build
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/GoodUser.cmake b/Tests/RunCMake/CMakePresetsWorkflow/GoodUser.cmake
new file mode 100644
index 000000000..9143e00b3
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/GoodUser.cmake
@@ -0,0 +1 @@
+message(STATUS "Testing the configure step at ${CMAKE_BINARY_DIR}")
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/GoodUser.json.in b/Tests/RunCMake/CMakePresetsWorkflow/GoodUser.json.in
new file mode 100644
index 000000000..e71b4ea18
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/GoodUser.json.in
@@ -0,0 +1,14 @@
+{
+ "version": 6,
+ "workflowPresets": [
+ {
+ "name": "GoodUser",
+ "steps": [
+ {
+ "type": "configure",
+ "name": "default"
+ }
+ ]
+ }
+ ]
+}
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt b/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-result.txt
index d00491fd7..d00491fd7 100644
--- a/Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt
+++ b/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-result.txt
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-stderr.txt b/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-stderr.txt
new file mode 100644
index 000000000..049ff54c8
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-stderr.txt
@@ -0,0 +1,6 @@
+^Unknown argument -DINVALID_OPTION
+Usage: cmake --workflow \[options\]
+Options:
+ --preset <preset> = Workflow preset to execute\.
+ --list-presets = List available workflow presets\.
+ --fresh = Configure a fresh build tree, removing any existing cache file\.$
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-stdout.txt b/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-stdout.txt
new file mode 100644
index 000000000..10f32932e
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-stdout.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/ListPresets-stdout.txt b/Tests/RunCMake/CMakePresetsWorkflow/ListPresets-stdout.txt
new file mode 100644
index 000000000..57f30a4e0
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/ListPresets-stdout.txt
@@ -0,0 +1,4 @@
+^Available workflow presets:
+
+ "default"
+ "with-description" - With Description$
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/ListPresets.json.in b/Tests/RunCMake/CMakePresetsWorkflow/ListPresets.json.in
new file mode 100644
index 000000000..9a7d5a615
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/ListPresets.json.in
@@ -0,0 +1,30 @@
+{
+ "version": 6,
+ "configurePresets": [
+ {
+ "name": "default"
+ }
+ ],
+ "workflowPresets": [
+ {
+ "name": "default",
+ "steps": [
+ {
+ "type": "configure",
+ "name": "default"
+ }
+ ]
+ },
+ {
+ "name": "with-description",
+ "displayName": "With Description",
+ "description": "This preset has a description.",
+ "steps": [
+ {
+ "type": "configure",
+ "name": "default"
+ }
+ ]
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/NoWorkflowSteps-result.txt b/Tests/RunCMake/CMakePresetsWorkflow/NoWorkflowSteps-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/NoWorkflowSteps-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/NoWorkflowSteps-stderr.txt b/Tests/RunCMake/CMakePresetsWorkflow/NoWorkflowSteps-stderr.txt
new file mode 100644
index 000000000..049ed6bc5
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/NoWorkflowSteps-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresetsWorkflow/NoWorkflowSteps: Invalid workflow steps$
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/NoWorkflowSteps.json.in b/Tests/RunCMake/CMakePresetsWorkflow/NoWorkflowSteps.json.in
new file mode 100644
index 000000000..27571979e
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/NoWorkflowSteps.json.in
@@ -0,0 +1,9 @@
+{
+ "version": 6,
+ "workflowPresets": [
+ {
+ "name": "default",
+ "steps": []
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/NonexistentStep-result.txt b/Tests/RunCMake/CMakePresetsWorkflow/NonexistentStep-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/NonexistentStep-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/NonexistentStep-stderr.txt b/Tests/RunCMake/CMakePresetsWorkflow/NonexistentStep-stderr.txt
new file mode 100644
index 000000000..c522b84d4
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/NonexistentStep-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresetsWorkflow/NonexistentStep: Invalid workflow steps$
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/NonexistentStep.json.in b/Tests/RunCMake/CMakePresetsWorkflow/NonexistentStep.json.in
new file mode 100644
index 000000000..235398bef
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/NonexistentStep.json.in
@@ -0,0 +1,14 @@
+{
+ "version": 6,
+ "workflowPresets": [
+ {
+ "name": "default",
+ "steps": [
+ {
+ "type": "configure",
+ "name": "default"
+ }
+ ]
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresetsWorkflow/RunCMakeTest.cmake
new file mode 100644
index 000000000..550600a18
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/RunCMakeTest.cmake
@@ -0,0 +1,89 @@
+include(RunCMake)
+
+# Presets do not support legacy VS generator name architecture suffix.
+if(RunCMake_GENERATOR MATCHES "^(Visual Studio [0-9]+ [0-9]+) ")
+ set(RunCMake_GENERATOR "${CMAKE_MATCH_1}")
+endif()
+
+function(run_cmake_workflow_presets name)
+ set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/${name}")
+ set(RunCMake_TEST_BINARY_DIR "${RunCMake_TEST_SOURCE_DIR}/build")
+ set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}")
+
+ if(NOT RunCMake_TEST_NO_CLEAN)
+ file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}")
+ endif()
+
+ set(RunCMake_TEST_NO_CLEAN TRUE)
+
+ set(CASE_NAME "${name}")
+ set(CASE_SOURCE_DIR "${RunCMake_SOURCE_DIR}")
+ configure_file("${RunCMake_SOURCE_DIR}/CMakeLists.txt.in" "${RunCMake_TEST_SOURCE_DIR}/CMakeLists.txt" @ONLY)
+
+ if(NOT CMakePresets_FILE)
+ set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/${name}.json.in")
+ endif()
+ if(EXISTS "${CMakePresets_FILE}")
+ configure_file("${CMakePresets_FILE}" "${RunCMake_TEST_SOURCE_DIR}/CMakePresets.json" @ONLY)
+ endif()
+
+ if(NOT CMakeUserPresets_FILE)
+ set(CMakeUserPresets_FILE "${RunCMake_SOURCE_DIR}/${name}User.json.in")
+ endif()
+ if(EXISTS "${CMakeUserPresets_FILE}")
+ configure_file("${CMakeUserPresets_FILE}" "${RunCMake_TEST_SOURCE_DIR}/CMakeUserPresets.json" @ONLY)
+ endif()
+
+ foreach(ASSET ${CMakePresets_ASSETS})
+ configure_file("${RunCMake_SOURCE_DIR}/${ASSET}.in" "${RunCMake_TEST_SOURCE_DIR}/${ASSET}" @ONLY)
+ endforeach()
+
+ if(EXISTS "${RunCMake_SOURCE_DIR}/${name}-check.cmake")
+ set(RunCMake-check-file "${name}-check.cmake")
+ else()
+ set(RunCMake-check-file "check.cmake")
+ endif()
+
+ if(eq)
+ set(eq 0 PARENT_SCOPE)
+ set(preset_arg "--preset=${name}")
+ else()
+ set(eq 1 PARENT_SCOPE)
+ set(preset_arg "--preset" "${name}")
+ endif()
+ run_cmake_command("${name}" "${CMAKE_COMMAND}" "--workflow" ${preset_arg} ${ARGN})
+endfunction()
+
+set(CMakePresets_SCHEMA_EXPECTED_RESULT 1)
+run_cmake_workflow_presets(UnsupportedVersion)
+set(CMakePresets_SCHEMA_EXPECTED_RESULT 0)
+run_cmake_workflow_presets(NoWorkflowSteps)
+run_cmake_workflow_presets(FirstStepNotConfigure)
+run_cmake_workflow_presets(SecondStepConfigure)
+run_cmake_workflow_presets(NonexistentStep)
+run_cmake_workflow_presets(UnreachableStep)
+run_cmake_workflow_presets(WorkflowStepHidden)
+run_cmake_workflow_presets(WorkflowStepDisabled)
+run_cmake_workflow_presets(WorkflowStepInvalidMacro)
+run_cmake_workflow_presets(ConfigureStepMismatch)
+
+set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/Good.json.in")
+set(CMakeUserPresets_FILE "${RunCMake_SOURCE_DIR}/GoodUser.json.in")
+set(CMakePresets_ASSETS cpack_staging.cmake)
+run_cmake_workflow_presets(Good)
+run_cmake_workflow_presets(GoodUser)
+run_cmake_workflow_presets(BadExitCode)
+unset(CMakePresets_FILE)
+unset(CMakeUserPresets_FILE)
+unset(CMakePresets_ASSETS)
+
+run_cmake_workflow_presets(ListPresets --list-presets)
+run_cmake_workflow_presets(InvalidOption -DINVALID_OPTION)
+
+set(RunCMake_TEST_NO_CLEAN TRUE)
+file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/Fresh")
+file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/Fresh/build")
+file(WRITE "${RunCMake_BINARY_DIR}/Fresh/build/CMakeCache.txt" "FRESH_CONFIGURE:BOOL=OFF\n")
+run_cmake_workflow_presets(Fresh --fresh)
+unset(RunCMake_TEST_NO_CLEAN)
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/SecondStepConfigure-result.txt b/Tests/RunCMake/CMakePresetsWorkflow/SecondStepConfigure-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/SecondStepConfigure-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/SecondStepConfigure-stderr.txt b/Tests/RunCMake/CMakePresetsWorkflow/SecondStepConfigure-stderr.txt
new file mode 100644
index 000000000..b0ad7d530
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/SecondStepConfigure-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresetsWorkflow/SecondStepConfigure: Invalid workflow steps$
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/SecondStepConfigure.json.in b/Tests/RunCMake/CMakePresetsWorkflow/SecondStepConfigure.json.in
new file mode 100644
index 000000000..44e158259
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/SecondStepConfigure.json.in
@@ -0,0 +1,25 @@
+{
+ "version": 6,
+ "configurePresets": [
+ {
+ "name": "default",
+ "binaryDir": "${sourceDir}/build",
+ "generator": "@RunCMake_GENERATOR@"
+ }
+ ],
+ "workflowPresets": [
+ {
+ "name": "default",
+ "steps": [
+ {
+ "type": "configure",
+ "name": "default"
+ },
+ {
+ "type": "configure",
+ "name": "default"
+ }
+ ]
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/UnreachableStep-result.txt b/Tests/RunCMake/CMakePresetsWorkflow/UnreachableStep-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/UnreachableStep-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/UnreachableStep-stderr.txt b/Tests/RunCMake/CMakePresetsWorkflow/UnreachableStep-stderr.txt
new file mode 100644
index 000000000..425e7196f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/UnreachableStep-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresetsWorkflow/UnreachableStep: Workflow step is unreachable from preset's file$
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/UnreachableStep.json.in b/Tests/RunCMake/CMakePresetsWorkflow/UnreachableStep.json.in
new file mode 100644
index 000000000..235398bef
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/UnreachableStep.json.in
@@ -0,0 +1,14 @@
+{
+ "version": 6,
+ "workflowPresets": [
+ {
+ "name": "default",
+ "steps": [
+ {
+ "type": "configure",
+ "name": "default"
+ }
+ ]
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/UnreachableStepUser.json.in b/Tests/RunCMake/CMakePresetsWorkflow/UnreachableStepUser.json.in
new file mode 100644
index 000000000..39b6835a9
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/UnreachableStepUser.json.in
@@ -0,0 +1,8 @@
+{
+ "version": 6,
+ "configurePresets": [
+ {
+ "name": "default"
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/UnsupportedVersion-result.txt b/Tests/RunCMake/CMakePresetsWorkflow/UnsupportedVersion-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/UnsupportedVersion-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/UnsupportedVersion-stderr.txt b/Tests/RunCMake/CMakePresetsWorkflow/UnsupportedVersion-stderr.txt
new file mode 100644
index 000000000..5cf01aaa5
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/UnsupportedVersion-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresetsWorkflow/UnsupportedVersion: File version must be 6 or higher for workflow preset support$
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/UnsupportedVersion.json.in b/Tests/RunCMake/CMakePresetsWorkflow/UnsupportedVersion.json.in
new file mode 100644
index 000000000..4ebaa8efe
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/UnsupportedVersion.json.in
@@ -0,0 +1,4 @@
+{
+ "version": 5,
+ "workflowPresets": []
+}
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepDisabled-result.txt b/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepDisabled-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepDisabled-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepDisabled-stderr.txt b/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepDisabled-stderr.txt
new file mode 100644
index 000000000..b598b272f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepDisabled-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Cannot use disabled configure preset in [^
+]*/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepDisabled: "default"$
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepDisabled.json.in b/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepDisabled.json.in
new file mode 100644
index 000000000..a3b6783d9
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepDisabled.json.in
@@ -0,0 +1,23 @@
+{
+ "version": 6,
+ "configurePresets": [
+ {
+ "name": "default",
+ "condition": {
+ "type": "const",
+ "value": false
+ }
+ }
+ ],
+ "workflowPresets": [
+ {
+ "name": "WorkflowStepDisabled",
+ "steps": [
+ {
+ "type": "configure",
+ "name": "default"
+ }
+ ]
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepHidden-result.txt b/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepHidden-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepHidden-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepHidden-stderr.txt b/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepHidden-stderr.txt
new file mode 100644
index 000000000..838ded514
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepHidden-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Cannot use hidden configure preset in [^
+]*/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepHidden: "default"$
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepHidden.json.in b/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepHidden.json.in
new file mode 100644
index 000000000..07c4105a9
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepHidden.json.in
@@ -0,0 +1,20 @@
+{
+ "version": 6,
+ "configurePresets": [
+ {
+ "name": "default",
+ "hidden": true
+ }
+ ],
+ "workflowPresets": [
+ {
+ "name": "WorkflowStepHidden",
+ "steps": [
+ {
+ "type": "configure",
+ "name": "default"
+ }
+ ]
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepInvalidMacro-result.txt b/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepInvalidMacro-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepInvalidMacro-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepInvalidMacro-stderr.txt b/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepInvalidMacro-stderr.txt
new file mode 100644
index 000000000..f132a9336
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepInvalidMacro-stderr.txt
@@ -0,0 +1 @@
+^CMake Error: Could not evaluate configure preset "default": Invalid macro expansion$
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepInvalidMacro.json.in b/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepInvalidMacro.json.in
new file mode 100644
index 000000000..6aec0e349
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/WorkflowStepInvalidMacro.json.in
@@ -0,0 +1,20 @@
+{
+ "version": 6,
+ "configurePresets": [
+ {
+ "name": "default",
+ "binaryDir": "$vendor{invalidMacro}"
+ }
+ ],
+ "workflowPresets": [
+ {
+ "name": "WorkflowStepInvalidMacro",
+ "steps": [
+ {
+ "type": "configure",
+ "name": "default"
+ }
+ ]
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/check.cmake b/Tests/RunCMake/CMakePresetsWorkflow/check.cmake
new file mode 100644
index 000000000..e79c4f12a
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/check.cmake
@@ -0,0 +1,3 @@
+set(CMakePresets_VALIDATE_SCRIPT_PATH "${RunCMake_SOURCE_DIR}/../CMakePresets/validate_schema.py")
+include("${RunCMake_SOURCE_DIR}/../CMakePresets/validate_schema.cmake")
+include("${RunCMake_SOURCE_DIR}/../CMakePresets/check.cmake")
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/cpack_staging.cmake.in b/Tests/RunCMake/CMakePresetsWorkflow/cpack_staging.cmake.in
new file mode 100644
index 000000000..4030dfb61
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsWorkflow/cpack_staging.cmake.in
@@ -0,0 +1 @@
+message(STATUS "Testing the package step at @RunCMake_TEST_BINARY_DIR@")
diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake
index 9b98ed41f..8904c696f 100644
--- a/Tests/RunCMake/CPack/DEB/Helpers.cmake
+++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake
@@ -97,7 +97,7 @@ function(getMissingShlibsErrorExtra FILE RESULT_VAR)
string(APPEND error_extra "; errors \"${deb_install_files_errors}\"")
endif()
- if(READELF_EXECUTABLE)
+ if(CPACK_READELF_EXECUTABLE)
string(APPEND error_extra "; readelf \"\n")
# Only dynamically linked ELF files are included
@@ -106,7 +106,7 @@ function(getMissingShlibsErrorExtra FILE RESULT_VAR)
if(_FILE MATCHES "ELF.*shared object")
string(REGEX MATCH "(^.*):" _FILE_NAME "${_FILE}")
- execute_process(COMMAND ${READELF_EXECUTABLE} -d "${CMAKE_MATCH_1}"
+ execute_process(COMMAND ${CPACK_READELF_EXECUTABLE} -d "${CMAKE_MATCH_1}"
WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
RESULT_VARIABLE result
OUTPUT_VARIABLE output
diff --git a/Tests/RunCMake/CPack/DEB/Prerequirements.cmake b/Tests/RunCMake/CPack/DEB/Prerequirements.cmake
index 60d02e718..3b02579fb 100644
--- a/Tests/RunCMake/CPack/DEB/Prerequirements.cmake
+++ b/Tests/RunCMake/CPack/DEB/Prerequirements.cmake
@@ -14,9 +14,9 @@ function(get_test_prerequirements found_var config_file)
endif()
# optional tool for some tests
- find_program(READELF_EXECUTABLE NAMES readelf)
- if(READELF_EXECUTABLE)
+ find_program(CPACK_READELF_EXECUTABLE NAMES readelf)
+ if(CPACK_READELF_EXECUTABLE)
file(APPEND "${config_file}"
- "\nset(READELF_EXECUTABLE \"${READELF_EXECUTABLE}\")")
+ "\nset(CPACK_READELF_EXECUTABLE \"${CPACK_READELF_EXECUTABLE}\")")
endif()
endfunction()
diff --git a/Tests/RunCMake/CPack/RPM/Prerequirements.cmake b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake
index e95cd1516..a4741ba5b 100644
--- a/Tests/RunCMake/CPack/RPM/Prerequirements.cmake
+++ b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake
@@ -15,9 +15,9 @@ function(get_test_prerequirements found_var config_file)
endif()
# optional tool for some tests
- find_program(OBJDUMP_EXECUTABLE objdump)
- if(OBJDUMP_EXECUTABLE)
+ find_program(CPACK_OBJDUMP_EXECUTABLE objdump)
+ if(CPACK_OBJDUMP_EXECUTABLE)
file(APPEND "${config_file}"
- "\nset(OBJDUMP_EXECUTABLE \"${OBJDUMP_EXECUTABLE}\")")
+ "\nset(CPACK_OBJDUMP_EXECUTABLE \"${CPACK_OBJDUMP_EXECUTABLE}\")")
endif()
endfunction()
diff --git a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake
index be44b2e33..b0bfc9d02 100644
--- a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake
+++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake
@@ -1,7 +1,7 @@
function(get_test_prerequirements found_var config_file)
include(${config_file})
- if(READELF_EXECUTABLE)
+ if(CPACK_READELF_EXECUTABLE)
set(${found_var} true PARENT_SCOPE)
endif()
endfunction()
diff --git a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake
index be44b2e33..b0bfc9d02 100644
--- a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake
+++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake
@@ -1,7 +1,7 @@
function(get_test_prerequirements found_var config_file)
include(${config_file})
- if(READELF_EXECUTABLE)
+ if(CPACK_READELF_EXECUTABLE)
set(${found_var} true PARENT_SCOPE)
endif()
endfunction()
diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake
index 90cfe4467..f5df8a2dd 100644
--- a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake
+++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/RPM-Prerequirements.cmake
@@ -2,7 +2,7 @@ function(get_test_prerequirements found_var config_file)
if(SUBTEST_SUFFIX MATCHES ".*single_debug_info")
include(${config_file})
- if(OBJDUMP_EXECUTABLE)
+ if(CPACK_OBJDUMP_EXECUTABLE)
set(${found_var} true PARENT_SCOPE)
endif()
else()
diff --git a/Tests/RunCMake/CTestTimeout/TestTimeout.c b/Tests/RunCMake/CTestTimeout/TestTimeout.c
index 5a008a746..0d534fc06 100644
--- a/Tests/RunCMake/CTestTimeout/TestTimeout.c
+++ b/Tests/RunCMake/CTestTimeout/TestTimeout.c
@@ -1,6 +1,7 @@
#if defined(_WIN32)
# include <windows.h>
#else
+# include <sched.h>
# include <unistd.h>
#endif
diff --git a/Tests/RunCMake/CUDA_architectures/architectures-suffix-stderr.txt b/Tests/RunCMake/CUDA_architectures/architectures-suffix-stderr.txt
index 7b6eb5384..ce40a7a78 100644
--- a/Tests/RunCMake/CUDA_architectures/architectures-suffix-stderr.txt
+++ b/Tests/RunCMake/CUDA_architectures/architectures-suffix-stderr.txt
@@ -1,4 +1,4 @@
^(CMake Warning in [^
-]*/Tests/RunCMake/CUDA_architectures/architectures-suffix-build/CMakeFiles/CMakeTmp/CMakeLists.txt:
+]*/Tests/RunCMake/CUDA_architectures/architectures-suffix-build/CMakeFiles/CMakeScratch/TryCompile-[^/]*/CMakeLists.txt:
Clang doesn't support disabling CUDA real code generation.
*)*$
diff --git a/Tests/RunCMake/CXXModules/CMakeLists.txt b/Tests/RunCMake/CXXModules/CMakeLists.txt
new file mode 100644
index 000000000..708d92ce4
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/CMakeLists.txt
@@ -0,0 +1,6 @@
+cmake_minimum_required(VERSION 3.23)
+project(${RunCMake_TEST} NONE)
+
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046")
+
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CXXModules/ExportBuildCxxModules-check.cmake b/Tests/RunCMake/CXXModules/ExportBuildCxxModules-check.cmake
new file mode 100644
index 000000000..cb6f6bdc3
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/ExportBuildCxxModules-check.cmake
@@ -0,0 +1,40 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/export-modules-targets.cmake" export_script)
+
+if (NOT export_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules/cxx-modules\.cmake"\)]])
+ list(APPEND RunCMake_TEST_FAILED
+ "Could not find C++ module property script inclusion")
+endif ()
+
+file(READ "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/cxx-modules/cxx-modules.cmake" trampoline_script)
+
+if (RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ if (NOT trampoline_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules-[^.]*\.cmake" OPTIONAL\)]])
+ list(APPEND RunCMake_TEST_FAILED
+ "Could not find C++ module property per-config script inclusion(s)")
+ endif ()
+else ()
+ if (NOT trampoline_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules-[^.]*\.cmake"\)]])
+ list(APPEND RunCMake_TEST_FAILED
+ "Could not find C++ module property per-config script inclusion(s)")
+ endif ()
+endif ()
+
+set(any_exists 0)
+foreach (config IN ITEMS noconfig Debug Release RelWithDebInfo MinSizeRel)
+ if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/cxx-modules/cxx-modules-${config}.cmake")
+ continue ()
+ endif ()
+ set(any_exists 1)
+
+ file(READ "${RunCMake_TEST_BINARY_DIR}/lib/cmake/export-modules/cxx-modules/cxx-modules-${config}.cmake" config_script)
+
+ if (NOT config_script MATCHES "include\\(\"\\\${CMAKE_CURRENT_LIST_DIR}/target-export-name-${config}\\.cmake\"\\)")
+ list(APPEND RunCMake_TEST_FAILED
+ "Could not find C++ module per-target property script inclusion")
+ endif ()
+endforeach ()
+
+if (NOT any_exists)
+ list(APPEND RunCMake_TEST_FAILED
+ "No per-configuration target files exist.")
+endif ()
diff --git a/Tests/RunCMake/CXXModules/ExportBuildCxxModules-stderr.txt b/Tests/RunCMake/CXXModules/ExportBuildCxxModules-stderr.txt
new file mode 100644
index 000000000..c05b0b482
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/ExportBuildCxxModules-stderr.txt
@@ -0,0 +1,11 @@
+CMake Warning \(dev\) at ExportBuildCxxModules.cmake:6 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/ExportBuildCxxModules.cmake b/Tests/RunCMake/CXXModules/ExportBuildCxxModules.cmake
new file mode 100644
index 000000000..850f8dcdd
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/ExportBuildCxxModules.cmake
@@ -0,0 +1,22 @@
+enable_language(CXX)
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
+set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "")
+
+add_library(export-modules)
+target_sources(export-modules
+ PUBLIC
+ FILE_SET fs TYPE CXX_MODULES FILES
+ sources/module.cxx)
+target_compile_features(export-modules
+ PRIVATE
+ cxx_std_20)
+set_property(TARGET export-modules
+ PROPERTY EXPORT_NAME export-name)
+
+install(TARGETS export-modules
+ EXPORT exp
+ FILE_SET fs DESTINATION "include/cxx/export-modules")
+
+export(EXPORT exp
+ FILE "${CMAKE_BINARY_DIR}/lib/cmake/export-modules/export-modules-targets.cmake"
+ CXX_MODULES_DIRECTORY "cxx-modules")
diff --git a/Tests/RunCMake/CXXModules/ExportInstallCxxModules-check.cmake b/Tests/RunCMake/CXXModules/ExportInstallCxxModules-check.cmake
new file mode 100644
index 000000000..9e83fd895
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/ExportInstallCxxModules-check.cmake
@@ -0,0 +1,35 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/eee57a7e91412f1be699e9b63fa9d601/exp.cmake" export_script)
+
+if (NOT export_script MATCHES [[include\("\${CMAKE_CURRENT_LIST_DIR}/cxx-modules/cxx-modules\.cmake"\)]])
+ list(APPEND RunCMake_TEST_FAILED
+ "Could not find C++ module property script inclusion")
+endif ()
+
+file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/eee57a7e91412f1be699e9b63fa9d601/cxx-modules/cxx-modules.cmake" trampoline_script)
+
+if (NOT trampoline_script MATCHES [[file\(GLOB _cmake_cxx_module_includes "\${CMAKE_CURRENT_LIST_DIR}/cxx-modules-\*\.cmake"\)]])
+ list(APPEND RunCMake_TEST_FAILED
+ "Could not find C++ module property per-config script inclusion(s)")
+endif ()
+
+set(any_exists 0)
+foreach (config IN ITEMS noconfig Debug Release RelWithDebInfo MinSizeRel)
+ if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/eee57a7e91412f1be699e9b63fa9d601/cxx-modules/cxx-modules-${config}.cmake")
+ continue ()
+ endif ()
+ set(any_exists 1)
+
+ file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/eee57a7e91412f1be699e9b63fa9d601/cxx-modules/cxx-modules-${config}.cmake" config_script)
+
+ if (NOT config_script MATCHES "include\\(\"\\\${CMAKE_CURRENT_LIST_DIR}/target-export-name-${config}\\.cmake\"\\)")
+ list(APPEND RunCMake_TEST_FAILED
+ "Could not find C++ module per-target property script inclusion")
+ endif ()
+endforeach ()
+
+if (NOT any_exists)
+ list(APPEND RunCMake_TEST_FAILED
+ "No per-configuration target files exist.")
+endif ()
+
+string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}")
diff --git a/Tests/RunCMake/CXXModules/ExportInstallCxxModules-stderr.txt b/Tests/RunCMake/CXXModules/ExportInstallCxxModules-stderr.txt
new file mode 100644
index 000000000..4fe27a988
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/ExportInstallCxxModules-stderr.txt
@@ -0,0 +1,11 @@
+CMake Warning \(dev\) at ExportInstallCxxModules.cmake:6 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/ExportInstallCxxModules.cmake b/Tests/RunCMake/CXXModules/ExportInstallCxxModules.cmake
new file mode 100644
index 000000000..234a4b5a0
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/ExportInstallCxxModules.cmake
@@ -0,0 +1,22 @@
+enable_language(CXX)
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
+set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "")
+
+add_library(export-modules)
+target_sources(export-modules
+ PUBLIC
+ FILE_SET fs TYPE CXX_MODULES FILES
+ sources/module.cxx)
+target_compile_features(export-modules
+ PRIVATE
+ cxx_std_20)
+set_property(TARGET export-modules
+ PROPERTY EXPORT_NAME export-name)
+
+install(TARGETS export-modules
+ EXPORT exp
+ FILE_SET fs DESTINATION "include/cxx/export-modules")
+
+install(EXPORT exp
+ DESTINATION "lib/cmake/export-modules"
+ CXX_MODULES_DIRECTORY "cxx-modules")
diff --git a/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterface-result.txt b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterface-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterface-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterface-stderr.txt b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterface-stderr.txt
new file mode 100644
index 000000000..d573a02f6
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterface-stderr.txt
@@ -0,0 +1,12 @@
+CMake Warning \(dev\) at FileSetModuleHeaderUnitsInterface.cmake:2 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Error at FileSetModuleHeaderUnitsInterface.cmake:2 \(target_sources\):
+ target_sources File set TYPEs "CXX_MODULES" and "CXX_MODULE_HEADER_UNITS"
+ may not have "INTERFACE" visibility
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
diff --git a/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterface.cmake b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterface.cmake
new file mode 100644
index 000000000..03ca17e23
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterface.cmake
@@ -0,0 +1,8 @@
+add_library(module-header)
+target_sources(module-header
+ INTERFACE
+ FILE_SET fs TYPE CXX_MODULE_HEADER_UNITS FILES
+ sources/module-header.h)
+target_compile_features(module-header
+ PRIVATE
+ cxx_std_20)
diff --git a/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported-stderr.txt b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported-stderr.txt
new file mode 100644
index 000000000..1b4ba5d5f
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported-stderr.txt
@@ -0,0 +1,6 @@
+CMake Warning \(dev\) at FileSetModuleHeaderUnitsInterfaceImported.cmake:2 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported.cmake b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported.cmake
new file mode 100644
index 000000000..9ff5606de
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsInterfaceImported.cmake
@@ -0,0 +1,8 @@
+add_library(module-header SHARED IMPORTED)
+target_sources(module-header
+ INTERFACE
+ FILE_SET fs TYPE CXX_MODULE_HEADER_UNITS FILES
+ sources/module-header.h)
+target_compile_features(module-header
+ INTERFACE
+ cxx_std_20)
diff --git a/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsPrivate-stderr.txt b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsPrivate-stderr.txt
new file mode 100644
index 000000000..a7ac88ece
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsPrivate-stderr.txt
@@ -0,0 +1,11 @@
+CMake Warning \(dev\) at FileSetModuleHeaderUnitsPrivate.cmake:7 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsPrivate.cmake b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsPrivate.cmake
new file mode 100644
index 000000000..ebf9853b2
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsPrivate.cmake
@@ -0,0 +1,13 @@
+enable_language(CXX)
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
+set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "")
+
+add_library(module-header
+ sources/cxx-anchor.cxx)
+target_sources(module-header
+ PRIVATE
+ FILE_SET fs TYPE CXX_MODULE_HEADER_UNITS FILES
+ sources/module-header.h)
+target_compile_features(module-header
+ PRIVATE
+ cxx_std_20)
diff --git a/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsPublic-stderr.txt b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsPublic-stderr.txt
new file mode 100644
index 000000000..a5b4edee7
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsPublic-stderr.txt
@@ -0,0 +1,11 @@
+CMake Warning \(dev\) at FileSetModuleHeaderUnitsPublic.cmake:7 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsPublic.cmake b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsPublic.cmake
new file mode 100644
index 000000000..3dfccbb55
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/FileSetModuleHeaderUnitsPublic.cmake
@@ -0,0 +1,13 @@
+enable_language(CXX)
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
+set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "")
+
+add_library(module-header
+ sources/cxx-anchor.cxx)
+target_sources(module-header
+ PUBLIC
+ FILE_SET fs TYPE CXX_MODULE_HEADER_UNITS FILES
+ sources/module-header.h)
+target_compile_features(module-header
+ PRIVATE
+ cxx_std_20)
diff --git a/Tests/RunCMake/CXXModules/FileSetModulesInterface-result.txt b/Tests/RunCMake/CXXModules/FileSetModulesInterface-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/FileSetModulesInterface-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CXXModules/FileSetModulesInterface-stderr.txt b/Tests/RunCMake/CXXModules/FileSetModulesInterface-stderr.txt
new file mode 100644
index 000000000..81a35e8ef
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/FileSetModulesInterface-stderr.txt
@@ -0,0 +1,12 @@
+CMake Warning \(dev\) at FileSetModulesInterface.cmake:2 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Error at FileSetModulesInterface.cmake:2 \(target_sources\):
+ target_sources File set TYPEs "CXX_MODULES" and "CXX_MODULE_HEADER_UNITS"
+ may not have "INTERFACE" visibility
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
diff --git a/Tests/RunCMake/CXXModules/FileSetModulesInterface.cmake b/Tests/RunCMake/CXXModules/FileSetModulesInterface.cmake
new file mode 100644
index 000000000..24cec3ec1
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/FileSetModulesInterface.cmake
@@ -0,0 +1,8 @@
+add_library(module)
+target_sources(module
+ INTERFACE
+ FILE_SET fs TYPE CXX_MODULES FILES
+ sources/module.cxx)
+target_compile_features(module
+ PRIVATE
+ cxx_std_20)
diff --git a/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported-stderr.txt b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported-stderr.txt
new file mode 100644
index 000000000..4420bbc13
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported-stderr.txt
@@ -0,0 +1,6 @@
+CMake Warning \(dev\) at FileSetModulesInterfaceImported.cmake:2 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported.cmake b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported.cmake
new file mode 100644
index 000000000..6640ae943
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/FileSetModulesInterfaceImported.cmake
@@ -0,0 +1,8 @@
+add_library(module SHARED IMPORTED)
+target_sources(module
+ INTERFACE
+ FILE_SET fs TYPE CXX_MODULES FILES
+ sources/module.cxx)
+target_compile_features(module
+ INTERFACE
+ cxx_std_20)
diff --git a/Tests/RunCMake/CXXModules/FileSetModulesPrivate-stderr.txt b/Tests/RunCMake/CXXModules/FileSetModulesPrivate-stderr.txt
new file mode 100644
index 000000000..03e06cc99
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/FileSetModulesPrivate-stderr.txt
@@ -0,0 +1,11 @@
+CMake Warning \(dev\) at FileSetModulesPrivate.cmake:6 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/FileSetModulesPrivate.cmake b/Tests/RunCMake/CXXModules/FileSetModulesPrivate.cmake
new file mode 100644
index 000000000..ca1898237
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/FileSetModulesPrivate.cmake
@@ -0,0 +1,12 @@
+enable_language(CXX)
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
+set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "")
+
+add_library(module)
+target_sources(module
+ PRIVATE
+ FILE_SET fs TYPE CXX_MODULES FILES
+ sources/module.cxx)
+target_compile_features(module
+ PRIVATE
+ cxx_std_20)
diff --git a/Tests/RunCMake/CXXModules/FileSetModulesPublic-stderr.txt b/Tests/RunCMake/CXXModules/FileSetModulesPublic-stderr.txt
new file mode 100644
index 000000000..0c110c3a3
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/FileSetModulesPublic-stderr.txt
@@ -0,0 +1,11 @@
+CMake Warning \(dev\) at FileSetModulesPublic.cmake:6 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/FileSetModulesPublic.cmake b/Tests/RunCMake/CXXModules/FileSetModulesPublic.cmake
new file mode 100644
index 000000000..58de17425
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/FileSetModulesPublic.cmake
@@ -0,0 +1,12 @@
+enable_language(CXX)
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
+set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "")
+
+add_library(module)
+target_sources(module
+ PUBLIC
+ FILE_SET fs TYPE CXX_MODULES FILES
+ sources/module.cxx)
+target_compile_features(module
+ PRIVATE
+ cxx_std_20)
diff --git a/Tests/RunCMake/CXXModules/InstallBMI-check.cmake b/Tests/RunCMake/CXXModules/InstallBMI-check.cmake
new file mode 100644
index 000000000..f891c8099
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/InstallBMI-check.cmake
@@ -0,0 +1,24 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake" install_script)
+
+if (NOT install_script MATCHES [[\(CMAKE_INSTALL_COMPONENT STREQUAL "bmi" OR NOT CMAKE_INSTALL_COMPONENT\)]])
+ list(APPEND RunCMake_TEST_FAILED
+ "Could not find BMI install script component for `bmi`")
+endif ()
+
+if (NOT install_script MATCHES [[include\("[^)]*/CMakeFiles/install-bmi\.dir/install-cxx-module-bmi-[^.]*\.cmake" OPTIONAL\)]])
+ list(APPEND RunCMake_TEST_FAILED
+ "Could not find BMI install script inclusion")
+endif ()
+
+if (NOT install_script MATCHES [[\(CMAKE_INSTALL_COMPONENT STREQUAL "bmi-optional"\)]])
+ list(APPEND RunCMake_TEST_FAILED
+ "Could not find BMI install script component for `bmi-optional`")
+endif ()
+
+if (NOT install_script MATCHES [[\(CMAKE_INSTALL_COMPONENT STREQUAL "bmi-only-debug" OR NOT CMAKE_INSTALL_COMPONENT\)
+ if\(CMAKE_INSTALL_CONFIG_NAME MATCHES "\^\(\[Dd\]\[Ee\]\[Bb\]\[Uu\]\[Gg\]\)\$"\)]])
+ list(APPEND RunCMake_TEST_FAILED
+ "Could not find BMI install script component for `bmi-only-debug`")
+endif ()
+
+string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}")
diff --git a/Tests/RunCMake/CXXModules/InstallBMI-stderr.txt b/Tests/RunCMake/CXXModules/InstallBMI-stderr.txt
new file mode 100644
index 000000000..fc3c7dbbd
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/InstallBMI-stderr.txt
@@ -0,0 +1,6 @@
+CMake Warning \(dev\) at InstallBMI.cmake:8 \(install\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/InstallBMI.cmake b/Tests/RunCMake/CXXModules/InstallBMI.cmake
new file mode 100644
index 000000000..f0947b47c
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/InstallBMI.cmake
@@ -0,0 +1,23 @@
+enable_language(CXX)
+
+add_library(install-bmi)
+target_sources(install-bmi
+ PRIVATE
+ sources/cxx-anchor.cxx)
+
+install(TARGETS install-bmi
+ CXX_MODULES_BMI
+ DESTINATION "lib/bmi"
+ COMPONENT "bmi")
+
+install(TARGETS install-bmi
+ CXX_MODULES_BMI
+ DESTINATION "lib/bmi"
+ EXCLUDE_FROM_ALL
+ COMPONENT "bmi-optional")
+
+install(TARGETS install-bmi
+ CXX_MODULES_BMI
+ DESTINATION "lib/bmi"
+ CONFIGURATIONS Debug
+ COMPONENT "bmi-only-debug")
diff --git a/Tests/RunCMake/CXXModules/InstallBMIGenericArgs-check.cmake b/Tests/RunCMake/CXXModules/InstallBMIGenericArgs-check.cmake
new file mode 100644
index 000000000..32a37ad77
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/InstallBMIGenericArgs-check.cmake
@@ -0,0 +1,8 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake" install_script)
+
+if (NOT install_script MATCHES [[include\("[^)]*/CMakeFiles/install-bmi-generic-args\.dir/install-cxx-module-bmi-[^.]*\.cmake" OPTIONAL\)]])
+ list(APPEND RunCMake_TEST_FAILED
+ "Could not find BMI install script inclusion")
+endif ()
+
+string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}")
diff --git a/Tests/RunCMake/CXXModules/InstallBMIGenericArgs-stderr.txt b/Tests/RunCMake/CXXModules/InstallBMIGenericArgs-stderr.txt
new file mode 100644
index 000000000..44c961fc3
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/InstallBMIGenericArgs-stderr.txt
@@ -0,0 +1,6 @@
+CMake Warning \(dev\) at InstallBMIGenericArgs.cmake:8 \(install\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/InstallBMIGenericArgs.cmake b/Tests/RunCMake/CXXModules/InstallBMIGenericArgs.cmake
new file mode 100644
index 000000000..8f1714303
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/InstallBMIGenericArgs.cmake
@@ -0,0 +1,9 @@
+enable_language(CXX)
+
+add_library(install-bmi-generic-args)
+target_sources(install-bmi-generic-args
+ PRIVATE
+ sources/cxx-anchor.cxx)
+
+install(TARGETS install-bmi-generic-args
+ DESTINATION "bin")
diff --git a/Tests/RunCMake/CXXModules/InstallBMIIgnore-check.cmake b/Tests/RunCMake/CXXModules/InstallBMIIgnore-check.cmake
new file mode 100644
index 000000000..7d13ef089
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/InstallBMIIgnore-check.cmake
@@ -0,0 +1,13 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake" install_script)
+
+if (install_script MATCHES [[\(CMAKE_INSTALL_COMPONENT STREQUAL "bmi" OR NOT CMAKE_INSTALL_COMPONENT\)]])
+ list(APPEND RunCMake_TEST_FAILED
+ "Found BMI install script component for `bmi`")
+endif ()
+
+if (install_script MATCHES [[include\("[^)]*/CMakeFiles/install-bmi-ignore\.dir/install-cxx-module-bmi-[^.]*\.cmake" OPTIONAL\)]])
+ list(APPEND RunCMake_TEST_FAILED
+ "Found BMI install script inclusion")
+endif ()
+
+string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}")
diff --git a/Tests/RunCMake/CXXModules/InstallBMIIgnore-stderr.txt b/Tests/RunCMake/CXXModules/InstallBMIIgnore-stderr.txt
new file mode 100644
index 000000000..d9d2c2d58
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/InstallBMIIgnore-stderr.txt
@@ -0,0 +1,6 @@
+CMake Warning \(dev\) at InstallBMIIgnore.cmake:5 \(install\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/InstallBMIIgnore.cmake b/Tests/RunCMake/CXXModules/InstallBMIIgnore.cmake
new file mode 100644
index 000000000..f33951106
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/InstallBMIIgnore.cmake
@@ -0,0 +1,9 @@
+enable_language(CXX)
+
+add_library(install-bmi-ignore INTERFACE)
+
+install(TARGETS install-bmi-ignore
+ CXX_MODULES_BMI
+ # An empty destination ignores BMI installation.
+ DESTINATION ""
+ COMPONENT "bmi")
diff --git a/Tests/RunCMake/CXXModules/InstallBMINoGenericArgs-check.cmake b/Tests/RunCMake/CXXModules/InstallBMINoGenericArgs-check.cmake
new file mode 100644
index 000000000..412e260d2
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/InstallBMINoGenericArgs-check.cmake
@@ -0,0 +1,8 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake" install_script)
+
+if (install_script MATCHES [[include\("[^)]*/CMakeFiles/install-bmi-generic-args\.dir/install-cxx-module-bmi-[^.]*\.cmake" OPTIONAL\)]])
+ list(APPEND RunCMake_TEST_FAILED
+ "Found BMI install script inclusion")
+endif ()
+
+string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}")
diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-check.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-check.cmake
new file mode 100644
index 000000000..0d08c4499
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-check.cmake
@@ -0,0 +1,34 @@
+include("${CMAKE_CURRENT_LIST_DIR}/check-json.cmake")
+
+if (RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(have_file 0)
+ foreach (config IN ITEMS Release Debug RelWithDebInfo MinSizeRel)
+ if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-public.dir/${config}/CXXDependInfo.json")
+ continue ()
+ endif ()
+ set(have_file 1)
+
+ set(CMAKE_BUILD_TYPE "${config}")
+
+ file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-public.dir/${config}/CXXDependInfo.json" actual_contents)
+ file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-public.json" expect_contents)
+ check_json("${actual_contents}" "${expect_contents}")
+
+ file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-private.dir/${config}/CXXDependInfo.json" actual_contents)
+ file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-private.json" expect_contents)
+ check_json("${actual_contents}" "${expect_contents}")
+ endforeach ()
+
+ if (NOT have_file)
+ list(APPEND RunCMake_TEST_FAILED
+ "No recognized build configurations found.")
+ endif ()
+else ()
+ file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-public.dir/CXXDependInfo.json" actual_contents)
+ file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-public.json" expect_contents)
+ check_json("${actual_contents}" "${expect_contents}")
+
+ file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-private.dir/CXXDependInfo.json" actual_contents)
+ file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-private.json" expect_contents)
+ check_json("${actual_contents}" "${expect_contents}")
+endif ()
diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-stderr.txt b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-stderr.txt
new file mode 100644
index 000000000..ebf7be5cc
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-stderr.txt
@@ -0,0 +1,11 @@
+CMake Warning \(dev\) at NinjaDependInfoBMIInstall.cmake:14 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall.cmake
new file mode 100644
index 000000000..32dc42d98
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall.cmake
@@ -0,0 +1,76 @@
+# Fake out that we have dyndep; we only need to generate, not actually build
+# here.
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
+set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "")
+
+enable_language(CXX)
+
+if (NOT CMAKE_GENERATOR MATCHES "Ninja")
+ message(FATAL_ERROR
+ "This test requires a 'Ninja' generator to be used.")
+endif ()
+
+add_library(ninja-bmi-install-public)
+target_sources(ninja-bmi-install-public
+ PRIVATE
+ sources/module-impl.cxx
+ sources/module-internal-part-impl.cxx
+ sources/module-part-impl.cxx
+ sources/module-use.cxx
+ PUBLIC
+ FILE_SET modules TYPE CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}/sources"
+ FILES
+ sources/module.cxx
+ sources/module-part.cxx
+ FILE_SET internal_partitions TYPE CXX_MODULES FILES
+ sources/module-internal-part.cxx)
+target_compile_features(ninja-bmi-install-public
+ PRIVATE
+ cxx_std_20)
+set_property(TARGET ninja-bmi-install-public
+ PROPERTY EXPORT_NAME "with-public")
+
+install(TARGETS ninja-bmi-install-public
+ FILE_SET modules
+ DESTINATION "lib/cxx"
+ COMPONENT "modules"
+ FILE_SET internal_partitions
+ DESTINATION "lib/cxx/internals"
+ COMPONENT "modules-internal"
+ CXX_MODULES_BMI
+ DESTINATION "lib/cxx/modules/$<CONFIG>"
+ COMPONENT "bmi")
+
+add_library(ninja-bmi-install-private)
+target_sources(ninja-bmi-install-private
+ PRIVATE
+ sources/module-impl.cxx
+ sources/module-internal-part-impl.cxx
+ sources/module-part-impl.cxx
+ sources/module-use.cxx
+ PRIVATE
+ FILE_SET modules TYPE CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}/sources"
+ FILES
+ sources/module.cxx
+ sources/module-part.cxx
+ FILE_SET internal_partitions TYPE CXX_MODULES FILES
+ sources/module-internal-part.cxx)
+target_compile_features(ninja-bmi-install-private
+ PRIVATE
+ cxx_std_20)
+set_property(TARGET ninja-bmi-install-private
+ PROPERTY EXPORT_NAME "with-private")
+
+set(CMAKE_INSTALL_MESSAGE LAZY)
+install(TARGETS ninja-bmi-install-private
+ CXX_MODULES_BMI
+ DESTINATION "lib/cxx/modules/private/$<CONFIG>"
+ PERMISSIONS
+ OWNER_READ OWNER_WRITE
+ GROUP_READ
+ WORLD_READ
+ COMPONENT "bmi")
diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoExport-check.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoExport-check.cmake
new file mode 100644
index 000000000..77202571d
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NinjaDependInfoExport-check.cmake
@@ -0,0 +1,34 @@
+include("${CMAKE_CURRENT_LIST_DIR}/check-json.cmake")
+
+if (RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(have_file 0)
+ foreach (config IN ITEMS Release Debug RelWithDebInfo MinSizeRel)
+ if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-public.dir/${config}/CXXDependInfo.json")
+ continue ()
+ endif ()
+ set(have_file 1)
+
+ set(CMAKE_BUILD_TYPE "${config}")
+
+ file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-public.dir/${config}/CXXDependInfo.json" actual_contents)
+ file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExport-public.json" expect_contents)
+ check_json("${actual_contents}" "${expect_contents}")
+
+ file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-private.dir/${config}/CXXDependInfo.json" actual_contents)
+ file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExport-private.json" expect_contents)
+ check_json("${actual_contents}" "${expect_contents}")
+ endforeach ()
+
+ if (NOT have_file)
+ list(APPEND RunCMake_TEST_FAILED
+ "No recognized build configurations found.")
+ endif ()
+else ()
+ file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-public.dir/CXXDependInfo.json" actual_contents)
+ file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExport-public.json" expect_contents)
+ check_json("${actual_contents}" "${expect_contents}")
+
+ file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-private.dir/CXXDependInfo.json" actual_contents)
+ file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExport-private.json" expect_contents)
+ check_json("${actual_contents}" "${expect_contents}")
+endif ()
diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoExport-stderr.txt b/Tests/RunCMake/CXXModules/NinjaDependInfoExport-stderr.txt
new file mode 100644
index 000000000..e328223fa
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NinjaDependInfoExport-stderr.txt
@@ -0,0 +1,11 @@
+CMake Warning \(dev\) at NinjaDependInfoExport.cmake:14 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoExport.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoExport.cmake
new file mode 100644
index 000000000..05e7ef7e5
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NinjaDependInfoExport.cmake
@@ -0,0 +1,85 @@
+# Fake out that we have dyndep; we only need to generate, not actually build
+# here.
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
+set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "")
+
+enable_language(CXX)
+
+if (NOT CMAKE_GENERATOR MATCHES "Ninja")
+ message(FATAL_ERROR
+ "This test requires a 'Ninja' generator to be used.")
+endif ()
+
+add_library(ninja-exports-public)
+target_sources(ninja-exports-public
+ PRIVATE
+ sources/module-impl.cxx
+ sources/module-internal-part-impl.cxx
+ sources/module-part-impl.cxx
+ sources/module-use.cxx
+ PUBLIC
+ FILE_SET modules TYPE CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}/sources"
+ FILES
+ sources/module.cxx
+ sources/module-part.cxx
+ FILE_SET internal_partitions TYPE CXX_MODULES FILES
+ sources/module-internal-part.cxx)
+target_compile_features(ninja-exports-public
+ PRIVATE
+ cxx_std_20)
+set_property(TARGET ninja-exports-public
+ PROPERTY EXPORT_NAME "with-public")
+
+install(TARGETS ninja-exports-public
+ EXPORT exp
+ FILE_SET modules
+ DESTINATION "lib/cxx"
+ COMPONENT "modules"
+ FILE_SET internal_partitions
+ DESTINATION "lib/cxx/internals"
+ COMPONENT "modules-internal")
+
+add_library(ninja-exports-private)
+target_sources(ninja-exports-private
+ PRIVATE
+ sources/module-impl.cxx
+ sources/module-internal-part-impl.cxx
+ sources/module-part-impl.cxx
+ sources/module-use.cxx
+ PRIVATE
+ FILE_SET modules TYPE CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}/sources"
+ FILES
+ sources/module.cxx
+ sources/module-part.cxx
+ FILE_SET internal_partitions TYPE CXX_MODULES FILES
+ sources/module-internal-part.cxx)
+target_compile_features(ninja-exports-private
+ PRIVATE
+ cxx_std_20)
+set_property(TARGET ninja-exports-private
+ PROPERTY EXPORT_NAME "with-private")
+
+install(TARGETS ninja-exports-private
+ EXPORT exp)
+
+# Test multiple build exports.
+export(EXPORT exp
+ FILE "${CMAKE_BINARY_DIR}/lib/cmake/export1/export1-targets.cmake"
+ NAMESPACE export1::
+ CXX_MODULES_DIRECTORY "cxx-modules")
+export(EXPORT exp
+ FILE "${CMAKE_BINARY_DIR}/lib/cmake/export2/export2-targets.cmake"
+ CXX_MODULES_DIRECTORY "cxx-modules")
+
+# Test multiple install exports.
+install(EXPORT exp
+ DESTINATION "lib/cmake/export1"
+ NAMESPACE export1::
+ CXX_MODULES_DIRECTORY "cxx-modules")
+install(EXPORT exp
+ DESTINATION "lib/cmake/export2"
+ CXX_MODULES_DIRECTORY "cxx-modules")
diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-check.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-check.cmake
new file mode 100644
index 000000000..b9a1315b7
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-check.cmake
@@ -0,0 +1,34 @@
+include("${CMAKE_CURRENT_LIST_DIR}/check-json.cmake")
+
+if (RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(have_file 0)
+ foreach (config IN ITEMS Release Debug RelWithDebInfo MinSizeRel)
+ if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-public.dir/${config}/CXXDependInfo.json")
+ continue ()
+ endif ()
+ set(have_file 1)
+
+ set(CMAKE_BUILD_TYPE "${config}")
+
+ file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-public.dir/${config}/CXXDependInfo.json" actual_contents)
+ file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoFileSet-public.json" expect_contents)
+ check_json("${actual_contents}" "${expect_contents}")
+
+ file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-private.dir/${config}/CXXDependInfo.json" actual_contents)
+ file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoFileSet-private.json" expect_contents)
+ check_json("${actual_contents}" "${expect_contents}")
+ endforeach ()
+
+ if (NOT have_file)
+ list(APPEND RunCMake_TEST_FAILED
+ "No recognized build configurations found.")
+ endif ()
+else ()
+ file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-public.dir/CXXDependInfo.json" actual_contents)
+ file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoFileSet-public.json" expect_contents)
+ check_json("${actual_contents}" "${expect_contents}")
+
+ file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-private.dir/CXXDependInfo.json" actual_contents)
+ file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoFileSet-private.json" expect_contents)
+ check_json("${actual_contents}" "${expect_contents}")
+endif ()
diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-stderr.txt b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-stderr.txt
new file mode 100644
index 000000000..ca430ccee
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-stderr.txt
@@ -0,0 +1,11 @@
+CMake Warning \(dev\) at NinjaDependInfoFileSet.cmake:14 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet.cmake
new file mode 100644
index 000000000..74e729e66
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet.cmake
@@ -0,0 +1,59 @@
+# Fake out that we have dyndep; we only need to generate, not actually build
+# here.
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
+set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "")
+
+enable_language(CXX)
+
+if (NOT CMAKE_GENERATOR MATCHES "Ninja")
+ message(FATAL_ERROR
+ "This test requires a 'Ninja' generator to be used.")
+endif ()
+
+add_library(ninja-file-sets-public)
+target_sources(ninja-file-sets-public
+ PRIVATE
+ sources/module-impl.cxx
+ sources/module-internal-part-impl.cxx
+ sources/module-part-impl.cxx
+ sources/module-use.cxx
+ PUBLIC
+ FILE_SET modules TYPE CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}/sources"
+ FILES
+ sources/module.cxx
+ sources/module-part.cxx
+ FILE_SET internal_partitions TYPE CXX_MODULES FILES
+ sources/module-internal-part.cxx)
+target_compile_features(ninja-file-sets-public
+ PRIVATE
+ cxx_std_20)
+
+install(TARGETS ninja-file-sets-public
+ FILE_SET modules
+ DESTINATION "lib/cxx"
+ COMPONENT "modules"
+ FILE_SET internal_partitions
+ DESTINATION "lib/cxx/internals"
+ COMPONENT "modules-internal")
+
+add_library(ninja-file-sets-private)
+target_sources(ninja-file-sets-private
+ PRIVATE
+ sources/module-impl.cxx
+ sources/module-internal-part-impl.cxx
+ sources/module-part-impl.cxx
+ sources/module-use.cxx
+ PRIVATE
+ FILE_SET modules TYPE CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}/sources"
+ FILES
+ sources/module.cxx
+ sources/module-part.cxx
+ FILE_SET internal_partitions TYPE CXX_MODULES FILES
+ sources/module-internal-part.cxx)
+target_compile_features(ninja-file-sets-private
+ PRIVATE
+ cxx_std_20)
diff --git a/Tests/RunCMake/CXXModules/NoCXX-result.txt b/Tests/RunCMake/CXXModules/NoCXX-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoCXX-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CXXModules/NoCXX-stderr.txt b/Tests/RunCMake/CXXModules/NoCXX-stderr.txt
new file mode 100644
index 000000000..aa7f406fc
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoCXX-stderr.txt
@@ -0,0 +1,20 @@
+CMake Warning \(dev\) at NoCXX.cmake:4 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Error in CMakeLists.txt:
+ The "nocxx" target has C\+\+ module sources but the "CXX" language has not
+ been enabled
+
+(
+CMake Error in CMakeLists.txt:
+( The "nocxx" target has C\+\+ module sources but the "CXX" language has not
+ been enabled
+| The "nocxx" target contains C\+\+ module sources which are not supported by
+ the generator
+)
+)*
+CMake Generate step failed. Build files cannot be regenerated correctly.
diff --git a/Tests/RunCMake/CXXModules/NoCXX.cmake b/Tests/RunCMake/CXXModules/NoCXX.cmake
new file mode 100644
index 000000000..3c46f9dc0
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoCXX.cmake
@@ -0,0 +1,9 @@
+enable_language(C)
+
+add_library(nocxx)
+target_sources(nocxx
+ PRIVATE
+ sources/c-anchor.c
+ PUBLIC
+ FILE_SET fs TYPE CXX_MODULES FILES
+ sources/module.cxx)
diff --git a/Tests/RunCMake/CXXModules/NoCXX20-result.txt b/Tests/RunCMake/CXXModules/NoCXX20-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoCXX20-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CXXModules/NoCXX20-stderr.txt b/Tests/RunCMake/CXXModules/NoCXX20-stderr.txt
new file mode 100644
index 000000000..95d73b1ad
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoCXX20-stderr.txt
@@ -0,0 +1,20 @@
+CMake Warning \(dev\) at NoCXX20.cmake:4 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Error in CMakeLists.txt:
+ The "nocxx20" target has C\+\+ module sources but is not using at least
+ "cxx_std_20"
+
+(
+CMake Error in CMakeLists.txt:
+( The "nocxx20" target has C\+\+ module sources but is not using at least
+ "cxx_std_20"
+| The "nocxx20" target contains C\+\+ module sources which are not supported by
+ the generator
+)
+)*
+CMake Generate step failed. Build files cannot be regenerated correctly.
diff --git a/Tests/RunCMake/CXXModules/NoCXX20.cmake b/Tests/RunCMake/CXXModules/NoCXX20.cmake
new file mode 100644
index 000000000..b7372e826
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoCXX20.cmake
@@ -0,0 +1,11 @@
+enable_language(CXX)
+
+add_library(nocxx20)
+target_sources(nocxx20
+ PUBLIC
+ FILE_SET fs TYPE CXX_MODULES FILES
+ sources/module.cxx)
+set_target_properties(nocxx20
+ PROPERTIES
+ CXX_STANDARD 17
+ CXX_STANDARD_REQUIRED ON)
diff --git a/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag-result.txt b/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag-stderr.txt b/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag-stderr.txt
new file mode 100644
index 000000000..aa99af040
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag-stderr.txt
@@ -0,0 +1,20 @@
+CMake Warning \(dev\) at NoCXX20ModuleFlag.cmake:6 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Error in CMakeLists.txt:
+ The "noexperimentalflag" target has C\+\+ module sources but its experimental
+ support has not been requested
+
+(
+CMake Error in CMakeLists.txt:
+( The "noexperimentalflag" target has C\+\+ module sources but its experimental
+ support has not been requested
+| The "noexperimentalflag" target contains C\+\+ module sources which are not
+ supported by the generator
+)
+)*
+CMake Generate step failed. Build files cannot be regenerated correctly.
diff --git a/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag.cmake b/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag.cmake
new file mode 100644
index 000000000..79892eed3
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoCXX20ModuleFlag.cmake
@@ -0,0 +1,12 @@
+enable_language(CXX)
+
+unset(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP)
+
+add_library(noexperimentalflag)
+target_sources(noexperimentalflag
+ PUBLIC
+ FILE_SET fs TYPE CXX_MODULES FILES
+ sources/module.cxx)
+target_compile_features(noexperimentalflag
+ PRIVATE
+ cxx_std_20)
diff --git a/Tests/RunCMake/CXXModules/NoDyndepSupport-result.txt b/Tests/RunCMake/CXXModules/NoDyndepSupport-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoDyndepSupport-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CXXModules/NoDyndepSupport-stderr.txt b/Tests/RunCMake/CXXModules/NoDyndepSupport-stderr.txt
new file mode 100644
index 000000000..52f781fa3
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoDyndepSupport-stderr.txt
@@ -0,0 +1,30 @@
+CMake Warning \(dev\) at NoDyndepSupport.cmake:10 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+(CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Error:
+ The Ninja generator does not support C\+\+20 modules using Ninja version
+
+ .*
+
+ due to lack of required features. Ninja 1.10 or higher is required.
+
+|CMake Error in CMakeLists.txt:
+ The "nodyndep" target contains C\+\+ module sources which are not supported
+ by the generator
+
+(
+CMake Error in CMakeLists.txt:
+ The "nodyndep" target contains C\+\+ module sources which are not supported
+ by the generator
+
+)*)
+CMake Generate step failed. Build files cannot be regenerated correctly.
diff --git a/Tests/RunCMake/CXXModules/NoDyndepSupport.cmake b/Tests/RunCMake/CXXModules/NoDyndepSupport.cmake
new file mode 100644
index 000000000..09544007f
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoDyndepSupport.cmake
@@ -0,0 +1,16 @@
+enable_language(CXX)
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
+set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "")
+
+if (NOT CMAKE_CXX_STANDARD_DEFAULT)
+ set(CMAKE_CXX_STANDARD_DEFAULT "11")
+endif ()
+
+add_library(nodyndep)
+target_sources(nodyndep
+ PUBLIC
+ FILE_SET fs TYPE CXX_MODULES FILES
+ sources/module.cxx)
+target_compile_features(nodyndep
+ PRIVATE
+ cxx_std_20)
diff --git a/Tests/RunCMake/CXXModules/NotCXXSourceModuleHeaderUnits-result.txt b/Tests/RunCMake/CXXModules/NotCXXSourceModuleHeaderUnits-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NotCXXSourceModuleHeaderUnits-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CXXModules/NotCXXSourceModuleHeaderUnits-stderr.txt b/Tests/RunCMake/CXXModules/NotCXXSourceModuleHeaderUnits-stderr.txt
new file mode 100644
index 000000000..a93eb400e
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NotCXXSourceModuleHeaderUnits-stderr.txt
@@ -0,0 +1,22 @@
+CMake Warning \(dev\) at NotCXXSourceModuleHeaderUnits.cmake:7 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Error in CMakeLists.txt:
+ Target "not-cxx-source" contains the source
+
+ .*/Tests/RunCMake/CXXModules/sources/c-anchor.c
+
+ in a file set of type "CXX_MODULE_HEADER_UNITS" but the source is not
+ classified as a "CXX" source.
+
+
+CMake Generate step failed. Build files cannot be regenerated correctly.
diff --git a/Tests/RunCMake/CXXModules/NotCXXSourceModuleHeaderUnits.cmake b/Tests/RunCMake/CXXModules/NotCXXSourceModuleHeaderUnits.cmake
new file mode 100644
index 000000000..af4ddacfa
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NotCXXSourceModuleHeaderUnits.cmake
@@ -0,0 +1,15 @@
+enable_language(C)
+enable_language(CXX)
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
+set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "")
+
+add_library(not-cxx-source)
+target_sources(not-cxx-source
+ PRIVATE
+ sources/cxx-anchor.cxx
+ PUBLIC
+ FILE_SET fs TYPE CXX_MODULE_HEADER_UNITS FILES
+ sources/c-anchor.c)
+target_compile_features(not-cxx-source
+ PRIVATE
+ cxx_std_20)
diff --git a/Tests/RunCMake/CXXModules/NotCXXSourceModules-result.txt b/Tests/RunCMake/CXXModules/NotCXXSourceModules-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NotCXXSourceModules-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CXXModules/NotCXXSourceModules-stderr.txt b/Tests/RunCMake/CXXModules/NotCXXSourceModules-stderr.txt
new file mode 100644
index 000000000..d341c1f33
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NotCXXSourceModules-stderr.txt
@@ -0,0 +1,17 @@
+CMake Warning \(dev\) at NotCXXSourceModules.cmake:7 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:6 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Error in CMakeLists.txt:
+ Target "not-cxx-source" contains the source
+
+ .*/Tests/RunCMake/CXXModules/sources/c-anchor.c
+
+ in a file set of type "CXX_MODULES" but the source is not classified as a
+ "CXX" source.
+
+
+CMake Generate step failed. Build files cannot be regenerated correctly.
diff --git a/Tests/RunCMake/CXXModules/NotCXXSourceModules.cmake b/Tests/RunCMake/CXXModules/NotCXXSourceModules.cmake
new file mode 100644
index 000000000..f7a6060df
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NotCXXSourceModules.cmake
@@ -0,0 +1,13 @@
+enable_language(C)
+enable_language(CXX)
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
+set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "")
+
+add_library(not-cxx-source)
+target_sources(not-cxx-source
+ PUBLIC
+ FILE_SET fs TYPE CXX_MODULES FILES
+ sources/c-anchor.c)
+target_compile_features(not-cxx-source
+ PRIVATE
+ cxx_std_20)
diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
new file mode 100644
index 000000000..3f17c1ff0
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
@@ -0,0 +1,170 @@
+include(RunCMake)
+
+# For `if (IN_LIST)`
+cmake_policy(SET CMP0057 NEW)
+
+run_cmake(compiler_introspection)
+include("${RunCMake_BINARY_DIR}/compiler_introspection-build/info.cmake")
+
+# Test negative cases where C++20 modules do not work.
+run_cmake(NoCXX)
+if ("cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
+ # This test requires that the compiler be told to compile in an older-than-20
+ # standard. If the compiler forces a standard to be used, skip it.
+ if (NOT forced_cxx_standard)
+ run_cmake(NoCXX20)
+ endif ()
+
+ # This test uses C++20, but another prerequisite is missing, so forced
+ # standards don't matter.
+ run_cmake(NoCXX20ModuleFlag)
+endif ()
+
+if (RunCMake_GENERATOR MATCHES "Ninja")
+ execute_process(
+ COMMAND "${CMAKE_MAKE_PROGRAM}" --version
+ RESULT_VARIABLE res
+ OUTPUT_VARIABLE ninja_version
+ ERROR_VARIABLE err
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_STRIP_TRAILING_WHITESPACE)
+
+ if (res)
+ message(WARNING
+ "Failed to determine `ninja` version: ${err}")
+ set(ninja_version "0")
+ endif ()
+endif ()
+
+# Test behavior when the generator does not support C++20 modules.
+if (NOT RunCMake_GENERATOR MATCHES "Ninja" OR
+ ninja_version VERSION_LESS "1.10" OR
+ NOT "cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
+ if ("cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
+ run_cmake(NoDyndepSupport)
+ endif ()
+
+ # Bail; the remaining tests require the generator to successfully generate
+ # with C++20 modules in the source list.
+ return ()
+endif ()
+
+set(fileset_types
+ Modules
+ ModuleHeaderUnits)
+set(scopes
+ Interface
+ Private
+ Public)
+foreach (fileset_type IN LISTS fileset_types)
+ foreach (scope IN LISTS scopes)
+ run_cmake("FileSet${fileset_type}${scope}")
+ endforeach ()
+ run_cmake("FileSet${fileset_type}InterfaceImported")
+
+ # Test the error message when a non-C++ source file is found in the source
+ # list.
+ run_cmake("NotCXXSource${fileset_type}")
+endforeach ()
+
+run_cmake(InstallBMI)
+run_cmake(InstallBMIGenericArgs)
+run_cmake(InstallBMIIgnore)
+
+run_cmake(ExportBuildCxxModules)
+run_cmake(ExportInstallCxxModules)
+
+# Generator-specific tests.
+if (RunCMake_GENERATOR MATCHES "Ninja")
+ run_cmake(NinjaDependInfoFileSet)
+ run_cmake(NinjaDependInfoExport)
+ run_cmake(NinjaDependInfoBMIInstall)
+else ()
+ message(FATAL_ERROR
+ "Please add 'DependInfo' tests for the '${RunCMake_GENERATOR}' generator.")
+endif ()
+
+# Actual compilation tests.
+if (NOT CMake_TEST_MODULE_COMPILATION)
+ return ()
+endif ()
+
+function (run_cxx_module_test directory)
+ set(test_name "${directory}")
+ if (NOT ARGN STREQUAL "")
+ list(POP_FRONT ARGN test_name)
+ endif ()
+
+ set(RunCMake_TEST_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/examples/${directory}")
+ set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/examples/${test_name}-build")
+
+ if (RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(RunCMake_TEST_OPTIONS -DCMAKE_CONFIGURATION_TYPES=Debug)
+ else ()
+ set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug)
+ endif ()
+
+ if (RunCMake_CXXModules_INSTALL)
+ set(prefix "${RunCMake_BINARY_DIR}/examples/${test_name}-install")
+ file(REMOVE_RECURSE "${prefix}")
+ list(APPEND RunCMake_TEST_OPTIONS
+ "-DCMAKE_INSTALL_PREFIX=${prefix}")
+ endif ()
+
+ list(APPEND RunCMake_TEST_OPTIONS
+ "-DCMake_TEST_MODULE_COMPILATION_RULES=${CMake_TEST_MODULE_COMPILATION_RULES}"
+ ${ARGN})
+ run_cmake("examples/${test_name}")
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command("examples/${test_name}-build" "${CMAKE_COMMAND}" --build . --config Debug)
+ if (RunCMake_CXXModules_INSTALL)
+ run_cmake_command("examples/${test_name}-install" "${CMAKE_COMMAND}" --build . --target install --config Debug)
+ endif ()
+ run_cmake_command("examples/${test_name}-test" "${CMAKE_CTEST_COMMAND}" -C Debug --output-on-failure)
+endfunction ()
+
+string(REPLACE "," ";" CMake_TEST_MODULE_COMPILATION "${CMake_TEST_MODULE_COMPILATION}")
+
+# Tests which use named modules.
+if ("named" IN_LIST CMake_TEST_MODULE_COMPILATION)
+ run_cxx_module_test(simple)
+ run_cxx_module_test(library library-static -DBUILD_SHARED_LIBS=OFF)
+ run_cxx_module_test(generated)
+ run_cxx_module_test(public-req-private)
+ run_cxx_module_test(deep-chain)
+endif ()
+
+# Tests which use named modules in shared libraries.
+if ("shared" IN_LIST CMake_TEST_MODULE_COMPILATION)
+ run_cxx_module_test(library library-shared -DBUILD_SHARED_LIBS=ON)
+endif ()
+
+# Tests which use partitions.
+if ("partitions" IN_LIST CMake_TEST_MODULE_COMPILATION)
+ run_cxx_module_test(partitions)
+endif ()
+
+# Tests which use internal partitions.
+if ("internal_partitions" IN_LIST CMake_TEST_MODULE_COMPILATION)
+ run_cxx_module_test(internal-partitions)
+endif ()
+
+# Tests which install BMIs
+if ("export_bmi" IN_LIST CMake_TEST_MODULE_COMPILATION)
+ run_cxx_module_test(export-interface-build)
+ run_cxx_module_test(export-bmi-and-interface-build)
+endif ()
+
+# All of the following tests perform installation.
+set(RunCMake_CXXModules_INSTALL 1)
+
+# Tests which install BMIs
+if ("install_bmi" IN_LIST CMake_TEST_MODULE_COMPILATION)
+ run_cxx_module_test(install-bmi)
+ run_cxx_module_test(install-bmi-and-interfaces)
+
+ if ("export_bmi" IN_LIST CMake_TEST_MODULE_COMPILATION)
+ run_cxx_module_test(export-interface-install)
+ run_cxx_module_test(export-bmi-and-interface-install)
+ endif ()
+endif ()
diff --git a/Tests/RunCMake/CXXModules/check-json.cmake b/Tests/RunCMake/CXXModules/check-json.cmake
new file mode 100644
index 000000000..19d0c8a3c
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/check-json.cmake
@@ -0,0 +1,160 @@
+cmake_policy(PUSH)
+cmake_policy(SET CMP0057 NEW)
+
+function (json_placeholders in out)
+ string(REPLACE "<CONFIG>" "${CMAKE_BUILD_TYPE}" in "${in}")
+ if (RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ string(REPLACE "<CONFIG_DIR>" "${CMAKE_BUILD_TYPE}/" in "${in}")
+ else ()
+ string(REPLACE "<CONFIG_DIR>" "" in "${in}")
+ endif ()
+ if (CMAKE_BUILD_TYPE)
+ string(REPLACE "<CONFIG_FORCE>" "${CMAKE_BUILD_TYPE}" in "${in}")
+ else ()
+ string(REPLACE "<CONFIG_FORCE>" "noconfig" in "${in}")
+ endif ()
+ string(REPLACE "<SOURCE_DIR>" "${RunCMake_SOURCE_DIR}" in "${in}")
+ string(REPLACE "<BINARY_DIR>" "${RunCMake_TEST_BINARY_DIR}" in "${in}")
+ set("${out}" "${in}" PARENT_SCOPE)
+endfunction ()
+
+function (check_json_value path actual_type expect_type actual_value expect_value)
+ if (NOT actual_type STREQUAL expect_type)
+ list(APPEND RunCMake_TEST_FAILED
+ "Type mismatch at ${path}: ${actual_type} vs. ${expect_type}")
+ return ()
+ endif ()
+
+ if (actual_type STREQUAL NULL)
+ # Nothing to check
+ elseif (actual_type STREQUAL BOOLEAN)
+ if (NOT actual_value STREQUAL expect_value)
+ list(APPEND RunCMake_TEST_FAILED
+ "Boolean mismatch at ${path}: ${actual_value} vs. ${expect_value}")
+ endif ()
+ elseif (actual_type STREQUAL NUMBER)
+ if (NOT actual_value EQUAL expect_value)
+ list(APPEND RunCMake_TEST_FAILED
+ "Number mismatch at ${path}: ${actual_value} vs. ${expect_value}")
+ endif ()
+ elseif (actual_type STREQUAL STRING)
+ # Allow some values to be ignored.
+ if (expect_value STREQUAL "<IGNORE>")
+ return ()
+ endif ()
+
+ json_placeholders("${expect_value}" expect_value_expanded)
+ if (NOT actual_value STREQUAL expect_value_expanded)
+ list(APPEND RunCMake_TEST_FAILED
+ "String mismatch at ${path}: ${actual_value} vs. ${expect_value_expanded}")
+ endif ()
+ elseif (actual_type STREQUAL ARRAY)
+ check_json_array("${path}" "${actual_value}" "${expect_value}")
+ elseif (actual_type STREQUAL OBJECT)
+ check_json_object("${path}" "${actual_value}" "${expect_value}")
+ endif ()
+endfunction ()
+
+# Check that two arrays are the same.
+function (check_json_array path actual expect)
+ string(JSON actual_len LENGTH "${actual}")
+ string(JSON expect_len LENGTH "${expect}")
+
+ set(iter_len "${actual_len}")
+ if (actual_len LESS expect_len)
+ list(APPEND RunCMake_TEST_FAILED
+ "Missing array items at ${path}")
+ elseif (expect_len LESS actual_len)
+ list(APPEND RunCMake_TEST_FAILED
+ "Extra array items at ${path}")
+ set(iter_len "${expect_len}")
+ endif ()
+
+ foreach (idx RANGE "${iter_len}")
+ if (idx EQUAL iter_len)
+ break ()
+ endif ()
+
+ set(new_path "${path}[${idx}]")
+ string(JSON actual_type TYPE "${actual}" "${idx}")
+ string(JSON expect_type TYPE "${expect}" "${idx}")
+ string(JSON actual_value GET "${actual}" "${idx}")
+ string(JSON expect_value GET "${expect}" "${idx}")
+ check_json_value("${new_path}" "${actual_type}" "${expect_type}" "${actual_value}" "${expect_value}")
+ endforeach ()
+endfunction ()
+
+# Check that two inner objects are the same.
+function (check_json_object path actual expect)
+ string(JSON actual_len LENGTH "${actual}")
+ string(JSON expect_len LENGTH "${expect}")
+
+ set(actual_keys "")
+ set(expect_keys "")
+ foreach (idx RANGE "${actual_len}")
+ if (idx EQUAL actual_len)
+ break ()
+ endif ()
+
+ string(JSON actual_key MEMBER "${actual}" "${idx}")
+ list(APPEND actual_keys "${actual_key}")
+ endforeach ()
+ foreach (idx RANGE "${expect_len}")
+ if (idx EQUAL expect_len)
+ break ()
+ endif ()
+
+ string(JSON expect_key MEMBER "${expect}" "${idx}")
+ list(APPEND expect_keys "${expect_key}")
+ endforeach ()
+
+ json_placeholders("${expect_keys}" expect_keys_expanded)
+
+ set(actual_keys_missed "${actual_keys}")
+ set(expect_keys_missed "${expect_keys}")
+
+ set(common_keys "")
+ set(expect_keys_stack "${expect_keys}")
+ while (expect_keys_stack)
+ list(POP_BACK expect_keys_stack expect_key)
+ json_placeholders("${expect_key}" expect_key_expanded)
+
+ if (expect_key_expanded IN_LIST actual_keys_missed AND
+ expect_key IN_LIST expect_keys_missed)
+ list(APPEND common_keys "${expect_key}")
+ endif ()
+
+ list(REMOVE_ITEM actual_keys_missed "${expect_key_expanded}")
+ list(REMOVE_ITEM expect_keys_missed "${expect_key}")
+ endwhile ()
+
+ if (actual_keys_missed)
+ string(REPLACE ";" ", " actual_keys_missed_text "${actual_keys_missed}")
+ list(APPEND RunCMake_TEST_FAILED
+ "Missing expected members at ${path}: ${actual_keys_missed_text}")
+ endif ()
+ if (expect_keys_missed)
+ string(REPLACE ";" ", " expect_keys_missed_text "${expect_keys_missed}")
+ list(APPEND RunCMake_TEST_FAILED
+ "Extra unexpected members at ${path}: ${expect_keys_missed_text}")
+ endif ()
+
+ foreach (key IN LISTS common_keys)
+ json_placeholders("${key}" key_expanded)
+ set(new_path "${path}.${key_expanded}")
+ string(JSON actual_type TYPE "${actual}" "${key_expanded}")
+ string(JSON expect_type TYPE "${expect}" "${key}")
+ string(JSON actual_value GET "${actual}" "${key_expanded}")
+ string(JSON expect_value GET "${expect}" "${key}")
+ check_json_value("${new_path}" "${actual_type}" "${expect_type}" "${actual_value}" "${expect_value}")
+ endforeach ()
+endfunction ()
+
+# Check that two JSON objects are the same.
+function (check_json actual expect)
+ check_json_object("" "${actual}" "${expect}")
+endfunction ()
+
+string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}")
+
+cmake_policy(POP)
diff --git a/Tests/RunCMake/CXXModules/compiler_introspection.cmake b/Tests/RunCMake/CXXModules/compiler_introspection.cmake
new file mode 100644
index 000000000..7a2df3d35
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/compiler_introspection.cmake
@@ -0,0 +1,25 @@
+enable_language(CXX)
+
+set(info "")
+
+# See `Modules/Compiler/MSVC-CXX.cmake` for this. If there is explicitly no
+# default, the feature list is populated to be everything.
+if (DEFINED CMAKE_CXX_STANDARD_DEFAULT AND
+ CMAKE_CXX_STANDARD_DEFAULT STREQUAL "")
+ set(CMAKE_CXX_COMPILE_FEATURES "")
+endif ()
+
+# Detect if the environment forces a C++ standard, let the test selection know.
+set(forced_cxx_standard 0)
+if (CMAKE_CXX_FLAGS MATCHES "-std=")
+ set(forced_cxx_standard 1)
+endif ()
+
+# Forward information about the C++ compile features.
+string(APPEND info "\
+set(CMAKE_CXX_COMPILE_FEATURES \"${CMAKE_CXX_COMPILE_FEATURES}\")
+set(CMAKE_MAKE_PROGRAM \"${CMAKE_MAKE_PROGRAM}\")
+set(forced_cxx_standard \"${forced_cxx_standard}\")
+")
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/info.cmake" "${info}")
diff --git a/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi-and-interfaces.cmake b/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi-and-interfaces.cmake
new file mode 100644
index 000000000..f99455b47
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi-and-interfaces.cmake
@@ -0,0 +1,22 @@
+function (check_for_bmi prefix destination name)
+ set(found 0)
+ foreach (ext IN ITEMS gcm)
+ if (EXISTS "${prefix}/${destination}/${name}.${ext}")
+ set(found 1)
+ break ()
+ endif ()
+ endforeach ()
+
+ if (NOT found)
+ message(SEND_ERROR
+ "Failed to find the ${name} BMI")
+ endif ()
+endfunction ()
+
+function (check_for_interface prefix destination subdir name)
+ set(found 0)
+ if (NOT EXISTS "${prefix}/${destination}/${subdir}/${name}")
+ message(SEND_ERROR
+ "Failed to find the ${name} module interface")
+ endif ()
+endfunction ()
diff --git a/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi.cmake b/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi.cmake
new file mode 100644
index 000000000..91f399588
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/cxx-modules-find-bmi.cmake
@@ -0,0 +1,27 @@
+function (check_for_bmi prefix destination name)
+ set(found 0)
+ foreach (ext IN ITEMS gcm ifc)
+ if (EXISTS "${prefix}/${destination}/${name}.${ext}")
+ set(found 1)
+ break ()
+ endif ()
+ endforeach ()
+
+ if (NOT found)
+ message(SEND_ERROR
+ "Failed to find the ${name} BMI")
+ endif ()
+endfunction ()
+
+function (check_for_interface prefix destination subdir name)
+ set(found 0)
+ if (NOT EXISTS "${prefix}/${destination}/${subdir}/${name}")
+ message(SEND_ERROR
+ "Failed to find the ${name} module interface")
+ endif ()
+endfunction ()
+
+function (report_dirs prefix destination)
+ message("prefix: ${prefix}")
+ message("destination: ${destination}")
+endfunction ()
diff --git a/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake b/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake
new file mode 100644
index 000000000..381094ea4
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake
@@ -0,0 +1,18 @@
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046")
+
+if (NOT EXISTS "${CMake_TEST_MODULE_COMPILATION_RULES}")
+ message(FATAL_ERROR
+ "The `CMake_TEST_MODULE_COMPILATION_RULES` file must be specified "
+ "for these tests to operate.")
+endif ()
+
+include("${CMake_TEST_MODULE_COMPILATION_RULES}")
+
+if (NOT CMake_TEST_CXXModules_UUID STREQUAL "a246741c-d067-4019-a8fb-3d16b0c9d1d3")
+ message(FATAL_ERROR
+ "The compilation rule file needs updated for changes in the test "
+ "suite. Please see the history for what needs to be updated.")
+endif ()
+
+include(CTest)
+enable_testing()
diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt b/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt
new file mode 100644
index 000000000..5e4392abc
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt
new file mode 100644
index 000000000..515b2409d
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt
@@ -0,0 +1,66 @@
+cmake_minimum_required(VERSION 3.24)
+project(cxx_modules_deep_chain CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+add_library(a STATIC)
+target_sources(a
+ PUBLIC
+ FILE_SET CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ a.cxx)
+target_compile_features(a PUBLIC cxx_std_20)
+
+add_library(b STATIC)
+target_sources(b
+ PUBLIC
+ FILE_SET CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ b.cxx)
+target_compile_features(b PUBLIC cxx_std_20)
+target_link_libraries(b PUBLIC a)
+
+add_library(c STATIC)
+target_sources(c
+ PUBLIC
+ FILE_SET CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ c.cxx)
+target_compile_features(c PUBLIC cxx_std_20)
+target_link_libraries(c PUBLIC b)
+
+add_library(d STATIC)
+target_sources(d
+ PUBLIC
+ FILE_SET CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ d.cxx)
+target_compile_features(d PUBLIC cxx_std_20)
+target_link_libraries(d PUBLIC c)
+
+add_library(e STATIC)
+target_sources(e
+ PUBLIC
+ FILE_SET CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ e.cxx)
+target_compile_features(e PUBLIC cxx_std_20)
+target_link_libraries(e PUBLIC d)
+
+add_executable(exe)
+target_link_libraries(exe PRIVATE e)
+target_sources(exe
+ PRIVATE
+ main.cxx)
+
+add_test(NAME exe COMMAND exe)
diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/a.cxx b/Tests/RunCMake/CXXModules/examples/deep-chain/a.cxx
new file mode 100644
index 000000000..9edaec967
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/deep-chain/a.cxx
@@ -0,0 +1,6 @@
+export module a;
+
+export int a()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/b.cxx b/Tests/RunCMake/CXXModules/examples/deep-chain/b.cxx
new file mode 100644
index 000000000..38ab0c2fe
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/deep-chain/b.cxx
@@ -0,0 +1,7 @@
+export module b;
+import a;
+
+export int b()
+{
+ return a();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/c.cxx b/Tests/RunCMake/CXXModules/examples/deep-chain/c.cxx
new file mode 100644
index 000000000..580a458f3
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/deep-chain/c.cxx
@@ -0,0 +1,7 @@
+export module c;
+import b;
+
+export int c()
+{
+ return b();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/d.cxx b/Tests/RunCMake/CXXModules/examples/deep-chain/d.cxx
new file mode 100644
index 000000000..78bc5baa2
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/deep-chain/d.cxx
@@ -0,0 +1,7 @@
+export module d;
+import c;
+
+export int d()
+{
+ return c();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/e.cxx b/Tests/RunCMake/CXXModules/examples/deep-chain/e.cxx
new file mode 100644
index 000000000..e0194401b
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/deep-chain/e.cxx
@@ -0,0 +1,7 @@
+export module e;
+import d;
+
+export int e()
+{
+ return d();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/main.cxx b/Tests/RunCMake/CXXModules/examples/deep-chain/main.cxx
new file mode 100644
index 000000000..0b7c15df5
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/deep-chain/main.cxx
@@ -0,0 +1,6 @@
+import e;
+
+int main(int argc, char* argv[])
+{
+ return e();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build-stderr.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build-stderr.txt
new file mode 100644
index 000000000..5e4392abc
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/CMakeLists.txt
new file mode 100644
index 000000000..a450b7e5d
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/CMakeLists.txt
@@ -0,0 +1,56 @@
+cmake_minimum_required(VERSION 3.24)
+project(cxx_modules_export_bmi_and_interfaces CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+add_library(export_bmi_and_interfaces STATIC)
+target_sources(export_bmi_and_interfaces
+ PRIVATE
+ forward.cxx
+ PRIVATE
+ FILE_SET modules_private TYPE CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ private.cxx
+ PUBLIC
+ FILE_SET modules TYPE CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ importable.cxx)
+target_compile_features(export_bmi_and_interfaces PUBLIC cxx_std_20)
+
+install(TARGETS export_bmi_and_interfaces
+ EXPORT CXXModules
+ FILE_SET modules DESTINATION "lib/cxx/miu"
+ CXX_MODULES_BMI DESTINATION "lib/cxx/bmi")
+export(EXPORT CXXModules
+ NAMESPACE CXXModules::
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/export_bmi_and_interfaces-targets.cmake"
+ CXX_MODULES_DIRECTORY "export_bmi_and_interfaces-cxx-modules")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_bmi_and_interfaces-config.cmake"
+ "include(\"\${CMAKE_CURRENT_LIST_DIR}/export_bmi_and_interfaces-targets.cmake\")
+set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1)
+")
+
+set(generator
+ -G "${CMAKE_GENERATOR}")
+if (CMAKE_GENERATOR_TOOLSET)
+ list(APPEND generator
+ -T "${CMAKE_GENERATOR_TOOLSET}")
+endif ()
+if (CMAKE_GENERATOR_PLATFORM)
+ list(APPEND generator
+ -A "${CMAKE_GENERATOR_PLATFORM}")
+endif ()
+
+add_test(NAME export_bmi_and_interfaces_build
+ COMMAND
+ "${CMAKE_COMMAND}"
+ "-Dexpected_source_dir=${CMAKE_CURRENT_SOURCE_DIR}"
+ "-Dexpected_binary_dir=${CMAKE_CURRENT_BINARY_DIR}"
+ "-Dexport_bmi_and_interfaces_DIR=${CMAKE_CURRENT_BINARY_DIR}"
+ ${generator}
+ -S "${CMAKE_CURRENT_SOURCE_DIR}/test"
+ -B "${CMAKE_CURRENT_BINARY_DIR}/test")
diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/forward.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/forward.cxx
new file mode 100644
index 000000000..7f53271f8
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/forward.cxx
@@ -0,0 +1,6 @@
+import priv;
+
+int forwarding()
+{
+ return from_private();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/importable.cxx
new file mode 100644
index 000000000..e0b18728c
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/importable.cxx
@@ -0,0 +1,8 @@
+export module importable;
+
+int forwarding();
+
+export int from_import()
+{
+ return forwarding();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/private.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/private.cxx
new file mode 100644
index 000000000..c5b719a33
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/private.cxx
@@ -0,0 +1,6 @@
+export module priv;
+
+export int from_private()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt
new file mode 100644
index 000000000..b814b3bf7
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 3.24)
+project(cxx_modules_library NONE)
+
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046")
+
+find_package(export_bmi_and_interfaces REQUIRED)
+
+if (NOT TARGET CXXModules::export_bmi_and_interfaces)
+ message(FATAL_ERROR
+ "Missing imported target")
+endif ()
+
+get_property(file_sets TARGET CXXModules::export_bmi_and_interfaces
+ PROPERTY INTERFACE_CXX_MODULE_SETS)
+if (NOT file_sets STREQUAL "modules")
+ message(FATAL_ERROR
+ "Incorrect exported file sets in `CXXModules::export_bmi_and_interfaces`: `${file_sets}`")
+endif ()
+
+get_property(file_set_files TARGET CXXModules::export_bmi_and_interfaces
+ PROPERTY CXX_MODULE_SET_modules)
+if (NOT file_set_files STREQUAL "${expected_source_dir}/importable.cxx")
+ message(FATAL_ERROR
+ "Incorrect exported file set paths in CXXModules::export_bmi_and_interfaces`: `${file_set_files}`")
+endif ()
+
+get_property(imported_modules TARGET CXXModules::export_bmi_and_interfaces
+ PROPERTY IMPORTED_CXX_MODULES_DEBUG)
+if (NOT imported_modules MATCHES "importable=${expected_source_dir}/importable.cxx,${expected_binary_dir}/CMakeFiles/export_bmi_and_interfaces.dir(/Debug)?/importable.(gcm|pcm|ifc)")
+ message(FATAL_ERROR
+ "Incorrect exported modules in CXXModules::export_bmi_and_interfaces`: `${imported_modules}`")
+endif ()
diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install-stderr.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install-stderr.txt
new file mode 100644
index 000000000..5e4392abc
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/CMakeLists.txt
new file mode 100644
index 000000000..a5574fe39
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/CMakeLists.txt
@@ -0,0 +1,59 @@
+cmake_minimum_required(VERSION 3.24)
+project(cxx_modules_export_bmi_and_interfaces CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+add_library(export_bmi_and_interfaces STATIC)
+target_sources(export_bmi_and_interfaces
+ PRIVATE
+ forward.cxx
+ PRIVATE
+ FILE_SET modules_private TYPE CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ private.cxx
+ PUBLIC
+ FILE_SET modules TYPE CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ importable.cxx)
+target_compile_features(export_bmi_and_interfaces PUBLIC cxx_std_20)
+
+install(TARGETS export_bmi_and_interfaces
+ EXPORT CXXModules
+ FILE_SET modules DESTINATION "lib/cxx/miu"
+ CXX_MODULES_BMI DESTINATION "lib/cxx/bmi")
+install(EXPORT CXXModules
+ NAMESPACE CXXModules::
+ DESTINATION "lib/cmake/export_bmi_and_interfaces"
+ FILE "export_bmi_and_interfaces-targets.cmake"
+ CXX_MODULES_DIRECTORY "export_bmi_and_interfaces-cxx-modules")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_bmi_and_interfaces-config.cmake"
+ "include(\"\${CMAKE_CURRENT_LIST_DIR}/export_bmi_and_interfaces-targets.cmake\")
+set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1)
+")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/export_bmi_and_interfaces-config.cmake"
+ DESTINATION "lib/cmake/export_bmi_and_interfaces")
+
+set(generator
+ -G "${CMAKE_GENERATOR}")
+if (CMAKE_GENERATOR_TOOLSET)
+ list(APPEND generator
+ -T "${CMAKE_GENERATOR_TOOLSET}")
+endif ()
+if (CMAKE_GENERATOR_PLATFORM)
+ list(APPEND generator
+ -A "${CMAKE_GENERATOR_PLATFORM}")
+endif ()
+
+add_test(NAME export_bmi_and_interfaces_build
+ COMMAND
+ "${CMAKE_COMMAND}"
+ "-Dexpected_source_dir=${CMAKE_INSTALL_PREFIX}/lib/cxx/miu"
+ "-Dexpected_binary_dir=${CMAKE_INSTALL_PREFIX}/lib/cxx/bmi"
+ "-Dexport_bmi_and_interfaces_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/export_bmi_and_interfaces"
+ ${generator}
+ -S "${CMAKE_CURRENT_SOURCE_DIR}/test"
+ -B "${CMAKE_CURRENT_BINARY_DIR}/test")
diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/forward.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/forward.cxx
new file mode 100644
index 000000000..7f53271f8
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/forward.cxx
@@ -0,0 +1,6 @@
+import priv;
+
+int forwarding()
+{
+ return from_private();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/importable.cxx
new file mode 100644
index 000000000..e0b18728c
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/importable.cxx
@@ -0,0 +1,8 @@
+export module importable;
+
+int forwarding();
+
+export int from_import()
+{
+ return forwarding();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/private.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/private.cxx
new file mode 100644
index 000000000..c5b719a33
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/private.cxx
@@ -0,0 +1,6 @@
+export module priv;
+
+export int from_private()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt
new file mode 100644
index 000000000..db0484d74
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 3.24)
+project(cxx_modules_library NONE)
+
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046")
+
+find_package(export_bmi_and_interfaces REQUIRED)
+
+if (NOT TARGET CXXModules::export_bmi_and_interfaces)
+ message(FATAL_ERROR
+ "Missing imported target")
+endif ()
+
+get_property(file_sets TARGET CXXModules::export_bmi_and_interfaces
+ PROPERTY INTERFACE_CXX_MODULE_SETS)
+if (NOT file_sets STREQUAL "modules")
+ message(FATAL_ERROR
+ "Incorrect exported file sets in `CXXModules::export_bmi_and_interfaces`: `${file_sets}`")
+endif ()
+
+get_property(file_set_files TARGET CXXModules::export_bmi_and_interfaces
+ PROPERTY CXX_MODULE_SET_modules)
+if (NOT file_set_files STREQUAL "${expected_source_dir}/importable.cxx")
+ message(FATAL_ERROR
+ "Incorrect exported file set paths in CXXModules::export_bmi_and_interfaces`: `${file_set_files}`")
+endif ()
+
+get_property(imported_modules TARGET CXXModules::export_bmi_and_interfaces
+ PROPERTY IMPORTED_CXX_MODULES_DEBUG)
+if (NOT imported_modules MATCHES "importable=${expected_source_dir}/importable.cxx,${expected_binary_dir}/importable.(gcm|pcm|ifc)")
+ message(FATAL_ERROR
+ "Incorrect exported modules in CXXModules::export_bmi_and_interfaces`: `${imported_modules}`")
+endif ()
diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build-stderr.txt b/Tests/RunCMake/CXXModules/examples/export-interface-build-stderr.txt
new file mode 100644
index 000000000..5e4392abc
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-interface-build-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-build/CMakeLists.txt
new file mode 100644
index 000000000..80ddaf83e
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/CMakeLists.txt
@@ -0,0 +1,53 @@
+cmake_minimum_required(VERSION 3.24)
+project(cxx_modules_export_interfaces CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+add_library(export_interfaces STATIC)
+target_sources(export_interfaces
+ PRIVATE
+ forward.cxx
+ PRIVATE
+ FILE_SET modules_private TYPE CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ private.cxx
+ PUBLIC
+ FILE_SET modules TYPE CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ importable.cxx)
+target_compile_features(export_interfaces PUBLIC cxx_std_20)
+
+install(TARGETS export_interfaces
+ EXPORT CXXModules
+ FILE_SET modules DESTINATION "lib/cxx/miu")
+export(EXPORT CXXModules
+ NAMESPACE CXXModules::
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces-targets.cmake")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces-config.cmake"
+ "include(\"\${CMAKE_CURRENT_LIST_DIR}/export_interfaces-targets.cmake\")
+set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1)
+")
+
+set(generator
+ -G "${CMAKE_GENERATOR}")
+if (CMAKE_GENERATOR_TOOLSET)
+ list(APPEND generator
+ -T "${CMAKE_GENERATOR_TOOLSET}")
+endif ()
+if (CMAKE_GENERATOR_PLATFORM)
+ list(APPEND generator
+ -A "${CMAKE_GENERATOR_PLATFORM}")
+endif ()
+
+add_test(NAME export_interfaces_build
+ COMMAND
+ "${CMAKE_COMMAND}"
+ "-Dexpected_dir=${CMAKE_CURRENT_SOURCE_DIR}"
+ "-Dexport_interfaces_DIR=${CMAKE_CURRENT_BINARY_DIR}"
+ ${generator}
+ -S "${CMAKE_CURRENT_SOURCE_DIR}/test"
+ -B "${CMAKE_CURRENT_BINARY_DIR}/test")
diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build/forward.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-build/forward.cxx
new file mode 100644
index 000000000..7f53271f8
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/forward.cxx
@@ -0,0 +1,6 @@
+import priv;
+
+int forwarding()
+{
+ return from_private();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-build/importable.cxx
new file mode 100644
index 000000000..e0b18728c
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/importable.cxx
@@ -0,0 +1,8 @@
+export module importable;
+
+int forwarding();
+
+export int from_import()
+{
+ return forwarding();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build/private.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-build/private.cxx
new file mode 100644
index 000000000..c5b719a33
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/private.cxx
@@ -0,0 +1,6 @@
+export module priv;
+
+export int from_private()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt
new file mode 100644
index 000000000..6145210d3
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 3.24)
+project(cxx_modules_library NONE)
+
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046")
+
+find_package(export_interfaces REQUIRED)
+
+if (NOT TARGET CXXModules::export_interfaces)
+ message(FATAL_ERROR
+ "Missing imported target")
+endif ()
+
+get_property(file_sets TARGET CXXModules::export_interfaces
+ PROPERTY INTERFACE_CXX_MODULE_SETS)
+if (NOT file_sets STREQUAL "modules")
+ message(FATAL_ERROR
+ "Incorrect exported file sets in `CXXModules::export_interfaces`: `${file_sets}`")
+endif ()
+
+get_property(file_set_files TARGET CXXModules::export_interfaces
+ PROPERTY CXX_MODULE_SET_modules)
+if (NOT file_set_files STREQUAL "${expected_dir}/importable.cxx")
+ message(FATAL_ERROR
+ "Incorrect exported file set paths in CXXModules::export_interfaces`: `${file_set_files}`")
+endif ()
+
+get_property(imported_modules_set TARGET CXXModules::export_interfaces
+ PROPERTY IMPORTED_CXX_MODULES_DEBUG SET)
+if (imported_modules_set)
+ message(FATAL_ERROR
+ "Unexpected C++ modules specified.")
+endif ()
diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install-stderr.txt b/Tests/RunCMake/CXXModules/examples/export-interface-install-stderr.txt
new file mode 100644
index 000000000..5e4392abc
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-interface-install-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-install/CMakeLists.txt
new file mode 100644
index 000000000..1dfb6daf7
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-interface-install/CMakeLists.txt
@@ -0,0 +1,56 @@
+cmake_minimum_required(VERSION 3.24)
+project(cxx_modules_export_interfaces CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+add_library(export_interfaces STATIC)
+target_sources(export_interfaces
+ PRIVATE
+ forward.cxx
+ PRIVATE
+ FILE_SET modules_private TYPE CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ private.cxx
+ PUBLIC
+ FILE_SET modules TYPE CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ importable.cxx)
+target_compile_features(export_interfaces PUBLIC cxx_std_20)
+
+install(TARGETS export_interfaces
+ EXPORT CXXModules
+ FILE_SET modules DESTINATION "lib/cxx/miu")
+install(EXPORT CXXModules
+ NAMESPACE CXXModules::
+ DESTINATION "lib/cmake/export_interfaces"
+ FILE "export_interfaces-targets.cmake")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces-config.cmake"
+ "include(\"\${CMAKE_CURRENT_LIST_DIR}/export_interfaces-targets.cmake\")
+set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1)
+")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/export_interfaces-config.cmake"
+ DESTINATION "lib/cmake/export_interfaces")
+
+set(generator
+ -G "${CMAKE_GENERATOR}")
+if (CMAKE_GENERATOR_TOOLSET)
+ list(APPEND generator
+ -T "${CMAKE_GENERATOR_TOOLSET}")
+endif ()
+if (CMAKE_GENERATOR_PLATFORM)
+ list(APPEND generator
+ -A "${CMAKE_GENERATOR_PLATFORM}")
+endif ()
+
+add_test(NAME export_interfaces_build
+ COMMAND
+ "${CMAKE_COMMAND}"
+ "-Dexpected_dir=${CMAKE_INSTALL_PREFIX}/lib/cxx/miu"
+ "-Dexport_interfaces_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/export_interfaces"
+ ${generator}
+ -S "${CMAKE_CURRENT_SOURCE_DIR}/test"
+ -B "${CMAKE_CURRENT_BINARY_DIR}/test")
diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/forward.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-install/forward.cxx
new file mode 100644
index 000000000..7f53271f8
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-interface-install/forward.cxx
@@ -0,0 +1,6 @@
+import priv;
+
+int forwarding()
+{
+ return from_private();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-install/importable.cxx
new file mode 100644
index 000000000..e0b18728c
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-interface-install/importable.cxx
@@ -0,0 +1,8 @@
+export module importable;
+
+int forwarding();
+
+export int from_import()
+{
+ return forwarding();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/private.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-install/private.cxx
new file mode 100644
index 000000000..c5b719a33
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-interface-install/private.cxx
@@ -0,0 +1,6 @@
+export module priv;
+
+export int from_private()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt
new file mode 100644
index 000000000..6145210d3
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 3.24)
+project(cxx_modules_library NONE)
+
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046")
+
+find_package(export_interfaces REQUIRED)
+
+if (NOT TARGET CXXModules::export_interfaces)
+ message(FATAL_ERROR
+ "Missing imported target")
+endif ()
+
+get_property(file_sets TARGET CXXModules::export_interfaces
+ PROPERTY INTERFACE_CXX_MODULE_SETS)
+if (NOT file_sets STREQUAL "modules")
+ message(FATAL_ERROR
+ "Incorrect exported file sets in `CXXModules::export_interfaces`: `${file_sets}`")
+endif ()
+
+get_property(file_set_files TARGET CXXModules::export_interfaces
+ PROPERTY CXX_MODULE_SET_modules)
+if (NOT file_set_files STREQUAL "${expected_dir}/importable.cxx")
+ message(FATAL_ERROR
+ "Incorrect exported file set paths in CXXModules::export_interfaces`: `${file_set_files}`")
+endif ()
+
+get_property(imported_modules_set TARGET CXXModules::export_interfaces
+ PROPERTY IMPORTED_CXX_MODULES_DEBUG SET)
+if (imported_modules_set)
+ message(FATAL_ERROR
+ "Unexpected C++ modules specified.")
+endif ()
diff --git a/Tests/RunCMake/CXXModules/examples/generated-stderr.txt b/Tests/RunCMake/CXXModules/examples/generated-stderr.txt
new file mode 100644
index 000000000..b9bbf34f2
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/generated-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at CMakeLists.txt:12 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/generated/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/generated/CMakeLists.txt
new file mode 100644
index 000000000..73f7ff776
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/generated/CMakeLists.txt
@@ -0,0 +1,23 @@
+cmake_minimum_required(VERSION 3.24)
+project(cxx_modules_generated CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/importable.cxx.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/importable.cxx"
+ COPYONLY)
+
+add_executable(generated)
+target_sources(generated
+ PRIVATE
+ main.cxx
+ PRIVATE
+ FILE_SET CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_BINARY_DIR}"
+ FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/importable.cxx")
+target_compile_features(generated PUBLIC cxx_std_20)
+
+add_test(NAME generated COMMAND generated)
diff --git a/Tests/RunCMake/CXXModules/examples/generated/importable.cxx.in b/Tests/RunCMake/CXXModules/examples/generated/importable.cxx.in
new file mode 100644
index 000000000..a9287d7fa
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/generated/importable.cxx.in
@@ -0,0 +1,5 @@
+export module importable;
+
+export int from_import() {
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/generated/main.cxx b/Tests/RunCMake/CXXModules/examples/generated/main.cxx
new file mode 100644
index 000000000..feb38d22e
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/generated/main.cxx
@@ -0,0 +1,6 @@
+import importable;
+
+int main(int argc, char* argv[])
+{
+ return from_import();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces-stderr.txt b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces-stderr.txt
new file mode 100644
index 000000000..5e4392abc
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/CMakeLists.txt
new file mode 100644
index 000000000..efaca0e11
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.24)
+project(cxx_modules_install_bmi_and_interfaces CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+add_library(install_bmi_and_interfaces STATIC)
+target_sources(install_bmi_and_interfaces
+ PUBLIC
+ FILE_SET CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ importable.cxx)
+target_compile_features(install_bmi_and_interfaces PUBLIC cxx_std_20)
+
+install(TARGETS install_bmi_and_interfaces
+ ARCHIVE DESTINATION "lib"
+ CXX_MODULES_BMI DESTINATION "lib/cxx/bmi"
+ FILE_SET CXX_MODULES DESTINATION "lib/cxx/miu")
+
+add_test(NAME check-for-bmi
+ COMMAND
+ "${CMAKE_COMMAND}"
+ "-Dprefix=${CMAKE_INSTALL_PREFIX}"
+ "-Dbmi_destination=lib/cxx/bmi"
+ "-Dfs_destination=lib/cxx/miu"
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/check-for-bmi.cmake")
diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/check-for-bmi.cmake b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/check-for-bmi.cmake
new file mode 100644
index 000000000..a8ff1ad6a
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/check-for-bmi.cmake
@@ -0,0 +1,7 @@
+include("${CMAKE_CURRENT_LIST_DIR}/../cxx-modules-find-bmi.cmake")
+
+report_dirs("${prefix}" "${bmi_destination}")
+check_for_bmi("${prefix}" "${bmi_destination}" importable)
+
+report_dirs("${prefix}" "${fs_destination}")
+check_for_interface("${prefix}" "${fs_destination}" "" importable.cxx)
diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/importable.cxx b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/importable.cxx
new file mode 100644
index 000000000..607680a07
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/install-bmi-and-interfaces/importable.cxx
@@ -0,0 +1,6 @@
+export module importable;
+
+export int from_import()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi-stderr.txt b/Tests/RunCMake/CXXModules/examples/install-bmi-stderr.txt
new file mode 100644
index 000000000..5e4392abc
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/install-bmi-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/install-bmi/CMakeLists.txt
new file mode 100644
index 000000000..4e039f9f2
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/install-bmi/CMakeLists.txt
@@ -0,0 +1,25 @@
+cmake_minimum_required(VERSION 3.24)
+project(cxx_modules_install_bmi CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+add_library(install_bmi STATIC)
+target_sources(install_bmi
+ PUBLIC
+ FILE_SET CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ importable.cxx)
+target_compile_features(install_bmi PUBLIC cxx_std_20)
+
+install(TARGETS install_bmi
+ ARCHIVE DESTINATION "lib"
+ CXX_MODULES_BMI DESTINATION "lib/cxx/bmi")
+
+add_test(NAME check-for-bmi
+ COMMAND
+ "${CMAKE_COMMAND}"
+ "-Dprefix=${CMAKE_INSTALL_PREFIX}"
+ "-Ddestination=lib/cxx/bmi"
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/check-for-bmi.cmake")
diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi/check-for-bmi.cmake b/Tests/RunCMake/CXXModules/examples/install-bmi/check-for-bmi.cmake
new file mode 100644
index 000000000..ff84ed637
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/install-bmi/check-for-bmi.cmake
@@ -0,0 +1,4 @@
+include("${CMAKE_CURRENT_LIST_DIR}/../cxx-modules-find-bmi.cmake")
+
+report_dirs("${prefix}" "${destination}")
+check_for_bmi("${prefix}" "${destination}" importable)
diff --git a/Tests/RunCMake/CXXModules/examples/install-bmi/importable.cxx b/Tests/RunCMake/CXXModules/examples/install-bmi/importable.cxx
new file mode 100644
index 000000000..607680a07
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/install-bmi/importable.cxx
@@ -0,0 +1,6 @@
+export module importable;
+
+export int from_import()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/internal-partitions-stderr.txt b/Tests/RunCMake/CXXModules/examples/internal-partitions-stderr.txt
new file mode 100644
index 000000000..4652aeced
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/internal-partitions-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at CMakeLists.txt:10 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/internal-partitions/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/internal-partitions/CMakeLists.txt
new file mode 100644
index 000000000..f5e9d942d
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/internal-partitions/CMakeLists.txt
@@ -0,0 +1,31 @@
+cmake_minimum_required(VERSION 3.24)
+project(cxx_modules_internal_partitions CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+include(GenerateExportHeader)
+
+add_library(internal-partitions)
+generate_export_header(internal-partitions)
+target_sources(internal-partitions
+ PUBLIC
+ FILE_SET HEADERS
+ BASE_DIRS
+ "${CMAKE_CURRENT_BINARY_DIR}"
+ FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/internal-partitions_export.h"
+ FILE_SET CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ importable.cxx
+ partition.cxx)
+target_compile_features(internal-partitions PUBLIC cxx_std_20)
+
+add_executable(exe)
+target_link_libraries(exe PRIVATE internal-partitions)
+target_sources(exe
+ PRIVATE
+ main.cxx)
+
+add_test(NAME exe COMMAND exe)
diff --git a/Tests/RunCMake/CXXModules/examples/internal-partitions/importable.cxx b/Tests/RunCMake/CXXModules/examples/internal-partitions/importable.cxx
new file mode 100644
index 000000000..b872ae98c
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/internal-partitions/importable.cxx
@@ -0,0 +1,9 @@
+export module importable;
+import : internal_partition;
+
+#include "internal-partitions_export.h"
+
+export INTERNAL_PARTITIONS_EXPORT int from_import()
+{
+ return from_partition();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/internal-partitions/main.cxx b/Tests/RunCMake/CXXModules/examples/internal-partitions/main.cxx
new file mode 100644
index 000000000..feb38d22e
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/internal-partitions/main.cxx
@@ -0,0 +1,6 @@
+import importable;
+
+int main(int argc, char* argv[])
+{
+ return from_import();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/internal-partitions/partition.cxx b/Tests/RunCMake/CXXModules/examples/internal-partitions/partition.cxx
new file mode 100644
index 000000000..b15f53c5a
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/internal-partitions/partition.cxx
@@ -0,0 +1,6 @@
+module importable : internal_partition;
+
+int from_partition()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/library-shared-stderr.txt b/Tests/RunCMake/CXXModules/examples/library-shared-stderr.txt
new file mode 100644
index 000000000..4652aeced
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/library-shared-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at CMakeLists.txt:10 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/library-static-stderr.txt b/Tests/RunCMake/CXXModules/examples/library-static-stderr.txt
new file mode 100644
index 000000000..4652aeced
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/library-static-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at CMakeLists.txt:10 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/library/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/library/CMakeLists.txt
new file mode 100644
index 000000000..27fd94f3f
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/library/CMakeLists.txt
@@ -0,0 +1,30 @@
+cmake_minimum_required(VERSION 3.24)
+project(cxx_modules_library CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+include(GenerateExportHeader)
+
+add_library(library)
+generate_export_header(library)
+target_sources(library
+ PUBLIC
+ FILE_SET HEADERS
+ BASE_DIRS
+ "${CMAKE_CURRENT_BINARY_DIR}"
+ FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/library_export.h"
+ FILE_SET CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ importable.cxx)
+target_compile_features(library PUBLIC cxx_std_20)
+
+add_executable(exe)
+target_link_libraries(exe PRIVATE library)
+target_sources(exe
+ PRIVATE
+ main.cxx)
+
+add_test(NAME exe COMMAND exe)
diff --git a/Tests/RunCMake/CXXModules/examples/library/importable.cxx b/Tests/RunCMake/CXXModules/examples/library/importable.cxx
new file mode 100644
index 000000000..72ed0dfd3
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/library/importable.cxx
@@ -0,0 +1,8 @@
+export module importable;
+
+#include "library_export.h"
+
+export LIBRARY_EXPORT int from_import()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/library/main.cxx b/Tests/RunCMake/CXXModules/examples/library/main.cxx
new file mode 100644
index 000000000..feb38d22e
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/library/main.cxx
@@ -0,0 +1,6 @@
+import importable;
+
+int main(int argc, char* argv[])
+{
+ return from_import();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/partitions-stderr.txt b/Tests/RunCMake/CXXModules/examples/partitions-stderr.txt
new file mode 100644
index 000000000..4652aeced
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/partitions-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at CMakeLists.txt:10 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/partitions/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/partitions/CMakeLists.txt
new file mode 100644
index 000000000..3a7b0d4a3
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/partitions/CMakeLists.txt
@@ -0,0 +1,31 @@
+cmake_minimum_required(VERSION 3.24)
+project(cxx_modules_partitions CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+include(GenerateExportHeader)
+
+add_library(partitions)
+generate_export_header(partitions)
+target_sources(partitions
+ PUBLIC
+ FILE_SET HEADERS
+ BASE_DIRS
+ "${CMAKE_CURRENT_BINARY_DIR}"
+ FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/partitions_export.h"
+ FILE_SET CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ importable.cxx
+ partition.cxx)
+target_compile_features(partitions PUBLIC cxx_std_20)
+
+add_executable(exe)
+target_link_libraries(exe PRIVATE partitions)
+target_sources(exe
+ PRIVATE
+ main.cxx)
+
+add_test(NAME exe COMMAND exe)
diff --git a/Tests/RunCMake/CXXModules/examples/partitions/importable.cxx b/Tests/RunCMake/CXXModules/examples/partitions/importable.cxx
new file mode 100644
index 000000000..d0ac2f47b
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/partitions/importable.cxx
@@ -0,0 +1,9 @@
+export module importable;
+export import : partition;
+
+#include "partitions_export.h"
+
+export PARTITIONS_EXPORT int from_import()
+{
+ return from_partition();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/partitions/main.cxx b/Tests/RunCMake/CXXModules/examples/partitions/main.cxx
new file mode 100644
index 000000000..c5b78c9c5
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/partitions/main.cxx
@@ -0,0 +1,6 @@
+import importable;
+
+int main(int argc, char* argv[])
+{
+ return from_import() + from_partition();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/partitions/partition.cxx b/Tests/RunCMake/CXXModules/examples/partitions/partition.cxx
new file mode 100644
index 000000000..a47a4fdfd
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/partitions/partition.cxx
@@ -0,0 +1,8 @@
+export module importable : partition;
+
+#include "partitions_export.h"
+
+export PARTITIONS_EXPORT int from_partition()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/public-req-private-build-result.txt b/Tests/RunCMake/CXXModules/examples/public-req-private-build-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/public-req-private-build-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CXXModules/examples/public-req-private-build-stdout.txt b/Tests/RunCMake/CXXModules/examples/public-req-private-build-stdout.txt
new file mode 100644
index 000000000..b5f1c5547
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/public-req-private-build-stdout.txt
@@ -0,0 +1 @@
+CMake Error: Public C\+\+ module source `.*/Tests/RunCMake/CXXModules/examples/public-req-private/pub.cxx` requires the `priv` C\+\+ module which is provided by a private source
diff --git a/Tests/RunCMake/CXXModules/examples/public-req-private-stderr.txt b/Tests/RunCMake/CXXModules/examples/public-req-private-stderr.txt
new file mode 100644
index 000000000..5e4392abc
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/public-req-private-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/public-req-private/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/public-req-private/CMakeLists.txt
new file mode 100644
index 000000000..600fec4b5
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/public-req-private/CMakeLists.txt
@@ -0,0 +1,22 @@
+cmake_minimum_required(VERSION 3.24)
+project(cxx_modules_public_req_private CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+add_library(public_req_private)
+target_sources(public_req_private
+ PRIVATE
+ FILE_SET private TYPE CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ priv.cxx
+ PUBLIC
+ FILE_SET public TYPE CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ pub.cxx)
+target_compile_features(public_req_private PUBLIC cxx_std_20)
+
+add_test(NAME cmake-version COMMAND "${CMAKE_COMMAND}" --version)
diff --git a/Tests/RunCMake/CXXModules/examples/public-req-private/priv.cxx b/Tests/RunCMake/CXXModules/examples/public-req-private/priv.cxx
new file mode 100644
index 000000000..7c000b749
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/public-req-private/priv.cxx
@@ -0,0 +1,6 @@
+export module priv;
+
+export int g()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/public-req-private/pub.cxx b/Tests/RunCMake/CXXModules/examples/public-req-private/pub.cxx
new file mode 100644
index 000000000..6ff2d2387
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/public-req-private/pub.cxx
@@ -0,0 +1,8 @@
+export module pub;
+
+import priv;
+
+export int f()
+{
+ return g();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/simple-stderr.txt b/Tests/RunCMake/CXXModules/examples/simple-stderr.txt
new file mode 100644
index 000000000..5e4392abc
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/simple-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\):
+ C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
+ experimental. It is meant only for compiler developers to try.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/simple/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/simple/CMakeLists.txt
new file mode 100644
index 000000000..442e4256b
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/simple/CMakeLists.txt
@@ -0,0 +1,18 @@
+cmake_minimum_required(VERSION 3.24)
+project(cxx_modules_simple CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+add_executable(simple)
+target_sources(simple
+ PRIVATE
+ main.cxx
+ PRIVATE
+ FILE_SET CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ importable.cxx)
+target_compile_features(simple PUBLIC cxx_std_20)
+
+add_test(NAME simple COMMAND simple)
diff --git a/Tests/RunCMake/CXXModules/examples/simple/importable.cxx b/Tests/RunCMake/CXXModules/examples/simple/importable.cxx
new file mode 100644
index 000000000..607680a07
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/simple/importable.cxx
@@ -0,0 +1,6 @@
+export module importable;
+
+export int from_import()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/simple/main.cxx b/Tests/RunCMake/CXXModules/examples/simple/main.cxx
new file mode 100644
index 000000000..feb38d22e
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/simple/main.cxx
@@ -0,0 +1,6 @@
+import importable;
+
+int main(int argc, char* argv[])
+{
+ return from_import();
+}
diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-private.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-private.json
new file mode 100644
index 000000000..65f075977
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-private.json
@@ -0,0 +1,45 @@
+{
+ "bmi-installation": {
+ "destination": "lib/cxx/modules/private/<CONFIG>",
+ "message-level": "MESSAGE_LAZY",
+ "permissions": " OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ",
+ "script-location": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-private.dir/install-cxx-module-bmi-<CONFIG_FORCE>.cmake"
+ },
+ "compiler-id": "<IGNORE>",
+ "config": "<CONFIG>",
+ "cxx-modules": {
+ "CMakeFiles/ninja-bmi-install-private.dir/sources/module-internal-part.cxx.o": {
+ "destination": null,
+ "name": "internal_partitions",
+ "relative-directory": "sources",
+ "source": "<SOURCE_DIR>/sources/module-internal-part.cxx",
+ "type": "CXX_MODULES",
+ "visibility": "PRIVATE"
+ },
+ "CMakeFiles/ninja-bmi-install-private.dir/sources/module-part.cxx.o": {
+ "destination": null,
+ "name": "modules",
+ "relative-directory": "",
+ "source": "<SOURCE_DIR>/sources/module-part.cxx",
+ "type": "CXX_MODULES",
+ "visibility": "PRIVATE"
+ },
+ "CMakeFiles/ninja-bmi-install-private.dir/sources/module.cxx.o": {
+ "destination": null,
+ "name": "modules",
+ "relative-directory": "",
+ "source": "<SOURCE_DIR>/sources/module.cxx",
+ "type": "CXX_MODULES",
+ "visibility": "PRIVATE"
+ }
+ },
+ "dir-cur-bld": "<BINARY_DIR>",
+ "dir-cur-src": "<SOURCE_DIR>",
+ "dir-top-bld": "<BINARY_DIR>",
+ "dir-top-src": "<SOURCE_DIR>",
+ "exports": [],
+ "include-dirs": [],
+ "language": "CXX",
+ "linked-target-dirs": [],
+ "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-private.dir"
+}
diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-public.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-public.json
new file mode 100644
index 000000000..9c8a8953d
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-public.json
@@ -0,0 +1,45 @@
+{
+ "bmi-installation": {
+ "destination": "lib/cxx/modules/<CONFIG>",
+ "message-level": "",
+ "permissions": "",
+ "script-location": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-public.dir/install-cxx-module-bmi-noconfig.cmake"
+ },
+ "compiler-id": "<IGNORE>",
+ "config": "<CONFIG>",
+ "cxx-modules": {
+ "CMakeFiles/ninja-bmi-install-public.dir/sources/module-internal-part.cxx.o": {
+ "destination": "lib/cxx/internals",
+ "name": "internal_partitions",
+ "relative-directory": "sources",
+ "source": "<SOURCE_DIR>/sources/module-internal-part.cxx",
+ "type": "CXX_MODULES",
+ "visibility": "PUBLIC"
+ },
+ "CMakeFiles/ninja-bmi-install-public.dir/sources/module-part.cxx.o": {
+ "destination": "lib/cxx",
+ "name": "modules",
+ "relative-directory": "",
+ "source": "<SOURCE_DIR>/sources/module-part.cxx",
+ "type": "CXX_MODULES",
+ "visibility": "PUBLIC"
+ },
+ "CMakeFiles/ninja-bmi-install-public.dir/sources/module.cxx.o": {
+ "destination": "lib/cxx",
+ "name": "modules",
+ "relative-directory": "",
+ "source": "<SOURCE_DIR>/sources/module.cxx",
+ "type": "CXX_MODULES",
+ "visibility": "PUBLIC"
+ }
+ },
+ "dir-cur-bld": "<BINARY_DIR>",
+ "dir-cur-src": "<SOURCE_DIR>",
+ "dir-top-bld": "<BINARY_DIR>",
+ "dir-top-src": "<SOURCE_DIR>",
+ "exports": [],
+ "include-dirs": [],
+ "language": "CXX",
+ "linked-target-dirs": [],
+ "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-public.dir"
+}
diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-private.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-private.json
new file mode 100644
index 000000000..05459815a
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-private.json
@@ -0,0 +1,73 @@
+{
+ "bmi-installation": null,
+ "compiler-id": "<IGNORE>",
+ "config": "<CONFIG>",
+ "cxx-modules": {
+ "CMakeFiles/ninja-exports-private.dir/sources/module-internal-part.cxx.o": {
+ "destination": null,
+ "name": "internal_partitions",
+ "relative-directory": "sources",
+ "source": "<SOURCE_DIR>/sources/module-internal-part.cxx",
+ "type": "CXX_MODULES",
+ "visibility": "PRIVATE"
+ },
+ "CMakeFiles/ninja-exports-private.dir/sources/module-part.cxx.o": {
+ "destination": null,
+ "name": "modules",
+ "relative-directory": "",
+ "source": "<SOURCE_DIR>/sources/module-part.cxx",
+ "type": "CXX_MODULES",
+ "visibility": "PRIVATE"
+ },
+ "CMakeFiles/ninja-exports-private.dir/sources/module.cxx.o": {
+ "destination": null,
+ "name": "modules",
+ "relative-directory": "",
+ "source": "<SOURCE_DIR>/sources/module.cxx",
+ "type": "CXX_MODULES",
+ "visibility": "PRIVATE"
+ }
+ },
+ "dir-cur-bld": "<BINARY_DIR>",
+ "dir-cur-src": "<SOURCE_DIR>",
+ "dir-top-bld": "<BINARY_DIR>",
+ "dir-top-src": "<SOURCE_DIR>",
+ "exports": [
+ {
+ "cxx-module-info-dir" : "cxx-modules",
+ "destination" : "lib/cmake/export1",
+ "export-name" : "with-private",
+ "export-prefix" : "<BINARY_DIR>/CMakeFiles/Export/d2e2673818fd2bd8c45c0e3ed0e38fcd",
+ "install" : true,
+ "namespace" : "export1::"
+ },
+ {
+ "cxx-module-info-dir" : "cxx-modules",
+ "destination" : "lib/cmake/export2",
+ "export-name" : "with-private",
+ "export-prefix" : "<BINARY_DIR>/CMakeFiles/Export/28cd47cb4c96ad5cadaa3fb1b0201ae8",
+ "install" : true,
+ "namespace" : ""
+ },
+ {
+ "cxx-module-info-dir" : "cxx-modules",
+ "destination" : "<BINARY_DIR>/lib/cmake/export1",
+ "export-name" : "with-private",
+ "export-prefix" : "<BINARY_DIR>/lib/cmake/export1",
+ "install" : false,
+ "namespace" : "export1::"
+ },
+ {
+ "cxx-module-info-dir" : "cxx-modules",
+ "destination" : "<BINARY_DIR>/lib/cmake/export2",
+ "export-name" : "with-private",
+ "export-prefix" : "<BINARY_DIR>/lib/cmake/export2",
+ "install" : false,
+ "namespace" : ""
+ }
+ ],
+ "include-dirs": [],
+ "language": "CXX",
+ "linked-target-dirs": [],
+ "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-exports-private.dir"
+}
diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-public.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-public.json
new file mode 100644
index 000000000..adc3ae391
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-public.json
@@ -0,0 +1,73 @@
+{
+ "bmi-installation": null,
+ "compiler-id": "<IGNORE>",
+ "config": "<CONFIG>",
+ "cxx-modules": {
+ "CMakeFiles/ninja-exports-public.dir/sources/module-internal-part.cxx.o": {
+ "destination": "lib/cxx/internals",
+ "name": "internal_partitions",
+ "relative-directory": "sources",
+ "source": "<SOURCE_DIR>/sources/module-internal-part.cxx",
+ "type": "CXX_MODULES",
+ "visibility": "PUBLIC"
+ },
+ "CMakeFiles/ninja-exports-public.dir/sources/module-part.cxx.o": {
+ "destination": "lib/cxx",
+ "name": "modules",
+ "relative-directory": "",
+ "source": "<SOURCE_DIR>/sources/module-part.cxx",
+ "type": "CXX_MODULES",
+ "visibility": "PUBLIC"
+ },
+ "CMakeFiles/ninja-exports-public.dir/sources/module.cxx.o": {
+ "destination": "lib/cxx",
+ "name": "modules",
+ "relative-directory": "",
+ "source": "<SOURCE_DIR>/sources/module.cxx",
+ "type": "CXX_MODULES",
+ "visibility": "PUBLIC"
+ }
+ },
+ "dir-cur-bld": "<BINARY_DIR>",
+ "dir-cur-src": "<SOURCE_DIR>",
+ "dir-top-bld": "<BINARY_DIR>",
+ "dir-top-src": "<SOURCE_DIR>",
+ "exports": [
+ {
+ "cxx-module-info-dir" : "cxx-modules",
+ "destination" : "lib/cmake/export1",
+ "export-name" : "with-public",
+ "export-prefix" : "<BINARY_DIR>/CMakeFiles/Export/d2e2673818fd2bd8c45c0e3ed0e38fcd",
+ "install" : true,
+ "namespace" : "export1::"
+ },
+ {
+ "cxx-module-info-dir" : "cxx-modules",
+ "destination" : "lib/cmake/export2",
+ "export-name" : "with-public",
+ "export-prefix" : "<BINARY_DIR>/CMakeFiles/Export/28cd47cb4c96ad5cadaa3fb1b0201ae8",
+ "install" : true,
+ "namespace" : ""
+ },
+ {
+ "cxx-module-info-dir" : "cxx-modules",
+ "destination" : "<BINARY_DIR>/lib/cmake/export1",
+ "export-name" : "with-public",
+ "export-prefix" : "<BINARY_DIR>/lib/cmake/export1",
+ "install" : false,
+ "namespace" : "export1::"
+ },
+ {
+ "cxx-module-info-dir" : "cxx-modules",
+ "destination" : "<BINARY_DIR>/lib/cmake/export2",
+ "export-name" : "with-public",
+ "export-prefix" : "<BINARY_DIR>/lib/cmake/export2",
+ "install" : false,
+ "namespace" : ""
+ }
+ ],
+ "include-dirs": [],
+ "language": "CXX",
+ "linked-target-dirs": [],
+ "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-exports-public.dir"
+}
diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-private.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-private.json
new file mode 100644
index 000000000..9ba65688b
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-private.json
@@ -0,0 +1,40 @@
+{
+ "bmi-installation": null,
+ "compiler-id": "<IGNORE>",
+ "config": "<CONFIG>",
+ "cxx-modules": {
+ "CMakeFiles/ninja-file-sets-private.dir/sources/module-internal-part.cxx.o": {
+ "destination": null,
+ "name": "internal_partitions",
+ "relative-directory": "sources",
+ "source": "<SOURCE_DIR>/sources/module-internal-part.cxx",
+ "type": "CXX_MODULES",
+ "visibility": "PRIVATE"
+ },
+ "CMakeFiles/ninja-file-sets-private.dir/sources/module-part.cxx.o": {
+ "destination": null,
+ "name": "modules",
+ "relative-directory": "",
+ "source": "<SOURCE_DIR>/sources/module-part.cxx",
+ "type": "CXX_MODULES",
+ "visibility": "PRIVATE"
+ },
+ "CMakeFiles/ninja-file-sets-private.dir/sources/module.cxx.o": {
+ "destination": null,
+ "name": "modules",
+ "relative-directory": "",
+ "source": "<SOURCE_DIR>/sources/module.cxx",
+ "type": "CXX_MODULES",
+ "visibility": "PRIVATE"
+ }
+ },
+ "dir-cur-bld": "<BINARY_DIR>",
+ "dir-cur-src": "<SOURCE_DIR>",
+ "dir-top-bld": "<BINARY_DIR>",
+ "dir-top-src": "<SOURCE_DIR>",
+ "exports": [],
+ "include-dirs": [],
+ "language": "CXX",
+ "linked-target-dirs": [],
+ "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-file-sets-private.dir"
+}
diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-public.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-public.json
new file mode 100644
index 000000000..46e2cbf98
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-public.json
@@ -0,0 +1,40 @@
+{
+ "bmi-installation": null,
+ "compiler-id": "<IGNORE>",
+ "config": "<CONFIG>",
+ "cxx-modules": {
+ "CMakeFiles/ninja-file-sets-public.dir/<CONFIG_DIR>sources/module-internal-part.cxx.o": {
+ "destination": "lib/cxx/internals",
+ "name": "internal_partitions",
+ "relative-directory": "sources",
+ "source": "<SOURCE_DIR>/sources/module-internal-part.cxx",
+ "type": "CXX_MODULES",
+ "visibility": "PUBLIC"
+ },
+ "CMakeFiles/ninja-file-sets-public.dir/<CONFIG_DIR>sources/module-part.cxx.o": {
+ "destination": "lib/cxx",
+ "name": "modules",
+ "relative-directory": "",
+ "source": "<SOURCE_DIR>/sources/module-part.cxx",
+ "type": "CXX_MODULES",
+ "visibility": "PUBLIC"
+ },
+ "CMakeFiles/ninja-file-sets-public.dir/<CONFIG_DIR>sources/module.cxx.o": {
+ "destination": "lib/cxx",
+ "name": "modules",
+ "relative-directory": "",
+ "source": "<SOURCE_DIR>/sources/module.cxx",
+ "type": "CXX_MODULES",
+ "visibility": "PUBLIC"
+ }
+ },
+ "dir-cur-bld": "<BINARY_DIR>",
+ "dir-cur-src": "<SOURCE_DIR>",
+ "dir-top-bld": "<BINARY_DIR>",
+ "dir-top-src": "<SOURCE_DIR>",
+ "exports": [],
+ "include-dirs": [],
+ "language": "CXX",
+ "linked-target-dirs": [],
+ "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-file-sets-public.dir"
+}
diff --git a/Tests/RunCMake/CXXModules/sources/c-anchor.c b/Tests/RunCMake/CXXModules/sources/c-anchor.c
new file mode 100644
index 000000000..c78218892
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/sources/c-anchor.c
@@ -0,0 +1,4 @@
+int c_anchor()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/sources/cxx-anchor.cxx b/Tests/RunCMake/CXXModules/sources/cxx-anchor.cxx
new file mode 100644
index 000000000..9c94ec12b
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/sources/cxx-anchor.cxx
@@ -0,0 +1,4 @@
+int cxx_anchor()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/sources/module-header.h b/Tests/RunCMake/CXXModules/sources/module-header.h
new file mode 100644
index 000000000..982617e5c
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/sources/module-header.h
@@ -0,0 +1,9 @@
+#ifndef module_header_h
+#define module_header_h
+
+inline int h()
+{
+ return 0;
+}
+
+#endif
diff --git a/Tests/RunCMake/CXXModules/sources/module-impl.cxx b/Tests/RunCMake/CXXModules/sources/module-impl.cxx
new file mode 100644
index 000000000..471899916
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/sources/module-impl.cxx
@@ -0,0 +1,6 @@
+module M;
+
+int f()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/sources/module-internal-part-impl.cxx b/Tests/RunCMake/CXXModules/sources/module-internal-part-impl.cxx
new file mode 100644
index 000000000..be77b0d54
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/sources/module-internal-part-impl.cxx
@@ -0,0 +1,11 @@
+#ifdef _MSC_VER
+// Only MSVC supports this pattern.
+module M : internal_part;
+#else
+module M;
+#endif
+
+int i()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/sources/module-internal-part.cxx b/Tests/RunCMake/CXXModules/sources/module-internal-part.cxx
new file mode 100644
index 000000000..fa82afbdd
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/sources/module-internal-part.cxx
@@ -0,0 +1,3 @@
+module M : internal_part;
+
+int i();
diff --git a/Tests/RunCMake/CXXModules/sources/module-part-impl.cxx b/Tests/RunCMake/CXXModules/sources/module-part-impl.cxx
new file mode 100644
index 000000000..46d5d9f54
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/sources/module-part-impl.cxx
@@ -0,0 +1,13 @@
+#ifdef _MSC_VER
+// Only MSVC supports this pattern.
+module M : part;
+#else
+module M;
+#endif
+
+import M : internal_part;
+
+int p()
+{
+ return i();
+}
diff --git a/Tests/RunCMake/CXXModules/sources/module-part.cxx b/Tests/RunCMake/CXXModules/sources/module-part.cxx
new file mode 100644
index 000000000..137c16f29
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/sources/module-part.cxx
@@ -0,0 +1,3 @@
+export module M : part;
+
+int p();
diff --git a/Tests/RunCMake/CXXModules/sources/module-use.cxx b/Tests/RunCMake/CXXModules/sources/module-use.cxx
new file mode 100644
index 000000000..2d060cdbd
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/sources/module-use.cxx
@@ -0,0 +1,6 @@
+import M;
+
+int main(int argc, char* argv[])
+{
+ return f() + p();
+}
diff --git a/Tests/RunCMake/CXXModules/sources/module.cxx b/Tests/RunCMake/CXXModules/sources/module.cxx
new file mode 100644
index 000000000..a631354cf
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/sources/module.cxx
@@ -0,0 +1,5 @@
+export module M;
+export import M : part;
+import M : internal_part;
+
+int f();
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake
index 276158ce0..bfb6f725e 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake
@@ -1,33 +1,27 @@
enable_language (C)
-include(CheckCompilerFlag)
+include(CheckCCompilerFlag)
set(C 1) # test that this is tolerated
-# test that the check uses an isolated locale
-set(_env_LC_ALL "${LC_ALL}")
-set(ENV{LC_ALL} "BAD")
-
-check_compiler_flag(C "-_this_is_not_a_flag_" SHOULD_FAIL)
-if(SHOULD_FAIL)
- message(SEND_ERROR "invalid C compile flag didn't fail.")
+if(NOT CMAKE_C_COMPILER_ID STREQUAL "PathScale")
+ set(DD --)
endif()
-if(CMAKE_C_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
- check_compiler_flag(C "-x c" SHOULD_WORK)
- if(NOT SHOULD_WORK)
- message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-x c' check failed")
- endif()
+check_c_compiler_flag("${DD}-_this_is_not_a_flag_" C_BOGUS_FLAG)
+if(C_BOGUS_FLAG)
+ message(SEND_ERROR "CHECK_C_COMPILER_FLAG() succeeded, but should have failed")
endif()
-
-if(CMAKE_C_COMPILER_ID STREQUAL "GNU") # LCC C compiler silently ignore -frtti instead of failing, so skip it here.
- check_compiler_flag(C "-frtti" SHOULD_FAIL_RTTI)
- if(SHOULD_FAIL_RTTI)
- message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-frtti' check passed but should have failed")
- endif()
+unset(C_BOGUS_FLAG CACHE)
+if(DEFINED C_BOGUS_FLAG)
+ # Verify that CHECK_C_COMPILER_FLAG didn't construct a normal variable
+ message(SEND_ERROR "CHECK_C_COMPILER_FLAG shouldn't construct C_BOGUS_FLAG as a normal variable")
endif()
-if(NOT "$ENV{LC_ALL}" STREQUAL "BAD")
- message(SEND_ERROR "ENV{LC_ALL} was not preserved by check_compiler_flag")
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "LCC")
+ unset(C_STRICT_PROTOTYPES CACHE)
+ CHECK_C_COMPILER_FLAG("-Werror;-Wstrict-prototypes" C_STRICT_PROTOTYPES)
+ if(NOT C_STRICT_PROTOTYPES)
+ message(SEND_ERROR "CHECK_C_COMPILER_FLAG failed -Werror -Wstrict-prototypes")
+ endif()
endif()
-set(ENV{LC_ALL} ${_env_LC_ALL})
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake
index dec31ec3a..eb20eb4aa 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake
@@ -1,26 +1,19 @@
enable_language (CXX)
-include(CheckCompilerFlag)
+include(CheckCXXCompilerFlag)
set(CXX 1) # test that this is tolerated
-# test that the check uses an isolated locale
-set(_env_LC_ALL "${LC_ALL}")
-set(ENV{LC_ALL} "BAD")
-
-check_compiler_flag(CXX "-_this_is_not_a_flag_" SHOULD_FAIL)
-if(SHOULD_FAIL)
- message(SEND_ERROR "invalid CXX compile flag didn't fail.")
+if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "PathScale")
+ set(DD --)
endif()
-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
- check_compiler_flag(CXX "-x c++" SHOULD_WORK)
- if(NOT SHOULD_WORK)
- message(SEND_ERROR "${CMAKE_CXX_COMPILER_ID} compiler flag '-x c++' check failed")
- endif()
+check_cxx_compiler_flag("${DD}-_this_is_not_a_flag_" CXX_BOGUS_FLAG)
+if(CXX_BOGUS_FLAG)
+ message(SEND_ERROR "CHECK_CXX_COMPILER_FLAG() succeeded, but should have failed")
endif()
-
-if(NOT "$ENV{LC_ALL}" STREQUAL "BAD")
- message(SEND_ERROR "ENV{LC_ALL} was not preserved by check_compiler_flag")
+unset(CXX_BOGUS_FLAG CACHE)
+if(DEFINED CXX_BOGUS_FLAG)
+ # Verify that CHECK_CXX_COMPILER_FLAG didn't construct a normal variable
+ message(SEND_ERROR "CHECK_CXX_COMPILER_FLAG shouldn't construct CXX_BOGUS_FLAG as a normal variable")
endif()
-set(ENV{LC_ALL} ${_env_LC_ALL})
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagC.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagC.cmake
new file mode 100644
index 000000000..276158ce0
--- /dev/null
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagC.cmake
@@ -0,0 +1,33 @@
+
+enable_language (C)
+include(CheckCompilerFlag)
+
+set(C 1) # test that this is tolerated
+
+# test that the check uses an isolated locale
+set(_env_LC_ALL "${LC_ALL}")
+set(ENV{LC_ALL} "BAD")
+
+check_compiler_flag(C "-_this_is_not_a_flag_" SHOULD_FAIL)
+if(SHOULD_FAIL)
+ message(SEND_ERROR "invalid C compile flag didn't fail.")
+endif()
+
+if(CMAKE_C_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
+ check_compiler_flag(C "-x c" SHOULD_WORK)
+ if(NOT SHOULD_WORK)
+ message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-x c' check failed")
+ endif()
+endif()
+
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU") # LCC C compiler silently ignore -frtti instead of failing, so skip it here.
+ check_compiler_flag(C "-frtti" SHOULD_FAIL_RTTI)
+ if(SHOULD_FAIL_RTTI)
+ message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-frtti' check passed but should have failed")
+ endif()
+endif()
+
+if(NOT "$ENV{LC_ALL}" STREQUAL "BAD")
+ message(SEND_ERROR "ENV{LC_ALL} was not preserved by check_compiler_flag")
+endif()
+set(ENV{LC_ALL} ${_env_LC_ALL})
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCUDACompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagCUDA.cmake
index 681a5466c..681a5466c 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckCUDACompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagCUDA.cmake
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagCXX.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagCXX.cmake
new file mode 100644
index 000000000..dec31ec3a
--- /dev/null
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagCXX.cmake
@@ -0,0 +1,26 @@
+
+enable_language (CXX)
+include(CheckCompilerFlag)
+
+set(CXX 1) # test that this is tolerated
+
+# test that the check uses an isolated locale
+set(_env_LC_ALL "${LC_ALL}")
+set(ENV{LC_ALL} "BAD")
+
+check_compiler_flag(CXX "-_this_is_not_a_flag_" SHOULD_FAIL)
+if(SHOULD_FAIL)
+ message(SEND_ERROR "invalid CXX compile flag didn't fail.")
+endif()
+
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+ check_compiler_flag(CXX "-x c++" SHOULD_WORK)
+ if(NOT SHOULD_WORK)
+ message(SEND_ERROR "${CMAKE_CXX_COMPILER_ID} compiler flag '-x c++' check failed")
+ endif()
+endif()
+
+if(NOT "$ENV{LC_ALL}" STREQUAL "BAD")
+ message(SEND_ERROR "ENV{LC_ALL} was not preserved by check_compiler_flag")
+endif()
+set(ENV{LC_ALL} ${_env_LC_ALL})
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagFortran.cmake
index 236f37b54..236f37b54 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagFortran.cmake
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckHIPCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagHIP.cmake
index 339ce1865..339ce1865 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckHIPCompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagHIP.cmake
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckISPCCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagISPC.cmake
index 662319ae6..662319ae6 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckISPCCompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagISPC.cmake
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckOBJCCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagOBJC.cmake
index f250f8d49..f250f8d49 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckOBJCCompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagOBJC.cmake
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckOBJCXXCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagOBJCXX.cmake
index bc940a629..bc940a629 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckOBJCXXCompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagOBJCXX.cmake
diff --git a/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake b/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake
index df2b667cc..b0e025c4f 100644
--- a/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake
@@ -5,28 +5,30 @@ run_cmake(NonExistentLanguage)
run_cmake(CheckCCompilerFlag)
run_cmake(CheckCXXCompilerFlag)
+run_cmake(CheckCompilerFlagC)
+run_cmake(CheckCompilerFlagCXX)
if (APPLE)
- run_cmake(CheckOBJCCompilerFlag)
- run_cmake(CheckOBJCXXCompilerFlag)
+ run_cmake(CheckCompilerFlagOBJC)
+ run_cmake(CheckCompilerFlagOBJCXX)
endif()
if (CMAKE_Fortran_COMPILER_ID)
- run_cmake(CheckFortranCompilerFlag)
+ run_cmake(CheckCompilerFlagFortran)
endif()
if (CMake_TEST_CUDA)
- run_cmake(CheckCUDACompilerFlag)
+ run_cmake(CheckCompilerFlagCUDA)
endif()
if(CMake_TEST_ISPC)
- run_cmake(CheckISPCCompilerFlag)
+ run_cmake(CheckCompilerFlagISPC)
endif()
if(CMake_TEST_HIP)
- run_cmake(CheckHIPCompilerFlag)
+ run_cmake(CheckCompilerFlagHIP)
endif()
if(APPLE)
- run_cmake_with_options(HeaderpadWorkaround --debug-trycompile)
+ run_cmake(HeaderpadWorkaround)
endif()
diff --git a/Tests/RunCMake/CheckIPOSupported/default-lang-none-stderr.txt b/Tests/RunCMake/CheckIPOSupported/default-lang-none-stderr.txt
index dc2c3ada9..9a1ba04ad 100644
--- a/Tests/RunCMake/CheckIPOSupported/default-lang-none-stderr.txt
+++ b/Tests/RunCMake/CheckIPOSupported/default-lang-none-stderr.txt
@@ -1,6 +1,6 @@
^CMake Error at .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(message\):
- IPO is not supported \(no C/CXX/Fortran languages found in ENABLED_LANGUAGES
- global property\)\.
+ IPO is not supported \(no C/CXX/CUDA/Fortran languages found in
+ ENABLED_LANGUAGES global property\)\.
Call Stack \(most recent call first\):
.*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(_ipo_not_supported\)
default-lang-none\.cmake:[0-9]+ \(check_ipo_supported\)
diff --git a/Tests/RunCMake/CheckLinkerFlag/CheckCLinkerFlag.cmake b/Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagC.cmake
index c8e87a474..c8e87a474 100644
--- a/Tests/RunCMake/CheckLinkerFlag/CheckCLinkerFlag.cmake
+++ b/Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagC.cmake
diff --git a/Tests/RunCMake/CheckLinkerFlag/CheckCUDALinkerFlag.cmake b/Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagCUDA.cmake
index 84d6dd92b..84d6dd92b 100644
--- a/Tests/RunCMake/CheckLinkerFlag/CheckCUDALinkerFlag.cmake
+++ b/Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagCUDA.cmake
diff --git a/Tests/RunCMake/CheckLinkerFlag/CheckCXXLinkerFlag.cmake b/Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagCXX.cmake
index 4e299b989..4e299b989 100644
--- a/Tests/RunCMake/CheckLinkerFlag/CheckCXXLinkerFlag.cmake
+++ b/Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagCXX.cmake
diff --git a/Tests/RunCMake/CheckLinkerFlag/CheckFortranLinkerFlag.cmake b/Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagFortran.cmake
index bca288ea0..bca288ea0 100644
--- a/Tests/RunCMake/CheckLinkerFlag/CheckFortranLinkerFlag.cmake
+++ b/Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagFortran.cmake
diff --git a/Tests/RunCMake/CheckLinkerFlag/CheckHIPLinkerFlag.cmake b/Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagHIP.cmake
index 3bf3b3051..3bf3b3051 100644
--- a/Tests/RunCMake/CheckLinkerFlag/CheckHIPLinkerFlag.cmake
+++ b/Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagHIP.cmake
diff --git a/Tests/RunCMake/CheckLinkerFlag/CheckOBJCLinkerFlag.cmake b/Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagOBJC.cmake
index fa1d18e38..fa1d18e38 100644
--- a/Tests/RunCMake/CheckLinkerFlag/CheckOBJCLinkerFlag.cmake
+++ b/Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagOBJC.cmake
diff --git a/Tests/RunCMake/CheckLinkerFlag/CheckOBJCXXLinkerFlag.cmake b/Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagOBJCXX.cmake
index 414efb8cc..414efb8cc 100644
--- a/Tests/RunCMake/CheckLinkerFlag/CheckOBJCXXLinkerFlag.cmake
+++ b/Tests/RunCMake/CheckLinkerFlag/CheckLinkerFlagOBJCXX.cmake
diff --git a/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake b/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake
index 39fc43097..5915ba1ac 100644
--- a/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake
@@ -1,22 +1,22 @@
include(RunCMake)
if (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU|LCC")
- run_cmake(CheckCLinkerFlag)
- run_cmake(CheckCXXLinkerFlag)
+ run_cmake(CheckLinkerFlagC)
+ run_cmake(CheckLinkerFlagCXX)
if (APPLE)
- run_cmake(CheckOBJCLinkerFlag)
- run_cmake(CheckOBJCXXLinkerFlag)
+ run_cmake(CheckLinkerFlagOBJC)
+ run_cmake(CheckLinkerFlagOBJCXX)
endif()
endif()
if (CMAKE_Fortran_COMPILER_ID MATCHES "GNU|LCC")
- run_cmake(CheckFortranLinkerFlag)
+ run_cmake(CheckLinkerFlagFortran)
endif()
if (CMake_TEST_CUDA)
- run_cmake(CheckCUDALinkerFlag)
+ run_cmake(CheckLinkerFlagCUDA)
endif()
if (CMake_TEST_HIP)
- run_cmake(CheckHIPLinkerFlag)
+ run_cmake(CheckLinkerFlagHIP)
endif()
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckCSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckCSourceCompiles.cmake
index 4f7362254..7104650cc 100644
--- a/Tests/RunCMake/CheckSourceCompiles/CheckCSourceCompiles.cmake
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckCSourceCompiles.cmake
@@ -1,15 +1,15 @@
enable_language (C)
-include(CheckSourceCompiles)
+include(CheckCSourceCompiles)
set(C 1) # test that this is tolerated
-check_source_compiles(C "I don't build" SHOULD_FAIL)
+check_c_source_compiles("I don't build" SHOULD_FAIL)
if(SHOULD_FAIL)
message(SEND_ERROR "invalid C source didn't fail.")
endif()
-check_source_compiles(C "int main() {return 0;}" SHOULD_BUILD)
+check_c_source_compiles("int main() {return 0;}" SHOULD_BUILD)
if(NOT SHOULD_BUILD)
message(SEND_ERROR "Test fail for valid C source.")
endif()
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckCXXSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckCXXSourceCompiles.cmake
index 97c9c30f5..7c9830abc 100644
--- a/Tests/RunCMake/CheckSourceCompiles/CheckCXXSourceCompiles.cmake
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckCXXSourceCompiles.cmake
@@ -1,15 +1,15 @@
enable_language (CXX)
-include(CheckSourceCompiles)
+include(CheckCXXSourceCompiles)
set(CXX 1) # test that this is tolerated
-check_source_compiles(CXX "I don't build" SHOULD_FAIL)
+check_cxx_source_compiles("I don't build" SHOULD_FAIL)
if(SHOULD_FAIL)
message(SEND_ERROR "invalid CXX source didn't fail.")
endif()
-check_source_compiles(CXX [=[
+check_cxx_source_compiles([=[
#include <vector>
int main() {
return 0;
@@ -20,8 +20,8 @@ if(NOT SHOULD_BUILD)
message(SEND_ERROR "Test fail for valid CXX source.")
endif()
-check_source_compiles(CXX "void l(char const (&x)[2]){}; int main() { l(\"\\n\"); return 0;}"
- SHOULD_BUILD_COMPLEX)
+CHECK_CXX_SOURCE_COMPILES("void l(char const (&x)[2]){}; int main() { l(\"\\\\n\"); return 0;}"
+ SHOULD_BUILD_COMPLEX)
if(NOT SHOULD_BUILD_COMPLEX)
message(SEND_ERROR "Test fail for valid CXX complex source.")
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckOBJCSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckOBJCSourceCompiles.cmake
index 76a500956..ac43a1ee5 100644
--- a/Tests/RunCMake/CheckSourceCompiles/CheckOBJCSourceCompiles.cmake
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckOBJCSourceCompiles.cmake
@@ -1,9 +1,14 @@
enable_language (OBJC)
-include(CheckSourceCompiles)
+include(CheckOBJCSourceCompiles)
set(OBJC 1) # test that this is tolerated
-check_source_compiles(OBJC [[
+check_objc_source_compiles("I don't build in Objective-C" SHOULD_FAIL)
+if(SHOULD_FAIL)
+ message(SEND_ERROR "invalid OBJC source didn't fail.")
+endif()
+
+check_objc_source_compiles([[
#import <Foundation/Foundation.h>
int main() {
NSObject *foo;
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckOBJCXXSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckOBJCXXSourceCompiles.cmake
index 814237ecc..008895605 100644
--- a/Tests/RunCMake/CheckSourceCompiles/CheckOBJCXXSourceCompiles.cmake
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckOBJCXXSourceCompiles.cmake
@@ -1,9 +1,14 @@
enable_language (OBJCXX)
-include(CheckSourceCompiles)
+include(CheckOBJCXXSourceCompiles)
set(OBJCXX 1) # test that this is tolerated
-check_source_compiles(OBJCXX [[
+check_objcxx_source_compiles("I don't build in Objective-C++" SHOULD_FAIL)
+if(SHOULD_FAIL)
+ message(SEND_ERROR "invalid OBJCXX source didn't fail.")
+endif()
+
+check_objcxx_source_compiles([[
#include <vector>
#import <Foundation/Foundation.h>
int main() {
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesC.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesC.cmake
new file mode 100644
index 000000000..4f7362254
--- /dev/null
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesC.cmake
@@ -0,0 +1,15 @@
+
+enable_language (C)
+include(CheckSourceCompiles)
+
+set(C 1) # test that this is tolerated
+
+check_source_compiles(C "I don't build" SHOULD_FAIL)
+if(SHOULD_FAIL)
+ message(SEND_ERROR "invalid C source didn't fail.")
+endif()
+
+check_source_compiles(C "int main() {return 0;}" SHOULD_BUILD)
+if(NOT SHOULD_BUILD)
+ message(SEND_ERROR "Test fail for valid C source.")
+endif()
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckCUDASourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesCUDA.cmake
index 21906499e..21906499e 100644
--- a/Tests/RunCMake/CheckSourceCompiles/CheckCUDASourceCompiles.cmake
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesCUDA.cmake
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesCXX.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesCXX.cmake
new file mode 100644
index 000000000..97c9c30f5
--- /dev/null
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesCXX.cmake
@@ -0,0 +1,28 @@
+
+enable_language (CXX)
+include(CheckSourceCompiles)
+
+set(CXX 1) # test that this is tolerated
+
+check_source_compiles(CXX "I don't build" SHOULD_FAIL)
+if(SHOULD_FAIL)
+ message(SEND_ERROR "invalid CXX source didn't fail.")
+endif()
+
+check_source_compiles(CXX [=[
+ #include <vector>
+ int main() {
+ return 0;
+ }
+]=]
+ SHOULD_BUILD)
+if(NOT SHOULD_BUILD)
+ message(SEND_ERROR "Test fail for valid CXX source.")
+endif()
+
+check_source_compiles(CXX "void l(char const (&x)[2]){}; int main() { l(\"\\n\"); return 0;}"
+ SHOULD_BUILD_COMPLEX)
+
+if(NOT SHOULD_BUILD_COMPLEX)
+ message(SEND_ERROR "Test fail for valid CXX complex source.")
+endif()
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckFortranSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesFortran.cmake
index 48dc5255d..48dc5255d 100644
--- a/Tests/RunCMake/CheckSourceCompiles/CheckFortranSourceCompiles.cmake
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesFortran.cmake
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckHIPSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesHIP.cmake
index 911a0d7b9..911a0d7b9 100644
--- a/Tests/RunCMake/CheckSourceCompiles/CheckHIPSourceCompiles.cmake
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesHIP.cmake
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckISPCSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesISPC.cmake
index 74b83c083..74b83c083 100644
--- a/Tests/RunCMake/CheckSourceCompiles/CheckISPCSourceCompiles.cmake
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesISPC.cmake
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesOBJC.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesOBJC.cmake
new file mode 100644
index 000000000..76a500956
--- /dev/null
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesOBJC.cmake
@@ -0,0 +1,16 @@
+enable_language (OBJC)
+include(CheckSourceCompiles)
+
+set(OBJC 1) # test that this is tolerated
+
+check_source_compiles(OBJC [[
+ #import <Foundation/Foundation.h>
+ int main() {
+ NSObject *foo;
+ return 0;
+ }
+]] SHOULD_BUILD)
+
+if(NOT SHOULD_BUILD)
+ message(SEND_ERROR "Test fail for valid OBJC source.")
+endif()
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesOBJCXX.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesOBJCXX.cmake
new file mode 100644
index 000000000..814237ecc
--- /dev/null
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesOBJCXX.cmake
@@ -0,0 +1,19 @@
+enable_language (OBJCXX)
+include(CheckSourceCompiles)
+
+set(OBJCXX 1) # test that this is tolerated
+
+check_source_compiles(OBJCXX [[
+ #include <vector>
+ #import <Foundation/Foundation.h>
+ int main() {
+ std::vector<int> v;
+ NSObject *foo;
+ return 0;
+ }
+]] SHOULD_BUILD)
+
+
+if(NOT SHOULD_BUILD)
+ message(SEND_ERROR "Test fail for OBJCXX source.")
+endif()
diff --git a/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake b/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake
index 530f133da..df77d3d09 100644
--- a/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake
@@ -6,24 +6,28 @@ run_cmake(UnknownArgument)
run_cmake(CheckCSourceCompiles)
run_cmake(CheckCXXSourceCompiles)
+run_cmake(CheckSourceCompilesC)
+run_cmake(CheckSourceCompilesCXX)
if (APPLE)
run_cmake(CheckOBJCSourceCompiles)
run_cmake(CheckOBJCXXSourceCompiles)
+ run_cmake(CheckSourceCompilesOBJC)
+ run_cmake(CheckSourceCompilesOBJCXX)
endif()
if (CMAKE_Fortran_COMPILER_ID)
- run_cmake(CheckFortranSourceCompiles)
+ run_cmake(CheckSourceCompilesFortran)
endif()
if (CMake_TEST_CUDA)
- run_cmake(CheckCUDASourceCompiles)
+ run_cmake(CheckSourceCompilesCUDA)
endif()
if(CMake_TEST_ISPC)
- run_cmake(CheckISPCSourceCompiles)
+ run_cmake(CheckSourceCompilesISPC)
endif()
if(CMake_TEST_HIP)
- run_cmake(CheckHIPSourceCompiles)
+ run_cmake(CheckSourceCompilesHIP)
endif()
diff --git a/Tests/RunCMake/CheckSourceRuns/CheckCSourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckCSourceRuns.cmake
index 96a10274c..c0f946336 100644
--- a/Tests/RunCMake/CheckSourceRuns/CheckCSourceRuns.cmake
+++ b/Tests/RunCMake/CheckSourceRuns/CheckCSourceRuns.cmake
@@ -1,15 +1,15 @@
enable_language (C)
-include(CheckSourceRuns)
+include(CheckCSourceRuns)
set(C 1) # test that this is tolerated
-check_source_runs(C "int main() {return 2;}" SHOULD_FAIL)
+check_c_source_runs("int main() {return 2;}" SHOULD_FAIL)
if(SHOULD_FAIL)
- message(SEND_ERROR "C check_source_runs succeeded, but should have failed.")
+ message(SEND_ERROR "check_c_source_runs succeeded, but should have failed.")
endif()
-check_source_runs(C "int main() {return 0;}" SHOULD_RUN)
+check_c_source_runs("int main() {return 0;}" SHOULD_RUN)
if(NOT SHOULD_RUN)
- message(SEND_ERROR "C check_source_runs failed for valid C executable.")
+ message(SEND_ERROR "check_c_source_runs failed for valid C executable.")
endif()
diff --git a/Tests/RunCMake/CheckSourceRuns/CheckCXXSourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckCXXSourceRuns.cmake
index c4bef6e94..c4c9026c0 100644
--- a/Tests/RunCMake/CheckSourceRuns/CheckCXXSourceRuns.cmake
+++ b/Tests/RunCMake/CheckSourceRuns/CheckCXXSourceRuns.cmake
@@ -1,15 +1,15 @@
enable_language (CXX)
-include(CheckSourceRuns)
+include(CheckCXXSourceRuns)
set(CXX 1) # test that this is tolerated
-check_source_runs(CXX "int main() {return 2;}" SHOULD_FAIL)
+check_cxx_source_runs("int main() {return 2;}" SHOULD_FAIL)
if(SHOULD_FAIL)
- message(SEND_ERROR "CXX check_source_runs succeeded, but should have failed.")
+ message(SEND_ERROR "check_cxx_source_runs succeeded, but should have failed.")
endif()
-check_source_runs(CXX
+check_cxx_source_runs(
[=[
#include <vector>
int main() {
@@ -18,5 +18,5 @@ check_source_runs(CXX
]=]
SHOULD_RUN)
if(NOT SHOULD_RUN)
- message(SEND_ERROR "CXX check_source_runs failed for valid C executable.")
+ message(SEND_ERROR "check_cxx_source_runs failed for valid C executable.")
endif()
diff --git a/Tests/RunCMake/CheckSourceRuns/CheckOBJCSourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckOBJCSourceRuns.cmake
index b8283523d..604b2a1e4 100644
--- a/Tests/RunCMake/CheckSourceRuns/CheckOBJCSourceRuns.cmake
+++ b/Tests/RunCMake/CheckSourceRuns/CheckOBJCSourceRuns.cmake
@@ -1,9 +1,14 @@
enable_language (OBJC)
-include(CheckSourceRuns)
+include(CheckOBJCSourceRuns)
set(OBJC 1) # test that this is tolerated
-check_source_runs(OBJC [[
+check_objc_source_runs("int main() {return 2;}" SHOULD_FAIL)
+if(SHOULD_FAIL)
+ message(SEND_ERROR "check_objc_source_runs succeeded, but should have failed.")
+endif()
+
+check_objc_source_runs([[
#import <Foundation/Foundation.h>
int main() {
NSObject *foo;
diff --git a/Tests/RunCMake/CheckSourceRuns/CheckOBJCXXSourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckOBJCXXSourceRuns.cmake
index 8a56f139b..b22016666 100644
--- a/Tests/RunCMake/CheckSourceRuns/CheckOBJCXXSourceRuns.cmake
+++ b/Tests/RunCMake/CheckSourceRuns/CheckOBJCXXSourceRuns.cmake
@@ -1,9 +1,14 @@
enable_language (OBJCXX)
-include(CheckSourceRuns)
+include(CheckOBJCXXSourceRuns)
set(OBJCXX 1) # test that this is tolerated
-check_source_runs(OBJCXX [[
+check_objcxx_source_runs("int main() {return 2;}" SHOULD_FAIL)
+if(SHOULD_FAIL)
+ message(SEND_ERROR "check_objcxx_source_runs succeeded, but should have failed.")
+endif()
+
+check_objcxx_source_runs([[
#include <vector>
#import <Foundation/Foundation.h>
int main() {
diff --git a/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsC.cmake b/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsC.cmake
new file mode 100644
index 000000000..96a10274c
--- /dev/null
+++ b/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsC.cmake
@@ -0,0 +1,15 @@
+
+enable_language (C)
+include(CheckSourceRuns)
+
+set(C 1) # test that this is tolerated
+
+check_source_runs(C "int main() {return 2;}" SHOULD_FAIL)
+if(SHOULD_FAIL)
+ message(SEND_ERROR "C check_source_runs succeeded, but should have failed.")
+endif()
+
+check_source_runs(C "int main() {return 0;}" SHOULD_RUN)
+if(NOT SHOULD_RUN)
+ message(SEND_ERROR "C check_source_runs failed for valid C executable.")
+endif()
diff --git a/Tests/RunCMake/CheckSourceRuns/CheckCUDASourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsCUDA.cmake
index ea5f4f975..ea5f4f975 100644
--- a/Tests/RunCMake/CheckSourceRuns/CheckCUDASourceRuns.cmake
+++ b/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsCUDA.cmake
diff --git a/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsCXX.cmake b/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsCXX.cmake
new file mode 100644
index 000000000..c4bef6e94
--- /dev/null
+++ b/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsCXX.cmake
@@ -0,0 +1,22 @@
+
+enable_language (CXX)
+include(CheckSourceRuns)
+
+set(CXX 1) # test that this is tolerated
+
+check_source_runs(CXX "int main() {return 2;}" SHOULD_FAIL)
+if(SHOULD_FAIL)
+ message(SEND_ERROR "CXX check_source_runs succeeded, but should have failed.")
+endif()
+
+check_source_runs(CXX
+[=[
+ #include <vector>
+ int main() {
+ return 0;
+ }
+]=]
+ SHOULD_RUN)
+if(NOT SHOULD_RUN)
+ message(SEND_ERROR "CXX check_source_runs failed for valid C executable.")
+endif()
diff --git a/Tests/RunCMake/CheckSourceRuns/CheckFortranSourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsFortran.cmake
index 50e8ec85f..50e8ec85f 100644
--- a/Tests/RunCMake/CheckSourceRuns/CheckFortranSourceRuns.cmake
+++ b/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsFortran.cmake
diff --git a/Tests/RunCMake/CheckSourceRuns/CheckHIPSourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsHIP.cmake
index d9fb8c22a..d9fb8c22a 100644
--- a/Tests/RunCMake/CheckSourceRuns/CheckHIPSourceRuns.cmake
+++ b/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsHIP.cmake
diff --git a/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsOBJC.cmake b/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsOBJC.cmake
new file mode 100644
index 000000000..b8283523d
--- /dev/null
+++ b/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsOBJC.cmake
@@ -0,0 +1,16 @@
+enable_language (OBJC)
+include(CheckSourceRuns)
+
+set(OBJC 1) # test that this is tolerated
+
+check_source_runs(OBJC [[
+ #import <Foundation/Foundation.h>
+ int main() {
+ NSObject *foo;
+ return 0;
+ }
+]] SHOULD_BUILD)
+
+if(NOT SHOULD_BUILD)
+ message(SEND_ERROR "Test fail for valid OBJC source.")
+endif()
diff --git a/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsOBJCXX.cmake b/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsOBJCXX.cmake
new file mode 100644
index 000000000..8a56f139b
--- /dev/null
+++ b/Tests/RunCMake/CheckSourceRuns/CheckSourceRunsOBJCXX.cmake
@@ -0,0 +1,19 @@
+enable_language (OBJCXX)
+include(CheckSourceRuns)
+
+set(OBJCXX 1) # test that this is tolerated
+
+check_source_runs(OBJCXX [[
+ #include <vector>
+ #import <Foundation/Foundation.h>
+ int main() {
+ std::vector<int> v;
+ NSObject *foo;
+ return 0;
+ }
+]] SHOULD_BUILD)
+
+
+if(NOT SHOULD_BUILD)
+ message(SEND_ERROR "Test fail for OBJCXX source.")
+endif()
diff --git a/Tests/RunCMake/CheckSourceRuns/RunCMakeTest.cmake b/Tests/RunCMake/CheckSourceRuns/RunCMakeTest.cmake
index 478410337..64cecfc0e 100644
--- a/Tests/RunCMake/CheckSourceRuns/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CheckSourceRuns/RunCMakeTest.cmake
@@ -6,20 +6,24 @@ run_cmake(UnknownArgument)
run_cmake(CheckCSourceRuns)
run_cmake(CheckCXXSourceRuns)
+run_cmake(CheckSourceRunsC)
+run_cmake(CheckSourceRunsCXX)
if (APPLE)
run_cmake(CheckOBJCSourceRuns)
run_cmake(CheckOBJCXXSourceRuns)
+ run_cmake(CheckSourceRunsOBJC)
+ run_cmake(CheckSourceRunsOBJCXX)
endif()
if (CMAKE_Fortran_COMPILER_ID)
- run_cmake(CheckFortranSourceRuns)
+ run_cmake(CheckSourceRunsFortran)
endif()
if (CMake_TEST_CUDA)
- run_cmake(CheckCUDASourceRuns)
+ run_cmake(CheckSourceRunsCUDA)
endif()
if (CMake_TEST_HIP)
- run_cmake(CheckHIPSourceRuns)
+ run_cmake(CheckSourceRunsHIP)
endif()
diff --git a/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake b/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake
index ee41d9475..5e3fbc478 100644
--- a/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake
@@ -29,3 +29,4 @@ if (NOT RunCMake_GENERATOR STREQUAL "Watcom WMake")
endif()
endif()
run_tidy(C-bad)
+run_tidy(compdb)
diff --git a/Tests/RunCMake/ClangTidy/compdb.cmake b/Tests/RunCMake/ClangTidy/compdb.cmake
new file mode 100644
index 000000000..f83e0aee9
--- /dev/null
+++ b/Tests/RunCMake/ClangTidy/compdb.cmake
@@ -0,0 +1,7 @@
+enable_language(C)
+
+# Include a --checks option to confirm that we don't match options that start
+# with --, only a standalone --
+set(CMAKE_C_CLANG_TIDY "${PSEUDO_TIDY}" -p ${CMAKE_BINARY_DIR} --checks=*)
+
+add_executable(main main.c)
diff --git a/Tests/RunCMake/CommandLine/DeprecateVS10-WARN-ON-stderr.txt b/Tests/RunCMake/CommandLine/DeprecateVS10-WARN-ON-stderr.txt
deleted file mode 100644
index 202ef80b6..000000000
--- a/Tests/RunCMake/CommandLine/DeprecateVS10-WARN-ON-stderr.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-^CMake Warning:
- The "Visual Studio 10 2010" generator is deprecated and will be removed in
- a future version of CMake.
-
- Add CMAKE_WARN_VS10=OFF to the cache to disable this warning.$
diff --git a/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-OFF.cmake b/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-OFF.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-OFF.cmake
diff --git a/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON-stderr.txt b/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON-stderr.txt
new file mode 100644
index 000000000..90809420e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Warning:
+ The "Visual Studio 11 2012" generator is deprecated and will be removed in
+ a future version of CMake.
+
+ Add CMAKE_WARN_VS11=OFF to the cache to disable this warning.$
diff --git a/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON.cmake b/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON.cmake
diff --git a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt
index 6a932f1e9..1452c9b62 100644
--- a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt
+++ b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt
@@ -1 +1 @@
-^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":4}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]},{"kind":"toolchains","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":false,"version":{.*}}$
+^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":4}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]},{"kind":"toolchains","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":false,"tls":(true|false),"version":{.*}}$
diff --git a/Tests/RunCMake/CommandLine/E_env-equal.cmake b/Tests/RunCMake/CommandLine/E_env-equal.cmake
new file mode 100644
index 000000000..3f18bb65f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_env-equal.cmake
@@ -0,0 +1,15 @@
+if (NOT DEFINED ENV{TEST_ENV_EXPECTED})
+ if (NOT DEFINED ENV{TEST_ENV})
+ message(STATUS "TEST_ENV is correctly not set in environment")
+ else ()
+ message(FATAL_ERROR "TEST_ENV is incorrectly set in environment")
+ endif ()
+else ()
+ if (NOT DEFINED ENV{TEST_ENV})
+ message(FATAL_ERROR "TEST_ENV is incorrectly not set in environment")
+ elseif ("$ENV{TEST_ENV}" STREQUAL "$ENV{TEST_ENV_EXPECTED}")
+ message(STATUS "TEST_ENV is correctly set in environment: $ENV{TEST_ENV}")
+ else ()
+ message(FATAL_ERROR "TEST_ENV is incorrectly set in environment!\n\tactual: $ENV{TEST_ENV}\n\texpected: $ENV{TEST_ENV_EXPECTED}")
+ endif ()
+endif ()
diff --git a/Tests/RunCMake/CommandLine/E_env_modify-bad-operation-result.txt b/Tests/RunCMake/CommandLine/E_env_modify-bad-operation-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_env_modify-bad-operation-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/E_env_modify-bad-operation-stderr.txt b/Tests/RunCMake/CommandLine/E_env_modify-bad-operation-stderr.txt
new file mode 100644
index 000000000..ccfdeab3d
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_env_modify-bad-operation-stderr.txt
@@ -0,0 +1,3 @@
+^CMake Error: Error: Unrecognized environment manipulation argument: unknown
+
+cmake -E env: invalid parameter to --modify: TEST_ENV=unknown:$
diff --git a/Tests/RunCMake/CommandLine/E_env_modify-cmake_list-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-cmake_list-stdout.txt
new file mode 100644
index 000000000..ad42f5693
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_env_modify-cmake_list-stdout.txt
@@ -0,0 +1 @@
+^-- TEST_ENV is correctly set in environment: exp;ect;ed$
diff --git a/Tests/RunCMake/CommandLine/E_env_modify-path_list-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-path_list-stdout.txt
new file mode 100644
index 000000000..49572a3d3
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_env_modify-path_list-stdout.txt
@@ -0,0 +1 @@
+^-- TEST_ENV is correctly set in environment: exp[;:]ect[;:]ed$
diff --git a/Tests/RunCMake/CommandLine/E_env_modify-reset-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-reset-stdout.txt
new file mode 100644
index 000000000..a60f1bf30
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_env_modify-reset-stdout.txt
@@ -0,0 +1 @@
+^-- TEST_ENV is correctly set in environment: expected$
diff --git a/Tests/RunCMake/CommandLine/E_env_modify-reset-to-unset-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-reset-to-unset-stdout.txt
new file mode 100644
index 000000000..a1d5c0108
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_env_modify-reset-to-unset-stdout.txt
@@ -0,0 +1 @@
+^-- TEST_ENV is correctly not set in environment$
diff --git a/Tests/RunCMake/CommandLine/E_env_modify-set-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-set-stdout.txt
new file mode 100644
index 000000000..feff1176e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_env_modify-set-stdout.txt
@@ -0,0 +1 @@
+^-- TEST_ENV is correctly set in environment: 1$
diff --git a/Tests/RunCMake/CommandLine/E_env_modify-string-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-string-stdout.txt
new file mode 100644
index 000000000..a60f1bf30
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_env_modify-string-stdout.txt
@@ -0,0 +1 @@
+^-- TEST_ENV is correctly set in environment: expected$
diff --git a/Tests/RunCMake/CommandLine/E_env_modify-unset-stdout.txt b/Tests/RunCMake/CommandLine/E_env_modify-unset-stdout.txt
new file mode 100644
index 000000000..a1d5c0108
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_env_modify-unset-stdout.txt
@@ -0,0 +1 @@
+^-- TEST_ENV is correctly not set in environment$
diff --git a/Tests/RunCMake/CommandLine/E_env_modify-with-double-dash-result.txt b/Tests/RunCMake/CommandLine/E_env_modify-with-double-dash-result.txt
new file mode 100644
index 000000000..573541ac9
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_env_modify-with-double-dash-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CommandLine/E_env_modify-without-double-dash-result.txt b/Tests/RunCMake/CommandLine/E_env_modify-without-double-dash-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_env_modify-without-double-dash-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/E_env_modify-without-double-dash-stderr.txt b/Tests/RunCMake/CommandLine/E_env_modify-without-double-dash-stderr.txt
new file mode 100644
index 000000000..8d98f9deb
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_env_modify-without-double-dash-stderr.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/CommandLine/P_working-dir.cmake b/Tests/RunCMake/CommandLine/P_working-dir.cmake
index 4ea029382..e2c0378eb 100644
--- a/Tests/RunCMake/CommandLine/P_working-dir.cmake
+++ b/Tests/RunCMake/CommandLine/P_working-dir.cmake
@@ -9,6 +9,11 @@ foreach(d CMAKE_BINARY_DIR CMAKE_CURRENT_BINARY_DIR CMAKE_SOURCE_DIR CMAKE_CURRE
if(EXPECTED_WORKING_DIR STREQUAL "${${d}}")
message(STATUS "${d} is the expected working directory (${EXPECTED_WORKING_DIR})")
else()
- message(FATAL_ERROR "${d} = \"${${d}}\" is not the expected working directory (${EXPECTED_WORKING_DIR})")
+ get_filename_component(resolved "${EXPECTED_WORKING_DIR}" REALPATH)
+ if(resolved STREQUAL "${${d}}")
+ message(STATUS "${d} is the expected working directory (${resolved}) after symlink resolution")
+ else()
+ message(FATAL_ERROR "${d} = \"${${d}}\" is not the expected working directory (${EXPECTED_WORKING_DIR})")
+ endif()
endif()
endforeach()
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index fc05b2d9d..a2eeddf4a 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -744,6 +744,10 @@ run_cmake_command(E_cat-without-double-dash ${CMAKE_COMMAND} -E cat "-file-start
unset(RunCMake_TEST_COMMAND_WORKING_DIRECTORY)
unset(out)
+# Unset environment variables that are used for testing cmake -E
+unset(ENV{TEST_ENV})
+unset(ENV{TEST_ENV_EXPECTED})
+
run_cmake_command(E_env-no-command0 ${CMAKE_COMMAND} -E env)
run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1)
run_cmake_command(E_env-bad-arg1 ${CMAKE_COMMAND} -E env -bad-arg1)
@@ -758,6 +762,56 @@ file(COPY_FILE "${EXIT_CODE_EXE}" "${RunCMake_BINARY_DIR}/env=${exit_code}")
run_cmake_command(E_env-with-double-dash ${CMAKE_COMMAND} -E env TEST_ENV=1 -- "${RunCMake_BINARY_DIR}/env=${exit_code}" zero_exit)
run_cmake_command(E_env-without-double-dash ${CMAKE_COMMAND} -E env TEST_ENV=1 "${RunCMake_BINARY_DIR}/env=${exit_code}" zero_exit)
+## Tests of env --modify
+# Repeat the same tests as above
+run_cmake_command(E_env_modify-set ${CMAKE_COMMAND} -E env --modify TEST_ENV=set:1 ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-set.cmake)
+run_cmake_command(E_env_modify-unset ${CMAKE_COMMAND} -E env --modify TEST_ENV=set:1 ${CMAKE_COMMAND} -E env --modify TEST_ENV=unset: ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-unset.cmake)
+run_cmake_command(E_env_modify-with-double-dash ${CMAKE_COMMAND} -E env --modify TEST_ENV=set:1 -- "${RunCMake_BINARY_DIR}/env=${exit_code}" zero_exit)
+run_cmake_command(E_env_modify-without-double-dash ${CMAKE_COMMAND} -E env --modify TEST_ENV=set:1 "${RunCMake_BINARY_DIR}/env=${exit_code}" zero_exit)
+
+# Test environment modification commands
+run_cmake_command(E_env_modify-reset
+ ${CMAKE_COMMAND} -E env TEST_ENV=expected
+ ${CMAKE_COMMAND} -E env TEST_ENV_EXPECTED=expected TEST_ENV=bad_value --modify TEST_ENV=reset:
+ ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-equal.cmake)
+
+run_cmake_command(E_env_modify-reset-to-unset
+ ${CMAKE_COMMAND} -E env --unset=TEST_ENV --unset=TEST_ENV_EXPECTED
+ ${CMAKE_COMMAND} -E env TEST_ENV=bad_value --modify TEST_ENV=reset:
+ ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-equal.cmake)
+
+run_cmake_command(E_env_modify-string
+ ${CMAKE_COMMAND} -E env TEST_ENV_EXPECTED=expected
+ --modify TEST_ENV=unset:
+ --modify TEST_ENV=string_append:ect
+ --modify TEST_ENV=string_prepend:exp
+ --modify TEST_ENV=string_append:ed
+ ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-equal.cmake)
+
+if (WIN32)
+ set(SEP "\\;")
+else ()
+ set(SEP ":")
+endif ()
+
+run_cmake_command(E_env_modify-path_list
+ ${CMAKE_COMMAND} -E env "TEST_ENV_EXPECTED=exp${SEP}ect${SEP}ed"
+ --modify TEST_ENV=unset:
+ --modify TEST_ENV=path_list_append:ect
+ --modify TEST_ENV=path_list_prepend:exp
+ --modify TEST_ENV=path_list_append:ed
+ ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-equal.cmake)
+
+run_cmake_command(E_env_modify-cmake_list
+ ${CMAKE_COMMAND} -E env "TEST_ENV_EXPECTED=exp\\;ect\\;ed"
+ --modify TEST_ENV=unset:
+ --modify TEST_ENV=cmake_list_append:ect
+ --modify TEST_ENV=cmake_list_prepend:exp
+ --modify TEST_ENV=cmake_list_append:ed
+ ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-equal.cmake)
+
+run_cmake_command(E_env_modify-bad-operation ${CMAKE_COMMAND} -E env --modify TEST_ENV=unknown:)
+
run_cmake_command(E_md5sum-dir ${CMAKE_COMMAND} -E md5sum .)
run_cmake_command(E_sha1sum-dir ${CMAKE_COMMAND} -E sha1sum .)
run_cmake_command(E_sha224sum-dir ${CMAKE_COMMAND} -E sha224sum .)
@@ -924,6 +978,8 @@ set(RunCMake_TEST_OPTIONS --debug-trycompile)
run_cmake(debug-trycompile)
unset(RunCMake_TEST_OPTIONS)
+run_cmake(trycompile-clean)
+
function(run_cmake_depends)
set(RunCMake_TEST_SOURCE_DIR "${RunCMake_SOURCE_DIR}/cmake_depends")
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/cmake_depends-build")
@@ -941,8 +997,8 @@ set(CMAKE_DEPENDS_CHECK_C
set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"${RunCMake_TEST_SOURCE_DIR}\")
set(CMAKE_RELATIVE_PATH_TOP_BINARY \"${RunCMake_TEST_BINARY_DIR}\")
")
- run_cmake_command(cmake_depends ${CMAKE_COMMAND} -E cmake_depends
- "Unix Makefiles"
+ run_cmake_command(cmake_depends ${CMAKE_COMMAND} -E env VERBOSE=1
+ ${CMAKE_COMMAND} -E cmake_depends "Unix Makefiles"
${RunCMake_TEST_SOURCE_DIR} ${RunCMake_TEST_SOURCE_DIR}
${RunCMake_TEST_BINARY_DIR} ${RunCMake_TEST_BINARY_DIR}
${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/DependInfo.cmake
@@ -1016,9 +1072,9 @@ set(RunCMake_TEST_OPTIONS --profiling-format=google-trace --profiling-output=${P
run_cmake(ProfilingTest)
unset(RunCMake_TEST_OPTIONS)
-if(RunCMake_GENERATOR MATCHES "^Visual Studio 10 2010")
- run_cmake_with_options(DeprecateVS10-WARN-ON -DCMAKE_WARN_VS10=ON)
- unset(ENV{CMAKE_WARN_VS10})
- run_cmake(DeprecateVS10-WARN-ON)
- run_cmake_with_options(DeprecateVS10-WARN-OFF -DCMAKE_WARN_VS10=OFF)
+if(RunCMake_GENERATOR MATCHES "^Visual Studio 11 2012")
+ run_cmake_with_options(DeprecateVS11-WARN-ON -DCMAKE_WARN_VS11=ON)
+ unset(ENV{CMAKE_WARN_VS11})
+ run_cmake(DeprecateVS11-WARN-ON)
+ run_cmake_with_options(DeprecateVS11-WARN-OFF -DCMAKE_WARN_VS11=OFF)
endif()
diff --git a/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt b/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt
index 8fe092b4a..cf972a805 100644
--- a/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt
+++ b/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt
@@ -1 +1 @@
-^Scanning dependencies of target DepTarget$
+Scanning dependencies of target DepTarget$
diff --git a/Tests/RunCMake/CommandLine/debug-trycompile-stderr.txt b/Tests/RunCMake/CommandLine/debug-trycompile-stderr.txt
new file mode 100644
index 000000000..e98730063
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/debug-trycompile-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Debug Log at [^
+]*/Modules/CMakeDetermineCompilerABI.cmake:[0-9]+ \(try_compile\):
+ Executing try_compile \(CMAKE_C_ABI_COMPILED\) in:
+
+ [^
+]*/Tests/RunCMake/CommandLine/debug-trycompile-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+
+Call Stack \(most recent call first\):
+ [^
+]*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)
+ debug-trycompile.cmake:[0-9]+ \(enable_language\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CommandLine/debug-trycompile.cmake b/Tests/RunCMake/CommandLine/debug-trycompile.cmake
index a3835a700..9619ba8f1 100644
--- a/Tests/RunCMake/CommandLine/debug-trycompile.cmake
+++ b/Tests/RunCMake/CommandLine/debug-trycompile.cmake
@@ -1,5 +1,8 @@
enable_language(C)
+
# Look for a source tree left by enable_language internal checks.
-if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/CMakeLists.txt)
+set(scratch ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeScratch)
+file(GLOB_RECURSE remnants ${scratch}/TryCompile-*/CMakeLists.txt)
+if(NOT remnants)
message(FATAL_ERROR "--debug-trycompile should leave the source behind")
endif()
diff --git a/Tests/RunCMake/CommandLine/trycompile-clean.cmake b/Tests/RunCMake/CommandLine/trycompile-clean.cmake
new file mode 100644
index 000000000..11ec2b9bb
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/trycompile-clean.cmake
@@ -0,0 +1,8 @@
+enable_language(C)
+
+# Look for a source tree left by enable_language internal checks.
+set(scratch ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeScratch)
+file(GLOB_RECURSE remnants ${scratch}/TryCompile-*/*)
+if(remnants)
+ message(FATAL_ERROR "try_compile should not leave artifacts behind")
+endif()
diff --git a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake
index 84d047982..e6a26052c 100644
--- a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake
@@ -17,7 +17,8 @@ endfunction()
function(run_compiler_launcher_env lang)
string(REGEX REPLACE "-.*" "" core_lang "${lang}")
- set(ENV{CMAKE_${core_lang}_COMPILER_LAUNCHER} "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1")
+ # Use the noop genexp $<PATH:...> genexp to validate genexp support.
+ set(ENV{CMAKE_${core_lang}_COMPILER_LAUNCHER} "$<PATH:CMAKE_PATH,${CMAKE_COMMAND}>;-E;env;USED_LAUNCHER=1")
run_compiler_launcher(${lang})
unset(ENV{CMAKE_${core_lang}_COMPILER_LAUNCHER})
endfunction()
diff --git a/Tests/RunCMake/CompilerTest/C-stdout.txt b/Tests/RunCMake/CompilerTest/C-stdout.txt
new file mode 100644
index 000000000..ce5d80eb8
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/C-stdout.txt
@@ -0,0 +1,2 @@
+-- Check for working C compiler: [^
+]* - works
diff --git a/Tests/RunCMake/CompilerTest/C.cmake b/Tests/RunCMake/CompilerTest/C.cmake
new file mode 100644
index 000000000..8e9d70cf4
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/C.cmake
@@ -0,0 +1,3 @@
+# Pretend the ABI check failed in order to force the fall-back test to run.
+set(CMAKE_C_ABI_COMPILED FALSE)
+enable_language(C)
diff --git a/Tests/RunCMake/CompilerTest/CMakeLists.txt b/Tests/RunCMake/CompilerTest/CMakeLists.txt
new file mode 100644
index 000000000..aba10165b
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.24)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CompilerTest/CUDA-stdout.txt b/Tests/RunCMake/CompilerTest/CUDA-stdout.txt
new file mode 100644
index 000000000..00d35df88
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/CUDA-stdout.txt
@@ -0,0 +1,2 @@
+-- Check for working CUDA compiler: [^
+]* - works
diff --git a/Tests/RunCMake/CompilerTest/CUDA.cmake b/Tests/RunCMake/CompilerTest/CUDA.cmake
new file mode 100644
index 000000000..e8c19a0d3
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/CUDA.cmake
@@ -0,0 +1,3 @@
+# Pretend the ABI check failed in order to force the fall-back test to run.
+set(CMAKE_CUDA_ABI_COMPILED FALSE)
+enable_language(CUDA)
diff --git a/Tests/RunCMake/CompilerTest/CXX-stdout.txt b/Tests/RunCMake/CompilerTest/CXX-stdout.txt
new file mode 100644
index 000000000..513fd85ef
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/CXX-stdout.txt
@@ -0,0 +1,2 @@
+-- Check for working CXX compiler: [^
+]* - works
diff --git a/Tests/RunCMake/CompilerTest/CXX.cmake b/Tests/RunCMake/CompilerTest/CXX.cmake
new file mode 100644
index 000000000..e17cc9d05
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/CXX.cmake
@@ -0,0 +1,3 @@
+# Pretend the ABI check failed in order to force the fall-back test to run.
+set(CMAKE_CXX_ABI_COMPILED FALSE)
+enable_language(CXX)
diff --git a/Tests/RunCMake/CompilerTest/Fortran-stdout.txt b/Tests/RunCMake/CompilerTest/Fortran-stdout.txt
new file mode 100644
index 000000000..d871feaa0
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/Fortran-stdout.txt
@@ -0,0 +1,2 @@
+-- Check for working Fortran compiler: [^
+]* - works
diff --git a/Tests/RunCMake/CompilerTest/Fortran.cmake b/Tests/RunCMake/CompilerTest/Fortran.cmake
new file mode 100644
index 000000000..8c83bd784
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/Fortran.cmake
@@ -0,0 +1,3 @@
+# Pretend the ABI check failed in order to force the fall-back test to run.
+set(CMAKE_Fortran_ABI_COMPILED FALSE)
+enable_language(Fortran)
diff --git a/Tests/RunCMake/CompilerTest/HIP-stdout.txt b/Tests/RunCMake/CompilerTest/HIP-stdout.txt
new file mode 100644
index 000000000..8b3baa732
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/HIP-stdout.txt
@@ -0,0 +1,2 @@
+-- Check for working HIP compiler: [^
+]* - works
diff --git a/Tests/RunCMake/CompilerTest/HIP.cmake b/Tests/RunCMake/CompilerTest/HIP.cmake
new file mode 100644
index 000000000..e56b77a71
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/HIP.cmake
@@ -0,0 +1,3 @@
+# Pretend the ABI check failed in order to force the fall-back test to run.
+set(CMAKE_HIP_ABI_COMPILED FALSE)
+enable_language(HIP)
diff --git a/Tests/RunCMake/CompilerTest/ISPC-stdout.txt b/Tests/RunCMake/CompilerTest/ISPC-stdout.txt
new file mode 100644
index 000000000..7e45c91a2
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/ISPC-stdout.txt
@@ -0,0 +1,3 @@
+-- The ISPC compiler identification is [^
+]*
+-- Configuring done
diff --git a/Tests/RunCMake/CompilerTest/ISPC.cmake b/Tests/RunCMake/CompilerTest/ISPC.cmake
new file mode 100644
index 000000000..3ce7b2874
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/ISPC.cmake
@@ -0,0 +1,3 @@
+# Pretend the ABI check failed in order to force the fall-back test to run.
+set(CMAKE_ISPC_ABI_COMPILED FALSE)
+enable_language(ISPC)
diff --git a/Tests/RunCMake/CompilerTest/OBJC-stdout.txt b/Tests/RunCMake/CompilerTest/OBJC-stdout.txt
new file mode 100644
index 000000000..23f512068
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/OBJC-stdout.txt
@@ -0,0 +1,2 @@
+-- Check for working OBJC compiler: [^
+]* - works
diff --git a/Tests/RunCMake/CompilerTest/OBJC.cmake b/Tests/RunCMake/CompilerTest/OBJC.cmake
new file mode 100644
index 000000000..5ec842ca0
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/OBJC.cmake
@@ -0,0 +1,3 @@
+# Pretend the ABI check failed in order to force the fall-back test to run.
+set(CMAKE_OBJC_ABI_COMPILED FALSE)
+enable_language(OBJC)
diff --git a/Tests/RunCMake/CompilerTest/OBJCXX-stdout.txt b/Tests/RunCMake/CompilerTest/OBJCXX-stdout.txt
new file mode 100644
index 000000000..82919048f
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/OBJCXX-stdout.txt
@@ -0,0 +1,2 @@
+-- Check for working OBJCXX compiler: [^
+]* - works
diff --git a/Tests/RunCMake/CompilerTest/OBJCXX.cmake b/Tests/RunCMake/CompilerTest/OBJCXX.cmake
new file mode 100644
index 000000000..49df0aae5
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/OBJCXX.cmake
@@ -0,0 +1,3 @@
+# Pretend the ABI check failed in order to force the fall-back test to run.
+set(CMAKE_OBJCXX_ABI_COMPILED FALSE)
+enable_language(OBJCXX)
diff --git a/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake b/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake
new file mode 100644
index 000000000..2dd9c7fbe
--- /dev/null
+++ b/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake
@@ -0,0 +1,25 @@
+include(RunCMake)
+
+run_cmake(C)
+run_cmake(CXX)
+
+if(CMake_TEST_CUDA)
+ run_cmake(CUDA)
+endif()
+
+if(CMake_TEST_Fortran)
+ run_cmake(Fortran)
+endif()
+
+if(CMake_TEST_HIP)
+ run_cmake(HIP)
+endif()
+
+if(CMake_TEST_ISPC)
+ run_cmake(ISPC)
+endif()
+
+if(CMake_TEST_OBJC)
+ run_cmake(OBJC)
+ run_cmake(OBJCXX)
+endif()
diff --git a/Tests/RunCMake/Configure/FailCopyFileABI-override.cmake b/Tests/RunCMake/Configure/CopyFileABI-override.cmake
index c633555b6..67f6ed532 100644
--- a/Tests/RunCMake/Configure/FailCopyFileABI-override.cmake
+++ b/Tests/RunCMake/Configure/CopyFileABI-override.cmake
@@ -1,5 +1,6 @@
# Change the executable suffix that try_compile will use for
-# COPY_FILE but not inside the test project. This forces failure.
+# COPY_FILE but not inside the test project, to verify
+# we can handle envs that try and break everything
get_property(in_try_compile GLOBAL PROPERTY IN_TRY_COMPILE)
if(NOT in_try_compile)
set(CMAKE_EXECUTABLE_SUFFIX .missing)
diff --git a/Tests/RunCMake/Configure/FailCopyFileABI-stdout.txt b/Tests/RunCMake/Configure/CopyFileABI-stdout.txt
index 92fe2330a..6a856a4d0 100644
--- a/Tests/RunCMake/Configure/FailCopyFileABI-stdout.txt
+++ b/Tests/RunCMake/Configure/CopyFileABI-stdout.txt
@@ -1,4 +1,4 @@
-- Detecting C compiler ABI info
--- Detecting C compiler ABI info - failed.*
+-- Detecting C compiler ABI info - done.*
-- Configuring done
-- Generating done
diff --git a/Tests/RunCMake/Configure/FailCopyFileABI.cmake b/Tests/RunCMake/Configure/CopyFileABI.cmake
index 74efd9720..4eee100ea 100644
--- a/Tests/RunCMake/Configure/FailCopyFileABI.cmake
+++ b/Tests/RunCMake/Configure/CopyFileABI.cmake
@@ -1,2 +1,2 @@
-set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/FailCopyFileABI-override.cmake)
+set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/CopyFileABI-override.cmake)
enable_language(C)
diff --git a/Tests/RunCMake/Configure/FailCopyFileABI-check.cmake b/Tests/RunCMake/Configure/FailCopyFileABI-check.cmake
deleted file mode 100644
index db0cb0a34..000000000
--- a/Tests/RunCMake/Configure/FailCopyFileABI-check.cmake
+++ /dev/null
@@ -1,14 +0,0 @@
-set(log "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/CMakeError.log")
-if(EXISTS "${log}")
- file(READ "${log}" error_log)
-else()
- set(error_log "")
-endif()
-string(REPLACE "\r\n" "\n" regex "Cannot copy output executable.*
-to destination specified by COPY_FILE:.*
-Unable to find the executable at any of:
- .*\\.missing")
-if(NOT error_log MATCHES "${regex}")
- string(REGEX REPLACE "\n" "\n " error_log " ${error_log}")
- set(RunCMake_TEST_FAILED "Log file:\n ${log}\ndoes not have expected COPY_FILE failure message:\n${error_log}")
-endif()
diff --git a/Tests/RunCMake/Configure/RunCMakeTest.cmake b/Tests/RunCMake/Configure/RunCMakeTest.cmake
index 9fd4499af..750fa3c2b 100644
--- a/Tests/RunCMake/Configure/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Configure/RunCMakeTest.cmake
@@ -1,9 +1,9 @@
include(RunCMake)
run_cmake(ContinueAfterError)
+run_cmake(CopyFileABI)
run_cmake(CustomTargetAfterError)
run_cmake(ErrorLogs)
-run_cmake(FailCopyFileABI)
# Use a single build tree for a few tests without cleaning.
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/RerunCMake-build)
diff --git a/Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build1-stdout.txt b/Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build1-stdout.txt
new file mode 100644
index 000000000..2c223f703
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build1-stdout.txt
@@ -0,0 +1,6 @@
+.*-- once: configure
+.*-- once: build
+.*-- once: install
+.*-- always: configure
+.*-- always: build
+.*-- always: install
diff --git a/Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build2-stdout.txt b/Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build2-stdout.txt
new file mode 100644
index 000000000..d69749013
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/BUILD_ALWAYS-build2-stdout.txt
@@ -0,0 +1,2 @@
+.*-- always: build
+.*-- always: install
diff --git a/Tests/RunCMake/ExternalProject/BUILD_ALWAYS.cmake b/Tests/RunCMake/ExternalProject/BUILD_ALWAYS.cmake
new file mode 100644
index 000000000..2e5fc6f72
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/BUILD_ALWAYS.cmake
@@ -0,0 +1,20 @@
+include(ExternalProject)
+
+ExternalProject_Add(once
+ DOWNLOAD_COMMAND ""
+ CONFIGURE_COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_BINARY_DIR}/once-configure.cmake
+ BUILD_COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_BINARY_DIR}/once-build.cmake
+ INSTALL_COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_BINARY_DIR}/once-install.cmake
+ )
+
+ExternalProject_Add(always
+ DEPENDS once
+ DOWNLOAD_COMMAND ""
+ CONFIGURE_COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_BINARY_DIR}/always-configure.cmake
+ BUILD_COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_BINARY_DIR}/always-build.cmake
+ COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${CMAKE_CURRENT_LIST_FILE}
+ "${CMAKE_CURRENT_BINARY_DIR}/byproduct.txt"
+ BUILD_BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/byproduct.txt"
+ BUILD_ALWAYS 1
+ INSTALL_COMMAND "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_BINARY_DIR}/always-install.cmake
+ )
diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
index 2588d6c59..f152f5b2b 100644
--- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
@@ -177,6 +177,28 @@ if(doSubstitutionTest)
__ep_test_with_build(Substitutions)
endif()
+function(__ep_test_BUILD_ALWAYS)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BUILD_ALWAYS-build)
+ run_cmake(BUILD_ALWAYS)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/once-configure.cmake" [[message(STATUS "once: configure")]])
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/once-build.cmake" [[message(STATUS "once: build")]])
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/once-install.cmake" [[message(STATUS "once: install")]])
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/always-configure.cmake" [[message(STATUS "always: configure")]])
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/always-build.cmake" [[message(STATUS "always: build")]])
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/always-install.cmake" [[message(STATUS "always: install")]])
+ run_cmake_command(BUILD_ALWAYS-build1 ${CMAKE_COMMAND} --build . --target always)
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/once-configure.cmake" [[message(FATAL_ERROR "once: configure should not run again")]])
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/once-build.cmake" [[message(FATAL_ERROR "once: build should not run again")]])
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/once-install.cmake" [[message(FATAL_ERROR "once: install should not run again")]])
+ if(NOT RunCMake_GENERATOR MATCHES "^(Xcode|Visual Studio 9 )")
+ # The Xcode and VS 9 build systems decide to run this every time.
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/always-configure.cmake" [[message(FATAL_ERROR "always: configure should not run again")]])
+ endif()
+ run_cmake_command(BUILD_ALWAYS-build2 ${CMAKE_COMMAND} --build . --target always)
+endfunction()
+__ep_test_BUILD_ALWAYS()
+
function(__ep_test_CONFIGURE_HANDLED_BY_BUILD)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CONFIGURE_HANDLED_BY_BUILD-build)
run_cmake(CONFIGURE_HANDLED_BY_BUILD)
diff --git a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake
index 28b8570d0..3b095a633 100644
--- a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake
@@ -38,9 +38,15 @@ run_cmake(exact_1.2.3.5)
unset(RunCMake_DEFAULT_stderr)
# check if searching for a version 0 works
-list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=0")
+set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=0")
run_cmake(exact_0_matching)
+set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=")
+run_cmake(empty_version)
+
+set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}")
+run_cmake(exact_1_no_version_var)
+
# check custom error message
set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DCustomMessage_VERSION=1.2.3.4")
run_cmake(custom_message_1)
diff --git a/Tests/RunCMake/FPHSA/empty_version-result.txt b/Tests/RunCMake/FPHSA/empty_version-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/empty_version-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/FPHSA/empty_version-stderr.txt b/Tests/RunCMake/FPHSA/empty_version-stderr.txt
new file mode 100644
index 000000000..3b60c7aac
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/empty_version-stderr.txt
@@ -0,0 +1,9 @@
+^CMake Error at [^
+]*/Modules/FindPackageHandleStandardArgs.cmake:[0-9]+ \(message\):
+ Could NOT find Pseudo: \(Required is at least version "1"\) \(found TRUE\)
+Call Stack \(most recent call first\):
+ [^
+]*/Modules/FindPackageHandleStandardArgs.cmake:[0-9]+ \(_FPHSA_FAILURE_MESSAGE\)
+ FindPseudo.cmake:[0-9]+ \(find_package_handle_standard_args\)
+ empty_version.cmake:[0-9]+ \(find_package\)
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/FPHSA/empty_version.cmake b/Tests/RunCMake/FPHSA/empty_version.cmake
new file mode 100644
index 000000000..7b7ff34f9
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/empty_version.cmake
@@ -0,0 +1 @@
+find_package(Pseudo 1 REQUIRED)
diff --git a/Tests/RunCMake/FPHSA/exact_1_no_version_var-stdout.txt b/Tests/RunCMake/FPHSA/exact_1_no_version_var-stdout.txt
new file mode 100644
index 000000000..7cbdf6ea6
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/exact_1_no_version_var-stdout.txt
@@ -0,0 +1 @@
+-- Found Pseudo: TRUE \(Required is at least version "1"\)
diff --git a/Tests/RunCMake/FPHSA/exact_1_no_version_var.cmake b/Tests/RunCMake/FPHSA/exact_1_no_version_var.cmake
new file mode 100644
index 000000000..7b7ff34f9
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/exact_1_no_version_var.cmake
@@ -0,0 +1 @@
+find_package(Pseudo 1 REQUIRED)
diff --git a/Tests/RunCMake/FetchContent/IncludesNonSystem/CMakeLists.txt b/Tests/RunCMake/FetchContent/IncludesNonSystem/CMakeLists.txt
new file mode 100644
index 000000000..f319e010f
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/IncludesNonSystem/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(barnonsys STATIC bar.cpp)
+add_executable(foononsys foo.cpp)
diff --git a/Tests/RunCMake/FetchContent/IncludesNonSystem/bar.cpp b/Tests/RunCMake/FetchContent/IncludesNonSystem/bar.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/IncludesNonSystem/bar.cpp
diff --git a/Tests/RunCMake/FetchContent/IncludesNonSystem/foo.cpp b/Tests/RunCMake/FetchContent/IncludesNonSystem/foo.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/IncludesNonSystem/foo.cpp
diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/CMakeLists.txt b/Tests/RunCMake/FetchContent/IncludesSystem/CMakeLists.txt
new file mode 100644
index 000000000..60c682020
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/IncludesSystem/CMakeLists.txt
@@ -0,0 +1,20 @@
+project(SystemSub NONE)
+
+FetchContent_Declare(
+ SubSub1
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/SubSub1
+ SYSTEM
+)
+FetchContent_Declare(
+ SubSub2
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/SubSub2
+)
+
+FetchContent_MakeAvailable(SubSub1 SubSub2)
+
+add_library(bar STATIC bar.cpp)
+
+add_library(foo STATIC foo.cpp)
+set_target_properties(foo PROPERTIES SYSTEM OFF)
+
+add_executable(zot zot.cpp)
diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/CMakeLists.txt b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/CMakeLists.txt
new file mode 100644
index 000000000..291339b8e
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_library(subsub1bar STATIC bar.cpp)
+
+add_library(subsub1foo STATIC foo.cpp)
+set_target_properties(subsub1foo PROPERTIES SYSTEM OFF)
+
+add_executable(subsub1zot zot.cpp)
diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/bar.cpp b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/bar.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/bar.cpp
diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/foo.cpp b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/foo.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/foo.cpp
diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/zot.cpp b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/zot.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub1/zot.cpp
diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/CMakeLists.txt b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/CMakeLists.txt
new file mode 100644
index 000000000..5755742d7
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_library(subsub2bar STATIC bar.cpp)
+
+add_library(subsub2foo STATIC foo.cpp)
+set_target_properties(subsub2foo PROPERTIES SYSTEM OFF)
+
+add_executable(subsub2zot zot.cpp)
diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/bar.cpp b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/bar.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/bar.cpp
diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/foo.cpp b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/foo.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/foo.cpp
diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/zot.cpp b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/zot.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/IncludesSystem/SubSub2/zot.cpp
diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/bar.cpp b/Tests/RunCMake/FetchContent/IncludesSystem/bar.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/IncludesSystem/bar.cpp
diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/foo.cpp b/Tests/RunCMake/FetchContent/IncludesSystem/foo.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/IncludesSystem/foo.cpp
diff --git a/Tests/RunCMake/FetchContent/IncludesSystem/zot.cpp b/Tests/RunCMake/FetchContent/IncludesSystem/zot.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/IncludesSystem/zot.cpp
diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
index a7ccf8355..bb27491b6 100644
--- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
@@ -8,6 +8,7 @@ run_cmake(FirstDetailsWin)
run_cmake(DownloadTwice)
run_cmake(DownloadFile)
run_cmake(SameGenerator)
+run_cmake(System)
run_cmake(VarDefinitions)
run_cmake(VarPassthroughs)
run_cmake(GetProperties)
diff --git a/Tests/RunCMake/FetchContent/System.cmake b/Tests/RunCMake/FetchContent/System.cmake
new file mode 100644
index 000000000..c10e2af49
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/System.cmake
@@ -0,0 +1,37 @@
+enable_language(CXX)
+
+include(FetchContent)
+
+FetchContent_Declare(
+ IncludesSystem
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/IncludesSystem
+ SYSTEM
+)
+FetchContent_MakeAvailable(IncludesSystem)
+
+FetchContent_Declare(
+ IncludesNonSystem
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/IncludesNonSystem
+)
+FetchContent_MakeAvailable(IncludesNonSystem)
+
+function(check_target_system target expected_value)
+ get_target_property(var ${target} SYSTEM)
+ if ((var AND NOT expected_value) OR (NOT var AND expected_value))
+ message(SEND_ERROR "\
+The 'SYSTEM' property of ${target} should be ${expected_value}, \
+but got ${var}")
+ endif()
+endfunction()
+
+check_target_system(foo OFF)
+check_target_system(bar ON)
+check_target_system(zot ON)
+check_target_system(subsub1foo OFF)
+check_target_system(subsub1bar ON)
+check_target_system(subsub1zot ON)
+check_target_system(subsub2foo OFF)
+check_target_system(subsub2bar ON)
+check_target_system(subsub2zot ON)
+check_target_system(foononsys OFF)
+check_target_system(barnonsys OFF)
diff --git a/Tests/RunCMake/FileAPI/CMakeLists.txt b/Tests/RunCMake/FileAPI/CMakeLists.txt
index 44025d3bd..9a66cde9b 100644
--- a/Tests/RunCMake/FileAPI/CMakeLists.txt
+++ b/Tests/RunCMake/FileAPI/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 3.12)
+cmake_minimum_required(VERSION 3.13)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/FileAPI/ClientStateful-check.py b/Tests/RunCMake/FileAPI/ClientStateful-check.py
index f3d20d13e..28679bbce 100644
--- a/Tests/RunCMake/FileAPI/ClientStateful-check.py
+++ b/Tests/RunCMake/FileAPI/ClientStateful-check.py
@@ -108,7 +108,11 @@ def check_query_json_empty(q):
check_error_re(q, "value, object or array expected")
def check_query_json_extra(q):
- check_error_re(q, "Extra non-whitespace after JSON value")
+ if bool(os.environ.get("CMake_JSONCPP_PRE_1_7_5", "")) and is_dict(q) and sorted(q.keys()) == ["responses"]:
+ # jsoncpp < 1.7.5 did not diagnose extra non-whitespace characters
+ check_error(q["responses"], "'requests' member missing")
+ else:
+ check_error_re(q, "Extra non-whitespace after JSON value")
def check_query_not_file(q):
check_error_re(q, "failed to read from file")
diff --git a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake
index 61dce17bd..961b73a6f 100644
--- a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake
@@ -39,6 +39,10 @@ if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo")
endif()
+if(JsonCpp_VERSION_STRING AND JsonCpp_VERSION_STRING VERSION_LESS 1.7.5)
+ set(ENV{CMake_JSONCPP_PRE_1_7_5} 1)
+endif()
+
run_cmake(Nothing)
run_cmake(Empty)
run_cmake(EmptyClient)
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py
index d5f596e70..b7623de2d 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py
@@ -213,6 +213,16 @@ def check_directory(c):
assert is_int(at["index"])
assert c["targets"][at["index"]]["name"] == et["index"]
+ if e.get("cxxModuleBmiTarget", None) is not None:
+ expected_keys.append("cxxModuleBmiTarget")
+ et = e["cxxModuleBmiTarget"]
+ at = a["cxxModuleBmiTarget"]
+ assert is_dict(at)
+ assert sorted(at.keys()) == ["id", "index"]
+ assert matches(at["id"], et["id"])
+ assert is_int(at["index"])
+ assert c["targets"][at["index"]]["name"] == et["index"]
+
if e["backtrace"] is not None:
expected_keys.append("backtrace")
check_backtrace(d, a["backtrace"], e["backtrace"])
@@ -654,6 +664,7 @@ def gen_check_directories(c, g):
read_codemodel_json_data("directories/dir_dir.json"),
read_codemodel_json_data("directories/external.json"),
read_codemodel_json_data("directories/fileset.json"),
+ read_codemodel_json_data("directories/subdir.json"),
]
if matches(g["name"], "^Visual Studio "):
@@ -712,6 +723,7 @@ def gen_check_targets(c, g, inSource):
read_codemodel_json_data("targets/c_shared_exe.json"),
read_codemodel_json_data("targets/c_static_lib.json"),
read_codemodel_json_data("targets/c_static_exe.json"),
+ read_codemodel_json_data("targets/c_subdir.json"),
read_codemodel_json_data("targets/all_build_cxx.json"),
read_codemodel_json_data("targets/zero_check_cxx.json"),
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json
index 6514910a8..de8b1779e 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/alias.json
@@ -10,7 +10,7 @@
"^cxx_alias_exe::@53632cba2752272bb008$"
],
"projectName": "Alias",
- "minimumCMakeVersion": "3.12",
+ "minimumCMakeVersion": "3.13",
"hasInstallRule": null,
"installers": []
}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json
index c89e4f9dd..e57191cb4 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/custom.json
@@ -10,7 +10,7 @@
"^custom_tgt::@c11385ffed57b860da63$"
],
"projectName": "Custom",
- "minimumCMakeVersion": "3.12",
+ "minimumCMakeVersion": "3.13",
"hasInstallRule": null,
"installers": []
}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json
index 8052c1a55..28f2b9933 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json
@@ -16,7 +16,7 @@
"^cxx_static_lib::@a56b12a3f5c0529fb296$"
],
"projectName": "Cxx",
- "minimumCMakeVersion": "3.12",
+ "minimumCMakeVersion": "3.13",
"hasInstallRule": true,
"installers": [
{
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json
index 8509f084c..2a3756e75 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir.json
@@ -7,7 +7,7 @@
],
"targetIds": null,
"projectName": "codemodel-v2",
- "minimumCMakeVersion": "3.12",
+ "minimumCMakeVersion": "3.13",
"hasInstallRule": null,
"installers": []
}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json
index 27184cd5e..12677f27f 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/dir_dir.json
@@ -5,7 +5,7 @@
"childSources": null,
"targetIds": null,
"projectName": "codemodel-v2",
- "minimumCMakeVersion": "3.12",
+ "minimumCMakeVersion": "3.13",
"hasInstallRule": null,
"installers": []
}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json
index 6d2952d14..f1199c36b 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/external.json
@@ -9,7 +9,7 @@
"^generated_exe::@[0-9a-f]+$"
],
"projectName": "External",
- "minimumCMakeVersion": "3.12",
+ "minimumCMakeVersion": "3.13",
"hasInstallRule": true,
"installers": [
{
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json
index 4774a13e9..c4df2ec70 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json
@@ -8,7 +8,7 @@
"^c_headers_2::@6b8db101d64c125f29fe$"
],
"projectName": "codemodel-v2",
- "minimumCMakeVersion": "3.12",
+ "minimumCMakeVersion": "3.13",
"hasInstallRule": true,
"installers": [
{
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json
index 92b952640..8210d7fef 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/imported.json
@@ -13,7 +13,7 @@
"^link_imported_static_exe::@ba7eb709d0b48779c6c8$"
],
"projectName": "Imported",
- "minimumCMakeVersion": "3.12",
+ "minimumCMakeVersion": "3.13",
"hasInstallRule": true,
"installers": [
{
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json
index 90664dc72..08edd649a 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json
@@ -9,7 +9,7 @@
"^iface_srcs::@25b7fa8ea00134654b85$"
],
"projectName": "Interface",
- "minimumCMakeVersion": "3.12",
+ "minimumCMakeVersion": "3.13",
"hasInstallRule": null,
"installers": []
}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/subdir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/subdir.json
new file mode 100644
index 000000000..996da471c
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/subdir.json
@@ -0,0 +1,11 @@
+{
+ "source": "^subdir$",
+ "build": "^subdir$",
+ "parentSource": "^\\.$",
+ "childSources": null,
+ "targetIds": null,
+ "projectName": "codemodel-v2",
+ "minimumCMakeVersion": "3.13",
+ "hasInstallRule": null,
+ "installers": []
+}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json
index e7b146f32..aed07e265 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json
@@ -11,7 +11,8 @@
"^object$",
"^.*/Tests/RunCMake/FileAPIExternalSource$",
"^dir$",
- "^fileset$"
+ "^fileset$",
+ "^subdir$"
],
"targetIds": [
"^ALL_BUILD::@6890427a1f51a3e7e1df$",
@@ -22,10 +23,11 @@
"^c_shared_lib::@6890427a1f51a3e7e1df$",
"^c_static_exe::@6890427a1f51a3e7e1df$",
"^c_static_lib::@6890427a1f51a3e7e1df$",
+ "^c_subdir::@6890427a1f51a3e7e1df$",
"^interface_exe::@6890427a1f51a3e7e1df$"
],
"projectName": "codemodel-v2",
- "minimumCMakeVersion": "3.12",
+ "minimumCMakeVersion": "3.13",
"hasInstallRule": true,
"installers": [
{
@@ -48,7 +50,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 39,
+ "line": 42,
"command": "install",
"hasParent": true
},
@@ -93,7 +95,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 42,
+ "line": 45,
"command": "install",
"hasParent": true
},
@@ -141,7 +143,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 42,
+ "line": 45,
"command": "install",
"hasParent": true
},
@@ -186,7 +188,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 42,
+ "line": 45,
"command": "install",
"hasParent": true
},
@@ -230,7 +232,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 42,
+ "line": 45,
"command": "install",
"hasParent": true
},
@@ -274,7 +276,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 47,
+ "line": 50,
"command": "install",
"hasParent": true
},
@@ -321,7 +323,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 49,
+ "line": 52,
"command": "install",
"hasParent": true
},
@@ -366,7 +368,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 50,
+ "line": 53,
"command": "install",
"hasParent": true
},
@@ -415,7 +417,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 51,
+ "line": 54,
"command": "install",
"hasParent": true
},
@@ -467,7 +469,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 52,
+ "line": 55,
"command": "install",
"hasParent": true
},
@@ -516,7 +518,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 53,
+ "line": 56,
"command": "install",
"hasParent": true
},
@@ -558,7 +560,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 54,
+ "line": 57,
"command": "install",
"hasParent": true
},
@@ -600,7 +602,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 55,
+ "line": 58,
"command": "install",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json
index 0d6c4a16d..151c0a81b 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json
@@ -14,7 +14,8 @@
"^\\.$",
"^dir$",
"^dir/dir$",
- "^fileset$"
+ "^fileset$",
+ "^subdir$"
],
"targetIds": [
"^ALL_BUILD::@6890427a1f51a3e7e1df$",
@@ -26,6 +27,7 @@
"^c_shared_exe::@6890427a1f51a3e7e1df$",
"^c_static_lib::@6890427a1f51a3e7e1df$",
"^c_static_exe::@6890427a1f51a3e7e1df$",
+ "^c_subdir::@6890427a1f51a3e7e1df$",
"^c_headers_1::@6b8db101d64c125f29fe$",
"^c_headers_2::@6b8db101d64c125f29fe$"
]
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json
index 4e772a7f7..0d45d076f 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json
@@ -96,6 +96,10 @@
"backtrace": null
},
{
+ "id": "^c_subdir::@6890427a1f51a3e7e1df$",
+ "backtrace": null
+ },
+ {
"id": "^c_static_exe::@6890427a1f51a3e7e1df$",
"backtrace": null
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json
index 3c9ace3b1..339240498 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json
@@ -27,7 +27,7 @@
]
},
{
- "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/.*/empty(\\.c)?\\.o(bj)?$",
+ "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/(object|build/c_object_lib\\.build)/.*/empty(\\.c)?\\.o(bj)?$",
"isGenerated": true,
"sourceGroupName": "Object Libraries",
"compileGroupLanguage": null,
@@ -57,7 +57,7 @@
{
"name": "Object Libraries",
"sourcePaths": [
- "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/.*/empty(\\.c)?\\.o(bj)?$"
+ "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/(object|build/c_object_lib\\.build)/.*/empty(\\.c)?\\.o(bj)?$"
]
}
],
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_lib.json
index e3a20df3a..1917f92ce 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_lib.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_lib.json
@@ -64,7 +64,7 @@
"nameOnDisk": null,
"artifacts": [
{
- "path": "^object/.*/empty(\\.c)?\\.o(bj)?$",
+ "path": "^(object|build/c_object_lib\\.build)/.*/empty(\\.c)?\\.o(bj)?$",
"_dllExtra": false
}
],
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json
index b4318ddfd..9a210ff60 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json
@@ -115,7 +115,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 42,
+ "line": 45,
"command": "install",
"hasParent": true
},
@@ -145,7 +145,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 42,
+ "line": 45,
"command": "install",
"hasParent": true
},
@@ -175,7 +175,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 47,
+ "line": 50,
"command": "install",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json
new file mode 100644
index 000000000..12ec917e5
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json
@@ -0,0 +1,150 @@
+{
+ "name": "c_subdir",
+ "id": "^c_subdir::@6890427a1f51a3e7e1df$",
+ "directorySource": "^\\.$",
+ "projectName": "codemodel-v2",
+ "type": "STATIC_LIBRARY",
+ "isGeneratorProvided": null,
+ "sources": [
+ {
+ "path": "^subdir/empty\\.c$",
+ "isGenerated": null,
+ "sourceGroupName": "Source Files",
+ "compileGroupLanguage": "C",
+ "backtrace": [
+ {
+ "file": "^subdir/CMakeLists\\.txt$",
+ "line": 4,
+ "command": "target_sources",
+ "hasParent": true
+ },
+ {
+ "file": "^subdir/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ }
+ ],
+ "sourceGroups": [
+ {
+ "name": "Source Files",
+ "sourcePaths": [
+ "^subdir/empty\\.c$"
+ ]
+ }
+ ],
+ "compileGroups": [
+ {
+ "language": "C",
+ "sourcePaths": [
+ "^subdir/empty\\.c$"
+ ],
+ "includes": [
+ {
+ "path": "^.*/Tests/RunCMake/FileAPI/subdir$",
+ "isSystem": null,
+ "backtrace": [
+ {
+ "file": "^subdir/CMakeLists\\.txt$",
+ "line": 2,
+ "command": "target_include_directories",
+ "hasParent": true
+ },
+ {
+ "file": "^subdir/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ }
+ ],
+ "defines": [
+ {
+ "define": "SUBDIR",
+ "backtrace": [
+ {
+ "file": "^subdir/CMakeLists\\.txt$",
+ "line": 1,
+ "command": "target_compile_definitions",
+ "hasParent": true
+ },
+ {
+ "file": "^subdir/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ }
+ ],
+ "compileCommandFragments": null
+ }
+ ],
+ "backtrace": [
+ {
+ "file": "^codemodel-v2\\.cmake$",
+ "line": 17,
+ "command": "add_library",
+ "hasParent": true
+ },
+ {
+ "file": "^codemodel-v2\\.cmake$",
+ "line": null,
+ "command": null,
+ "hasParent": true
+ },
+ {
+ "file": "^CMakeLists\\.txt$",
+ "line": 3,
+ "command": "include",
+ "hasParent": true
+ },
+ {
+ "file": "^CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ],
+ "folder": null,
+ "nameOnDisk": "^(lib)?c_subdir\\.(a|lib)$",
+ "artifacts": [
+ {
+ "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_subdir\\.(a|lib)$",
+ "_dllExtra": false
+ }
+ ],
+ "build": "^\\.$",
+ "source": "^\\.$",
+ "install": null,
+ "link": null,
+ "archive": {
+ "lto": null
+ },
+ "dependencies": [
+ {
+ "id": "^c_lib::@6890427a1f51a3e7e1df$",
+ "backtrace": [
+ {
+ "file": "^subdir/CMakeLists\\.txt$",
+ "line": 3,
+ "command": "target_link_libraries",
+ "hasParent": true
+ },
+ {
+ "file": "^subdir/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ },
+ {
+ "id": "^ZERO_CHECK::@6890427a1f51a3e7e1df$",
+ "backtrace": null
+ }
+ ]
+}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json
index 5769f0cda..16d074aa7 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json
@@ -136,7 +136,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 39,
+ "line": 42,
"command": "install",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json
index 119c91d42..e8d62188a 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json
@@ -27,7 +27,7 @@
]
},
{
- "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/.*/empty(\\.cxx)?\\.o(bj)?$",
+ "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/(object|build/cxx_object_lib\\.build)/.*/empty(\\.cxx)?\\.o(bj)?$",
"isGenerated": true,
"sourceGroupName": "Object Libraries",
"compileGroupLanguage": null,
@@ -57,7 +57,7 @@
{
"name": "Object Libraries",
"sourcePaths": [
- "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/object/.*/empty(\\.cxx)?\\.o(bj)?$"
+ "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/(object|build/cxx_object_lib\\.build)/.*/empty(\\.cxx)?\\.o(bj)?$"
]
}
],
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_lib.json
index 8e99f7d6a..24b391b24 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_lib.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_lib.json
@@ -64,7 +64,7 @@
"nameOnDisk": null,
"artifacts": [
{
- "path": "^object/.*/empty(\\.cxx)?\\.o(bj)?$",
+ "path": "^(object|build/cxx_object_lib\\.build)/.*/empty(\\.cxx)?\\.o(bj)?$",
"_dllExtra": false
}
],
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json
index 1fe4d678c..03f4cb90e 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json
@@ -91,7 +91,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 42,
+ "line": 45,
"command": "install",
"hasParent": true
},
@@ -121,7 +121,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 42,
+ "line": 45,
"command": "install",
"hasParent": true
},
@@ -151,7 +151,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 47,
+ "line": 50,
"command": "install",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2.cmake b/Tests/RunCMake/FileAPI/codemodel-v2.cmake
index 019eb8762..09db21601 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2.cmake
+++ b/Tests/RunCMake/FileAPI/codemodel-v2.cmake
@@ -14,6 +14,9 @@ add_library(c_static_lib STATIC empty.c)
add_executable(c_static_exe empty.c)
target_link_libraries(c_static_exe PRIVATE c_static_lib)
+add_library(c_subdir STATIC)
+add_subdirectory(subdir)
+
add_subdirectory(cxx)
add_subdirectory(alias)
add_subdirectory(object)
diff --git a/Tests/RunCMake/FileAPI/subdir/CMakeLists.txt b/Tests/RunCMake/FileAPI/subdir/CMakeLists.txt
new file mode 100644
index 000000000..b8f4550d8
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/subdir/CMakeLists.txt
@@ -0,0 +1,4 @@
+target_compile_definitions(c_subdir PRIVATE SUBDIR)
+target_include_directories(c_subdir PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
+target_link_libraries(c_subdir PRIVATE c_lib)
+target_sources(c_subdir PRIVATE empty.c)
diff --git a/Tests/RunCMake/FileAPI/subdir/empty.c b/Tests/RunCMake/FileAPI/subdir/empty.c
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/subdir/empty.c
diff --git a/Tests/RunCMake/File_Archive/RunCMakeTest.cmake b/Tests/RunCMake/File_Archive/RunCMakeTest.cmake
index 3908f4243..dad0dd36c 100644
--- a/Tests/RunCMake/File_Archive/RunCMakeTest.cmake
+++ b/Tests/RunCMake/File_Archive/RunCMakeTest.cmake
@@ -13,6 +13,9 @@ run_cmake(zip)
# Extracting only selected files or directories
run_cmake(zip-filtered)
+run_cmake(create-missing-args)
+run_cmake(extract-missing-args)
+
run_cmake(unsupported-format)
run_cmake(zip-with-bad-compression)
run_cmake(7zip-with-bad-compression)
diff --git a/Tests/RunCMake/File_Archive/create-missing-args-result.txt b/Tests/RunCMake/File_Archive/create-missing-args-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/File_Archive/create-missing-args-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/File_Archive/create-missing-args-stderr.txt b/Tests/RunCMake/File_Archive/create-missing-args-stderr.txt
new file mode 100644
index 000000000..fd026f929
--- /dev/null
+++ b/Tests/RunCMake/File_Archive/create-missing-args-stderr.txt
@@ -0,0 +1,19 @@
+^CMake Error at create-missing-args.cmake:[0-9]+ \(file\):
+ Error after keyword "COMPRESSION":
+
+ missing required value
+
+ Error after keyword "COMPRESSION_LEVEL":
+
+ missing required value
+
+ Error after keyword "FORMAT":
+
+ missing required value
+
+ Error after keyword "OUTPUT":
+
+ missing required value
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/File_Archive/create-missing-args.cmake b/Tests/RunCMake/File_Archive/create-missing-args.cmake
new file mode 100644
index 000000000..a0c84d2dd
--- /dev/null
+++ b/Tests/RunCMake/File_Archive/create-missing-args.cmake
@@ -0,0 +1,8 @@
+file(ARCHIVE_CREATE
+ OUTPUT # missing output path
+ FORMAT # missing output format
+ COMPRESSION # missing compression type
+ COMPRESSION_LEVEL # missing compression level
+ MTIME # missing modification time
+ PATHS # no paths
+ )
diff --git a/Tests/RunCMake/File_Archive/extract-missing-args-result.txt b/Tests/RunCMake/File_Archive/extract-missing-args-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/File_Archive/extract-missing-args-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/File_Archive/extract-missing-args-stderr.txt b/Tests/RunCMake/File_Archive/extract-missing-args-stderr.txt
new file mode 100644
index 000000000..0c93ecef2
--- /dev/null
+++ b/Tests/RunCMake/File_Archive/extract-missing-args-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Error at extract-missing-args.cmake:[0-9]+ \(file\):
+ Error after keyword "DESTINATION":
+
+ missing required value
+
+ Error after keyword "INPUT":
+
+ missing required value
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/File_Archive/extract-missing-args.cmake b/Tests/RunCMake/File_Archive/extract-missing-args.cmake
new file mode 100644
index 000000000..21c5d997a
--- /dev/null
+++ b/Tests/RunCMake/File_Archive/extract-missing-args.cmake
@@ -0,0 +1,5 @@
+file(ARCHIVE_EXTRACT
+ INPUT # missing input
+ DESTINATION # missing destination
+ PATTERNS # no patterns
+ )
diff --git a/Tests/RunCMake/File_Configure/BadArgContent-stderr.txt b/Tests/RunCMake/File_Configure/BadArgContent-stderr.txt
index a6ea314d5..72292f9b5 100644
--- a/Tests/RunCMake/File_Configure/BadArgContent-stderr.txt
+++ b/Tests/RunCMake/File_Configure/BadArgContent-stderr.txt
@@ -1,4 +1,7 @@
CMake Error at BadArgContent.cmake:[0-9]+ \(file\):
- file CONFIGURE CONTENT option needs a value.
+ Error after keyword "CONTENT":
+
+ missing required value
+
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt b/Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt
index b5a924c13..d793f4830 100644
--- a/Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt
+++ b/Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt
@@ -1,4 +1,7 @@
CMake Error at BadArgOutput.cmake:[0-9]+ \(file\):
- file CONFIGURE OUTPUT option needs a value.
+ Error after keyword "OUTPUT":
+
+ missing required value
+
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/File_Configure/NoArgContent-result.txt b/Tests/RunCMake/File_Configure/NoArgContent-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/File_Configure/NoArgContent-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/File_Configure/NoArgContent-stderr.txt b/Tests/RunCMake/File_Configure/NoArgContent-stderr.txt
new file mode 100644
index 000000000..2e8dd9a74
--- /dev/null
+++ b/Tests/RunCMake/File_Configure/NoArgContent-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at NoArgContent.cmake:[0-9]+ \(file\):
+ file CONFIGURE CONTENT option is mandatory.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/File_Configure/NoArgContent.cmake b/Tests/RunCMake/File_Configure/NoArgContent.cmake
new file mode 100644
index 000000000..cf52c4667
--- /dev/null
+++ b/Tests/RunCMake/File_Configure/NoArgContent.cmake
@@ -0,0 +1 @@
+file(CONFIGURE OUTPUT "")
diff --git a/Tests/RunCMake/File_Configure/NoArgOutput-result.txt b/Tests/RunCMake/File_Configure/NoArgOutput-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/File_Configure/NoArgOutput-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/File_Configure/NoArgOutput-stderr.txt b/Tests/RunCMake/File_Configure/NoArgOutput-stderr.txt
new file mode 100644
index 000000000..53de48b0a
--- /dev/null
+++ b/Tests/RunCMake/File_Configure/NoArgOutput-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at NoArgOutput.cmake:[0-9]+ \(file\):
+ file CONFIGURE OUTPUT option is mandatory.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/File_Configure/NoArgOutput.cmake b/Tests/RunCMake/File_Configure/NoArgOutput.cmake
new file mode 100644
index 000000000..77e9cdc8f
--- /dev/null
+++ b/Tests/RunCMake/File_Configure/NoArgOutput.cmake
@@ -0,0 +1 @@
+file(CONFIGURE CONTENT "")
diff --git a/Tests/RunCMake/File_Configure/RunCMakeTest.cmake b/Tests/RunCMake/File_Configure/RunCMakeTest.cmake
index 502298518..008ce6751 100644
--- a/Tests/RunCMake/File_Configure/RunCMakeTest.cmake
+++ b/Tests/RunCMake/File_Configure/RunCMakeTest.cmake
@@ -9,6 +9,8 @@ run_cmake(DirOutput)
run_cmake(NewLineStyle-NoArg)
run_cmake(NewLineStyle-ValidArg)
run_cmake(NewLineStyle-WrongArg)
+run_cmake(NoArgOutput)
+run_cmake(NoArgContent)
run_cmake(SubDir)
run_cmake(AtOnly)
run_cmake(EscapeQuotes)
diff --git a/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt b/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt
index e823b25dd..708e6bec4 100644
--- a/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt
+++ b/Tests/RunCMake/File_Generate/EmptyCondition1-stderr.txt
@@ -1,4 +1,7 @@
CMake Error at EmptyCondition1.cmake:2 \(file\):
- file Incorrect arguments to GENERATE subcommand.
+ Error after keyword "CONDITION":
+
+ missing required value
+
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/File_Generate/InputAndContent-check.cmake b/Tests/RunCMake/File_Generate/InputAndContent-check.cmake
new file mode 100644
index 000000000..5c9b80361
--- /dev/null
+++ b/Tests/RunCMake/File_Generate/InputAndContent-check.cmake
@@ -0,0 +1,8 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/output-INPUT.txt" input)
+if(NOT input MATCHES "INPUT file")
+ string(APPEND RunCMake_TEST_FAILED "INPUT incorrectly overridden by CONTENT")
+endif()
+file(READ "${RunCMake_TEST_BINARY_DIR}/output-CONTENT.txt" content)
+if(NOT content MATCHES "CONTENT argument")
+ string(APPEND RunCMake_TEST_FAILED "CONTENT incorrectly overridden by INPUT")
+endif()
diff --git a/Tests/RunCMake/File_Generate/InputAndContent-input.txt b/Tests/RunCMake/File_Generate/InputAndContent-input.txt
new file mode 100644
index 000000000..73f162ba9
--- /dev/null
+++ b/Tests/RunCMake/File_Generate/InputAndContent-input.txt
@@ -0,0 +1 @@
+INPUT file
diff --git a/Tests/RunCMake/File_Generate/InputAndContent.cmake b/Tests/RunCMake/File_Generate/InputAndContent.cmake
new file mode 100644
index 000000000..9c3977ab3
--- /dev/null
+++ b/Tests/RunCMake/File_Generate/InputAndContent.cmake
@@ -0,0 +1,10 @@
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output-INPUT.txt"
+ INPUT "${CMAKE_CURRENT_SOURCE_DIR}/InputAndContent-input.txt"
+ CONTENT "CONTENT argument"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output-CONTENT.txt"
+ CONTENT "CONTENT argument"
+ INPUT "${CMAKE_CURRENT_SOURCE_DIR}/InputAndContent-input.txt"
+)
diff --git a/Tests/RunCMake/File_Generate/NewLineStyle-NoArg-stderr.txt b/Tests/RunCMake/File_Generate/NewLineStyle-NoArg-stderr.txt
index bc71f2f59..b1b7f80a1 100644
--- a/Tests/RunCMake/File_Generate/NewLineStyle-NoArg-stderr.txt
+++ b/Tests/RunCMake/File_Generate/NewLineStyle-NoArg-stderr.txt
@@ -1,4 +1,7 @@
CMake Error at NewLineStyle-NoArg.cmake:[0-9]+ \(file\):
- file Incorrect arguments to GENERATE subcommand.
+ Error after keyword "NEWLINE_STYLE":
+
+ missing required value
+
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake
index be3bf04dd..5a670ae4f 100644
--- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake
+++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake
@@ -17,6 +17,7 @@ run_cmake(EmptyCondition2)
run_cmake(BadCondition)
run_cmake(DebugEvaluate)
run_cmake(GenerateSource)
+run_cmake(InputAndContent)
run_cmake(OutputNameMatchesSources)
run_cmake(OutputNameMatchesObjects)
run_cmake(OutputNameMatchesOtherSources)
diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
index f479dcf4f..661ae3f30 100644
--- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
@@ -24,6 +24,27 @@ endif()
# We need a real pkg-config to run the test for get_variable.
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
+ string(FIND "${CMAKE_CURRENT_BINARY_DIR}" " " IS_SPACES_IN_PATH)
+ if(IS_SPACES_IN_PATH GREATER -1)
+ string(REPLACE " " "\\ " ESCAPED_ROOT "${CMAKE_CURRENT_BINARY_DIR}")
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_spaces.pc" "
+libdir=${ESCAPED_ROOT}
+Name: test_spaces.pc
+Version: 0.0
+Description: test spaces
+Libs: -L\${libdir}
+")
+ set(PKG_CONFIG_PATH_SAVED "$ENV{PKG_CONFIG_PATH}")
+ set(ENV{PKG_CONFIG_PATH} "${CMAKE_CURRENT_BINARY_DIR}")
+ execute_process(COMMAND "${PKG_CONFIG_EXECUTABLE}" --libs test_spaces
+ ERROR_QUIET COMMAND_ERROR_IS_FATAL ANY
+ OUTPUT_VARIABLE test_spaces_LIBS)
+ set(ENV{PKG_CONFIG_PATH} "${PKG_CONFIG_PATH_SAVED}")
+ string(STRIP "${test_spaces_LIBS}" test_spaces_LIBS_STRIPPED)
+ if(NOT "${test_spaces_LIBS_STRIPPED}" STREQUAL "-L${ESCAPED_ROOT}")
+ set(PKG_CONFIG_DONT_SUPPORT_SPACES_IN_PATH TRUE)
+ endif()
+ endif()
run_cmake(FindPkgConfig_GET_VARIABLE)
run_cmake(FindPkgConfig_GET_VARIABLE_PREFIX_PATH)
run_cmake(FindPkgConfig_GET_VARIABLE_PKGCONFIG_PATH)
@@ -32,5 +53,7 @@ if (PKG_CONFIG_FOUND)
run_cmake(FindPkgConfig_VERSION_OPERATORS)
run_cmake(FindPkgConfig_GET_MATCHING_MODULE_NAME)
run_cmake(FindPkgConfig_empty_target)
- run_cmake(FindPkgConfig_LIBRARY_PATH)
+ if(NOT PKG_CONFIG_DONT_SUPPORT_SPACES_IN_PATH)
+ run_cmake(FindPkgConfig_LIBRARY_PATH)
+ endif()
endif ()
diff --git a/Tests/RunCMake/Framework/FrameworkConsumption.cmake b/Tests/RunCMake/Framework/FrameworkConsumption.cmake
index 466316665..58b70a31c 100644
--- a/Tests/RunCMake/Framework/FrameworkConsumption.cmake
+++ b/Tests/RunCMake/Framework/FrameworkConsumption.cmake
@@ -13,3 +13,21 @@ set_target_properties(Gui PROPERTIES
add_executable(app main.c)
target_link_libraries(app PRIVATE Gui)
+
+
+# Same test but with generation done in custom directories
+add_library(Gui2 SHARED Gui.c "${input_header}")
+set_target_properties(Gui2 PROPERTIES
+ PUBLIC_HEADER "${input_header}"
+ FRAMEWORK TRUE
+ LIBRARY_OUTPUT_DIRECTORY lib
+)
+
+add_executable(app2 main2.c)
+set_target_properties(Gui2 PROPERTIES
+ PUBLIC_HEADER "${input_header}"
+ FRAMEWORK TRUE
+ RUNTIME_OUTPUT_DIRECTORY bin
+)
+
+target_link_libraries(app2 PRIVATE Gui2)
diff --git a/Tests/RunCMake/Framework/main2.c b/Tests/RunCMake/Framework/main2.c
new file mode 100644
index 000000000..11f4e4d53
--- /dev/null
+++ b/Tests/RunCMake/Framework/main2.c
@@ -0,0 +1,9 @@
+
+#include <Gui2/Gui.h>
+
+int main()
+{
+ foo();
+
+ return 0;
+}
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-result.txt b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-stderr.txt b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-stderr.txt
new file mode 100644
index 000000000..fb61d4b8f
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error in CMakeLists.txt:
+ MSVC_DEBUG_INFORMATION_FORMAT value 'BogusValue' not known for this (C|CXX)
+ compiler.
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW.cmake
new file mode 100644
index 000000000..165ea3821
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0141 NEW)
+include(CMP0141-common.cmake)
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NoEffect.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NoEffect.cmake
new file mode 100644
index 000000000..82754a95c
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NoEffect.cmake
@@ -0,0 +1,4 @@
+include(CMP0141-common.cmake)
+
+# Setting this policy after enable_language command has no effect.
+cmake_policy(SET CMP0141 NEW)
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-OLD.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-OLD.cmake
new file mode 100644
index 000000000..7bbe586d7
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0141 OLD)
+include(CMP0141-common.cmake)
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-WARN.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-WARN.cmake
new file mode 100644
index 000000000..912112adc
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-WARN.cmake
@@ -0,0 +1,2 @@
+
+include(CMP0141-common.cmake)
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-common.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-common.cmake
new file mode 100644
index 000000000..8e43a25c5
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-common.cmake
@@ -0,0 +1,31 @@
+enable_language(CXX)
+
+cmake_policy(GET CMP0141 cmp0141)
+if(cmp0141 STREQUAL "NEW")
+ if(NOT CMAKE_MSVC_DEBUG_INFORMATION_FORMAT_DEFAULT)
+ message(SEND_ERROR "CMAKE_MSVC_DEBUG_INFORMATION_FORMAT_DEFAULT not set under NEW behavior")
+ endif()
+else()
+ if(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT_DEFAULT)
+ message(SEND_ERROR "CMAKE_MSVC_DEBUG_INFORMATION_FORMAT_DEFAULT is set under OLD behavior")
+ endif()
+endif()
+
+if(cmp0141 STREQUAL "NEW")
+ if(CMAKE_CXX_FLAGS_DEBUG MATCHES "[/-]Zi( |$)")
+ message(SEND_ERROR "CMAKE_CXX_FLAGS_DEBUG has -Zi flags under NEW behavior.")
+ endif()
+ if(CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "[/-]Zi( |$)")
+ message(SEND_ERROR "CMAKE_CXX_FLAGS_RELWITHDEBINFO has -Zi flags under NEW behavior.")
+ endif()
+else()
+ if(NOT (CMAKE_CXX_FLAGS_DEBUG MATCHES "[/-]Zi( |$)"))
+ message(SEND_ERROR "CMAKE_CXX_FLAGS_DEBUG does not have -Zi flags under OLD behavior.")
+ endif()
+ if(NOT (CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "[/-]Zi( |$)"))
+ message(SEND_ERROR "CMAKE_CXX_FLAGS_RELWITHDEBINFO does not have -Zi flags under OLD behavior.")
+ endif()
+endif()
+
+set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT BogusValue)
+add_library(foo empty.cxx)
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMakeLists.txt b/Tests/RunCMake/MSVCDebugInformationFormat/CMakeLists.txt
new file mode 100644
index 000000000..aba10165b
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.24)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/RunCMakeTest.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/RunCMakeTest.cmake
new file mode 100644
index 000000000..f678acf94
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/RunCMakeTest.cmake
@@ -0,0 +1,6 @@
+include(RunCMake)
+
+run_cmake(CMP0141-WARN)
+run_cmake(CMP0141-OLD)
+run_cmake(CMP0141-NEW)
+run_cmake(CMP0141-NoEffect)
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/empty.cxx b/Tests/RunCMake/MSVCDebugInformationFormat/empty.cxx
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/empty.cxx
diff --git a/Tests/RunCMake/Ninja/QtAutoMocSkipPch.cmake b/Tests/RunCMake/Ninja/QtAutoMocSkipPch.cmake
new file mode 100644
index 000000000..059b91741
--- /dev/null
+++ b/Tests/RunCMake/Ninja/QtAutoMocSkipPch.cmake
@@ -0,0 +1,17 @@
+enable_language(CXX)
+
+set(QtX Qt${with_qt_version})
+
+find_package(${QtX} REQUIRED COMPONENTS Core)
+
+set(CMAKE_AUTOMOC ON)
+
+add_library(simple_lib SHARED simple_lib.cpp)
+add_executable(app_with_qt app.cpp app_qt.cpp)
+
+target_link_libraries(app_with_qt PRIVATE simple_lib ${QtX}::Core)
+
+set_source_files_properties(app.cpp app_qt.cpp
+ PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
+
+target_precompile_headers(app_with_qt PRIVATE [["QObject"]])
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 0825666a0..b94466ce8 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -42,6 +42,15 @@ function(run_Intl)
endfunction()
run_Intl()
+if(WIN32)
+ if(RunCMake_MAKE_PROGRAM)
+ set(maybe_MAKE_PROGRAM "-DRunCMake_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}")
+ endif()
+ run_cmake_script(ShowIncludes-54936 -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
+ run_cmake_script(ShowIncludes-65001 -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
+ unset(maybe_MAKE_PROGRAM)
+endif()
+
function(run_NoWorkToDo)
run_cmake(NoWorkToDo)
set(RunCMake_TEST_NO_CLEAN 1)
@@ -366,6 +375,22 @@ function(run_QtAutoMocDeps)
run_ninja("${RunCMake_TEST_BINARY_DIR}")
endif()
endfunction()
+
+function(run_QtAutoMocSkipPch)
+ set(QtX Qt${CMake_TEST_Qt_version})
+ if(CMake_TEST_${QtX}Core_Version VERSION_GREATER_EQUAL 5.15.0)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/QtAutoMocSkipPch-build)
+ run_cmake_with_options(QtAutoMocSkipPch
+ "-Dwith_qt_version=${CMake_TEST_Qt_version}"
+ "-D${QtX}_DIR=${${QtX}_DIR}"
+ "-D${QtX}Core_DIR=${${QtX}Core_DIR}"
+ "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
+ )
+ # Build the project.
+ run_ninja("${RunCMake_TEST_BINARY_DIR}")
+ endif()
+endfunction()
if(CMake_TEST_Qt_version)
run_QtAutoMocDeps()
+ run_QtAutoMocSkipPch()
endif()
diff --git a/Tests/RunCMake/Ninja/ShowIncludes-54936-check.cmake b/Tests/RunCMake/Ninja/ShowIncludes-54936-check.cmake
new file mode 100644
index 000000000..40bb68f6d
--- /dev/null
+++ b/Tests/RunCMake/Ninja/ShowIncludes-54936-check.cmake
@@ -0,0 +1,3 @@
+# 'cl /showIncludes' prefix with 'VSLANG=2052' and 'chcp 54936'.
+string(ASCII 215 162 210 226 58 32 176 252 186 172 206 196 188 254 58 expect)
+include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes-check.cmake)
diff --git a/Tests/RunCMake/Ninja/ShowIncludes-54936-stdout.txt b/Tests/RunCMake/Ninja/ShowIncludes-54936-stdout.txt
new file mode 100644
index 000000000..42a2f35ac
--- /dev/null
+++ b/Tests/RunCMake/Ninja/ShowIncludes-54936-stdout.txt
@@ -0,0 +1 @@
+-- showIncludes='注意: 包含文件:'
diff --git a/Tests/RunCMake/Ninja/ShowIncludes-54936.cmake b/Tests/RunCMake/Ninja/ShowIncludes-54936.cmake
new file mode 100644
index 000000000..07b4192c7
--- /dev/null
+++ b/Tests/RunCMake/Ninja/ShowIncludes-54936.cmake
@@ -0,0 +1,2 @@
+set(CODEPAGE 54936)
+include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes.cmake)
diff --git a/Tests/RunCMake/Ninja/ShowIncludes-65001-check.cmake b/Tests/RunCMake/Ninja/ShowIncludes-65001-check.cmake
new file mode 100644
index 000000000..c73b7344b
--- /dev/null
+++ b/Tests/RunCMake/Ninja/ShowIncludes-65001-check.cmake
@@ -0,0 +1,3 @@
+# 'cl /showIncludes' prefix with 'VSLANG=2052' and 'chcp 65001'.
+string(ASCII 230 179 168 230 132 143 58 32 229 140 133 229 144 171 230 150 135 228 187 182 58 expect)
+include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes-check.cmake)
diff --git a/Tests/RunCMake/Ninja/ShowIncludes-65001-stdout.txt b/Tests/RunCMake/Ninja/ShowIncludes-65001-stdout.txt
new file mode 100644
index 000000000..42a2f35ac
--- /dev/null
+++ b/Tests/RunCMake/Ninja/ShowIncludes-65001-stdout.txt
@@ -0,0 +1 @@
+-- showIncludes='注意: 包含文件:'
diff --git a/Tests/RunCMake/Ninja/ShowIncludes-65001.cmake b/Tests/RunCMake/Ninja/ShowIncludes-65001.cmake
new file mode 100644
index 000000000..0eebd6165
--- /dev/null
+++ b/Tests/RunCMake/Ninja/ShowIncludes-65001.cmake
@@ -0,0 +1,2 @@
+set(CODEPAGE 65001)
+include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes.cmake)
diff --git a/Tests/RunCMake/Ninja/ShowIncludes-check.cmake b/Tests/RunCMake/Ninja/ShowIncludes-check.cmake
new file mode 100644
index 000000000..304a7f689
--- /dev/null
+++ b/Tests/RunCMake/Ninja/ShowIncludes-check.cmake
@@ -0,0 +1,17 @@
+set(rules_ninja "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/rules.ninja")
+if(NOT EXISTS "${rules_ninja}")
+ set(RunCMake_TEST_FAILED "Generator output file is missing:\n ${rules_ninja}")
+ return()
+endif()
+
+file(READ "${rules_ninja}" rules_ninja)
+if(rules_ninja MATCHES "msvc_deps_prefix = ([^\r\n]*)\n")
+ set(actual "${CMAKE_MATCH_1}")
+endif()
+
+if(NOT actual STREQUAL expect)
+ string(HEX "${actual}" actual_hex)
+ string(HEX "${expect}" expect_hex)
+ set(RunCMake_TEST_FAILED "Expected byte sequence\n '${expect}' (${expect_hex})\nbut got\n '${actual}' (${actual_hex})")
+ return()
+endif()
diff --git a/Tests/RunCMake/Ninja/ShowIncludes-cmake.cmake b/Tests/RunCMake/Ninja/ShowIncludes-cmake.cmake
new file mode 100644
index 000000000..672a89f38
--- /dev/null
+++ b/Tests/RunCMake/Ninja/ShowIncludes-cmake.cmake
@@ -0,0 +1,7 @@
+# Set the console code page.
+execute_process(COMMAND cmd /c chcp "${CODEPAGE}")
+
+if(RunCMake_MAKE_PROGRAM)
+ set(maybe_MAKE_PROGRAM "-DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}")
+endif()
+execute_process(COMMAND "${CMAKE_COMMAND}" . -G Ninja ${maybe_MAKE_PROGRAM})
diff --git a/Tests/RunCMake/Ninja/ShowIncludes.cmake b/Tests/RunCMake/Ninja/ShowIncludes.cmake
new file mode 100644
index 000000000..b9f89fe24
--- /dev/null
+++ b/Tests/RunCMake/Ninja/ShowIncludes.cmake
@@ -0,0 +1,22 @@
+# Create a project to do showIncludes prefix detection.
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt" "
+cmake_minimum_required(VERSION 3.25)
+project(ShowIncludes NONE)
+include(CMakeDetermineCompilerId)
+set(CMAKE_dummy_COMPILER \"${showIncludes}\")
+CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX(dummy \"\")
+set(CMAKE_CL_SHOWINCLUDES_PREFIX \"\${CMAKE_dummy_CL_SHOWINCLUDES_PREFIX}\")
+file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/showIncludes.txt\" \"\${CMAKE_CL_SHOWINCLUDES_PREFIX}\")
+")
+
+if(RunCMake_MAKE_PROGRAM)
+ set(maybe_MAKE_PROGRAM "-DRunCMake_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}")
+endif()
+
+# Run cmake in a new Window to isolate its console code page.
+execute_process(COMMAND cmd /c start /min /wait ""
+ ${CMAKE_COMMAND} -DCODEPAGE=${CODEPAGE} ${maybe_MAKE_PROGRAM} -P ${CMAKE_CURRENT_LIST_DIR}/ShowIncludes-cmake.cmake)
+
+# Print our internal UTF-8 representation of the showIncludes prefix.
+file(READ "${CMAKE_CURRENT_BINARY_DIR}/showIncludes.txt" showIncludes_txt)
+message(STATUS "showIncludes='${showIncludes_txt}'")
diff --git a/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake
new file mode 100644
index 000000000..a1ae6ac99
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake
@@ -0,0 +1,28 @@
+set(expected_compile_commands
+[==[^\[
+{
+ "directory": "[^
+]*(/Tests/RunCMake/NinjaMultiConfig/CompileCommands-build|\\\\Tests\\\\RunCMake\\\\NinjaMultiConfig\\\\CompileCommands-build)",
+ "command": "[^
+]*Debug[^
+]*",
+ "file": "[^
+]*(/Tests/RunCMake/NinjaMultiConfig/main\.c|\\\\Tests\\\\RunCMake\\\\NinjaMultiConfig\\\\main\.c)"
+},
+{
+ "directory": "[^
+]*(/Tests/RunCMake/NinjaMultiConfig/CompileCommands-build|\\\\Tests\\\\RunCMake\\\\NinjaMultiConfig\\\\CompileCommands-build)",
+ "command": "[^
+]*Release[^
+]*",
+ "file": "[^
+]*(/Tests/RunCMake/NinjaMultiConfig/main\.c|\\\\Tests\\\\RunCMake\\\\NinjaMultiConfig\\\\main\.c)"
+}
+]$]==])
+
+file(READ "${RunCMake_TEST_BINARY_DIR}/compile_commands.json" actual_compile_commands)
+if(NOT actual_compile_commands MATCHES "${expected_compile_commands}")
+ string(REPLACE "\n" "\n " expected_compile_commands_formatted "${expected_compile_commands}")
+ string(REPLACE "\n" "\n " actual_compile_commands_formatted "${actual_compile_commands}")
+ string(APPEND RunCMake_TEST_FAILED "Expected compile_commands.json to match:\n ${expected_compile_commands_formatted}\nActual compile_commands.json:\n ${actual_compile_commands_formatted}\n")
+endif()
diff --git a/Tests/RunCMake/NinjaMultiConfig/CompileCommands.cmake b/Tests/RunCMake/NinjaMultiConfig/CompileCommands.cmake
new file mode 100644
index 000000000..fc44d5ad8
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CompileCommands.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+
+add_executable(exe main.c)
diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
index 738bc6c5d..c040e8f1e 100644
--- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
@@ -453,6 +453,11 @@ run_cmake_command(NoUnusedVariables ${CMAKE_COMMAND} ${CMAKE_CURRENT_LIST_DIR}
"-DCMAKE_DEFAULT_BUILD_TYPE=Debug"
"-DCMAKE_DEFAULT_CONFIGS=all"
)
+unset(RunCMake_TEST_BINARY_DIR)
+
+set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release;-DCMAKE_CROSS_CONFIGS=all;-DCMAKE_EXPORT_COMPILE_COMMANDS=ON")
+run_cmake(CompileCommands)
+unset(RunCMake_TEST_OPTIONS)
# CudaSimple uses separable compilation, which is currently only supported on NVCC.
if(CMake_TEST_CUDA)
diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake b/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake
index 1410eae78..df4ef1fcb 100644
--- a/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake
+++ b/Tests/RunCMake/ParseImplicitLinkInfo/ParseImplicitLinkInfo.cmake
@@ -155,6 +155,7 @@ foreach(t ${targets})
cmake_parse_implicit_link_info("${input}" implicit_libs idirs implicit_fwks log
"${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}"
+ LANGUAGE ${lang}
COMPUTE_IMPLICIT_OBJECTS implicit_objs)
set(library_arch)
diff --git a/Tests/RunCMake/PrecompileHeaders/DisabledPch.cmake b/Tests/RunCMake/PrecompileHeaders/DisabledPch.cmake
index 59ee14b9f..18b09c1c1 100644
--- a/Tests/RunCMake/PrecompileHeaders/DisabledPch.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/DisabledPch.cmake
@@ -1,5 +1,4 @@
-cmake_minimum_required(VERSION 3.15)
-project(DisabledPch C)
+enable_language(C)
add_library(foo foo.c)
target_include_directories(foo PUBLIC include)
diff --git a/Tests/RunCMake/PrecompileHeaders/PchDebugGenex.cmake b/Tests/RunCMake/PrecompileHeaders/PchDebugGenex.cmake
index 854689fd8..039a546b6 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchDebugGenex.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchDebugGenex.cmake
@@ -1,5 +1,4 @@
-cmake_minimum_required(VERSION 3.15)
-project(PchDebugGenex C)
+enable_language(C)
add_library(foo foo.c)
target_include_directories(foo PUBLIC include)
diff --git a/Tests/RunCMake/PrecompileHeaders/PchIncludedAllLanguages.cmake b/Tests/RunCMake/PrecompileHeaders/PchIncludedAllLanguages.cmake
index a4554103d..eef189ae6 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchIncludedAllLanguages.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchIncludedAllLanguages.cmake
@@ -1,5 +1,5 @@
-cmake_minimum_required(VERSION 3.15)
-project(PchIncludedAllLanguages C CXX)
+enable_language(C)
+enable_language(CXX)
if(CMAKE_CXX_COMPILE_OPTIONS_USE_PCH)
add_definitions(-DHAVE_PCH_SUPPORT)
diff --git a/Tests/RunCMake/PrecompileHeaders/PchIncludedOneLanguage.cmake b/Tests/RunCMake/PrecompileHeaders/PchIncludedOneLanguage.cmake
index dd582aca8..6c5e89d86 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchIncludedOneLanguage.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchIncludedOneLanguage.cmake
@@ -1,5 +1,5 @@
-cmake_minimum_required(VERSION 3.16)
-project(PchIncludedAllLanguages C CXX)
+enable_language(C)
+enable_language(CXX)
if(CMAKE_CXX_COMPILE_OPTIONS_USE_PCH)
add_definitions(-DHAVE_PCH_SUPPORT)
diff --git a/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake b/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake
index aab20d8f5..c031660f5 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake
@@ -1,5 +1,4 @@
-cmake_minimum_required(VERSION 3.15)
-project(PchInterface C)
+enable_language(C)
add_library(foo foo.c)
target_include_directories(foo PUBLIC include)
diff --git a/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe.cmake b/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe.cmake
index b4fdb712a..ad8a32818 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchLibObjLibExe.cmake
@@ -1,5 +1,4 @@
-cmake_minimum_required(VERSION 3.16)
-project(PchLibObjLibExe CXX)
+enable_language(CXX)
foreach(i 1 2 3)
file(WRITE ${CMAKE_BINARY_DIR}/empty${i}.cpp "void nothing${i}() {}\n")
diff --git a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake
index bb18a6423..d8abf8e09 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake
@@ -1,5 +1,5 @@
-cmake_minimum_required(VERSION 3.15)
-project(PchMultilanguage C CXX)
+enable_language(C)
+enable_language(CXX)
add_executable(foobar
foo.c
diff --git a/Tests/RunCMake/PrecompileHeaders/PchPrologueEpilogue.cmake b/Tests/RunCMake/PrecompileHeaders/PchPrologueEpilogue.cmake
index 3e27620f9..988c4c69f 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchPrologueEpilogue.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchPrologueEpilogue.cmake
@@ -1,6 +1,5 @@
-cmake_minimum_required(VERSION 3.15)
-
-project(PchPrologueEpilogue)
+enable_language(C)
+enable_language(CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/Tests/RunCMake/PrecompileHeaders/PchReuseFrom-CMP0141-NEW-empty.cmake b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom-CMP0141-NEW-empty.cmake
new file mode 100644
index 000000000..41c7d22f3
--- /dev/null
+++ b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom-CMP0141-NEW-empty.cmake
@@ -0,0 +1,4 @@
+cmake_policy(SET CMP0141 NEW)
+set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "")
+string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " -Zi")
+include(PchReuseFrom-common.cmake)
diff --git a/Tests/RunCMake/PrecompileHeaders/PchReuseFrom-CMP0141-NEW.cmake b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom-CMP0141-NEW.cmake
new file mode 100644
index 000000000..daf7a3879
--- /dev/null
+++ b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom-CMP0141-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0141 NEW)
+include(PchReuseFrom-common.cmake)
diff --git a/Tests/RunCMake/PrecompileHeaders/PchReuseFrom-CMP0141-OLD.cmake b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom-CMP0141-OLD.cmake
new file mode 100644
index 000000000..9586887fd
--- /dev/null
+++ b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom-CMP0141-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0141 OLD)
+include(PchReuseFrom-common.cmake)
diff --git a/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom-common.cmake
index f8fba441a..8d5e94507 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom-common.cmake
@@ -1,5 +1,4 @@
-cmake_minimum_required(VERSION 3.15)
-project(PchReuseFrom C)
+enable_language(C)
if(CMAKE_C_COMPILE_OPTIONS_USE_PCH)
add_definitions(-DHAVE_PCH_SUPPORT)
diff --git a/Tests/RunCMake/PrecompileHeaders/PchReuseFromObjLib.cmake b/Tests/RunCMake/PrecompileHeaders/PchReuseFromObjLib.cmake
index ba504a3ef..510877ff0 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchReuseFromObjLib.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchReuseFromObjLib.cmake
@@ -1,6 +1,5 @@
-cmake_minimum_required(VERSION 3.18)
-
-project(PchReuseFromObjLib)
+enable_language(C)
+enable_language(CXX)
set(CMAKE_PCH_WARN_INVALID OFF)
diff --git a/Tests/RunCMake/PrecompileHeaders/PchReuseFromPrefixed.cmake b/Tests/RunCMake/PrecompileHeaders/PchReuseFromPrefixed.cmake
index e306d8e9c..14703e336 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchReuseFromPrefixed.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchReuseFromPrefixed.cmake
@@ -1,5 +1,4 @@
-cmake_minimum_required(VERSION 3.15)
-project(PchReuseFromPrefixed C)
+enable_language(C)
if(CMAKE_C_COMPILE_OPTIONS_USE_PCH)
add_definitions(-DHAVE_PCH_SUPPORT)
diff --git a/Tests/RunCMake/PrecompileHeaders/PchReuseFromSubdir.cmake b/Tests/RunCMake/PrecompileHeaders/PchReuseFromSubdir.cmake
index fff74dcd6..fefb4eeeb 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchReuseFromSubdir.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchReuseFromSubdir.cmake
@@ -1,5 +1,4 @@
-cmake_minimum_required(VERSION 3.15)
-project(PchReuseFromSubdir C)
+enable_language(C)
add_library(empty empty.c)
target_precompile_headers(empty PUBLIC
diff --git a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
index fd41e2f8e..b163369a2 100644
--- a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
@@ -15,7 +15,11 @@ run_test(PchInterface)
run_cmake(PchPrologueEpilogue)
run_test(SkipPrecompileHeaders)
run_test(CXXnotC)
-run_test(PchReuseFrom)
+run_test(PchReuseFrom-CMP0141-OLD)
+run_test(PchReuseFrom-CMP0141-NEW)
+if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
+ run_test(PchReuseFrom-CMP0141-NEW-empty)
+endif()
run_test(PchReuseFromPrefixed)
run_test(PchReuseFromSubdir)
run_cmake(PchMultilanguage)
diff --git a/Tests/RunCMake/PrecompileHeaders/SkipPrecompileHeaders.cmake b/Tests/RunCMake/PrecompileHeaders/SkipPrecompileHeaders.cmake
index 49efbfbab..7405e658c 100644
--- a/Tests/RunCMake/PrecompileHeaders/SkipPrecompileHeaders.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/SkipPrecompileHeaders.cmake
@@ -1,6 +1,5 @@
-cmake_minimum_required(VERSION 3.15)
-
-project(SkipPrecompileHeaders)
+enable_language(C)
+enable_language(CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index 1c92ca0fd..ba9cc3b96 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -1,8 +1,10 @@
-foreach(arg
+foreach(
+ arg
+ IN ITEMS
RunCMake_GENERATOR
RunCMake_SOURCE_DIR
RunCMake_BINARY_DIR
- )
+ )
if(NOT DEFINED ${arg})
message(FATAL_ERROR "${arg} not given!")
endif()
@@ -31,7 +33,7 @@ function(run_cmake test)
set(platform_name msys)
endif()
- foreach(o out err)
+ foreach(o IN ITEMS out err)
if(RunCMake-std${o}-file AND EXISTS ${top_src}/${RunCMake-std${o}-file})
file(READ ${top_src}/${RunCMake-std${o}-file} expect_std${o})
string(REGEX REPLACE "\n+$" "" expect_std${o} "${expect_std${o}}")
@@ -162,6 +164,7 @@ function(run_cmake test)
"|Your license to use PGI[^\n]*expired"
"|Please obtain a new version at"
"|contact PGI Sales at"
+ "|icp?c: remark #10441: The Intel\\(R\\) C\\+\\+ Compiler Classic \\(ICC\\) is deprecated"
"|[^\n]*install_name_tool: warning: changes being made to the file will invalidate the code signature in:"
"|[^\n]*xcodebuild[^\n]*DVTPlugInManager"
@@ -176,7 +179,7 @@ function(run_cmake test)
"|[^\n]*Bullseye Testing Technology"
")[^\n]*\n)+"
)
- foreach(o out err)
+ foreach(o IN ITEMS out err)
string(REGEX REPLACE "\r\n" "\n" actual_std${o} "${actual_std${o}}")
string(REGEX REPLACE "${ignore_line_regex}" "\\1" actual_std${o} "${actual_std${o}}")
string(REGEX REPLACE "\n+$" "" actual_std${o} "${actual_std${o}}")
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
index 97c339450..0d8e4c94f 100644
--- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
+++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
@@ -36,6 +36,7 @@
\* CMP0113
\* CMP0119
\* CMP0131
+ \* CMP0142
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/VS10Project/DebugInformationFormat-check.cmake b/Tests/RunCMake/VS10Project/DebugInformationFormat-check.cmake
new file mode 100644
index 000000000..46af974c7
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/DebugInformationFormat-check.cmake
@@ -0,0 +1,46 @@
+macro(DebugInformationFormat_check tgt Debug_expect Release_expect MinSizeRel_expect RelWithDebInfo_expect)
+ set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/${tgt}.vcxproj")
+ if(NOT EXISTS "${vcProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not exist.")
+ return()
+ endif()
+
+ set(Debug_actual "")
+ set(Release_actual "")
+ set(MinSizeRel_actual "")
+ set(RelWithDebInfo_actual "")
+
+ file(STRINGS "${vcProjectFile}" lines)
+ foreach(line IN LISTS lines)
+ if(line MATCHES "^ *<ItemDefinitionGroup Condition=\"'\\$\\(Configuration\\)\\|\\$\\(Platform\\)'=='([^<>]+)\\|[A-Za-z0-9_]+'\">")
+ set(Configuration "${CMAKE_MATCH_1}")
+ endif()
+ if(line MATCHES "^ *<DebugInformationFormat>([^<>]+)</DebugInformationFormat>")
+ set(${Configuration}_actual "${CMAKE_MATCH_1}")
+ endif()
+ endforeach()
+
+ if (NOT "${Debug_actual}" STREQUAL "${Debug_expect}")
+ set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj Debug Configuration has DebugInformationFormat '${Debug_actual}', not '${Debug_expect}'.")
+ endif()
+ if (NOT "${Release_actual}" STREQUAL "${Release_expect}")
+ set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj Release Configuration has DebugInformationFormat '${Release_actual}', not '${Release_expect}'.")
+ endif()
+ if (NOT "${MinSizeRel_actual}" STREQUAL "${MinSizeRel_expect}")
+ set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj MinSizeRel Configuration has DebugInformationFormat '${MinSizeRel_actual}', not '${MinSizeRel_expect}'.")
+ endif()
+ if (NOT "${RelWithDebInfo_actual}" STREQUAL "${RelWithDebInfo_expect}")
+ set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj RelWithDebInfo Configuration has DebugInformationFormat '${RelWithDebInfo_actual}', not '${RelWithDebInfo_expect}'.")
+ endif()
+endmacro()
+
+DebugInformationFormat_check(default-C ProgramDatabase "" "" ProgramDatabase)
+DebugInformationFormat_check(default-CXX ProgramDatabase "" "" ProgramDatabase)
+DebugInformationFormat_check(empty-C "" "" "" "")
+DebugInformationFormat_check(empty-CXX "" "" "" "")
+DebugInformationFormat_check(Embedded-C OldStyle OldStyle OldStyle OldStyle)
+DebugInformationFormat_check(Embedded-CXX OldStyle OldStyle OldStyle OldStyle)
+DebugInformationFormat_check(ProgramDatabase-C ProgramDatabase ProgramDatabase ProgramDatabase ProgramDatabase)
+DebugInformationFormat_check(ProgramDatabase-CXX ProgramDatabase ProgramDatabase ProgramDatabase ProgramDatabase)
+DebugInformationFormat_check(EditAndContinue-C EditAndContinue EditAndContinue EditAndContinue EditAndContinue)
+DebugInformationFormat_check(EditAndContinue-CXX EditAndContinue EditAndContinue EditAndContinue EditAndContinue)
diff --git a/Tests/RunCMake/VS10Project/DebugInformationFormat.cmake b/Tests/RunCMake/VS10Project/DebugInformationFormat.cmake
new file mode 100644
index 000000000..f6701664c
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/DebugInformationFormat.cmake
@@ -0,0 +1,24 @@
+set(CMAKE_CONFIGURATION_TYPES Debug Release MinSizeRel RelWithDebInfo)
+cmake_policy(SET CMP0141 NEW)
+enable_language(C)
+enable_language(CXX)
+
+add_library(default-C empty.c)
+add_library(default-CXX empty.cxx)
+
+set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "")
+add_library(empty-C empty.c)
+add_library(empty-CXX empty.cxx)
+
+set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "Embedded")
+add_library(Embedded-C empty.c)
+add_library(Embedded-CXX empty.cxx)
+
+set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase")
+add_library(ProgramDatabase-C empty.c)
+add_library(ProgramDatabase-CXX empty.cxx)
+
+add_library(EditAndContinue-C empty.c)
+set_property(TARGET EditAndContinue-C PROPERTY MSVC_DEBUG_INFORMATION_FORMAT "EditAndContinue")
+add_library(EditAndContinue-CXX empty.cxx)
+set_property(TARGET EditAndContinue-CXX PROPERTY MSVC_DEBUG_INFORMATION_FORMAT "EditAndContinue")
diff --git a/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake b/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake
index bcdc10105..1701a36aa 100644
--- a/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake
+++ b/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake
@@ -5,6 +5,7 @@ if(NOT EXISTS "${vcProjectFile}")
endif()
set(found_iface_h 0)
+set(found_int_dir 0)
file(STRINGS "${vcProjectFile}" lines)
foreach(line IN LISTS lines)
if(line MATCHES "<([A-Za-z0-9_]+) +Include=.*iface\\.h")
@@ -19,7 +20,15 @@ foreach(line IN LISTS lines)
endif()
set(found_iface_h 1)
endif()
+ if(line MATCHES "^ *<IntDir [^<>]+>[^<>]+</IntDir>")
+ set(found_int_dir 1)
+ endif()
endforeach()
if(NOT found_iface_h)
set(RunCMake_TEST_FAILED "iface.h not referenced in\n ${vcProjectFile}")
+ return()
+endif()
+if(NOT found_int_dir)
+ set(RunCMake_TEST_FAILED "No references to IntDir in\n ${vcProjectFile}")
+ return()
endif()
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index e540b9fc4..f027e94ed 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -88,3 +88,4 @@ run_cmake(VsDotnetStartupObject)
run_cmake(VsDotnetTargetFramework)
run_cmake(VsDotnetTargetFrameworkVersion)
run_cmake(VsNoCompileBatching)
+run_cmake(DebugInformationFormat)
diff --git a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets-check.cmake b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets-check.cmake
index 100f48287..4d5508da0 100644
--- a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets-check.cmake
+++ b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets-check.cmake
@@ -9,7 +9,7 @@ function(check_file target filename)
if(filename MATCHES "^(.*)(\\.[a-z]+)$")
set(header_filename "${CMAKE_MATCH_1}")
endif()
- set(expected_contents "#include <${header_filename}>\n")
+ set(expected_contents "#include <${header_filename}> // IWYU pragma: associated\n")
file(READ "${full_filename}" actual_contents)
if(NOT actual_contents STREQUAL expected_contents)
diff --git a/Tests/RunCMake/VsDotnetSdk/RunCMakeTest.cmake b/Tests/RunCMake/VsDotnetSdk/RunCMakeTest.cmake
index 9c9074ed7..22e2bb3b5 100644
--- a/Tests/RunCMake/VsDotnetSdk/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VsDotnetSdk/RunCMakeTest.cmake
@@ -4,6 +4,7 @@ include(RunCMake)
run_cmake(VsDotnetSdkCustomCommandsTarget)
run_cmake(VsDotnetSdkCustomCommandsSource)
run_cmake(VsDotnetSdkStartupObject)
+run_cmake(VsDotnetSdkDefines)
run_cmake(DotnetSdkVariables)
function(run_VsDotnetSdk)
diff --git a/Tests/RunCMake/VsDotnetSdk/VsDotnetSdk.cmake b/Tests/RunCMake/VsDotnetSdk/VsDotnetSdk.cmake
index c585f5ece..bd914f821 100644
--- a/Tests/RunCMake/VsDotnetSdk/VsDotnetSdk.cmake
+++ b/Tests/RunCMake/VsDotnetSdk/VsDotnetSdk.cmake
@@ -6,16 +6,22 @@ project (DotNetSdk CSharp)
set(CMAKE_DOTNET_TARGET_FRAMEWORK net472)
set(CMAKE_DOTNET_SDK "Microsoft.NET.Sdk")
+if(CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64")
+ set(VS_RT_IDENTIFIER arm64)
+else()
+ set(VS_RT_IDENTIFIER win10-x64)
+endif()
+
add_library(dotNetSdkLib1 SHARED lib1.cs)
set_target_properties(dotNetSdkLib1
PROPERTIES
- VS_GLOBAL_RuntimeIdentifier win10-x64)
+ VS_GLOBAL_RuntimeIdentifier ${VS_RT_IDENTIFIER})
add_executable(DotNetSdk csharponly.cs)
target_link_libraries(DotNetSdk dotNetSdkLib1)
set_target_properties(DotNetSdk
PROPERTIES
- VS_GLOBAL_RuntimeIdentifier win10-x64
+ VS_GLOBAL_RuntimeIdentifier ${VS_RT_IDENTIFIER}
VS_DOTNET_REFERENCE_SomeDll
${PROJECT_SOURCE_DIR}/SomeDll.dll)
diff --git a/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkDefines-check.cmake b/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkDefines-check.cmake
new file mode 100644
index 000000000..eaeba2439
--- /dev/null
+++ b/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkDefines-check.cmake
@@ -0,0 +1,64 @@
+#
+# Check C# VS project for required elements.
+#
+set(csProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.csproj")
+if(NOT EXISTS "${csProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${csProjectFile} does not exist.")
+ return()
+endif()
+
+
+set(inDebug FALSE)
+set(inRelease FALSE)
+set(debugOK FALSE)
+set(releaseOK FALSE)
+
+
+file(STRINGS "${csProjectFile}" lines)
+foreach(line IN LISTS lines)
+ #message(STATUS ${line})
+ if(line MATCHES "^ *<PropertyGroup .*Debug.*")
+ set(inDebug TRUE)
+ elseif(line MATCHES "^ *<PropertyGroup .*Release.*")
+ set(inRelease TRUE)
+ elseif(line MATCHES "^ *</PropertyGroup> *$")
+ set(inRelease FALSE)
+ set(inDebug FALSE)
+ elseif(inDebug AND
+ (line MATCHES "^ *<DefineConstants>.*MY_FOO_DEFINE.*</DefineConstants> *$") AND
+ (line MATCHES "^ *<DefineConstants>.*DEFINE_ONLY_FOR_DEBUG.*</DefineConstants> *$") AND
+ (NOT (line MATCHES "^ *<DefineConstants>.*DEFINE_ONLY_FOR_RELEASE.*</DefineConstants> *$")) AND
+ (NOT (line MATCHES "^ *<DefineConstants>.*MY_BAR_ASSIGNMENT=bar.*</DefineConstants> *$"))
+ )
+ set(debugOK TRUE)
+ elseif(inRelease AND
+ (line MATCHES "^ *<DefineConstants>.*MY_FOO_DEFINE.*</DefineConstants> *$") AND
+ (line MATCHES "^ *<DefineConstants>.*DEFINE_ONLY_FOR_RELEASE.*</DefineConstants> *$") AND
+ (NOT (line MATCHES "^ *<DefineConstants>.*DEFINE_ONLY_FOR_DEBUG.*</DefineConstants> *$")) AND
+ (NOT (line MATCHES "^ *<DefineConstants>.*MY_BAR_ASSIGNMENT=bar.*</DefineConstants> *$"))
+ )
+ set(releaseOK TRUE)
+ endif()
+endforeach()
+
+function(print_csprojfile)
+ file(STRINGS "${csProjectFile}" lines)
+ foreach(line IN LISTS lines)
+ message(STATUS ${line})
+ endforeach()
+endfunction()
+
+
+if(NOT debugOK)
+ message(STATUS "Failed to set Debug configuration defines correctly.")
+ set(RunCMake_TEST_FAILED "Failed to set Debug configuration defines correctly.")
+ print_csprojfile()
+ return()
+endif()
+
+if(NOT releaseOK)
+ message(STATUS "Failed to set Release configuration defines correctly.")
+ set(RunCMake_TEST_FAILED "Failed to set Release configuration defines correctly.")
+ print_csprojfile()
+ return()
+endif()
diff --git a/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkDefines.cmake b/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkDefines.cmake
new file mode 100644
index 000000000..d89f19b8f
--- /dev/null
+++ b/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkDefines.cmake
@@ -0,0 +1,19 @@
+enable_language(CSharp)
+if(NOT CMAKE_CSharp_COMPILER)
+ return()
+endif()
+
+set(CMAKE_DOTNET_SDK "Microsoft.NET.Sdk")
+set(CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION "net5.0")
+
+add_executable(foo csharponly.cs lib1.cs)
+
+# Issue 23376
+target_compile_definitions(
+ foo
+ PUBLIC
+ MY_FOO_DEFINE
+ "MY_BAR_ASSIGNMENT=bar"
+ $<$<CONFIG:Debug>:DEFINE_ONLY_FOR_DEBUG>
+ $<$<CONFIG:Release>:DEFINE_ONLY_FOR_RELEASE>
+)
diff --git a/Tests/RunCMake/XcodeProject/Clean-build-check.cmake b/Tests/RunCMake/XcodeProject/Clean-build-check.cmake
new file mode 100644
index 000000000..605881a52
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/Clean-build-check.cmake
@@ -0,0 +1,5 @@
+set(pattern "${RunCMake_TEST_BINARY_DIR}/build/empty.build/Debug/Objects-normal/*/empty.o")
+file(GLOB objs "${pattern}")
+if(NOT objs)
+ set(RunCMake_TEST_FAILED "Expected object does not exist:\n ${pattern}")
+endif()
diff --git a/Tests/RunCMake/XcodeProject/Clean-clean-check.cmake b/Tests/RunCMake/XcodeProject/Clean-clean-check.cmake
new file mode 100644
index 000000000..76ea8a14f
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/Clean-clean-check.cmake
@@ -0,0 +1,5 @@
+set(pattern "${RunCMake_TEST_BINARY_DIR}/build/empty.build/Debug/Objects-normal/*/empty.o")
+file(GLOB objs "${pattern}")
+if(objs)
+ set(RunCMake_TEST_FAILED "Object file(s) not cleaned:\n ${objs}")
+endif()
diff --git a/Tests/RunCMake/XcodeProject/Clean.cmake b/Tests/RunCMake/XcodeProject/Clean.cmake
new file mode 100644
index 000000000..1ab7e10c1
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/Clean.cmake
@@ -0,0 +1,2 @@
+enable_language(C)
+add_subdirectory(Clean)
diff --git a/Tests/RunCMake/XcodeProject/Clean/CMakeLists.txt b/Tests/RunCMake/XcodeProject/Clean/CMakeLists.txt
new file mode 100644
index 000000000..59e62cb94
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/Clean/CMakeLists.txt
@@ -0,0 +1 @@
+add_library(empty empty.c)
diff --git a/Tests/RunCMake/XcodeProject/Clean/empty.c b/Tests/RunCMake/XcodeProject/Clean/empty.c
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/Clean/empty.c
diff --git a/Tests/RunCMake/XcodeProject/EffectivePlatformNameOFF.cmake b/Tests/RunCMake/XcodeProject/EffectivePlatformNameOFF.cmake
new file mode 100644
index 000000000..4a3bf561b
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/EffectivePlatformNameOFF.cmake
@@ -0,0 +1,12 @@
+enable_language(CXX)
+
+set_property(GLOBAL PROPERTY XCODE_EMIT_EFFECTIVE_PLATFORM_NAME OFF)
+
+set(CMAKE_MACOSX_BUNDLE true)
+
+add_library(library STATIC foo.cpp)
+
+add_executable(main main.cpp)
+target_link_libraries(main library)
+
+install(TARGETS library ARCHIVE DESTINATION lib)
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index 128a9dcab..573d5f719 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -1,5 +1,14 @@
include(RunCMake)
+function(RunClean)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Clean-build)
+ run_cmake(Clean -DCMAKE_CONFIGURATION_TYPES=Debug)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(Clean-build xcodebuild)
+ run_cmake_command(Clean-clean xcodebuild clean)
+endfunction()
+RunClean()
+
run_cmake(ExplicitCMakeLists)
run_cmake(ImplicitCMakeLists)
run_cmake(InterfaceLibSources)
@@ -346,6 +355,7 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 6)
endif()
if(NOT XCODE_VERSION VERSION_LESS 5)
+ # XcodeMultiplatform
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeMultiplatform-build)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OPTIONS "${IOS_DEPLOYMENT_TARGET}")
@@ -365,6 +375,23 @@ if(NOT XCODE_VERSION VERSION_LESS 5)
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
unset(RunCMake_TEST_OPTIONS)
+
+ # EffectivePlatformNameOFF
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/EffectivePlatformNameOFF-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME=iOS" "-DCMAKE_OSX_SYSROOT=iphonesimulator")
+
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+ run_cmake(EffectivePlatformNameOFF)
+
+ run_cmake_command(EffectivePlatformNameOFF-iphonesimulator-build ${CMAKE_COMMAND} --build .)
+ run_cmake_command(EffectivePlatformNameOFF-iphonesimulator-install ${CMAKE_COMMAND} --build . --target install -- DESTDIR=${RunCMake_TEST_BINARY_DIR}/_install_iphonesimulator)
+
+ unset(RunCMake_TEST_BINARY_DIR)
+ unset(RunCMake_TEST_NO_CLEAN)
+ unset(RunCMake_TEST_OPTIONS)
endif()
if(XCODE_VERSION VERSION_GREATER_EQUAL 8)
diff --git a/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake b/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake
index 71b7d8fae..bec8790f8 100644
--- a/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake
+++ b/Tests/RunCMake/XcodeProject/SearchPaths-check.cmake
@@ -12,6 +12,8 @@ set(found_target_library_FRAMEWORK_SEARCH_PATHS 0)
set(found_inherited_FRAMEWORK_SEARCH_PATHS 0)
set(found_project_LIBRARY_SEARCH_PATHS 0)
set(found_target_library_LIBRARY_SEARCH_PATHS 0)
+set(found_target_cmp0142old_LIBRARY_SEARCH_PATHS 0)
+set(found_target_cmp0142new_LIBRARY_SEARCH_PATHS 0)
set(found_inherited_LIBRARY_SEARCH_PATHS 0)
file(STRINGS "${xcProjectFile}" lines)
foreach(line IN LISTS lines)
@@ -42,6 +44,12 @@ foreach(line IN LISTS lines)
if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathLib/\$\(CONFIGURATION\)\$\(EFFECTIVE_PLATFORM_NAME\)(\\")?","(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathLib(\\")?","\$\(inherited\)"\);]])
set(found_target_library_LIBRARY_SEARCH_PATHS 1)
endif()
+ if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathCMP0142OLD/\$\(CONFIGURATION\)\$\(EFFECTIVE_PLATFORM_NAME\)(\\")?","(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathCMP0142OLD(\\")?","\$\(inherited\)"\);]])
+ set(found_target_cmp0142old_LIBRARY_SEARCH_PATHS 1)
+ endif()
+ if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("(\\")?[^"]*/Tests/RunCMake/XcodeProject/SearchPaths-build/TargetSearchPathCMP0142NEW(\\")?","\$\(inherited\)"\);]])
+ set(found_target_cmp0142new_LIBRARY_SEARCH_PATHS 1)
+ endif()
if(line MATCHES [[LIBRARY_SEARCH_PATHS = \("\$\(inherited\)"\);]])
set(found_inherited_LIBRARY_SEARCH_PATHS 1)
endif()
@@ -68,6 +76,12 @@ endif()
if(NOT found_target_library_LIBRARY_SEARCH_PATHS)
string(APPEND RunCMake_TEST_FAILED "Did not find expected LIBRARY_SEARCH_PATHS for target 'library' in\n ${xcProjectFile}\n")
endif()
+if(NOT found_target_cmp0142old_LIBRARY_SEARCH_PATHS)
+ string(APPEND RunCMake_TEST_FAILED "Did not find expected LIBRARY_SEARCH_PATHS for target 'cmp0142old' in\n ${xcProjectFile}\n")
+endif()
+if(NOT found_target_cmp0142new_LIBRARY_SEARCH_PATHS)
+ string(APPEND RunCMake_TEST_FAILED "Did not find expected LIBRARY_SEARCH_PATHS for target 'cmp0142new' in\n ${xcProjectFile}\n")
+endif()
if(found_inherited_LIBRARY_SEARCH_PATHS)
string(APPEND RunCMake_TEST_FAILED "Found unexpected LIBRARY_SEARCH_PATHS inherited-only value in\n ${xcProjectFile}\n")
endif()
diff --git a/Tests/RunCMake/XcodeProject/SearchPaths.cmake b/Tests/RunCMake/XcodeProject/SearchPaths.cmake
index ef977092b..b4697720d 100644
--- a/Tests/RunCMake/XcodeProject/SearchPaths.cmake
+++ b/Tests/RunCMake/XcodeProject/SearchPaths.cmake
@@ -3,6 +3,8 @@ enable_language(C)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ProjectSearchPath")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathInc/TargetInc.framework")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathLib/TargetLib.framework")
+file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142OLD")
+file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142NEW")
set(CMAKE_XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS "${CMAKE_CURRENT_BINARY_DIR}/ProjectSearchPath")
set(CMAKE_XCODE_ATTRIBUTE_LIBRARY_SEARCH_PATHS "${CMAKE_CURRENT_BINARY_DIR}/ProjectSearchPath")
@@ -19,3 +21,11 @@ target_include_directories(include PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSe
add_executable(library main.c)
target_link_libraries(library PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathLib/TargetLib.framework")
target_link_directories(library PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathLib")
+
+cmake_policy(SET CMP0142 OLD)
+add_executable(cmp0142old main.c)
+target_link_directories(cmp0142old PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142OLD")
+
+cmake_policy(SET CMP0142 NEW)
+add_executable(cmp0142new main.c)
+target_link_directories(cmp0142new PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/TargetSearchPathCMP0142NEW")
diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
index be44ecdbb..6bad52738 100644
--- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
@@ -29,6 +29,8 @@ check_property("UNDEFINED_BEHAVIOUR_SANITIZER" "enableUBSanitizer")
check_property("UNDEFINED_BEHAVIOUR_SANITIZER_STOP" "stopOnEveryUBSanitizerIssue")
check_property("DISABLE_MAIN_THREAD_CHECKER" "disableMainThreadChecker")
check_property("MAIN_THREAD_CHECKER_STOP" "stopOnEveryMainThreadCheckerIssue")
+check_property("DISABLE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION" "enableGPUValidationMode")
+check_property("ENABLE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION" "enableGPUShaderValidationMode")
check_property("MALLOC_SCRIBBLE" "MallocScribble")
check_property("MALLOC_GUARD_EDGES" "MallocGuardEdges")
@@ -43,6 +45,8 @@ check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED" "enableGPUFrameCaptureMo
check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_METAL" "enableGPUFrameCaptureMode=\"1\"")
check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED_MIXED_CASE" "enableGPUFrameCaptureMode=\"3\"")
check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_METAL_MIXED_CASE" "enableGPUFrameCaptureMode=\"1\"")
+check_property("LAUNCH_MODE_AUTO" "launchStyle=\"0\"")
+check_property("LAUNCH_MODE_WAIT" "launchStyle=\"1\"")
check_property("EXECUTABLE" "myExecutable")
check_property("ARGUMENTS" [=["--foo"]=])
diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
index 126a9fc9d..267e3797a 100644
--- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
@@ -32,12 +32,16 @@ function(create_scheme_for_property scheme property value)
set_target_properties(${scheme} PROPERTIES XCODE_SCHEME_${property} "${value}")
endfunction()
+create_scheme_for_property(DISABLE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION ENABLE_GPU_API_VALIDATION OFF)
+create_scheme_for_property(ENABLE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION ENABLE_GPU_SHADER_VALIDATION ON)
create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_1 ENABLE_GPU_FRAME_CAPTURE_MODE 1)
create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_3 ENABLE_GPU_FRAME_CAPTURE_MODE 3)
create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED ENABLE_GPU_FRAME_CAPTURE_MODE Disabled)
create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_METAL ENABLE_GPU_FRAME_CAPTURE_MODE Metal)
create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED_MIXED_CASE ENABLE_GPU_FRAME_CAPTURE_MODE DISAbled)
create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_METAL_MIXED_CASE ENABLE_GPU_FRAME_CAPTURE_MODE METal)
+create_scheme_for_property(LAUNCH_MODE_AUTO LAUNCH_MODE AUTO)
+create_scheme_for_property(LAUNCH_MODE_WAIT LAUNCH_MODE WAIT)
create_scheme_for_property(EXECUTABLE EXECUTABLE myExecutable)
create_scheme_for_property(ARGUMENTS ARGUMENTS "--foo;--bar=baz")
create_scheme_for_property(ENVIRONMENT ENVIRONMENT "FOO=foo;BAR=bar")
diff --git a/Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake b/Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake
index 951e03c8f..ddf45af7f 100644
--- a/Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake
+++ b/Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake
@@ -3,6 +3,7 @@ include(RunCMake)
run_cmake(DoesNotExist)
run_cmake(Missing)
run_cmake(Function)
+run_cmake(System)
macro(run_cmake_install case)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build)
diff --git a/Tests/RunCMake/add_subdirectory/System.cmake b/Tests/RunCMake/add_subdirectory/System.cmake
new file mode 100644
index 000000000..45d7d9aa0
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/System.cmake
@@ -0,0 +1,22 @@
+enable_language(CXX)
+
+add_subdirectory(System SYSTEM)
+
+function(check_target_system target expected_value)
+ get_target_property(var ${target} SYSTEM)
+ if ((var AND NOT expected_value) OR (NOT var AND expected_value))
+ message(SEND_ERROR "\
+The 'SYSTEM' property of ${target} should be ${expected_value}, \
+but got ${var}")
+ endif()
+endfunction()
+
+check_target_system(foo OFF)
+check_target_system(bar ON)
+check_target_system(zot ON)
+check_target_system(subsub1foo OFF)
+check_target_system(subsub1bar ON)
+check_target_system(subsub1zot ON)
+check_target_system(subsub2foo OFF)
+check_target_system(subsub2bar ON)
+check_target_system(subsub2zot ON)
diff --git a/Tests/RunCMake/add_subdirectory/System/CMakeLists.txt b/Tests/RunCMake/add_subdirectory/System/CMakeLists.txt
new file mode 100644
index 000000000..ef74e8003
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/System/CMakeLists.txt
@@ -0,0 +1,11 @@
+project(SystemSub NONE)
+
+add_subdirectory(SubSub1 SYSTEM)
+add_subdirectory(SubSub2)
+
+add_library(bar STATIC bar.cpp)
+
+add_library(foo STATIC foo.cpp)
+set_target_properties(foo PROPERTIES SYSTEM OFF)
+
+add_executable(zot zot.cpp)
diff --git a/Tests/RunCMake/add_subdirectory/System/SubSub1/CMakeLists.txt b/Tests/RunCMake/add_subdirectory/System/SubSub1/CMakeLists.txt
new file mode 100644
index 000000000..291339b8e
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/System/SubSub1/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_library(subsub1bar STATIC bar.cpp)
+
+add_library(subsub1foo STATIC foo.cpp)
+set_target_properties(subsub1foo PROPERTIES SYSTEM OFF)
+
+add_executable(subsub1zot zot.cpp)
diff --git a/Tests/RunCMake/add_subdirectory/System/SubSub1/bar.cpp b/Tests/RunCMake/add_subdirectory/System/SubSub1/bar.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/System/SubSub1/bar.cpp
diff --git a/Tests/RunCMake/add_subdirectory/System/SubSub1/foo.cpp b/Tests/RunCMake/add_subdirectory/System/SubSub1/foo.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/System/SubSub1/foo.cpp
diff --git a/Tests/RunCMake/add_subdirectory/System/SubSub1/zot.cpp b/Tests/RunCMake/add_subdirectory/System/SubSub1/zot.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/System/SubSub1/zot.cpp
diff --git a/Tests/RunCMake/add_subdirectory/System/SubSub2/CMakeLists.txt b/Tests/RunCMake/add_subdirectory/System/SubSub2/CMakeLists.txt
new file mode 100644
index 000000000..5755742d7
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/System/SubSub2/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_library(subsub2bar STATIC bar.cpp)
+
+add_library(subsub2foo STATIC foo.cpp)
+set_target_properties(subsub2foo PROPERTIES SYSTEM OFF)
+
+add_executable(subsub2zot zot.cpp)
diff --git a/Tests/RunCMake/add_subdirectory/System/SubSub2/bar.cpp b/Tests/RunCMake/add_subdirectory/System/SubSub2/bar.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/System/SubSub2/bar.cpp
diff --git a/Tests/RunCMake/add_subdirectory/System/SubSub2/foo.cpp b/Tests/RunCMake/add_subdirectory/System/SubSub2/foo.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/System/SubSub2/foo.cpp
diff --git a/Tests/RunCMake/add_subdirectory/System/SubSub2/zot.cpp b/Tests/RunCMake/add_subdirectory/System/SubSub2/zot.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/System/SubSub2/zot.cpp
diff --git a/Tests/RunCMake/add_subdirectory/System/bar.cpp b/Tests/RunCMake/add_subdirectory/System/bar.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/System/bar.cpp
diff --git a/Tests/RunCMake/add_subdirectory/System/foo.cpp b/Tests/RunCMake/add_subdirectory/System/foo.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/System/foo.cpp
diff --git a/Tests/RunCMake/add_subdirectory/System/zot.cpp b/Tests/RunCMake/add_subdirectory/System/zot.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/System/zot.cpp
diff --git a/Tests/RunCMake/block/CMakeLists.txt b/Tests/RunCMake/block/CMakeLists.txt
new file mode 100644
index 000000000..45cd10ecc
--- /dev/null
+++ b/Tests/RunCMake/block/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.3...3.25)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/block/EndAlone-result.txt b/Tests/RunCMake/block/EndAlone-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/block/EndAlone-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/block/EndAlone-stderr.txt b/Tests/RunCMake/block/EndAlone-stderr.txt
new file mode 100644
index 000000000..a588dd7be
--- /dev/null
+++ b/Tests/RunCMake/block/EndAlone-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at EndAlone.cmake:[0-9]+ \(endblock\):
+ Flow control statements are not properly nested.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/block/EndAlone.cmake b/Tests/RunCMake/block/EndAlone.cmake
new file mode 100644
index 000000000..0c428a90b
--- /dev/null
+++ b/Tests/RunCMake/block/EndAlone.cmake
@@ -0,0 +1 @@
+endblock()
diff --git a/Tests/RunCMake/block/EndAloneWithArgument-result.txt b/Tests/RunCMake/block/EndAloneWithArgument-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/block/EndAloneWithArgument-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/block/EndAloneWithArgument-stderr.txt b/Tests/RunCMake/block/EndAloneWithArgument-stderr.txt
new file mode 100644
index 000000000..c3d25a315
--- /dev/null
+++ b/Tests/RunCMake/block/EndAloneWithArgument-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at EndAloneWithArgument.cmake:[0-9]+ \(endblock\):
+ Flow control statements are not properly nested.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/block/EndAloneWithArgument.cmake b/Tests/RunCMake/block/EndAloneWithArgument.cmake
new file mode 100644
index 000000000..05df5b0d6
--- /dev/null
+++ b/Tests/RunCMake/block/EndAloneWithArgument.cmake
@@ -0,0 +1 @@
+endblock(WRONG_ARG)
diff --git a/Tests/RunCMake/block/EndMissing-result.txt b/Tests/RunCMake/block/EndMissing-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/block/EndMissing-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/block/EndMissing-stderr.txt b/Tests/RunCMake/block/EndMissing-stderr.txt
new file mode 100644
index 000000000..b9739a5be
--- /dev/null
+++ b/Tests/RunCMake/block/EndMissing-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at EndMissing.cmake:[0-9]+ \(block\):
+ Flow control statements are not properly nested.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/block/EndMissing.cmake b/Tests/RunCMake/block/EndMissing.cmake
new file mode 100644
index 000000000..335b64eee
--- /dev/null
+++ b/Tests/RunCMake/block/EndMissing.cmake
@@ -0,0 +1 @@
+block()
diff --git a/Tests/RunCMake/block/EndWithArgument-stderr.txt b/Tests/RunCMake/block/EndWithArgument-stderr.txt
new file mode 100644
index 000000000..758645385
--- /dev/null
+++ b/Tests/RunCMake/block/EndWithArgument-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) in EndWithArgument.cmake:
+ A logical block closing on the line
+
+ .+/Tests/RunCMake/block/EndWithArgument.cmake:[0-9]+ \(endblock\)
+
+ has unexpected arguments.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/block/EndWithArgument.cmake b/Tests/RunCMake/block/EndWithArgument.cmake
new file mode 100644
index 000000000..0641c9a10
--- /dev/null
+++ b/Tests/RunCMake/block/EndWithArgument.cmake
@@ -0,0 +1,2 @@
+block()
+endblock(END_ARG)
diff --git a/Tests/RunCMake/block/InvalidArgument-result.txt b/Tests/RunCMake/block/InvalidArgument-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidArgument-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/block/InvalidArgument-stderr.txt b/Tests/RunCMake/block/InvalidArgument-stderr.txt
new file mode 100644
index 000000000..bee604b89
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidArgument-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at InvalidArgument.cmake:[0-9]+ \(block\):
+ block PROPAGATE cannot be specified without a new scope for VARIABLES
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/block/InvalidArgument.cmake b/Tests/RunCMake/block/InvalidArgument.cmake
new file mode 100644
index 000000000..5269cd077
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidArgument.cmake
@@ -0,0 +1,2 @@
+block(SCOPE_FOR POLICIES PROPAGATE VAR1)
+endblock()
diff --git a/Tests/RunCMake/block/InvalidNesting1-result.txt b/Tests/RunCMake/block/InvalidNesting1-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidNesting1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/block/InvalidNesting1-stderr.txt b/Tests/RunCMake/block/InvalidNesting1-stderr.txt
new file mode 100644
index 000000000..6dfe0e10d
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidNesting1-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at InvalidNesting1.cmake:[0-9]+ \(else\):
+ Flow control statements are not properly nested.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/block/InvalidNesting1.cmake b/Tests/RunCMake/block/InvalidNesting1.cmake
new file mode 100644
index 000000000..27b794463
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidNesting1.cmake
@@ -0,0 +1,6 @@
+
+if (TRUE)
+ block()
+else()
+ endblock()
+endif()
diff --git a/Tests/RunCMake/block/InvalidNesting2-result.txt b/Tests/RunCMake/block/InvalidNesting2-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidNesting2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/block/InvalidNesting2-stderr.txt b/Tests/RunCMake/block/InvalidNesting2-stderr.txt
new file mode 100644
index 000000000..71325b6a9
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidNesting2-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at InvalidNesting2.cmake:[0-9]+ \(endblock\):
+ Flow control statements are not properly nested.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/block/InvalidNesting2.cmake b/Tests/RunCMake/block/InvalidNesting2.cmake
new file mode 100644
index 000000000..ae94cdcb3
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidNesting2.cmake
@@ -0,0 +1,6 @@
+
+block()
+if (TRUE)
+elseif(FALSE)
+endblock()
+endif()
diff --git a/Tests/RunCMake/block/InvalidNesting3-result.txt b/Tests/RunCMake/block/InvalidNesting3-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidNesting3-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/block/InvalidNesting3-stderr.txt b/Tests/RunCMake/block/InvalidNesting3-stderr.txt
new file mode 100644
index 000000000..344a931e6
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidNesting3-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at InvalidNesting3.cmake:[0-9]+ \(endwhile\):
+ Flow control statements are not properly nested.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/block/InvalidNesting3.cmake b/Tests/RunCMake/block/InvalidNesting3.cmake
new file mode 100644
index 000000000..f692d244d
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidNesting3.cmake
@@ -0,0 +1,5 @@
+
+while(TRUE)
+block()
+endwhile()
+endblock()
diff --git a/Tests/RunCMake/block/InvalidNesting4-result.txt b/Tests/RunCMake/block/InvalidNesting4-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidNesting4-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/block/InvalidNesting4-stderr.txt b/Tests/RunCMake/block/InvalidNesting4-stderr.txt
new file mode 100644
index 000000000..44d636462
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidNesting4-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at InvalidNesting4.cmake:[0-9]+ \(endblock\):
+ Flow control statements are not properly nested.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/block/InvalidNesting4.cmake b/Tests/RunCMake/block/InvalidNesting4.cmake
new file mode 100644
index 000000000..6e8e0ae6b
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidNesting4.cmake
@@ -0,0 +1,5 @@
+
+block()
+foreach(item IN ITEMS A B)
+endblock()
+endforeach()
diff --git a/Tests/RunCMake/block/InvalidNesting5-result.txt b/Tests/RunCMake/block/InvalidNesting5-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidNesting5-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/block/InvalidNesting5-stderr.txt b/Tests/RunCMake/block/InvalidNesting5-stderr.txt
new file mode 100644
index 000000000..976d2e1ea
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidNesting5-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at InvalidNesting5.cmake:[0-9]+ \(endfunction\):
+ Flow control statements are not properly nested.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/block/InvalidNesting5.cmake b/Tests/RunCMake/block/InvalidNesting5.cmake
new file mode 100644
index 000000000..0479e8da9
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidNesting5.cmake
@@ -0,0 +1,5 @@
+
+function(FUNC)
+ block()
+endfunction()
+endblock()
diff --git a/Tests/RunCMake/block/InvalidNesting6-result.txt b/Tests/RunCMake/block/InvalidNesting6-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidNesting6-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/block/InvalidNesting6-stderr.txt b/Tests/RunCMake/block/InvalidNesting6-stderr.txt
new file mode 100644
index 000000000..2d67b16b8
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidNesting6-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at InvalidNesting6.cmake:[0-9]+ \(endblock\):
+ Flow control statements are not properly nested.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/block/InvalidNesting6.cmake b/Tests/RunCMake/block/InvalidNesting6.cmake
new file mode 100644
index 000000000..a1cb359bb
--- /dev/null
+++ b/Tests/RunCMake/block/InvalidNesting6.cmake
@@ -0,0 +1,5 @@
+
+ block()
+macro(FUNC)
+endblock()
+endmacro()
diff --git a/Tests/RunCMake/block/MissingArgument-result.txt b/Tests/RunCMake/block/MissingArgument-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/block/MissingArgument-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/block/MissingArgument-stderr.txt b/Tests/RunCMake/block/MissingArgument-stderr.txt
new file mode 100644
index 000000000..d3e63cadf
--- /dev/null
+++ b/Tests/RunCMake/block/MissingArgument-stderr.txt
@@ -0,0 +1,7 @@
+CMake Error at MissingArgument.cmake:[0-9]+ \(block\):
+ Error after keyword "SCOPE_FOR":
+
+ missing required value
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/block/MissingArgument.cmake b/Tests/RunCMake/block/MissingArgument.cmake
new file mode 100644
index 000000000..60188871a
--- /dev/null
+++ b/Tests/RunCMake/block/MissingArgument.cmake
@@ -0,0 +1,2 @@
+block(SCOPE_FOR)
+endblock()
diff --git a/Tests/RunCMake/block/RunCMakeTest.cmake b/Tests/RunCMake/block/RunCMakeTest.cmake
new file mode 100644
index 000000000..4260e76ad
--- /dev/null
+++ b/Tests/RunCMake/block/RunCMakeTest.cmake
@@ -0,0 +1,22 @@
+include(RunCMake)
+
+run_cmake(WrongArgument)
+run_cmake(InvalidArgument)
+run_cmake(MissingArgument)
+run_cmake(WrongScope)
+run_cmake(EndMissing)
+run_cmake(EndWithArgument)
+run_cmake(EndAlone)
+run_cmake(EndAloneWithArgument)
+
+run_cmake(InvalidNesting1)
+run_cmake(InvalidNesting2)
+run_cmake(InvalidNesting3)
+run_cmake(InvalidNesting4)
+run_cmake(InvalidNesting5)
+run_cmake(InvalidNesting6)
+
+run_cmake(Scope)
+run_cmake(Scope-VARIABLES)
+run_cmake(Scope-POLICIES)
+run_cmake(Workflows)
diff --git a/Tests/RunCMake/block/Scope-POLICIES.cmake b/Tests/RunCMake/block/Scope-POLICIES.cmake
new file mode 100644
index 000000000..9536a9975
--- /dev/null
+++ b/Tests/RunCMake/block/Scope-POLICIES.cmake
@@ -0,0 +1,40 @@
+
+set(VAR1 "OUTER1")
+set(VAR2 "OUTER2")
+
+set(VARSUB1 "OUTERSUB1")
+set(VARSUB2 "OUTERSUB2")
+
+cmake_policy(SET CMP0139 NEW)
+
+# create a block with a new scope for policies
+block(SCOPE_FOR POLICIES)
+ set(VAR1 "INNER1")
+ unset(VAR2)
+ set(VAR3 "INNER3")
+ add_subdirectory(Scope)
+
+ cmake_policy(SET CMP0139 OLD)
+endblock()
+
+# check final values for variables
+if(NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "INNER1")
+ message(SEND_ERROR "block/endblock: VAR1 has unexpected value: ${VAR1}")
+endif()
+if(DEFINED VAR2)
+ message(SEND_ERROR "block/endblock: VAR2 is unexpectedly defined: ${VAR2}")
+endif()
+if(NOT DEFINED VAR3 OR NOT VAR3 STREQUAL "INNER3")
+ message(SEND_ERROR "block/endblock: VAR3 has unexpected value: ${VAR3}")
+endif()
+if(NOT DEFINED VARSUB1 OR NOT VARSUB1 STREQUAL "SUBDIR1")
+ message(SEND_ERROR "block/endblock: VARSUB1 has unexpected value: ${VARSUB1}")
+endif()
+if(NOT DEFINED VARSUB2 OR NOT VARSUB2 STREQUAL "SUBDIR2")
+ message(SEND_ERROR "block/endblock: VARSUB2 has unexpected value: ${VARSUB2}")
+endif()
+
+cmake_policy(GET CMP0139 CMP0139_STATUS)
+if(NOT CMP0139_STATUS STREQUAL "NEW")
+ message(SEND_ERROR "block/endblock: CMP0139 has unexpected value: ${CMP0139_STATUS}")
+endif()
diff --git a/Tests/RunCMake/block/Scope-VARIABLES.cmake b/Tests/RunCMake/block/Scope-VARIABLES.cmake
new file mode 100644
index 000000000..ac8da140c
--- /dev/null
+++ b/Tests/RunCMake/block/Scope-VARIABLES.cmake
@@ -0,0 +1,62 @@
+
+set(VAR1 "OUTER1")
+set(VAR2 "OUTER2")
+set(VAR3 "OUTER3")
+set(VAR4 "OUTER4")
+set(VAR5 "OUTER5")
+
+set(VAR6 "CACHE6" CACHE STRING "")
+set(VAR6 "OUTER6")
+
+set(VARSUB1 "OUTERSUB1")
+set(VARSUB2 "OUTERSUB2")
+
+cmake_policy(SET CMP0139 NEW)
+
+# create a block with a new scope for variables
+block(SCOPE_FOR VARIABLES PROPAGATE VAR3 VAR4 VAR5 VAR6 VAR7 VARSUB2)
+ set(VAR1 "INNER1")
+ set(VAR2 "INNER2" PARENT_SCOPE)
+ set(VAR3 "INNER3")
+ unset(VAR4)
+ unset(VAR6)
+ set(VAR7 "INNER7")
+ add_subdirectory(Scope)
+
+ cmake_policy(SET CMP0139 OLD)
+endblock()
+
+# check final values for variables
+if(NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "OUTER1")
+ message(SEND_ERROR "block/endblock: VAR1 has unexpected value: ${VAR1}")
+endif()
+if(NOT DEFINED VAR2 OR NOT VAR2 STREQUAL "INNER2")
+ message(SEND_ERROR "block/endblock: VAR2 has unexpected value: ${VAR2}")
+endif()
+if(NOT DEFINED VAR3 OR NOT VAR3 STREQUAL "INNER3")
+ message(SEND_ERROR "block/endblock: VAR3 has unexpected value: ${VAR3}")
+endif()
+if(DEFINED VAR4)
+ message(SEND_ERROR "block/endblock: VAR4 is unexpectedly defined: ${VAR4}")
+endif()
+if(NOT DEFINED VAR5 OR NOT VAR5 STREQUAL "OUTER5")
+ message(SEND_ERROR "block/endblock: VAR5 has unexpected value: ${VAR5}")
+endif()
+unset(VAR6 CACHE)
+if (DEFINED VAR6)
+ message(SEND_ERROR "block/endblock: VAR6 is unexpectedly defined: ${VAR6}")
+endif()
+if(NOT DEFINED VAR7 OR NOT VAR7 STREQUAL "INNER7")
+ message(SEND_ERROR "block/endblock: VAR7 has unexpected value: ${VAR7}")
+endif()
+if(NOT DEFINED VARSUB1 OR NOT VARSUB1 STREQUAL "OUTERSUB1")
+ message(SEND_ERROR "block/endblock: VARSUB1 has unexpected value: ${VARSUB1}")
+endif()
+if(NOT DEFINED VARSUB2 OR NOT VARSUB2 STREQUAL "SUBDIR2")
+ message(SEND_ERROR "block/endblock: VARSUB2 has unexpected value: ${VARSUB2}")
+endif()
+
+cmake_policy(GET CMP0139 CMP0139_STATUS)
+if(NOT CMP0139_STATUS STREQUAL "OLD")
+ message(SEND_ERROR "block/endblock: CMP0139 has unexpected value: ${CMP0139_STATUS}")
+endif()
diff --git a/Tests/RunCMake/block/Scope.cmake b/Tests/RunCMake/block/Scope.cmake
new file mode 100644
index 000000000..ef43df604
--- /dev/null
+++ b/Tests/RunCMake/block/Scope.cmake
@@ -0,0 +1,62 @@
+
+set(VAR1 "OUTER1")
+set(VAR2 "OUTER2")
+set(VAR3 "OUTER3")
+set(VAR4 "OUTER4")
+set(VAR5 "OUTER5")
+
+set(VAR6 "CACHE6" CACHE STRING "")
+set(VAR6 "OUTER6")
+
+set(VARSUB1 "OUTERSUB1")
+set(VARSUB2 "OUTERSUB2")
+
+cmake_policy(SET CMP0139 NEW)
+
+# create a block with a new scope for variables and policies
+block(PROPAGATE VAR3 VAR4 VAR5 VAR6 VAR7 VARSUB2)
+ set(VAR1 "INNER1")
+ set(VAR2 "INNER2" PARENT_SCOPE)
+ set(VAR3 "INNER3")
+ unset(VAR4)
+ unset(VAR6)
+ set(VAR7 "INNER7")
+ add_subdirectory(Scope)
+
+ cmake_policy(SET CMP0139 OLD)
+endblock()
+
+# check final values for variables
+if(NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "OUTER1")
+ message(SEND_ERROR "block/endblock: VAR1 has unexpected value: ${VAR1}")
+endif()
+if(NOT DEFINED VAR2 OR NOT VAR2 STREQUAL "INNER2")
+ message(SEND_ERROR "block/endblock: VAR2 has unexpected value: ${VAR2}")
+endif()
+if(NOT DEFINED VAR3 OR NOT VAR3 STREQUAL "INNER3")
+ message(SEND_ERROR "block/endblock: VAR3 has unexpected value: ${VAR3}")
+endif()
+if(DEFINED VAR4)
+ message(SEND_ERROR "block/endblock: VAR4 is unexpectedly defined: ${VAR4}")
+endif()
+if(NOT DEFINED VAR5 OR NOT VAR5 STREQUAL "OUTER5")
+ message(SEND_ERROR "block/endblock: VAR5 has unexpected value: ${VAR5}")
+endif()
+unset(VAR6 CACHE)
+if (DEFINED VAR6)
+ message(SEND_ERROR "block/endblock: VAR6 is unexpectedly defined: ${VAR6}")
+endif()
+if(NOT DEFINED VAR7 OR NOT VAR7 STREQUAL "INNER7")
+ message(SEND_ERROR "block/endblock: VAR6 has unexpected value: ${VAR7}")
+endif()
+if(NOT DEFINED VARSUB1 OR NOT VARSUB1 STREQUAL "OUTERSUB1")
+ message(SEND_ERROR "block/endblock: VARSUB1 has unexpected value: ${VARSUB1}")
+endif()
+if(NOT DEFINED VARSUB2 OR NOT VARSUB2 STREQUAL "SUBDIR2")
+ message(SEND_ERROR "block/endblock: VARSUB2 has unexpected value: ${VARSUB2}")
+endif()
+
+cmake_policy(GET CMP0139 CMP0139_STATUS)
+if(NOT CMP0139_STATUS STREQUAL "NEW")
+ message(SEND_ERROR "block/endblock: CMP0139 has unexpected value: ${CMP0139_STATUS}")
+endif()
diff --git a/Tests/RunCMake/block/Scope/CMakeLists.txt b/Tests/RunCMake/block/Scope/CMakeLists.txt
new file mode 100644
index 000000000..afd79e301
--- /dev/null
+++ b/Tests/RunCMake/block/Scope/CMakeLists.txt
@@ -0,0 +1,2 @@
+set(VARSUB1 "SUBDIR1" PARENT_SCOPE)
+set(VARSUB2 "SUBDIR2" PARENT_SCOPE)
diff --git a/Tests/RunCMake/block/Workflows.cmake b/Tests/RunCMake/block/Workflows.cmake
new file mode 100644
index 000000000..cbf032eb4
--- /dev/null
+++ b/Tests/RunCMake/block/Workflows.cmake
@@ -0,0 +1,78 @@
+
+set(VAR1 "OUTER1")
+set(VAR2 "OUTER2")
+set(VAR3 "OUTER3")
+
+while (TRUE)
+ # create a block with a new scope for variables
+ block(SCOPE_FOR VARIABLES PROPAGATE VAR3)
+ set(VAR2 "INNER2" PARENT_SCOPE)
+ set(VAR3 "INNER3")
+ break()
+ endblock()
+endwhile()
+
+# check final values for variables
+if(NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "OUTER1")
+ message(SEND_ERROR "block/endblock: VAR1 has unexpected value: ${VAR1}")
+endif()
+if(NOT DEFINED VAR2 OR NOT VAR2 STREQUAL "INNER2")
+ message(SEND_ERROR "block/endblock: VAR2 has unexpected value: ${VAR2}")
+endif()
+if(NOT DEFINED VAR3 OR NOT VAR3 STREQUAL "INNER3")
+ message(SEND_ERROR "block/endblock: VAR3 has unexpected value: ${VAR3}")
+endif()
+
+
+
+set(VAR1 "OUTER1")
+set(VAR2 "OUTER2")
+set(VAR3 "OUTER3")
+
+function (OUTER)
+ # create a block with a new scope for variables
+ block(SCOPE_FOR VARIABLES PROPAGATE VAR3)
+ set(VAR2 "INNER2" PARENT_SCOPE)
+ set(VAR3 "INNER3")
+ return()
+ endblock()
+ set(VAR1 "INNER1" PARENT_SCOPE)
+endfunction()
+outer()
+
+# check final values for variables
+if(NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "OUTER1")
+ message(SEND_ERROR "block/endblock: VAR1 has unexpected value: ${VAR1}")
+endif()
+if(NOT DEFINED VAR2 OR NOT VAR2 STREQUAL "OUTER2")
+ message(SEND_ERROR "block/endblock: VAR2 has unexpected value: ${VAR2}")
+endif()
+if(NOT DEFINED VAR3 OR NOT VAR3 STREQUAL "OUTER3")
+ message(SEND_ERROR "block/endblock: VAR3 has unexpected value: ${VAR3}")
+endif()
+
+
+
+set(VAR1 "OUTER1")
+set(VAR2 "OUTER2")
+set(VAR3 "OUTER3")
+
+foreach (id IN ITEMS 1 2 3)
+ # create a block with a new scope for variables
+ block(SCOPE_FOR VARIABLES PROPAGATE VAR${id})
+ set(VAR${id} "INNER${id}")
+ continue()
+ set(VAR${id} "BAD${id}")
+ endblock()
+endforeach()
+
+# check final values for variables
+if(NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "INNER1")
+ message(SEND_ERROR "block/endblock: VAR1 has unexpected value: ${VAR1}")
+endif()
+if(NOT DEFINED VAR2 OR NOT VAR2 STREQUAL "INNER2")
+ message(SEND_ERROR "block/endblock: VAR2 has unexpected value: ${VAR2}")
+endif()
+if(NOT DEFINED VAR3 OR NOT VAR3 STREQUAL "INNER3")
+ message(SEND_ERROR "block/endblock: VAR3 has unexpected value: ${VAR3}")
+endif()
diff --git a/Tests/RunCMake/block/WrongArgument-result.txt b/Tests/RunCMake/block/WrongArgument-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/block/WrongArgument-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/block/WrongArgument-stderr.txt b/Tests/RunCMake/block/WrongArgument-stderr.txt
new file mode 100644
index 000000000..56faea70c
--- /dev/null
+++ b/Tests/RunCMake/block/WrongArgument-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at WrongArgument.cmake:[0-9]+ \(block\):
+ block called with unsupported argument "WRONG_ARG"
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/block/WrongArgument.cmake b/Tests/RunCMake/block/WrongArgument.cmake
new file mode 100644
index 000000000..e46086656
--- /dev/null
+++ b/Tests/RunCMake/block/WrongArgument.cmake
@@ -0,0 +1,2 @@
+block(WRONG_ARG)
+endblock()
diff --git a/Tests/RunCMake/block/WrongScope-result.txt b/Tests/RunCMake/block/WrongScope-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/block/WrongScope-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/block/WrongScope-stderr.txt b/Tests/RunCMake/block/WrongScope-stderr.txt
new file mode 100644
index 000000000..dd2a1efbe
--- /dev/null
+++ b/Tests/RunCMake/block/WrongScope-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at WrongScope.cmake:[0-9]+ \(block\):
+ block SCOPE_FOR unsupported scope "WRONG_SCOPE"
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/block/WrongScope.cmake b/Tests/RunCMake/block/WrongScope.cmake
new file mode 100644
index 000000000..97a6783a6
--- /dev/null
+++ b/Tests/RunCMake/block/WrongScope.cmake
@@ -0,0 +1,2 @@
+block(SCOPE_FOR WRONG_SCOPE)
+endblock()
diff --git a/Tests/RunCMake/cmake_host_system_information/Registry_BadQuery2-stderr.txt b/Tests/RunCMake/cmake_host_system_information/Registry_BadQuery2-stderr.txt
index 6a430f181..ea1566d9a 100644
--- a/Tests/RunCMake/cmake_host_system_information/Registry_BadQuery2-stderr.txt
+++ b/Tests/RunCMake/cmake_host_system_information/Registry_BadQuery2-stderr.txt
@@ -1,5 +1,7 @@
CMake Error at Registry_BadQuery2.cmake:[0-9]+ \(cmake_host_system_information\):
- cmake_host_system_information missing expected value for argument\(s\)
- "VALUE".
+ Error after keyword "VALUE":
+
+ missing required value
+
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/cmake_host_system_information/Registry_BadView1-stderr.txt b/Tests/RunCMake/cmake_host_system_information/Registry_BadView1-stderr.txt
index 5eda4ffb7..f8c96d8ff 100644
--- a/Tests/RunCMake/cmake_host_system_information/Registry_BadView1-stderr.txt
+++ b/Tests/RunCMake/cmake_host_system_information/Registry_BadView1-stderr.txt
@@ -1,5 +1,7 @@
CMake Error at Registry_BadView1.cmake:[0-9]+ \(cmake_host_system_information\):
- cmake_host_system_information missing expected value for argument\(s\)
- "VIEW".
+ Error after keyword "VIEW":
+
+ missing required value
+
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake
index 6480b2e0c..38ce10bbd 100644
--- a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake
+++ b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake
@@ -8,6 +8,7 @@ foreach(command IN ITEMS
"if" "elseif" "else" "endif"
"while" "endwhile"
"foreach" "endforeach"
+ "block" "endblock"
)
message(STATUS "Running call_invalid_command for ${command}...")
run_cmake_with_options(call_invalid_command -Dcommand=${command})
@@ -42,6 +43,7 @@ foreach(command IN ITEMS
"if" "elseif" "else" "endif"
"while" "endwhile"
"foreach" "endforeach"
+ "block" "endblock"
"return"
)
message(STATUS "Running defer_call_invalid_command for ${command}...")
@@ -82,3 +84,61 @@ run_cmake(defer_get_call_id_var)
run_cmake(defer_missing_arg)
run_cmake(defer_missing_call)
run_cmake(defer_unknown_option)
+
+# Default log level
+run_cmake_command(
+ get_message_log_level_none
+ ${CMAKE_COMMAND}
+ -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake
+ )
+
+# Log level from cache
+run_cmake_command(
+ get_message_log_level_cache
+ ${CMAKE_COMMAND}
+ -DCMAKE_MESSAGE_LOG_LEVEL=TRACE
+ -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake
+ )
+
+# Log level from regular variable
+run_cmake_command(
+ get_message_log_level_var
+ ${CMAKE_COMMAND}
+ -DNEW_LOG_LEVEL=TRACE
+ -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake
+ )
+
+# Log level from command line
+run_cmake_command(
+ get_message_log_level_cli
+ ${CMAKE_COMMAND}
+ --log-level=DEBUG
+ -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake
+ )
+
+# Log level from command line, it has higher priority over a cache variable
+run_cmake_command(
+ get_message_log_level_cli_and_cache
+ ${CMAKE_COMMAND}
+ --log-level=DEBUG
+ -DCMAKE_MESSAGE_LOG_LEVEL=TRACE
+ -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake
+ )
+
+# Log level from command line, it has higher priority over a regular variable
+run_cmake_command(
+ get_message_log_level_cli_and_var
+ ${CMAKE_COMMAND}
+ --log-level=DEBUG
+ -DNEW_LOG_LEVEL=TRACE
+ -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake
+ )
+
+# Log level from variable, it has higher priority over a cache variable
+run_cmake_command(
+ get_message_log_level_var_and_cache
+ ${CMAKE_COMMAND}
+ -DNEW_LOG_LEVEL=DEBUG
+ -DCMAKE_MESSAGE_LOG_LEVEL=TRACE
+ -P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake
+ )
diff --git a/Tests/RunCMake/cmake_language/get_message_log_level.cmake b/Tests/RunCMake/cmake_language/get_message_log_level.cmake
new file mode 100644
index 000000000..1740c1f70
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/get_message_log_level.cmake
@@ -0,0 +1,5 @@
+if(NEW_LOG_LEVEL)
+ set(CMAKE_MESSAGE_LOG_LEVEL "${NEW_LOG_LEVEL}")
+endif()
+cmake_language(GET_MESSAGE_LOG_LEVEL log_level)
+message(STATUS "log level is: ${log_level}")
diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_cache-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_cache-stdout.txt
new file mode 100644
index 000000000..cf1cd7b1c
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/get_message_log_level_cache-stdout.txt
@@ -0,0 +1 @@
+log level is: TRACE
diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_cli-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_cli-stdout.txt
new file mode 100644
index 000000000..4d6e1ebe0
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/get_message_log_level_cli-stdout.txt
@@ -0,0 +1 @@
+log level is: DEBUG
diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_cli_and_cache-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_cli_and_cache-stdout.txt
new file mode 100644
index 000000000..4d6e1ebe0
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/get_message_log_level_cli_and_cache-stdout.txt
@@ -0,0 +1 @@
+log level is: DEBUG
diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_cli_and_var-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_cli_and_var-stdout.txt
new file mode 100644
index 000000000..4d6e1ebe0
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/get_message_log_level_cli_and_var-stdout.txt
@@ -0,0 +1 @@
+log level is: DEBUG
diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_none-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_none-stdout.txt
new file mode 100644
index 000000000..92ffd3497
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/get_message_log_level_none-stdout.txt
@@ -0,0 +1 @@
+log level is: STATUS
diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_var-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_var-stdout.txt
new file mode 100644
index 000000000..cf1cd7b1c
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/get_message_log_level_var-stdout.txt
@@ -0,0 +1 @@
+log level is: TRACE
diff --git a/Tests/RunCMake/cmake_language/get_message_log_level_var_and_cache-stdout.txt b/Tests/RunCMake/cmake_language/get_message_log_level_var_and_cache-stdout.txt
new file mode 100644
index 000000000..4d6e1ebe0
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/get_message_log_level_var_and_cache-stdout.txt
@@ -0,0 +1 @@
+log level is: DEBUG
diff --git a/Tests/RunCMake/cmake_path/BASE_DIRECTORY-no-arg-stderr.txt b/Tests/RunCMake/cmake_path/BASE_DIRECTORY-no-arg-stderr.txt
new file mode 100644
index 000000000..ad7d134f0
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/BASE_DIRECTORY-no-arg-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\):
+ Error after keyword "BASE_DIRECTORY":
+
+ missing required value
diff --git a/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-empty-stderr.txt b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-empty-stderr.txt
new file mode 100644
index 000000000..f1b52cc4a
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-empty-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at .+/call-cmake_path.cmake:[0-9]+ \(cmake_path\):
+ Error after keyword "OUTPUT_VARIABLE":
+
+ empty string not allowed
diff --git a/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt
index e1d6592cf..63289ef85 100644
--- a/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt
+++ b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt
@@ -1,2 +1,4 @@
CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\):
- cmake_path OUTPUT_VARIABLE requires an argument.
+ Error after keyword "OUTPUT_VARIABLE":
+
+ missing required value
diff --git a/Tests/RunCMake/cmake_path/RunCMakeTest.cmake b/Tests/RunCMake/cmake_path/RunCMakeTest.cmake
index 991f46b09..1742b0662 100644
--- a/Tests/RunCMake/cmake_path/RunCMakeTest.cmake
+++ b/Tests/RunCMake/cmake_path/RunCMakeTest.cmake
@@ -74,6 +74,14 @@ foreach (command IN ITEMS APPEND APPEND_STRING REMOVE_FILENAME REPLACE_FILENAME
endforeach()
+## BASE_DIRECTORY without argument
+set (RunCMake-stderr-file "BASE_DIRECTORY-no-arg-stderr.txt")
+
+foreach (command IN ITEMS RELATIVE_PATH ABSOLUTE_PATH)
+ run_cmake_command (${command}-OUTPUT_VARIABLE-no-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path BASE_DIRECTORY" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+
## Invalid output variable
set (RunCMake-stderr-file "invalid-output-var-stderr.txt")
@@ -106,6 +114,9 @@ foreach (command IN ITEMS NATIVE_PATH
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()
+# OUTPUT_VARIABLE empty name
+set (RunCMake-stderr-file "OUTPUT_VARIABLE-empty-stderr.txt")
+
foreach (command IN ITEMS APPEND APPEND_STRING REMOVE_FILENAME REPLACE_FILENAME
REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH
RELATIVE_PATH ABSOLUTE_PATH)
diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-result.txt b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-result.txt
new file mode 100644
index 000000000..573541ac9
--- /dev/null
+++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-stdout.txt b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-stdout.txt
new file mode 100644
index 000000000..a7eae0583
--- /dev/null
+++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop-stdout.txt
@@ -0,0 +1 @@
+CTEST_TEST_VAR=set-via-ENVIRONMENT-property
diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop.cmake b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop.cmake
new file mode 100644
index 000000000..51e7f2aab
--- /dev/null
+++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-prop.cmake
@@ -0,0 +1,9 @@
+include(CTest)
+
+add_test(NAME cmake_environment COMMAND "${CMAKE_COMMAND}" -E environment)
+set_tests_properties(
+ cmake_environment
+ PROPERTIES
+ ENVIRONMENT "CTEST_TEST_VAR=set-via-ENVIRONMENT-property"
+ ENVIRONMENT_MODIFICATION "CTEST_TEST_VAR=set:set-via-ENVIRONMENT_MODIFICATION;CTEST_TEST_VAR=reset:"
+)
diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-result.txt b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-result.txt
new file mode 100644
index 000000000..573541ac9
--- /dev/null
+++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-stdout.txt b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-stdout.txt
new file mode 100644
index 000000000..beaf133ec
--- /dev/null
+++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system-stdout.txt
@@ -0,0 +1 @@
+CTEST_TEST_VAR=set-via-system-environment
diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system.cmake b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system.cmake
new file mode 100644
index 000000000..23268aac3
--- /dev/null
+++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-reset-to-system.cmake
@@ -0,0 +1,9 @@
+include(CTest)
+
+add_test(NAME cmake_environment COMMAND "${CMAKE_COMMAND}" -E environment)
+set_tests_properties(
+ cmake_environment
+ PROPERTIES
+ # ENVIRONMENT "CTEST_TEST_VAR=set-via-ENVIRONMENT-property"
+ ENVIRONMENT_MODIFICATION "CTEST_TEST_VAR=set:set-via-ENVIRONMENT_MODIFICATION;CTEST_TEST_VAR=reset:"
+)
diff --git a/Tests/RunCMake/ctest_environment/RunCMakeTest.cmake b/Tests/RunCMake/ctest_environment/RunCMakeTest.cmake
index 3447779f3..365c9e833 100644
--- a/Tests/RunCMake/ctest_environment/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_environment/RunCMakeTest.cmake
@@ -10,3 +10,7 @@ set(RunCTest_VERBOSE_FLAG "-VV")
run_ctest(ENVIRONMENT_MODIFICATION-invalid-op)
run_ctest(ENVIRONMENT_MODIFICATION-no-colon)
run_ctest(ENVIRONMENT_MODIFICATION-no-equals)
+
+set(ENV{CTEST_TEST_VAR} set-via-system-environment)
+run_ctest(ENVIRONMENT_MODIFICATION-reset-to-prop)
+run_ctest(ENVIRONMENT_MODIFICATION-reset-to-system)
diff --git a/Tests/RunCMake/ctest_memcheck/testCudaSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testCudaSanitizer.cmake
index adc7a1a36..850f72cc0 100644
--- a/Tests/RunCMake/ctest_memcheck/testCudaSanitizer.cmake
+++ b/Tests/RunCMake/ctest_memcheck/testCudaSanitizer.cmake
@@ -277,3 +277,12 @@ file(APPEND "${LOG_FILE}"
=========
========= RACECHECK SUMMARY: 12 hazards displayed (0 errors, 12 warnings)
")
+
+# false-positives
+file(APPEND "${LOG_FILE}"
+"========= COMPUTE-SANITIZER
+========= Error: Target application terminated before first instrumented API call
+========= Tracking kernels launched by child processes requires the --target-processes all option.
+========= Error: No attachable process found. compute-sanitizer timed-out.
+========= Default timeout can be adjusted with --launch-timeout. Awaiting target completion.
+")
diff --git a/Tests/RunCMake/execute_process/EchoCommand3-stderr.txt b/Tests/RunCMake/execute_process/EchoCommand3-stderr.txt
index e27f1e6d2..62cad521f 100644
--- a/Tests/RunCMake/execute_process/EchoCommand3-stderr.txt
+++ b/Tests/RunCMake/execute_process/EchoCommand3-stderr.txt
@@ -1,2 +1,4 @@
CMake Error at .*EchoCommand.cmake:.*\(execute_process\):
- execute_process called with no value for COMMAND_ECHO.
+ Error after keyword "COMMAND_ECHO":
+
+ missing required value
diff --git a/Tests/RunCMake/execute_process/EncodingMissing-stderr.txt b/Tests/RunCMake/execute_process/EncodingMissing-stderr.txt
index 1a695790f..7f85654c6 100644
--- a/Tests/RunCMake/execute_process/EncodingMissing-stderr.txt
+++ b/Tests/RunCMake/execute_process/EncodingMissing-stderr.txt
@@ -1,4 +1,7 @@
^CMake Error at EncodingMissing.cmake:[0-9]+ \(execute_process\):
- execute_process called with no value for ENCODING.
+ Error after keyword "ENCODING":
+
+ missing required value
+
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt
deleted file mode 100644
index b22387bbd..000000000
--- a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-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
deleted file mode 100644
index b49583d5c..000000000
--- a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-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-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt
deleted file mode 100644
index 8d09e3510..000000000
--- a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-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
deleted file mode 100644
index 36915c15b..000000000
--- a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-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-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt
deleted file mode 100644
index 84ba2a299..000000000
--- a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-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
deleted file mode 100644
index 22cab0b14..000000000
--- a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-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-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt
deleted file mode 100644
index 2c248f8bf..000000000
--- a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-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
deleted file mode 100644
index 8b6210651..000000000
--- a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-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-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt
deleted file mode 100644
index a18609f2c..000000000
--- a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-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
deleted file mode 100644
index 9fbd3599d..000000000
--- a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-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
deleted file mode 100644
index 87e3e5766..000000000
--- a/Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-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
deleted file mode 100644
index d9226b835..000000000
--- a/Tests/RunCMake/file-CHMOD/CHMOD-override.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-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-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt
deleted file mode 100644
index 1c87a593f..000000000
--- a/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-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
deleted file mode 100644
index 1289efc10..000000000
--- a/Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-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/RunCMakeTest.cmake b/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake
index 18deb8951..e6b11694d 100644
--- a/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake
@@ -1,12 +1,14 @@
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)
+run_cmake_script(no-perms)
+run_cmake_script(missing-perms)
+run_cmake_script(missing-file-perms)
+run_cmake_script(missing-dir-perms)
+run_cmake_script(all-perms)
+run_cmake_script(invalid-perms)
+run_cmake_script(invalid-path)
+run_cmake_script(ok)
+run_cmake_script(override)
if(UNIX)
execute_process(COMMAND id -u $ENV{USER}
@@ -15,5 +17,5 @@ if(UNIX)
endif()
if(NOT WIN32 AND NOT MSYS AND NOT "${uid}" STREQUAL "0")
- run_cmake(CHMOD-write-only)
+ run_cmake_script(write-only)
endif()
diff --git a/Tests/RunCMake/file-CHMOD/all-perms-result.txt b/Tests/RunCMake/file-CHMOD/all-perms-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/all-perms-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/all-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/all-perms-stderr.txt
new file mode 100644
index 000000000..6932a1f0b
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/all-perms-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at [^
+]*/all-perms\.cmake:[0-9]+ \(file\):
+ file Remove either PERMISSIONS or FILE_PERMISSIONS or DIRECTORY_PERMISSIONS
+ from the invocation$
diff --git a/Tests/RunCMake/file-CHMOD/all-perms.cmake b/Tests/RunCMake/file-CHMOD/all-perms.cmake
new file mode 100644
index 000000000..5ff81b85f
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/all-perms.cmake
@@ -0,0 +1,3 @@
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS OWNER_READ
+ FILE_PERMISSIONS OWNER_READ DIRECTORY_PERMISSIONS OWNER_READ)
diff --git a/Tests/RunCMake/file-CHMOD/invalid-path-result.txt b/Tests/RunCMake/file-CHMOD/invalid-path-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/invalid-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/invalid-path-stderr.txt b/Tests/RunCMake/file-CHMOD/invalid-path-stderr.txt
new file mode 100644
index 000000000..eb5fb3163
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/invalid-path-stderr.txt
@@ -0,0 +1,6 @@
+^CMake Error at [^
+]*/invalid-path\.cmake:[0-9]+ \(file\):
+ file does not exist:
+
+ [^
+]*/Tests/RunCMake/file-CHMOD/invalid-path-build/I_dont_exist$
diff --git a/Tests/RunCMake/file-CHMOD/invalid-path.cmake b/Tests/RunCMake/file-CHMOD/invalid-path.cmake
new file mode 100644
index 000000000..e8b0313c4
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/invalid-path.cmake
@@ -0,0 +1 @@
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/I_dont_exist PERMISSIONS OWNER_READ)
diff --git a/Tests/RunCMake/file-CHMOD/invalid-perms-result.txt b/Tests/RunCMake/file-CHMOD/invalid-perms-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/invalid-perms-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/invalid-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/invalid-perms-stderr.txt
new file mode 100644
index 000000000..daab22e4e
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/invalid-perms-stderr.txt
@@ -0,0 +1,3 @@
+^CMake Error at [^
+]*/invalid-perms\.cmake:[0-9]+ \(file\):
+ file INVALID_PERMISSION is an invalid permission specifier$
diff --git a/Tests/RunCMake/file-CHMOD/invalid-perms.cmake b/Tests/RunCMake/file-CHMOD/invalid-perms.cmake
new file mode 100644
index 000000000..42129b9df
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/invalid-perms.cmake
@@ -0,0 +1,2 @@
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS INVALID_PERMISSION)
diff --git a/Tests/RunCMake/file-CHMOD/missing-dir-perms-result.txt b/Tests/RunCMake/file-CHMOD/missing-dir-perms-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/missing-dir-perms-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/missing-dir-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/missing-dir-perms-stderr.txt
new file mode 100644
index 000000000..c05bb2dd7
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/missing-dir-perms-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at [^
+]*/missing-dir-perms.cmake:[0-9]+ \(file\):
+ Error after keyword "DIRECTORY_PERMISSIONS":
+
+ missing required value$
diff --git a/Tests/RunCMake/file-CHMOD/missing-dir-perms.cmake b/Tests/RunCMake/file-CHMOD/missing-dir-perms.cmake
new file mode 100644
index 000000000..9d0fdade8
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/missing-dir-perms.cmake
@@ -0,0 +1,2 @@
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS OWNER_READ DIRECTORY_PERMISSIONS)
diff --git a/Tests/RunCMake/file-CHMOD/missing-file-perms-result.txt b/Tests/RunCMake/file-CHMOD/missing-file-perms-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/missing-file-perms-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/missing-file-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/missing-file-perms-stderr.txt
new file mode 100644
index 000000000..c3f4f0f17
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/missing-file-perms-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at [^
+]*/missing-file-perms.cmake:[0-9]+ \(file\):
+ Error after keyword "FILE_PERMISSIONS":
+
+ missing required value$
diff --git a/Tests/RunCMake/file-CHMOD/missing-file-perms.cmake b/Tests/RunCMake/file-CHMOD/missing-file-perms.cmake
new file mode 100644
index 000000000..bcf35aa19
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/missing-file-perms.cmake
@@ -0,0 +1,2 @@
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS OWNER_READ FILE_PERMISSIONS)
diff --git a/Tests/RunCMake/file-CHMOD/missing-perms-result.txt b/Tests/RunCMake/file-CHMOD/missing-perms-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/missing-perms-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/missing-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/missing-perms-stderr.txt
new file mode 100644
index 000000000..1508b130c
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/missing-perms-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at [^
+]*/missing-perms.cmake:[0-9]+ \(file\):
+ Error after keyword "PERMISSIONS":
+
+ missing required value$
diff --git a/Tests/RunCMake/file-CHMOD/missing-perms.cmake b/Tests/RunCMake/file-CHMOD/missing-perms.cmake
new file mode 100644
index 000000000..da9f182f6
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/missing-perms.cmake
@@ -0,0 +1,2 @@
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a FILE_PERMISSIONS OWNER_READ PERMISSIONS)
diff --git a/Tests/RunCMake/file-CHMOD/no-perms-result.txt b/Tests/RunCMake/file-CHMOD/no-perms-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/no-perms-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/no-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/no-perms-stderr.txt
new file mode 100644
index 000000000..4c5a13983
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/no-perms-stderr.txt
@@ -0,0 +1,3 @@
+^CMake Error at [^
+]*/no-perms\.cmake:[0-9]+ \(file\):
+ file No permissions given$
diff --git a/Tests/RunCMake/file-CHMOD/no-perms.cmake b/Tests/RunCMake/file-CHMOD/no-perms.cmake
new file mode 100644
index 000000000..602cfc20f
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/no-perms.cmake
@@ -0,0 +1,2 @@
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a)
diff --git a/Tests/RunCMake/file-CHMOD/ok.cmake b/Tests/RunCMake/file-CHMOD/ok.cmake
new file mode 100644
index 000000000..7c74d2776
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/ok.cmake
@@ -0,0 +1,2 @@
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS OWNER_READ)
diff --git a/Tests/RunCMake/file-CHMOD/override.cmake b/Tests/RunCMake/file-CHMOD/override.cmake
new file mode 100644
index 000000000..67e5a23ca
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/override.cmake
@@ -0,0 +1,3 @@
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS OWNER_READ
+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE)
diff --git a/Tests/RunCMake/file-CHMOD/write-only-result.txt b/Tests/RunCMake/file-CHMOD/write-only-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/write-only-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/write-only-stderr.txt b/Tests/RunCMake/file-CHMOD/write-only-stderr.txt
new file mode 100644
index 000000000..169a09266
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/write-only-stderr.txt
@@ -0,0 +1,6 @@
+^CMake Error at [^
+]*/write-only\.cmake:[0-9]+ \(file\):
+ file failed to open for reading \(Permission denied\):
+
+ [^
+]*/Tests/RunCMake/file-CHMOD/write-only-build/a$
diff --git a/Tests/RunCMake/file-CHMOD/write-only.cmake b/Tests/RunCMake/file-CHMOD/write-only.cmake
new file mode 100644
index 000000000..aa9d8038b
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/write-only.cmake
@@ -0,0 +1,3 @@
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/a "CONTENT")
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/a PERMISSIONS OWNER_WRITE)
+file(READ ${CMAKE_CURRENT_BINARY_DIR}/a content)
diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2-stderr.txt b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2-stderr.txt
index c6ad3d090..39f307d2e 100644
--- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2-stderr.txt
+++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2-stderr.txt
@@ -13,11 +13,21 @@ Call Stack \(most recent call first\):
This warning is for project developers\. Use -Wno-dev to suppress it\.
CMake Error at badargs2\.cmake:[0-9]+ \(file\):
- file Keywords missing values:
+ Error after keyword "BUNDLE_EXECUTABLE":
+
+ missing required value
+
+ Error after keyword "CONFLICTING_DEPENDENCIES_PREFIX":
+
+ missing required value
+
+ Error after keyword "RESOLVED_DEPENDENCIES_VAR":
+
+ missing required value
+
+ Error after keyword "UNRESOLVED_DEPENDENCIES_VAR":
+
+ missing required value
- RESOLVED_DEPENDENCIES_VAR
- UNRESOLVED_DEPENDENCIES_VAR
- CONFLICTING_DEPENDENCIES_PREFIX
- BUNDLE_EXECUTABLE
Call Stack \(most recent call first\):
CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt b/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt
index 7c58aeb4a..54a3e5a72 100644
--- a/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt
+++ b/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt
@@ -1,2 +1,7 @@
-CMake Error at REAL_PATH-no-base-dir.cmake:[0-9]+ \(file\):
- file BASE_DIRECTORY requires a value
+^CMake Error at REAL_PATH-no-base-dir.cmake:[0-9]+ \(file\):
+ Error after keyword "BASE_DIRECTORY":
+
+ missing required value
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake
index aff4735f4..db889568e 100644
--- a/Tests/RunCMake/file/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file/RunCMakeTest.cmake
@@ -47,6 +47,7 @@ run_cmake(GLOB_RECURSE)
run_cmake(GLOB_RECURSE-noexp-FOLLOW_SYMLINKS)
run_cmake(SIZE)
run_cmake(SIZE-error-does-not-exist)
+run_cmake(TIMESTAMP)
run_cmake(REMOVE-empty)
diff --git a/Tests/RunCMake/file/TIMESTAMP-stdout.txt b/Tests/RunCMake/file/TIMESTAMP-stdout.txt
new file mode 100644
index 000000000..42be6ba29
--- /dev/null
+++ b/Tests/RunCMake/file/TIMESTAMP-stdout.txt
@@ -0,0 +1 @@
+-- '[0-9]*-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-6][0-9]Z'
diff --git a/Tests/RunCMake/file/TIMESTAMP.cmake b/Tests/RunCMake/file/TIMESTAMP.cmake
new file mode 100644
index 000000000..2bd257721
--- /dev/null
+++ b/Tests/RunCMake/file/TIMESTAMP.cmake
@@ -0,0 +1,2 @@
+file(TIMESTAMP "TIMESTAMP.cmake" output UTC)
+message(STATUS "'${output}'")
diff --git a/Tests/RunCMake/find_file/RunCMakeTest.cmake b/Tests/RunCMake/find_file/RunCMakeTest.cmake
index 23765d41c..296bb711b 100644
--- a/Tests/RunCMake/find_file/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_file/RunCMakeTest.cmake
@@ -7,6 +7,10 @@ run_cmake(Required)
run_cmake(NO_CACHE)
run_cmake(REGISTRY_VIEW-no-view)
run_cmake(REGISTRY_VIEW-wrong-view)
+run_cmake(VALIDATOR-no-function)
+run_cmake(VALIDATOR-undefined-function)
+run_cmake(VALIDATOR-specify-macro)
+run_cmake(VALIDATOR)
run_cmake_with_options(FromPATHEnvDebugVar --debug-find-var=PrefixInPATH_File)
diff --git a/Tests/RunCMake/find_file/VALIDATOR-no-function-result.txt b/Tests/RunCMake/find_file/VALIDATOR-no-function-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/find_file/VALIDATOR-no-function-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_file/VALIDATOR-no-function-stderr.txt b/Tests/RunCMake/find_file/VALIDATOR-no-function-stderr.txt
new file mode 100644
index 000000000..4d496490d
--- /dev/null
+++ b/Tests/RunCMake/find_file/VALIDATOR-no-function-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at VALIDATOR-no-function.cmake:[0-9]+ \(find_file\):
+ find_file missing required argument for "VALIDATOR"
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/find_file/VALIDATOR-no-function.cmake b/Tests/RunCMake/find_file/VALIDATOR-no-function.cmake
new file mode 100644
index 000000000..4800fe987
--- /dev/null
+++ b/Tests/RunCMake/find_file/VALIDATOR-no-function.cmake
@@ -0,0 +1,2 @@
+
+find_file(result NAMES input.txt VALIDATOR)
diff --git a/Tests/RunCMake/find_file/VALIDATOR-specify-macro-result.txt b/Tests/RunCMake/find_file/VALIDATOR-specify-macro-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/find_file/VALIDATOR-specify-macro-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_file/VALIDATOR-specify-macro-stderr.txt b/Tests/RunCMake/find_file/VALIDATOR-specify-macro-stderr.txt
new file mode 100644
index 000000000..7e0eda09b
--- /dev/null
+++ b/Tests/RunCMake/find_file/VALIDATOR-specify-macro-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at VALIDATOR-specify-macro.cmake:[0-9]+ \(find_file\):
+ find_file command specified for "VALIDATOR" is not a function: check.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/find_file/VALIDATOR-specify-macro.cmake b/Tests/RunCMake/find_file/VALIDATOR-specify-macro.cmake
new file mode 100644
index 000000000..ec0ce9a30
--- /dev/null
+++ b/Tests/RunCMake/find_file/VALIDATOR-specify-macro.cmake
@@ -0,0 +1,5 @@
+
+macro(CHECK result path)
+endmacro()
+
+find_file(result NAMES input.txt VALIDATOR check)
diff --git a/Tests/RunCMake/find_file/VALIDATOR-stderr.txt b/Tests/RunCMake/find_file/VALIDATOR-stderr.txt
new file mode 100644
index 000000000..6c8159bca
--- /dev/null
+++ b/Tests/RunCMake/find_file/VALIDATOR-stderr.txt
@@ -0,0 +1,3 @@
+CHECK='[^']+/Tests/RunCMake/find_file/include/PrefixInPATH.h'
+CHECK='[^']+/Tests/RunCMake/find_file/include/PrefixInPATH.h'
+CHECK='[^']+/Tests/RunCMake/find_file/include/PrefixInPATH.h'
diff --git a/Tests/RunCMake/find_file/VALIDATOR-stdout.txt b/Tests/RunCMake/find_file/VALIDATOR-stdout.txt
new file mode 100644
index 000000000..44fa77cb9
--- /dev/null
+++ b/Tests/RunCMake/find_file/VALIDATOR-stdout.txt
@@ -0,0 +1,3 @@
+-- FILE='[^']+/Tests/RunCMake/find_file/include/PrefixInPATH.h'
+-- FILE='[^']+/Tests/RunCMake/find_file/include/PrefixInPATH.h'
+-- FILE='FILE-NOTFOUND'
diff --git a/Tests/RunCMake/find_file/VALIDATOR-undefined-function-result.txt b/Tests/RunCMake/find_file/VALIDATOR-undefined-function-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/find_file/VALIDATOR-undefined-function-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_file/VALIDATOR-undefined-function-stderr.txt b/Tests/RunCMake/find_file/VALIDATOR-undefined-function-stderr.txt
new file mode 100644
index 000000000..b4125e6af
--- /dev/null
+++ b/Tests/RunCMake/find_file/VALIDATOR-undefined-function-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at VALIDATOR-undefined-function.cmake:[0-9]+ \(find_file\):
+ find_file command specified for "VALIDATOR" is undefined: undefined.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/find_file/VALIDATOR-undefined-function.cmake b/Tests/RunCMake/find_file/VALIDATOR-undefined-function.cmake
new file mode 100644
index 000000000..c46588762
--- /dev/null
+++ b/Tests/RunCMake/find_file/VALIDATOR-undefined-function.cmake
@@ -0,0 +1,2 @@
+
+find_file(result NAMES input.txt VALIDATOR undefined)
diff --git a/Tests/RunCMake/find_file/VALIDATOR.cmake b/Tests/RunCMake/find_file/VALIDATOR.cmake
new file mode 100644
index 000000000..72dd8f9cb
--- /dev/null
+++ b/Tests/RunCMake/find_file/VALIDATOR.cmake
@@ -0,0 +1,39 @@
+
+function(CHECK_DEFAULT result filename)
+ message("CHECK='${filename}'")
+endfunction()
+
+function(CHECK_OK result filename)
+ message("CHECK='${filename}'")
+ set(${result} TRUE PARENT_SCOPE)
+endfunction()
+
+function(CHECK_KO result filename)
+ message("CHECK='${filename}'")
+ set(${result} FALSE PARENT_SCOPE)
+endfunction()
+
+
+find_file(FILE
+ NAMES PrefixInPATH.h
+ HINTS ${CMAKE_CURRENT_SOURCE_DIR}/include
+ VALIDATOR check_default
+ )
+message(STATUS "FILE='${FILE}'")
+unset(FILE CACHE)
+
+find_file(FILE
+ NAMES PrefixInPATH.h
+ HINTS ${CMAKE_CURRENT_SOURCE_DIR}/include
+ VALIDATOR check_ok
+ )
+message(STATUS "FILE='${FILE}'")
+unset(FILE CACHE)
+
+find_file(FILE
+ NAMES PrefixInPATH.h
+ HINTS ${CMAKE_CURRENT_SOURCE_DIR}/include
+ VALIDATOR check_ko
+ )
+message(STATUS "FILE='${FILE}'")
+unset(FILE CACHE)
diff --git a/Tests/RunCMake/find_library/RunCMakeTest.cmake b/Tests/RunCMake/find_library/RunCMakeTest.cmake
index a912077cf..8b223b443 100644
--- a/Tests/RunCMake/find_library/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_library/RunCMakeTest.cmake
@@ -15,6 +15,10 @@ run_cmake(Required)
run_cmake(NO_CACHE)
run_cmake(REGISTRY_VIEW-no-view)
run_cmake(REGISTRY_VIEW-wrong-view)
+run_cmake(VALIDATOR-no-function)
+run_cmake(VALIDATOR-undefined-function)
+run_cmake(VALIDATOR-specify-macro)
+run_cmake(VALIDATOR)
run_cmake_script(FromScriptMode "-DTEMP_DIR=${RunCMake_BINARY_DIR}/FromScriptMode-temp")
diff --git a/Tests/RunCMake/find_library/VALIDATOR-no-function-result.txt b/Tests/RunCMake/find_library/VALIDATOR-no-function-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/find_library/VALIDATOR-no-function-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_library/VALIDATOR-no-function-stderr.txt b/Tests/RunCMake/find_library/VALIDATOR-no-function-stderr.txt
new file mode 100644
index 000000000..6c04aa4dc
--- /dev/null
+++ b/Tests/RunCMake/find_library/VALIDATOR-no-function-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at VALIDATOR-no-function.cmake:[0-9]+ \(find_library\):
+ find_library missing required argument for "VALIDATOR"
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/find_library/VALIDATOR-no-function.cmake b/Tests/RunCMake/find_library/VALIDATOR-no-function.cmake
new file mode 100644
index 000000000..516e54ed5
--- /dev/null
+++ b/Tests/RunCMake/find_library/VALIDATOR-no-function.cmake
@@ -0,0 +1,2 @@
+
+find_library(result NAMES input.txt VALIDATOR)
diff --git a/Tests/RunCMake/find_library/VALIDATOR-specify-macro-result.txt b/Tests/RunCMake/find_library/VALIDATOR-specify-macro-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/find_library/VALIDATOR-specify-macro-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_library/VALIDATOR-specify-macro-stderr.txt b/Tests/RunCMake/find_library/VALIDATOR-specify-macro-stderr.txt
new file mode 100644
index 000000000..03e7df945
--- /dev/null
+++ b/Tests/RunCMake/find_library/VALIDATOR-specify-macro-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at VALIDATOR-specify-macro.cmake:[0-9]+ \(find_library\):
+ find_library command specified for "VALIDATOR" is not a function: check.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/find_library/VALIDATOR-specify-macro.cmake b/Tests/RunCMake/find_library/VALIDATOR-specify-macro.cmake
new file mode 100644
index 000000000..fa90d723d
--- /dev/null
+++ b/Tests/RunCMake/find_library/VALIDATOR-specify-macro.cmake
@@ -0,0 +1,5 @@
+
+macro(CHECK result path)
+endmacro()
+
+find_library(result NAMES input.txt VALIDATOR check)
diff --git a/Tests/RunCMake/find_library/VALIDATOR-stderr.txt b/Tests/RunCMake/find_library/VALIDATOR-stderr.txt
new file mode 100644
index 000000000..721145068
--- /dev/null
+++ b/Tests/RunCMake/find_library/VALIDATOR-stderr.txt
@@ -0,0 +1,3 @@
+CHECK='[^']+/Tests/RunCMake/find_library/lib/libPrefixInPATH.a'
+CHECK='[^']+/Tests/RunCMake/find_library/lib/libPrefixInPATH.a'
+CHECK='[^']+/Tests/RunCMake/find_library/lib/libPrefixInPATH.a'
diff --git a/Tests/RunCMake/find_library/VALIDATOR-stdout.txt b/Tests/RunCMake/find_library/VALIDATOR-stdout.txt
new file mode 100644
index 000000000..bd2549bf3
--- /dev/null
+++ b/Tests/RunCMake/find_library/VALIDATOR-stdout.txt
@@ -0,0 +1,3 @@
+-- LIB='[^']+/Tests/RunCMake/find_library/lib/libPrefixInPATH.a'
+-- LIB='[^']+/Tests/RunCMake/find_library/lib/libPrefixInPATH.a'
+-- LIB='LIB-NOTFOUND'
diff --git a/Tests/RunCMake/find_library/VALIDATOR-undefined-function-result.txt b/Tests/RunCMake/find_library/VALIDATOR-undefined-function-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/find_library/VALIDATOR-undefined-function-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_library/VALIDATOR-undefined-function-stderr.txt b/Tests/RunCMake/find_library/VALIDATOR-undefined-function-stderr.txt
new file mode 100644
index 000000000..dc7ad9ee0
--- /dev/null
+++ b/Tests/RunCMake/find_library/VALIDATOR-undefined-function-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at VALIDATOR-undefined-function.cmake:[0-9]+ \(find_library\):
+ find_library command specified for "VALIDATOR" is undefined: undefined.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/find_library/VALIDATOR-undefined-function.cmake b/Tests/RunCMake/find_library/VALIDATOR-undefined-function.cmake
new file mode 100644
index 000000000..9ac7ee0b0
--- /dev/null
+++ b/Tests/RunCMake/find_library/VALIDATOR-undefined-function.cmake
@@ -0,0 +1,2 @@
+
+find_library(result NAMES input.txt VALIDATOR undefined)
diff --git a/Tests/RunCMake/find_library/VALIDATOR.cmake b/Tests/RunCMake/find_library/VALIDATOR.cmake
new file mode 100644
index 000000000..759394128
--- /dev/null
+++ b/Tests/RunCMake/find_library/VALIDATOR.cmake
@@ -0,0 +1,41 @@
+list(APPEND CMAKE_FIND_LIBRARY_PREFIXES lib)
+list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .a)
+
+function(CHECK_DEFAULT result filename)
+ message("CHECK='${filename}'")
+endfunction()
+
+function(CHECK_OK result filename)
+ message("CHECK='${filename}'")
+ set(${result} TRUE PARENT_SCOPE)
+endfunction()
+
+function(CHECK_KO result filename)
+ message("CHECK='${filename}'")
+ set(${result} FALSE PARENT_SCOPE)
+endfunction()
+
+
+find_library(LIB
+ NAMES PrefixInPATH
+ HINTS ${CMAKE_CURRENT_SOURCE_DIR}/lib
+ VALIDATOR check_default
+ )
+message(STATUS "LIB='${LIB}'")
+unset(LIB CACHE)
+
+find_library(LIB
+ NAMES PrefixInPATH
+ HINTS ${CMAKE_CURRENT_SOURCE_DIR}/lib
+ VALIDATOR check_ok
+ )
+message(STATUS "LIB='${LIB}'")
+unset(LIB CACHE)
+
+find_library(LIB
+ NAMES PrefixInPATH
+ HINTS ${CMAKE_CURRENT_SOURCE_DIR}/lib
+ VALIDATOR check_ko
+ )
+message(STATUS "LIB='${LIB}'")
+unset(LIB CACHE)
diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake
index 32e54d502..fa41fc180 100644
--- a/Tests/RunCMake/find_package/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake
@@ -55,6 +55,22 @@ run_cmake(REGISTRY_VIEW-no-view)
run_cmake(REGISTRY_VIEW-wrong-view)
run_cmake(REGISTRY_VIEW-propagated)
+file(
+ GLOB SearchPaths_TEST_CASE_LIST
+ LIST_DIRECTORIES TRUE
+ "${RunCMake_SOURCE_DIR}/SearchPaths/*"
+ )
+foreach(TestCasePrefix IN LISTS SearchPaths_TEST_CASE_LIST)
+ if(IS_DIRECTORY "${TestCasePrefix}")
+ cmake_path(GET TestCasePrefix FILENAME TestSuffix)
+ run_cmake_with_options(
+ SearchPaths_${TestSuffix}
+ "-DSearchPaths_ROOT=${TestCasePrefix}"
+ "--debug-find-pkg=SearchPaths"
+ )
+ endif()
+endforeach()
+
if(UNIX
AND NOT MSYS # FIXME: This works on CYGWIN but not on MSYS
)
diff --git a/Tests/RunCMake/find_package/SearchPaths.cmake b/Tests/RunCMake/find_package/SearchPaths.cmake
new file mode 100644
index 000000000..a5a10fced
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0074 NEW)
+find_package(SearchPaths REQUIRED CONFIG)
diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix/SearchPathsConfig.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths/prefix/SearchPathsConfig.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/cmake/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/cmake/SearchPathsConfig.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/cmake/SearchPathsConfig.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/SearchPaths-1.2.3/SearchPathsConfig.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/SearchPaths-1.2.3/SearchPathsConfig.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1.2.3/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1.2.3/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1.2.3/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1.2.3/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1.2.3/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1.2.3/lib/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/SearchPathsConfig.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1.2.3/lib/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1.2.3/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1.2.3/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1.2.3/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1.2.3/share/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1.2.3/share/SearchPaths-1.2.3/SearchPathsConfig.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1.2.3/share/SearchPaths-1.2.3/SearchPathsConfig.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1.2.3/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1.2.3/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1.2.3/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/share/cmake/SearchPaths-1.2.3/SearchPathsConfig.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/share/SearchPaths-1.2.3/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/share/SearchPaths-1.2.3/SearchPathsConfig.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/share/SearchPaths-1.2.3/SearchPathsConfig.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake b/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/share/SearchPaths-1.2.3/cmake/SearchPathsConfig.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix-stderr.txt
new file mode 100644
index 000000000..fae13ef3e
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix-stderr.txt
@@ -0,0 +1,10 @@
+ find_package considered the following locations for SearchPaths's Config
+ module:
+
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix/SearchPathsConfig\.cmake
+
+ The file was found at
+
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix/SearchPathsConfig\.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix.cmake
new file mode 100644
index 000000000..d83131395
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake")
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_cmake-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_cmake-stderr.txt
new file mode 100644
index 000000000..eba88c94a
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_cmake-stderr.txt
@@ -0,0 +1,12 @@
+ find_package considered the following locations for SearchPaths's Config
+ module:
+
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_cmake-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_cmake-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/cmake/SearchPathsConfig\.cmake
+
+ The file was found at
+
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_cmake/cmake/SearchPathsConfig\.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_cmake.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_cmake.cmake
new file mode 100644
index 000000000..d83131395
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_cmake.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake")
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg-stderr.txt
new file mode 100644
index 000000000..cebc169a2
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg-stderr.txt
@@ -0,0 +1,12 @@
+ find_package considered the following locations for SearchPaths's Config
+ module:
+
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/lib/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
+
+ The file was found at
+
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_cmake_pkg/lib/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg.cmake
new file mode 100644
index 000000000..d83131395
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_cmake_pkg.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake")
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg-stderr.txt
new file mode 100644
index 000000000..4e5d3f662
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg-stderr.txt
@@ -0,0 +1,12 @@
+ find_package considered the following locations for SearchPaths's Config
+ module:
+
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/lib/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
+
+ The file was found at
+
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg/lib/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg.cmake
new file mode 100644
index 000000000..d83131395
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake")
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake-stderr.txt
new file mode 100644
index 000000000..f29054582
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake-stderr.txt
@@ -0,0 +1,12 @@
+ find_package considered the following locations for SearchPaths's Config
+ module:
+
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/lib/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake
+
+ The file was found at
+
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_lib_pkg_cmake/lib/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake.cmake
new file mode 100644
index 000000000..d83131395
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_lib_pkg_cmake.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake")
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg-stderr.txt
new file mode 100644
index 000000000..32b9fcb7f
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg-stderr.txt
@@ -0,0 +1,12 @@
+ find_package considered the following locations for SearchPaths's Config
+ module:
+
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
+
+ The file was found at
+
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg.cmake
new file mode 100644
index 000000000..d83131395
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake")
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake-stderr.txt
new file mode 100644
index 000000000..7bf5cf8b6
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake-stderr.txt
@@ -0,0 +1,14 @@
+ find_package considered the following locations for SearchPaths's Config
+ module:
+
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1\.2\.3/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake
+
+ The file was found at
+
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake.cmake
new file mode 100644
index 000000000..d83131395
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake")
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg-stderr.txt
new file mode 100644
index 000000000..812c60728
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg-stderr.txt
@@ -0,0 +1,14 @@
+ find_package considered the following locations for SearchPaths's Config
+ module:
+
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1\.2\.3/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1\.2\.3/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
+
+ The file was found at
+
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_cmake_pkg/SearchPaths-1\.2\.3/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg.cmake
new file mode 100644
index 000000000..d83131395
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_cmake_pkg.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake")
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg-stderr.txt
new file mode 100644
index 000000000..3592f72e8
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg-stderr.txt
@@ -0,0 +1,14 @@
+ find_package considered the following locations for SearchPaths's Config
+ module:
+
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1\.2\.3/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1\.2\.3/lib/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
+
+ The file was found at
+
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_cmake_pkg/SearchPaths-1\.2\.3/lib/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg.cmake
new file mode 100644
index 000000000..d83131395
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_cmake_pkg.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake")
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg-stderr.txt
new file mode 100644
index 000000000..b196b7a7b
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg-stderr.txt
@@ -0,0 +1,14 @@
+ find_package considered the following locations for SearchPaths's Config
+ module:
+
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1\.2\.3/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1\.2\.3/lib/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
+
+ The file was found at
+
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg/SearchPaths-1\.2\.3/lib/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg.cmake
new file mode 100644
index 000000000..d83131395
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake")
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake-stderr.txt
new file mode 100644
index 000000000..17e039961
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake-stderr.txt
@@ -0,0 +1,14 @@
+ find_package considered the following locations for SearchPaths's Config
+ module:
+
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1\.2\.3/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1\.2\.3/lib/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake
+
+ The file was found at
+
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_lib_pkg_cmake/SearchPaths-1\.2\.3/lib/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake.cmake
new file mode 100644
index 000000000..d83131395
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_lib_pkg_cmake.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake")
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg-stderr.txt
new file mode 100644
index 000000000..ee01a50c5
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg-stderr.txt
@@ -0,0 +1,14 @@
+ find_package considered the following locations for SearchPaths's Config
+ module:
+
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1\.2\.3/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1\.2\.3/share/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
+
+ The file was found at
+
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_cmake_pkg/SearchPaths-1\.2\.3/share/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg.cmake
new file mode 100644
index 000000000..d83131395
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_cmake_pkg.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake")
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg-stderr.txt
new file mode 100644
index 000000000..d6abd2ff6
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg-stderr.txt
@@ -0,0 +1,14 @@
+ find_package considered the following locations for SearchPaths's Config
+ module:
+
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1\.2\.3/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1\.2\.3/share/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
+
+ The file was found at
+
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg/SearchPaths-1\.2\.3/share/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg.cmake
new file mode 100644
index 000000000..d83131395
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake")
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake-stderr.txt
new file mode 100644
index 000000000..b578b2bab
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake-stderr.txt
@@ -0,0 +1,14 @@
+ find_package considered the following locations for SearchPaths's Config
+ module:
+
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1\.2\.3/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1\.2\.3/share/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake
+
+ The file was found at
+
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_pkg_share_pkg_cmake/SearchPaths-1\.2\.3/share/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake.cmake
new file mode 100644
index 000000000..d83131395
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_pkg_share_pkg_cmake.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake")
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg-stderr.txt
new file mode 100644
index 000000000..2f3f18aa2
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg-stderr.txt
@@ -0,0 +1,12 @@
+ find_package considered the following locations for SearchPaths's Config
+ module:
+
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/share/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
+
+ The file was found at
+
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_cmake_pkg/share/cmake/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg.cmake
new file mode 100644
index 000000000..d83131395
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_share_cmake_pkg.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake")
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg-stderr.txt
new file mode 100644
index 000000000..3eef00243
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg-stderr.txt
@@ -0,0 +1,12 @@
+ find_package considered the following locations for SearchPaths's Config
+ module:
+
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/share/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
+
+ The file was found at
+
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg/share/SearchPaths-1\.2\.3/SearchPathsConfig\.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg.cmake
new file mode 100644
index 000000000..d83131395
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake")
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake-stderr.txt b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake-stderr.txt
new file mode 100644
index 000000000..c962f8bce
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake-stderr.txt
@@ -0,0 +1,12 @@
+ find_package considered the following locations for SearchPaths's Config
+ module:
+
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake-build/CMakeFiles/pkgRedirects/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake-build/CMakeFiles/pkgRedirects/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/SearchPathsConfig\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/searchpaths-config\.cmake
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/share/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake
+
+ The file was found at
+
+ .*/Tests/RunCMake/find_package/SearchPaths/prefix_share_pkg_cmake/share/SearchPaths-1\.2\.3/cmake/SearchPathsConfig\.cmake
diff --git a/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake.cmake b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake.cmake
new file mode 100644
index 000000000..d83131395
--- /dev/null
+++ b/Tests/RunCMake/find_package/SearchPaths_prefix_share_pkg_cmake.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_SOURCE_DIR}/SearchPaths.cmake")
diff --git a/Tests/RunCMake/find_path/RunCMakeTest.cmake b/Tests/RunCMake/find_path/RunCMakeTest.cmake
index 63cadc22f..9c76f2e46 100644
--- a/Tests/RunCMake/find_path/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_path/RunCMakeTest.cmake
@@ -7,6 +7,10 @@ run_cmake(Required)
run_cmake(NO_CACHE)
run_cmake(REGISTRY_VIEW-no-view)
run_cmake(REGISTRY_VIEW-wrong-view)
+run_cmake(VALIDATOR-no-function)
+run_cmake(VALIDATOR-undefined-function)
+run_cmake(VALIDATOR-specify-macro)
+run_cmake(VALIDATOR)
if(APPLE)
run_cmake(FrameworksWithSubdirs)
diff --git a/Tests/RunCMake/find_path/VALIDATOR-no-function-result.txt b/Tests/RunCMake/find_path/VALIDATOR-no-function-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/find_path/VALIDATOR-no-function-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_path/VALIDATOR-no-function-stderr.txt b/Tests/RunCMake/find_path/VALIDATOR-no-function-stderr.txt
new file mode 100644
index 000000000..1dfd06499
--- /dev/null
+++ b/Tests/RunCMake/find_path/VALIDATOR-no-function-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at VALIDATOR-no-function.cmake:[0-9]+ \(find_path\):
+ find_path missing required argument for "VALIDATOR"
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/find_path/VALIDATOR-no-function.cmake b/Tests/RunCMake/find_path/VALIDATOR-no-function.cmake
new file mode 100644
index 000000000..bac275284
--- /dev/null
+++ b/Tests/RunCMake/find_path/VALIDATOR-no-function.cmake
@@ -0,0 +1,2 @@
+
+find_path(result NAMES input.txt VALIDATOR)
diff --git a/Tests/RunCMake/find_path/VALIDATOR-specify-macro-result.txt b/Tests/RunCMake/find_path/VALIDATOR-specify-macro-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/find_path/VALIDATOR-specify-macro-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_path/VALIDATOR-specify-macro-stderr.txt b/Tests/RunCMake/find_path/VALIDATOR-specify-macro-stderr.txt
new file mode 100644
index 000000000..92ee17ee5
--- /dev/null
+++ b/Tests/RunCMake/find_path/VALIDATOR-specify-macro-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at VALIDATOR-specify-macro.cmake:[0-9]+ \(find_path\):
+ find_path command specified for "VALIDATOR" is not a function: check.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/find_path/VALIDATOR-specify-macro.cmake b/Tests/RunCMake/find_path/VALIDATOR-specify-macro.cmake
new file mode 100644
index 000000000..62b44ed6c
--- /dev/null
+++ b/Tests/RunCMake/find_path/VALIDATOR-specify-macro.cmake
@@ -0,0 +1,5 @@
+
+macro(CHECK result path)
+endmacro()
+
+find_path(result NAMES input.txt VALIDATOR check)
diff --git a/Tests/RunCMake/find_path/VALIDATOR-stderr.txt b/Tests/RunCMake/find_path/VALIDATOR-stderr.txt
new file mode 100644
index 000000000..851353dc2
--- /dev/null
+++ b/Tests/RunCMake/find_path/VALIDATOR-stderr.txt
@@ -0,0 +1,3 @@
+CHECK='[^']+/Tests/RunCMake/find_path/include/'
+CHECK='[^']+/Tests/RunCMake/find_path/include/'
+CHECK='[^']+/Tests/RunCMake/find_path/include/'
diff --git a/Tests/RunCMake/find_path/VALIDATOR-stdout.txt b/Tests/RunCMake/find_path/VALIDATOR-stdout.txt
new file mode 100644
index 000000000..3fce03039
--- /dev/null
+++ b/Tests/RunCMake/find_path/VALIDATOR-stdout.txt
@@ -0,0 +1,3 @@
+-- DIR='[^']+/Tests/RunCMake/find_path/include'
+-- DIR='[^']+/Tests/RunCMake/find_path/include'
+-- DIR='DIR-NOTFOUND'
diff --git a/Tests/RunCMake/find_path/VALIDATOR-undefined-function-result.txt b/Tests/RunCMake/find_path/VALIDATOR-undefined-function-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/find_path/VALIDATOR-undefined-function-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_path/VALIDATOR-undefined-function-stderr.txt b/Tests/RunCMake/find_path/VALIDATOR-undefined-function-stderr.txt
new file mode 100644
index 000000000..d3e05176a
--- /dev/null
+++ b/Tests/RunCMake/find_path/VALIDATOR-undefined-function-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at VALIDATOR-undefined-function.cmake:[0-9]+ \(find_path\):
+ find_path command specified for "VALIDATOR" is undefined: undefined.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/find_path/VALIDATOR-undefined-function.cmake b/Tests/RunCMake/find_path/VALIDATOR-undefined-function.cmake
new file mode 100644
index 000000000..3fb55c526
--- /dev/null
+++ b/Tests/RunCMake/find_path/VALIDATOR-undefined-function.cmake
@@ -0,0 +1,2 @@
+
+find_path(result NAMES input.txt VALIDATOR undefined)
diff --git a/Tests/RunCMake/find_path/VALIDATOR.cmake b/Tests/RunCMake/find_path/VALIDATOR.cmake
new file mode 100644
index 000000000..1e01250b1
--- /dev/null
+++ b/Tests/RunCMake/find_path/VALIDATOR.cmake
@@ -0,0 +1,39 @@
+
+function(CHECK_DEFAULT result filename)
+ message("CHECK='${filename}'")
+endfunction()
+
+function(CHECK_OK result filename)
+ message("CHECK='${filename}'")
+ set(${result} TRUE PARENT_SCOPE)
+endfunction()
+
+function(CHECK_KO result filename)
+ message("CHECK='${filename}'")
+ set(${result} FALSE PARENT_SCOPE)
+endfunction()
+
+
+find_path(DIR
+ NAMES PrefixInPATH.h
+ HINTS ${CMAKE_CURRENT_SOURCE_DIR}/include
+ VALIDATOR check_default
+ )
+message(STATUS "DIR='${DIR}'")
+unset(DIR CACHE)
+
+find_path(DIR
+ NAMES PrefixInPATH.h
+ HINTS ${CMAKE_CURRENT_SOURCE_DIR}/include
+ VALIDATOR check_ok
+ )
+message(STATUS "DIR='${DIR}'")
+unset(DIR CACHE)
+
+find_path(DIR
+ NAMES PrefixInPATH.h
+ HINTS ${CMAKE_CURRENT_SOURCE_DIR}/include
+ VALIDATOR check_ko
+ )
+message(STATUS "DIR='${DIR}'")
+unset(DIR CACHE)
diff --git a/Tests/RunCMake/find_program/RunCMakeTest.cmake b/Tests/RunCMake/find_program/RunCMakeTest.cmake
index d0ce8fcac..f8ecb8fed 100644
--- a/Tests/RunCMake/find_program/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_program/RunCMakeTest.cmake
@@ -9,6 +9,10 @@ run_cmake(NO_CACHE)
run_cmake(IgnorePrefixPath)
run_cmake(REGISTRY_VIEW-no-view)
run_cmake(REGISTRY_VIEW-wrong-view)
+run_cmake(VALIDATOR-no-function)
+run_cmake(VALIDATOR-undefined-function)
+run_cmake(VALIDATOR-specify-macro)
+run_cmake(VALIDATOR)
if(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN|MSYS)$")
run_cmake(WindowsCom)
diff --git a/Tests/RunCMake/find_program/VALIDATOR-no-function-result.txt b/Tests/RunCMake/find_program/VALIDATOR-no-function-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/find_program/VALIDATOR-no-function-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_program/VALIDATOR-no-function-stderr.txt b/Tests/RunCMake/find_program/VALIDATOR-no-function-stderr.txt
new file mode 100644
index 000000000..b8868af5b
--- /dev/null
+++ b/Tests/RunCMake/find_program/VALIDATOR-no-function-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at VALIDATOR-no-function.cmake:[0-9]+ \(find_program\):
+ find_program missing required argument for "VALIDATOR"
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/find_program/VALIDATOR-no-function.cmake b/Tests/RunCMake/find_program/VALIDATOR-no-function.cmake
new file mode 100644
index 000000000..0d6a74f3b
--- /dev/null
+++ b/Tests/RunCMake/find_program/VALIDATOR-no-function.cmake
@@ -0,0 +1,2 @@
+
+find_program(result NAMES input.txt VALIDATOR)
diff --git a/Tests/RunCMake/find_program/VALIDATOR-specify-macro-result.txt b/Tests/RunCMake/find_program/VALIDATOR-specify-macro-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/find_program/VALIDATOR-specify-macro-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_program/VALIDATOR-specify-macro-stderr.txt b/Tests/RunCMake/find_program/VALIDATOR-specify-macro-stderr.txt
new file mode 100644
index 000000000..1ae51481b
--- /dev/null
+++ b/Tests/RunCMake/find_program/VALIDATOR-specify-macro-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at VALIDATOR-specify-macro.cmake:[0-9]+ \(find_program\):
+ find_program command specified for "VALIDATOR" is not a function: check.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/find_program/VALIDATOR-specify-macro.cmake b/Tests/RunCMake/find_program/VALIDATOR-specify-macro.cmake
new file mode 100644
index 000000000..43bb9ec31
--- /dev/null
+++ b/Tests/RunCMake/find_program/VALIDATOR-specify-macro.cmake
@@ -0,0 +1,5 @@
+
+macro(CHECK result path)
+endmacro()
+
+find_program(result NAMES input.txt VALIDATOR check)
diff --git a/Tests/RunCMake/find_program/VALIDATOR-stderr.txt b/Tests/RunCMake/find_program/VALIDATOR-stderr.txt
new file mode 100644
index 000000000..6704ed1f2
--- /dev/null
+++ b/Tests/RunCMake/find_program/VALIDATOR-stderr.txt
@@ -0,0 +1,3 @@
+CHECK='[^']+/Tests/RunCMake/find_program/A/testA'
+CHECK='[^']+/Tests/RunCMake/find_program/A/testA'
+CHECK='[^']+/Tests/RunCMake/find_program/A/testA'
diff --git a/Tests/RunCMake/find_program/VALIDATOR-stdout.txt b/Tests/RunCMake/find_program/VALIDATOR-stdout.txt
new file mode 100644
index 000000000..d434742d0
--- /dev/null
+++ b/Tests/RunCMake/find_program/VALIDATOR-stdout.txt
@@ -0,0 +1,3 @@
+-- PROG='[^']+/Tests/RunCMake/find_program/A/testA'
+-- PROG='[^']+/Tests/RunCMake/find_program/A/testA'
+-- PROG='PROG-NOTFOUND'
diff --git a/Tests/RunCMake/find_program/VALIDATOR-undefined-function-result.txt b/Tests/RunCMake/find_program/VALIDATOR-undefined-function-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/find_program/VALIDATOR-undefined-function-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_program/VALIDATOR-undefined-function-stderr.txt b/Tests/RunCMake/find_program/VALIDATOR-undefined-function-stderr.txt
new file mode 100644
index 000000000..a89ffa079
--- /dev/null
+++ b/Tests/RunCMake/find_program/VALIDATOR-undefined-function-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at VALIDATOR-undefined-function.cmake:[0-9]+ \(find_program\):
+ find_program command specified for "VALIDATOR" is undefined: undefined.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/find_program/VALIDATOR-undefined-function.cmake b/Tests/RunCMake/find_program/VALIDATOR-undefined-function.cmake
new file mode 100644
index 000000000..96be5fdcd
--- /dev/null
+++ b/Tests/RunCMake/find_program/VALIDATOR-undefined-function.cmake
@@ -0,0 +1,2 @@
+
+find_program(result NAMES input.txt VALIDATOR undefined)
diff --git a/Tests/RunCMake/find_program/VALIDATOR.cmake b/Tests/RunCMake/find_program/VALIDATOR.cmake
new file mode 100644
index 000000000..8be2b3906
--- /dev/null
+++ b/Tests/RunCMake/find_program/VALIDATOR.cmake
@@ -0,0 +1,39 @@
+
+function(CHECK_DEFAULT result filename)
+ message("CHECK='${filename}'")
+endfunction()
+
+function(CHECK_OK result filename)
+ message("CHECK='${filename}'")
+ set(${result} TRUE PARENT_SCOPE)
+endfunction()
+
+function(CHECK_KO result filename)
+ message("CHECK='${filename}'")
+ set(${result} FALSE PARENT_SCOPE)
+endfunction()
+
+
+find_program(PROG
+ NAMES testA
+ HINTS ${CMAKE_CURRENT_SOURCE_DIR}/A
+ VALIDATOR check_default
+ )
+message(STATUS "PROG='${PROG}'")
+unset(PROG CACHE)
+
+find_program(PROG
+ NAMES testA
+ HINTS ${CMAKE_CURRENT_SOURCE_DIR}/A
+ VALIDATOR check_ok
+ )
+message(STATUS "PROG='${PROG}'")
+unset(PROG CACHE)
+
+find_program(PROG
+ NAMES testA
+ HINTS ${CMAKE_CURRENT_SOURCE_DIR}/A
+ VALIDATOR check_ko
+ )
+message(STATUS "PROG='${PROG}'")
+unset(PROG CACHE)
diff --git a/Tests/RunCMake/install/DIRECTORY-symlink-clobber-all-result.txt b/Tests/RunCMake/install/DIRECTORY-symlink-clobber-all-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-symlink-clobber-all-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/DIRECTORY-symlink-clobber-all-stderr.txt b/Tests/RunCMake/install/DIRECTORY-symlink-clobber-all-stderr.txt
new file mode 100644
index 000000000..d082b8a12
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-symlink-clobber-all-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Error at cmake_install.cmake:[0-9]+ \(file\):
+ file INSTALL cannot duplicate symlink
+
+ [^
+]*/Tests/RunCMake/install/DIRECTORY-symlink-clobber-build/new/dir
+
+ at
+
+ [^
+]*/Tests/RunCMake/install/DIRECTORY-symlink-clobber-build/root-all/dest/dir
+
+ because: A directory already exists at that location
diff --git a/Tests/RunCMake/install/DIRECTORY-symlink-clobber-all-stdout.txt b/Tests/RunCMake/install/DIRECTORY-symlink-clobber-all-stdout.txt
new file mode 100644
index 000000000..c520de1c9
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-symlink-clobber-all-stdout.txt
@@ -0,0 +1,12 @@
+-- Installing: [^
+]*/Tests/RunCMake/install/DIRECTORY-symlink-clobber-build/root-all/dest/dir
+-- Installing: [^
+]*/Tests/RunCMake/install/DIRECTORY-symlink-clobber-build/root-all/dest/dir/file
+-- Installing: [^
+]*/Tests/RunCMake/install/DIRECTORY-symlink-clobber-build/root-all/dest/lnk
+-- Installing: [^
+]*/Tests/RunCMake/install/DIRECTORY-symlink-clobber-build/root-all/dest/lnk
+-- (Up-to-date|Installing): [^
+]*/Tests/RunCMake/install/DIRECTORY-symlink-clobber-build/root-all/dest/lnk/file
+-- Installing: [^
+]*/Tests/RunCMake/install/DIRECTORY-symlink-clobber-build/root-all/dest/dir
diff --git a/Tests/RunCMake/install/DIRECTORY-symlink-clobber.cmake b/Tests/RunCMake/install/DIRECTORY-symlink-clobber.cmake
new file mode 100644
index 000000000..ac7a2cf4a
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-symlink-clobber.cmake
@@ -0,0 +1,11 @@
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/old/dir)
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/old/dir/file "")
+file(CREATE_LINK dir ${CMAKE_CURRENT_BINARY_DIR}/old/lnk SYMBOLIC)
+install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/old/dir DESTINATION dest)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/old/lnk DESTINATION dest)
+
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/new/lnk)
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/new/lnk/file "")
+file(CREATE_LINK lnk ${CMAKE_CURRENT_BINARY_DIR}/new/dir SYMBOLIC)
+install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/new/lnk DESTINATION dest)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/new/dir DESTINATION dest)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index 7c12d4a31..477ffe06c 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -175,6 +175,10 @@ run_install_test(FILES-PERMISSIONS)
run_install_test(TARGETS-RPATH)
run_install_test(InstallRequiredSystemLibraries)
+if(UNIX)
+ run_install_test(DIRECTORY-symlink-clobber)
+endif()
+
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
run_cmake(TARGETS-RUNTIME_DEPENDENCIES-macos-two-bundle)
run_cmake(TARGETS-RUNTIME_DEPENDENCIES-macos-no-framework)
diff --git a/Tests/RunCMake/project/LanguagesDuplicate-check.cmake b/Tests/RunCMake/project/LanguagesDuplicate-check.cmake
new file mode 100644
index 000000000..31c7da367
--- /dev/null
+++ b/Tests/RunCMake/project/LanguagesDuplicate-check.cmake
@@ -0,0 +1,10 @@
+if(NOT actual_stderr MATCHES "The following language has been specified multiple times: C\n")
+ set(RunCMake_TEST_FAILED "'LANGUAGES C C C' should report only 'C' and only once.")
+endif()
+
+if(NOT actual_stderr MATCHES "The following languages have been specified multiple times: C, CXX\n")
+ if(RunCMake_TEST_FAILED)
+ string(APPEND RunCMake_TEST_FAILED "\n")
+ endif()
+ string(APPEND RunCMake_TEST_FAILED "'LANGUAGES C C CXX CXX' should report 'C' and 'CXX'.")
+endif()
diff --git a/Tests/RunCMake/project/LanguagesDuplicate.cmake b/Tests/RunCMake/project/LanguagesDuplicate.cmake
new file mode 100644
index 000000000..97a79d082
--- /dev/null
+++ b/Tests/RunCMake/project/LanguagesDuplicate.cmake
@@ -0,0 +1,11 @@
+cmake_policy(SET CMP0057 NEW)
+
+project(ProjectA C C C)
+project(ProjectB C C CXX CXX)
+
+get_property(langs GLOBAL PROPERTY ENABLED_LANGUAGES)
+foreach(lang C CXX)
+ if(NOT lang IN_LIST langs)
+ message(FATAL_ERROR "Expected language '${lang}' to be enabled.")
+ endif()
+endforeach()
diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake
index 945d9ed58..6d9f52f51 100644
--- a/Tests/RunCMake/project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/project/RunCMakeTest.cmake
@@ -12,6 +12,11 @@ run_cmake_with_options(CodeInjection
if(CMake_TEST_RESOURCES)
run_cmake(ExplicitRC)
endif()
+
+set(RunCMake_DEFAULT_stderr .)
+run_cmake(LanguagesDuplicate)
+unset(RunCMake_DEFAULT_stderr)
+
run_cmake(LanguagesImplicit)
run_cmake(LanguagesEmpty)
run_cmake(LanguagesNONE)
diff --git a/Tests/RunCMake/pseudo_tidy.c b/Tests/RunCMake/pseudo_tidy.c
index 2feeb0fc9..a43133b8d 100644
--- a/Tests/RunCMake/pseudo_tidy.c
+++ b/Tests/RunCMake/pseudo_tidy.c
@@ -5,6 +5,16 @@ int main(int argc, char* argv[])
{
int i;
for (i = 1; i < argc; ++i) {
+ if (strcmp(argv[i], "-p") == 0) {
+ // Ensure compile commands were not appended after the source file
+ for (++i; i < argc; ++i) {
+ if (strcmp(argv[i], "--") == 0) {
+ fprintf(stderr, "Command line arguments unexpectedly appended\n");
+ return 1;
+ }
+ }
+ return 0;
+ }
if (strcmp(argv[i], "-bad") == 0) {
fprintf(stdout, "stdout from bad command line arg '-bad'\n");
fprintf(stderr, "stderr from bad command line arg '-bad'\n");
diff --git a/Tests/RunCMake/return/CMP0140-NEW.cmake b/Tests/RunCMake/return/CMP0140-NEW.cmake
new file mode 100644
index 000000000..eb6b85c57
--- /dev/null
+++ b/Tests/RunCMake/return/CMP0140-NEW.cmake
@@ -0,0 +1,13 @@
+
+cmake_policy(SET CMP0140 NEW)
+
+function(FUNC)
+ set(VAR "set")
+ return(PROPAGATE VAR)
+endfunction()
+
+set(VAR "initial")
+func()
+if (NOT DEFINED VAR OR NOT VAR STREQUAL "set")
+ message(FATAL_ERROR "return(PROPAGATE) not handled correctly.")
+endif()
diff --git a/Tests/RunCMake/return/CMP0140-OLD.cmake b/Tests/RunCMake/return/CMP0140-OLD.cmake
new file mode 100644
index 000000000..8113a43f2
--- /dev/null
+++ b/Tests/RunCMake/return/CMP0140-OLD.cmake
@@ -0,0 +1,8 @@
+
+cmake_policy(SET CMP0140 OLD)
+
+function(FUNC)
+ return(PROPAGATE VAR)
+endfunction()
+
+func()
diff --git a/Tests/RunCMake/return/CMP0140-WARN-result.txt b/Tests/RunCMake/return/CMP0140-WARN-result.txt
new file mode 100644
index 000000000..573541ac9
--- /dev/null
+++ b/Tests/RunCMake/return/CMP0140-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/return/CMP0140-WARN-stderr.txt b/Tests/RunCMake/return/CMP0140-WARN-stderr.txt
new file mode 100644
index 000000000..ed4beb6f5
--- /dev/null
+++ b/Tests/RunCMake/return/CMP0140-WARN-stderr.txt
@@ -0,0 +1,12 @@
+CMake Warning \(dev\) at CMP0140-WARN.cmake:[0-9]+ \(return\):
+ Policy CMP0140 is not set: The return\(\) command checks its arguments. Run
+ "cmake --help-policy CMP0140" for policy details. Use the cmake_policy
+ command to set the policy and suppress this warning.
+
+ return\(\) checks its arguments when the policy is set to NEW. Since the
+ policy is not set the OLD behavior will be used so the arguments will be
+ ignored.
+Call Stack \(most recent call first\):
+ CMP0140-WARN.cmake:[0-9]+ \(func\)
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/return/CMP0140-WARN.cmake b/Tests/RunCMake/return/CMP0140-WARN.cmake
new file mode 100644
index 000000000..df2fc887b
--- /dev/null
+++ b/Tests/RunCMake/return/CMP0140-WARN.cmake
@@ -0,0 +1,8 @@
+
+cmake_policy(VERSION 3.1)
+
+function(FUNC)
+ return(PROPAGATE VAR)
+endfunction()
+
+func()
diff --git a/Tests/RunCMake/return/CMakeLists.txt b/Tests/RunCMake/return/CMakeLists.txt
index ef2163c29..6cc903fc7 100644
--- a/Tests/RunCMake/return/CMakeLists.txt
+++ b/Tests/RunCMake/return/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.1...3.25)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/return/PropagateFromDirectory.cmake b/Tests/RunCMake/return/PropagateFromDirectory.cmake
new file mode 100644
index 000000000..9c820bb7d
--- /dev/null
+++ b/Tests/RunCMake/return/PropagateFromDirectory.cmake
@@ -0,0 +1,10 @@
+
+set(VAR1 "initial")
+set(VAR2 "initial")
+
+add_subdirectory(subdir)
+
+if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set")
+ OR DEFINED VAR2)
+ message(SEND_ERROR "erroneous propagation for FUNC1")
+endif()
diff --git a/Tests/RunCMake/return/PropagateFromFunction.cmake b/Tests/RunCMake/return/PropagateFromFunction.cmake
new file mode 100644
index 000000000..1c12bc198
--- /dev/null
+++ b/Tests/RunCMake/return/PropagateFromFunction.cmake
@@ -0,0 +1,142 @@
+
+function(FUNC1)
+ set(VAR1 "set")
+ unset(VAR2)
+ return(PROPAGATE VAR1 VAR2)
+endfunction()
+
+set(VAR1 "initial")
+set(VAR2 "initial")
+func1()
+if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set")
+ OR DEFINED VAR2)
+ message(SEND_ERROR "erroneous propagation for FUNC1")
+endif()
+
+
+function(FUNC2)
+ block()
+ set(VAR1 "set")
+ unset(VAR2)
+ return(PROPAGATE VAR1 VAR2)
+ endblock()
+endfunction()
+
+set(VAR1 "initial")
+set(VAR2 "initial")
+func2()
+if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set")
+ OR DEFINED VAR2)
+ message(SEND_ERROR "erroneous propagation for FUNC2")
+endif()
+
+
+function(FUNC3)
+ block(SCOPE_FOR POLICIES)
+ set(VAR1 "set")
+ unset(VAR2)
+ return(PROPAGATE VAR1 VAR2)
+ endblock()
+endfunction()
+
+set(VAR1 "initial")
+set(VAR2 "initial")
+func3()
+if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set")
+ OR DEFINED VAR2)
+ message(SEND_ERROR "erroneous propagation for FUNC3")
+endif()
+
+
+function(FUNC4)
+ while(TRUE)
+ set(VAR1 "set")
+ unset(VAR2)
+ return(PROPAGATE VAR1 VAR2)
+ endwhile()
+endfunction()
+
+set(VAR1 "initial")
+set(VAR2 "initial")
+func4()
+if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set")
+ OR DEFINED VAR2)
+ message(SEND_ERROR "erroneous propagation for FUNC4")
+endif()
+
+
+function(FUNC5)
+ foreach(item IN ITEMS A B)
+ set(VAR1 "set")
+ unset(VAR2)
+ return(PROPAGATE VAR1 VAR2)
+ endforeach()
+endfunction()
+
+set(VAR1 "initial")
+set(VAR2 "initial")
+func5()
+if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set")
+ OR DEFINED VAR2)
+ message(SEND_ERROR "erroneous propagation for FUNC5")
+endif()
+
+
+function(FUNC6)
+ if(TRUE)
+ set(VAR1 "set")
+ unset(VAR2)
+ return(PROPAGATE VAR1 VAR2)
+ endif()
+endfunction()
+
+set(VAR1 "initial")
+set(VAR2 "initial")
+func6()
+if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set")
+ OR DEFINED VAR2)
+ message(SEND_ERROR "erroneous propagation for FUNC6")
+endif()
+
+
+function(FUNC7)
+ if(FALSE)
+ else()
+ set(VAR1 "set")
+ unset(VAR2)
+ return(PROPAGATE VAR1 VAR2)
+ endif()
+endfunction()
+
+set(VAR1 "initial")
+set(VAR2 "initial")
+func7()
+if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set")
+ OR DEFINED VAR2)
+ message(SEND_ERROR "erroneous propagation for FUNC7")
+endif()
+
+
+set(VAR1 "initial")
+set(VAR2 "initial")
+cmake_language(CALL func7)
+if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set")
+ OR DEFINED VAR2)
+ message(SEND_ERROR "erroneous propagation for cmake_language(CALL FUNC7)")
+endif()
+
+
+set(VAR1 "initial")
+set(VAR2 "initial")
+cmake_language(EVAL CODE "
+ function(FUNC8)
+ set(VAR1 \"set\")
+ unset(VAR2)
+ return(PROPAGATE VAR1 VAR2)
+ endfunction()
+
+ func8()")
+if((NOT DEFINED VAR1 OR NOT VAR1 STREQUAL "set")
+ OR DEFINED VAR2)
+ message(SEND_ERROR "erroneous propagation for cmake_language(EVAL CODE)")
+endif()
diff --git a/Tests/RunCMake/return/PropagateNothing.cmake b/Tests/RunCMake/return/PropagateNothing.cmake
new file mode 100644
index 000000000..0ace58e45
--- /dev/null
+++ b/Tests/RunCMake/return/PropagateNothing.cmake
@@ -0,0 +1,2 @@
+
+return(PROPAGATE)
diff --git a/Tests/RunCMake/return/RunCMakeTest.cmake b/Tests/RunCMake/return/RunCMakeTest.cmake
index 2cc6c9d32..f9e06a53c 100644
--- a/Tests/RunCMake/return/RunCMakeTest.cmake
+++ b/Tests/RunCMake/return/RunCMakeTest.cmake
@@ -1,3 +1,12 @@
include(RunCMake)
run_cmake(ReturnFromForeach)
+
+run_cmake(WrongArgument)
+run_cmake(PropagateNothing)
+run_cmake(PropagateFromFunction)
+run_cmake(PropagateFromDirectory)
+
+run_cmake(CMP0140-NEW)
+run_cmake(CMP0140-OLD)
+run_cmake(CMP0140-WARN)
diff --git a/Tests/RunCMake/return/WrongArgument-result.txt b/Tests/RunCMake/return/WrongArgument-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/return/WrongArgument-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/return/WrongArgument-stderr.txt b/Tests/RunCMake/return/WrongArgument-stderr.txt
new file mode 100644
index 000000000..4d1c5ad87
--- /dev/null
+++ b/Tests/RunCMake/return/WrongArgument-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at WrongArgument.cmake:[0-9]+ \(return\):
+ return called with unsupported argument "WRONG_ARG"
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/return/WrongArgument.cmake b/Tests/RunCMake/return/WrongArgument.cmake
new file mode 100644
index 000000000..d03b19fa4
--- /dev/null
+++ b/Tests/RunCMake/return/WrongArgument.cmake
@@ -0,0 +1,2 @@
+
+return(WRONG_ARG)
diff --git a/Tests/RunCMake/return/subdir/CMakeLists.txt b/Tests/RunCMake/return/subdir/CMakeLists.txt
new file mode 100644
index 000000000..e575d4704
--- /dev/null
+++ b/Tests/RunCMake/return/subdir/CMakeLists.txt
@@ -0,0 +1,5 @@
+
+set(VAR1 "set")
+unset(VAR2)
+
+return(PROPAGATE VAR1 VAR2)
diff --git a/Tests/RunCMake/showIncludes.c b/Tests/RunCMake/showIncludes.c
new file mode 100644
index 000000000..23b38458d
--- /dev/null
+++ b/Tests/RunCMake/showIncludes.c
@@ -0,0 +1,33 @@
+#if defined(_MSC_VER) && _MSC_VER >= 1928
+# pragma warning(disable : 5105) /* macro expansion warning in windows.h */
+#endif
+#include <windows.h>
+
+#include <stdio.h>
+
+int main()
+{
+ /* 'cl /showIncludes' encodes output in the console output code page. */
+ unsigned int cp = GetConsoleOutputCP();
+ printf("Console output code page: %u\n", cp);
+ printf("Console input code page: %u\n", GetConsoleCP());
+ printf("ANSI code page: %u\n", GetACP());
+ printf("OEM code page: %u\n", GetOEMCP());
+
+ if (cp == 54936 || cp == 936) {
+ /* VSLANG=2052 */
+ printf("\xd7\xa2\xd2\xe2: "
+ "\xb0\xfc\xba\xac\xce\xc4\xbc\xfe:\n");
+ return 0;
+ }
+
+ if (cp == 65001) {
+ /* VSLANG=2052 */
+ printf("\xe6\xb3\xa8\xe6\x84\x8f: "
+ "\xe5\x8c\x85\xe5\x90\xab\xe6\x96\x87\xe4\xbb\xb6:\n");
+ return 0;
+ }
+
+ fprintf(stderr, "No example showIncludes for console's output code page.\n");
+ return 1;
+}
diff --git a/Tests/RunCMake/string/JSON.cmake b/Tests/RunCMake/string/JSON.cmake
index ab4194d26..255c16a56 100644
--- a/Tests/RunCMake/string/JSON.cmake
+++ b/Tests/RunCMake/string/JSON.cmake
@@ -129,7 +129,7 @@ assert_strequal("${error}" "member '0' not found")
string(JSON result ERROR_VARIABLE error GET "${json1}" array 10)
assert_strequal("${result}" "array-10-NOTFOUND")
-assert_strequal("${error}" "expected an index less then 4 got '10'")
+assert_strequal("${error}" "expected an index less than 4 got '10'")
string(JSON result ERROR_VARIABLE error GET "${json1}" array 2 some notThere)
assert_strequal("${result}" "array-2-some-notThere-NOTFOUND")
@@ -240,7 +240,7 @@ endif()
string(JSON result ERROR_VARIABLE error MEMBER "${json1}" values 100)
assert_strequal("${result}" "values-100-NOTFOUND")
-assert_strequal("${error}" "expected an index less then 5 got '100'")
+assert_strequal("${error}" "expected an index less than 5 got '100'")
# Test length loops
string(JSON arrayLength ERROR_VARIABLE error LENGTH "${json1}" types array)
@@ -301,7 +301,7 @@ assert_json_equal("${error}" "${result}"
string(JSON result ERROR_VARIABLE error REMOVE ${json2} array 100)
assert_strequal("${result}" "array-100-NOTFOUND")
-assert_strequal("${error}" "expected an index less then 4 got '100'")
+assert_strequal("${error}" "expected an index less than 4 got '100'")
# Test SET
string(JSON result ERROR_VARIABLE error SET ${json2} new 5)
diff --git a/Tests/RunCMake/target_compile_options/CMP0101-BEFORE_keyword-stderr.txt b/Tests/RunCMake/target_compile_options/CMP0101-BEFORE_keyword-stderr.txt
new file mode 100644
index 000000000..f04e43ff2
--- /dev/null
+++ b/Tests/RunCMake/target_compile_options/CMP0101-BEFORE_keyword-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0101-BEFORE_keyword.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0101 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake
index 021de413b..9b6581c51 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake
@@ -90,12 +90,22 @@ if(APPLE AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES
run_cmake_target(apple_framework target-framework main-target-framework)
run_cmake_target(apple_framework target-reexport_framework main-target-reexport_framework)
run_cmake_target(apple_framework target-weak_framework main-target-weak_framework)
+
+ if(RunCMake_GENERATOR_IS_MULTI_CONFIG AND (NOT XCODE OR XCODE_VERSION GREATER_EQUAL 13))
+ run_cmake_target(apple_framework target-framework-postfix main-target-framework-postfix)
+ run_cmake_target(apple_framework target-reexport_framework-postfix main-target-reexport_framework-postfix)
+ run_cmake_target(apple_framework target-weak_framework-postfix main-target-weak_framework-postfix)
+ endif()
endif()
if (CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION GREATER_EQUAL "12")
run_cmake_target(apple_framework needed_framework main-needed_framework)
run_cmake_target(apple_framework target-needed_framework main-target-needed_framework)
+
+ if(RunCMake_GENERATOR_IS_MULTI_CONFIG AND (NOT XCODE OR XCODE_VERSION GREATER_EQUAL 13))
+ run_cmake_target(apple_framework target-needed_framework-postfix main-target-needed_framework-postfix)
+ endif()
endif()
# Apple library features
diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/apple_framework.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/apple_framework.cmake
index e9a93e9fc..ca0e72d7e 100644
--- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/apple_framework.cmake
+++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/apple_framework.cmake
@@ -59,3 +59,33 @@ target_link_libraries(main-target-reexport_framework PRIVATE "$<LINK_LIBRARY:FRA
# feature WEAK_FRAMEWORK
add_executable(main-target-weak_framework main.mm)
target_link_libraries(main-target-weak_framework PRIVATE "$<LINK_LIBRARY:FRAMEWORK,Foundation>" "$<LINK_LIBRARY:REEXPORT_FRAMEWORK,target-framework>")
+
+
+
+get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+if(IS_MULTI_CONFIG)
+ add_library(target-framework-postfix SHARED foo.mm)
+ set_target_properties(target-framework-postfix PROPERTIES FRAMEWORK TRUE
+ FRAMEWORK_MULTI_CONFIG_POSTFIX_RELEASE "_release")
+ target_link_libraries(target-framework-postfix PRIVATE "$<LINK_LIBRARY:FRAMEWORK,Foundation>")
+
+
+ # feature FRAMEWORK
+ add_executable(main-target-framework-postfix main.mm)
+ target_link_libraries(main-target-framework-postfix PRIVATE "$<LINK_LIBRARY:FRAMEWORK,Foundation>" "$<LINK_LIBRARY:FRAMEWORK,target-framework-postfix>")
+
+
+ # feature NEEDED_FRAMEWORK
+ add_executable(main-target-needed_framework-postfix main.mm)
+ target_link_libraries(main-target-needed_framework-postfix PRIVATE "$<LINK_LIBRARY:FRAMEWORK,Foundation>" "$<LINK_LIBRARY:NEEDED_FRAMEWORK,target-framework-postfix>")
+
+
+ # feature REEXPORT_FRAMEWORK
+ add_executable(main-target-reexport_framework-postfix main.mm)
+ target_link_libraries(main-target-reexport_framework-postfix PRIVATE "$<LINK_LIBRARY:FRAMEWORK,Foundation>" "$<LINK_LIBRARY:REEXPORT_FRAMEWORK,target-framework-postfix>")
+
+
+ # feature WEAK_FRAMEWORK
+ add_executable(main-target-weak_framework-postfix main.mm)
+ target_link_libraries(main-target-weak_framework-postfix PRIVATE "$<LINK_LIBRARY:FRAMEWORK,Foundation>" "$<LINK_LIBRARY:REEXPORT_FRAMEWORK,target-framework-postfix>")
+endif()
diff --git a/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental-result.txt b/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental-stderr.txt b/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental-stderr.txt
new file mode 100644
index 000000000..042d67df6
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Warning \(dev\) at FileSetDefaultWrongTypeExperimental.cmake:6 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Error at FileSetDefaultWrongTypeExperimental\.cmake:[0-9]+ \(target_sources\):
+ target_sources File set TYPE may only be "HEADERS", "CXX_MODULES", or
+ "CXX_MODULE_HEADER_UNITS"
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake b/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake
new file mode 100644
index 000000000..5ade637df
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake
@@ -0,0 +1,6 @@
+enable_language(C)
+
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046")
+
+add_library(lib1 STATIC empty.c)
+target_sources(lib1 PRIVATE FILE_SET UNKNOWN)
diff --git a/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental-result.txt b/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental-stderr.txt b/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental-stderr.txt
new file mode 100644
index 000000000..a1b784fa2
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Warning \(dev\) at FileSetWrongTypeExperimental.cmake:6 \(target_sources\):
+ CMake's C\+\+ module support is experimental. It is meant only for
+ experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Error at FileSetWrongTypeExperimental\.cmake:[0-9]+ \(target_sources\):
+ target_sources File set TYPE may only be "HEADERS", "CXX_MODULES", or
+ "CXX_MODULE_HEADER_UNITS"
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake b/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake
new file mode 100644
index 000000000..332441c82
--- /dev/null
+++ b/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake
@@ -0,0 +1,6 @@
+enable_language(C)
+
+set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046")
+
+add_library(lib1 STATIC empty.c)
+target_sources(lib1 PRIVATE FILE_SET a TYPE UNKNOWN)
diff --git a/Tests/RunCMake/target_sources/RunCMakeTest.cmake b/Tests/RunCMake/target_sources/RunCMakeTest.cmake
index 6a3c7b9c6..7c67c3f47 100644
--- a/Tests/RunCMake/target_sources/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_sources/RunCMakeTest.cmake
@@ -26,6 +26,8 @@ run_cmake(FileSetProperties)
run_cmake(FileSetNoType)
run_cmake(FileSetWrongType)
run_cmake(FileSetDefaultWrongType)
+run_cmake(FileSetWrongTypeExperimental)
+run_cmake(FileSetDefaultWrongTypeExperimental)
run_cmake(FileSetChangeScope)
run_cmake(FileSetChangeType)
run_cmake(FileSetWrongBaseDirs)
diff --git a/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt b/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt
index 652bcfcd1..4e41a19dc 100644
--- a/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt
+++ b/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at BadLinkLibraries.cmake:2 \(try_compile\):
+CMake Error at BadLinkLibraries.cmake:[0-9]+ \(try_compile\):
Only libraries may be used as try_compile or try_run IMPORTED
LINK_LIBRARIES. Got not_a_library of type UTILITY.
Call Stack \(most recent call first\):
diff --git a/Tests/RunCMake/try_compile/BadLinkLibraries.cmake b/Tests/RunCMake/try_compile/BadLinkLibraries.cmake
index e8b5add87..b758e23cd 100644
--- a/Tests/RunCMake/try_compile/BadLinkLibraries.cmake
+++ b/Tests/RunCMake/try_compile/BadLinkLibraries.cmake
@@ -1,3 +1,7 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
add_custom_target(not_a_library)
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
LINK_LIBRARIES not_a_library)
diff --git a/Tests/RunCMake/try_compile/BadSources1-stderr.txt b/Tests/RunCMake/try_compile/BadSources1-stderr.txt
index 864a2942c..ddcba4f35 100644
--- a/Tests/RunCMake/try_compile/BadSources1-stderr.txt
+++ b/Tests/RunCMake/try_compile/BadSources1-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at BadSources1.cmake:1 \(try_compile\):
+CMake Error at BadSources1.cmake:[0-9]+ \(try_compile\):
Unknown extension ".c" for file
.*/Tests/RunCMake/try_compile/src.c
diff --git a/Tests/RunCMake/try_compile/BadSources1.cmake b/Tests/RunCMake/try_compile/BadSources1.cmake
index aa4dc5ee5..c95935d3a 100644
--- a/Tests/RunCMake/try_compile/BadSources1.cmake
+++ b/Tests/RunCMake/try_compile/BadSources1.cmake
@@ -1 +1,3 @@
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c)
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c)
diff --git a/Tests/RunCMake/try_compile/BadSources2-stderr.txt b/Tests/RunCMake/try_compile/BadSources2-stderr.txt
index 3313f9933..953dd9ccc 100644
--- a/Tests/RunCMake/try_compile/BadSources2-stderr.txt
+++ b/Tests/RunCMake/try_compile/BadSources2-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at BadSources2.cmake:2 \(try_compile\):
+CMake Error at BadSources2.cmake:[0-9]+ \(try_compile\):
Unknown extension ".cxx" for file
.*/Tests/RunCMake/try_compile/src.cxx
diff --git a/Tests/RunCMake/try_compile/BadSources2.cmake b/Tests/RunCMake/try_compile/BadSources2.cmake
index ed2b0364d..3f22bb6f2 100644
--- a/Tests/RunCMake/try_compile/BadSources2.cmake
+++ b/Tests/RunCMake/try_compile/BadSources2.cmake
@@ -1,5 +1,6 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
enable_language(C)
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c
- ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx
)
diff --git a/Tests/RunCMake/try_compile/BinDirEmpty-result.txt b/Tests/RunCMake/try_compile/BinDirEmpty-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_compile/BinDirEmpty-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/BinDirEmpty-stderr.txt b/Tests/RunCMake/try_compile/BinDirEmpty-stderr.txt
new file mode 100644
index 000000000..b1f5ae3b4
--- /dev/null
+++ b/Tests/RunCMake/try_compile/BinDirEmpty-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at BinDirEmpty.cmake:[0-9]+ \(try_compile\):
+ No <bindir> specified.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/try_compile/BinDirEmpty.cmake b/Tests/RunCMake/try_compile/BinDirEmpty.cmake
new file mode 100644
index 000000000..7bea43d85
--- /dev/null
+++ b/Tests/RunCMake/try_compile/BinDirEmpty.cmake
@@ -0,0 +1 @@
+try_compile(resultVar "" ${CMAKE_CURRENT_SOURCE_DIR}/src.c)
diff --git a/Tests/RunCMake/try_compile/BinDirRelative-result.txt b/Tests/RunCMake/try_compile/BinDirRelative-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_compile/BinDirRelative-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/BinDirRelative-stderr.txt b/Tests/RunCMake/try_compile/BinDirRelative-stderr.txt
new file mode 100644
index 000000000..a7b6302d0
--- /dev/null
+++ b/Tests/RunCMake/try_compile/BinDirRelative-stderr.txt
@@ -0,0 +1,6 @@
+^CMake Error at BinDirRelative.cmake:[0-9]+ \(try_compile\):
+ <bindir> is not an absolute path:
+
+ 'bin_dir_relative'
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/try_compile/BinDirRelative.cmake b/Tests/RunCMake/try_compile/BinDirRelative.cmake
new file mode 100644
index 000000000..8deda11ee
--- /dev/null
+++ b/Tests/RunCMake/try_compile/BinDirRelative.cmake
@@ -0,0 +1 @@
+try_compile(resultVar bin_dir_relative ${CMAKE_CURRENT_SOURCE_DIR}/src.c)
diff --git a/Tests/RunCMake/try_compile/BuildType.cmake b/Tests/RunCMake/try_compile/BuildType.cmake
new file mode 100644
index 000000000..8d7e3bef8
--- /dev/null
+++ b/Tests/RunCMake/try_compile/BuildType.cmake
@@ -0,0 +1,8 @@
+enable_language(C)
+set(CMAKE_BUILD_TYPE RelWithDebInfo)
+
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT
+ ${try_compile_bindir_or_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/out.bin"
+ )
diff --git a/Tests/RunCMake/try_compile/BuildTypeAsFlag.cmake b/Tests/RunCMake/try_compile/BuildTypeAsFlag.cmake
new file mode 100644
index 000000000..a822156e2
--- /dev/null
+++ b/Tests/RunCMake/try_compile/BuildTypeAsFlag.cmake
@@ -0,0 +1,9 @@
+enable_language(C)
+set(CMAKE_BUILD_TYPE RelWithDebInfo)
+
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT
+ ${try_compile_bindir_or_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/out.bin"
+ CMAKE_FLAGS "-DCMAKE_BUILD_TYPE=Release"
+ )
diff --git a/Tests/RunCMake/try_compile/CStandard-stderr.txt b/Tests/RunCMake/try_compile/CStandard-stderr.txt
index 209afcc56..c3c48a16c 100644
--- a/Tests/RunCMake/try_compile/CStandard-stderr.txt
+++ b/Tests/RunCMake/try_compile/CStandard-stderr.txt
@@ -1,4 +1,4 @@
-^CMake Error at .*/Tests/RunCMake/try_compile/CStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\):
+^CMake Error at .*/Tests/RunCMake/try_compile/CStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\):
C_STANDARD is set to invalid value '3'
+
CMake Error at CStandard.cmake:[0-9]+ \(try_compile\):
diff --git a/Tests/RunCMake/try_compile/CStandard.cmake b/Tests/RunCMake/try_compile/CStandard.cmake
index 2849ed4fd..6ac04db4a 100644
--- a/Tests/RunCMake/try_compile/CStandard.cmake
+++ b/Tests/RunCMake/try_compile/CStandard.cmake
@@ -1,7 +1,11 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(C)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
C_STANDARD 3
OUTPUT_VARIABLE out
)
+
message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/CStandardGNU.cmake b/Tests/RunCMake/try_compile/CStandardGNU.cmake
index 79ae87445..10a438403 100644
--- a/Tests/RunCMake/try_compile/CStandardGNU.cmake
+++ b/Tests/RunCMake/try_compile/CStandardGNU.cmake
@@ -1,23 +1,30 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(C)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c
C_STANDARD 99
C_STANDARD_REQUIRED 1
C_EXTENSIONS 0
OUTPUT_VARIABLE out
)
+
if(NOT result)
message(FATAL_ERROR "try_compile failed:\n${out}")
endif()
cmake_policy(SET CMP0067 NEW)
+
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED 1)
set(CMAKE_C_EXTENSIONS 0)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c
OUTPUT_VARIABLE out
)
+
if(NOT result)
message(FATAL_ERROR "try_compile failed:\n${out}")
endif()
diff --git a/Tests/RunCMake/try_compile/CStandardNoDefault.cmake b/Tests/RunCMake/try_compile/CStandardNoDefault.cmake
index 97e72ea40..f4dd5aebe 100644
--- a/Tests/RunCMake/try_compile/CStandardNoDefault.cmake
+++ b/Tests/RunCMake/try_compile/CStandardNoDefault.cmake
@@ -1,9 +1,13 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(C)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
C_STANDARD 3 # bogus, but not used
OUTPUT_VARIABLE out
)
+
if(NOT result)
message(FATAL_ERROR "try_compile failed:\n${out}")
endif()
diff --git a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt
index 5d09c0c61..8c4930287 100644
--- a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt
+++ b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at CopyFileErrorNoCopyFile.cmake:1 \(try_compile\):
+CMake Error at CopyFileErrorNoCopyFile.cmake:[0-9]+ \(try_compile\):
COPY_FILE_ERROR may be used only with COPY_FILE
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake
index 8d7cb0e7f..8d15b3db1 100644
--- a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake
+++ b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake
@@ -1,2 +1,4 @@
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
COPY_FILE_ERROR _copied)
diff --git a/Tests/RunCMake/try_compile/CudaStandard-stderr.txt b/Tests/RunCMake/try_compile/CudaStandard-stderr.txt
index bcf95d546..52dff8f33 100644
--- a/Tests/RunCMake/try_compile/CudaStandard-stderr.txt
+++ b/Tests/RunCMake/try_compile/CudaStandard-stderr.txt
@@ -1,4 +1,4 @@
-^CMake Error at .*/Tests/RunCMake/try_compile/CudaStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\):
+^CMake Error at .*/Tests/RunCMake/try_compile/CudaStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\):
CUDA_STANDARD is set to invalid value '4'
+
CMake Error at CudaStandard.cmake:[0-9]+ \(try_compile\):
diff --git a/Tests/RunCMake/try_compile/CudaStandard.cmake b/Tests/RunCMake/try_compile/CudaStandard.cmake
index a230424bf..0be89bef3 100644
--- a/Tests/RunCMake/try_compile/CudaStandard.cmake
+++ b/Tests/RunCMake/try_compile/CudaStandard.cmake
@@ -1,7 +1,11 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(CUDA)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.cu
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.cu
CUDA_STANDARD 4
OUTPUT_VARIABLE out
)
+
message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/CxxStandard-stderr.txt b/Tests/RunCMake/try_compile/CxxStandard-stderr.txt
index ec7245fdd..55a06e294 100644
--- a/Tests/RunCMake/try_compile/CxxStandard-stderr.txt
+++ b/Tests/RunCMake/try_compile/CxxStandard-stderr.txt
@@ -1,6 +1,17 @@
-^CMake Error at .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\):
+^(CMake Error in .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:
+ The CXX_STANDARD property on target "cmTC_[0-9a-f]*" contained an invalid
+ value: "3".
+
+
+)?CMake Error at .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\):
CXX_STANDARD is set to invalid value '3'
-+
+
+(
+CMake Error in .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:
+ The CXX_STANDARD property on target "cmTC_[0-9a-f]*" contained an invalid
+ value: "3".
+
+)?
CMake Error at CxxStandard.cmake:[0-9]+ \(try_compile\):
Failed to generate test project build system.
Call Stack \(most recent call first\):
diff --git a/Tests/RunCMake/try_compile/CxxStandard.cmake b/Tests/RunCMake/try_compile/CxxStandard.cmake
index bcb49b9b3..e5b4e7818 100644
--- a/Tests/RunCMake/try_compile/CxxStandard.cmake
+++ b/Tests/RunCMake/try_compile/CxxStandard.cmake
@@ -1,7 +1,11 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(CXX)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx
CXX_STANDARD 3
OUTPUT_VARIABLE out
)
+
message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/CxxStandardGNU.cmake b/Tests/RunCMake/try_compile/CxxStandardGNU.cmake
index e714fe4d0..552d99d6b 100644
--- a/Tests/RunCMake/try_compile/CxxStandardGNU.cmake
+++ b/Tests/RunCMake/try_compile/CxxStandardGNU.cmake
@@ -1,23 +1,30 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(CXX)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CxxStandardGNU.cxx
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CxxStandardGNU.cxx
CXX_STANDARD 11
CXX_STANDARD_REQUIRED 1
CXX_EXTENSIONS 0
OUTPUT_VARIABLE out
)
+
if(NOT result)
message(FATAL_ERROR "try_compile failed:\n${out}")
endif()
cmake_policy(SET CMP0067 NEW)
+
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED 1)
set(CMAKE_CXX_EXTENSIONS 0)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CxxStandardGNU.cxx
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CxxStandardGNU.cxx
OUTPUT_VARIABLE out
)
+
if(NOT result)
message(FATAL_ERROR "try_compile failed:\n${out}")
endif()
diff --git a/Tests/RunCMake/try_compile/CxxStandardNoDefault.cmake b/Tests/RunCMake/try_compile/CxxStandardNoDefault.cmake
index 35caa9d09..e0ebfeec7 100644
--- a/Tests/RunCMake/try_compile/CxxStandardNoDefault.cmake
+++ b/Tests/RunCMake/try_compile/CxxStandardNoDefault.cmake
@@ -1,9 +1,13 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(CXX)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx
CXX_STANDARD 3 # bogus, but not used
OUTPUT_VARIABLE out
)
+
if(NOT result)
message(FATAL_ERROR "try_compile failed:\n${out}")
endif()
diff --git a/Tests/RunCMake/try_compile/EmptyListArgs.cmake b/Tests/RunCMake/try_compile/EmptyListArgs.cmake
new file mode 100644
index 000000000..5cd7465ff
--- /dev/null
+++ b/Tests/RunCMake/try_compile/EmptyListArgs.cmake
@@ -0,0 +1,11 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
+enable_language(C)
+
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ CMAKE_FLAGS # no values
+ COMPILE_DEFINITIONS # no values
+ LINK_LIBRARIES # no values
+ LINK_OPTIONS # no values
+ )
diff --git a/Tests/RunCMake/try_compile/EmptyValueArgs-result.txt b/Tests/RunCMake/try_compile/EmptyValueArgs-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_compile/EmptyValueArgs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt b/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt
new file mode 100644
index 000000000..b1344bd43
--- /dev/null
+++ b/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt
@@ -0,0 +1,9 @@
+CMake Error at EmptyValueArgs.cmake:[0-9]+ \(try_compile\):
+ COPY_FILE must be followed by a file path
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at EmptyValueArgs.cmake:[0-9]+ \(try_compile\):
+ COPY_FILE_ERROR must be followed by a variable name
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/try_compile/EmptyValueArgs.cmake b/Tests/RunCMake/try_compile/EmptyValueArgs.cmake
new file mode 100644
index 000000000..fda4f1023
--- /dev/null
+++ b/Tests/RunCMake/try_compile/EmptyValueArgs.cmake
@@ -0,0 +1,7 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ COPY_FILE "")
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ COPY_FILE "x" COPY_FILE_ERROR "")
diff --git a/Tests/RunCMake/try_compile/EnvConfig.cmake b/Tests/RunCMake/try_compile/EnvConfig.cmake
index 4040c593d..6e668259d 100644
--- a/Tests/RunCMake/try_compile/EnvConfig.cmake
+++ b/Tests/RunCMake/try_compile/EnvConfig.cmake
@@ -1,3 +1,5 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(C)
set(ENV{CMAKE_BUILD_TYPE} "Bad")
@@ -6,8 +8,8 @@ set(ENV{CMAKE_CONFIGURATION_TYPES} "Bad;Debug")
add_library(tc_defs INTERFACE IMPORTED)
target_compile_definitions(tc_defs INTERFACE "TC_CONFIG_$<UPPER_CASE:$<CONFIG>>")
-try_compile(ENV_CONFIG_RESULT "${CMAKE_BINARY_DIR}"
- SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/EnvConfig.c"
+try_compile(ENV_CONFIG_RESULT "${try_compile_bindir_or_SOURCES}"
+ ${try_compile_redundant_SOURCES} "${CMAKE_CURRENT_SOURCE_DIR}/EnvConfig.c"
COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/EnvConfig.bin"
OUTPUT_VARIABLE tc_output
LINK_LIBRARIES tc_defs
diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake b/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake
index 6d29069cd..1ead4c28a 100644
--- a/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake
+++ b/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake
@@ -1,8 +1,12 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
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
+
+set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16 avx512skx-i32x16)
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
OUTPUT_VARIABLE out
)
+
message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake
index 7f59c1451..e08e25f23 100644
--- a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake
+++ b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake
@@ -1,11 +1,16 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
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
+
+set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16 avx512skx-i32x16)
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_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.cmake b/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake
index c1ab6f24e..2276bd3be 100644
--- a/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake
+++ b/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake
@@ -1,7 +1,12 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(ISPC)
+
set(CMAKE_ISPC_INSTRUCTION_SETS "avxknl-i32x16")
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
OUTPUT_VARIABLE out
)
+
message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/ISPCTargets.cmake b/Tests/RunCMake/try_compile/ISPCTargets.cmake
index 0d3bd4369..bd455691d 100644
--- a/Tests/RunCMake/try_compile/ISPCTargets.cmake
+++ b/Tests/RunCMake/try_compile/ISPCTargets.cmake
@@ -1,7 +1,12 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
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
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
OUTPUT_VARIABLE out
)
+
message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/NoArgs-stderr.txt b/Tests/RunCMake/try_compile/NoArgs-stderr.txt
index 8808fd19a..422858006 100644
--- a/Tests/RunCMake/try_compile/NoArgs-stderr.txt
+++ b/Tests/RunCMake/try_compile/NoArgs-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at NoArgs.cmake:1 \(try_compile\):
- try_compile unknown error.
+CMake Error at NoArgs.cmake:[0-9]+ \(try_compile\):
+ The try_compile\(\) command requires at least 3 arguments.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NoCStandard-result.txt b/Tests/RunCMake/try_compile/NoCStandard-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoCStandard-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/NoCStandard-stderr.txt b/Tests/RunCMake/try_compile/NoCStandard-stderr.txt
new file mode 100644
index 000000000..e0bb9ed14
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoCStandard-stderr.txt
@@ -0,0 +1,7 @@
+CMake Error at NoCStandard.cmake:[0-9]+ \(try_compile\):
+ Error after keyword "C_STANDARD":
+
+ missing required value
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NoCStandard.cmake b/Tests/RunCMake/try_compile/NoCStandard.cmake
new file mode 100644
index 000000000..e0d0478d2
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoCStandard.cmake
@@ -0,0 +1,4 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ C_STANDARD)
diff --git a/Tests/RunCMake/try_compile/NoCopyFile-stderr.txt b/Tests/RunCMake/try_compile/NoCopyFile-stderr.txt
index d65d94883..55ba687c0 100644
--- a/Tests/RunCMake/try_compile/NoCopyFile-stderr.txt
+++ b/Tests/RunCMake/try_compile/NoCopyFile-stderr.txt
@@ -1,4 +1,7 @@
-CMake Error at NoCopyFile.cmake:1 \(try_compile\):
- COPY_FILE must be followed by a file path
+CMake Error at NoCopyFile.cmake:[0-9]+ \(try_compile\):
+ Error after keyword "COPY_FILE":
+
+ missing required value
+
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NoCopyFile.cmake b/Tests/RunCMake/try_compile/NoCopyFile.cmake
index 8c648ff32..270dff9b2 100644
--- a/Tests/RunCMake/try_compile/NoCopyFile.cmake
+++ b/Tests/RunCMake/try_compile/NoCopyFile.cmake
@@ -1,2 +1,4 @@
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
COPY_FILE)
diff --git a/Tests/RunCMake/try_compile/NoCopyFile2-stderr.txt b/Tests/RunCMake/try_compile/NoCopyFile2-stderr.txt
index e88952475..008d4e9a4 100644
--- a/Tests/RunCMake/try_compile/NoCopyFile2-stderr.txt
+++ b/Tests/RunCMake/try_compile/NoCopyFile2-stderr.txt
@@ -1,4 +1,7 @@
-CMake Error at NoCopyFile2.cmake:1 \(try_compile\):
- COPY_FILE must be followed by a file path
+CMake Error at NoCopyFile2.cmake:[0-9]+ \(try_compile\):
+ Error after keyword "COPY_FILE":
+
+ missing required value
+
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NoCopyFile2.cmake b/Tests/RunCMake/try_compile/NoCopyFile2.cmake
index 04b7f6882..2ea81824a 100644
--- a/Tests/RunCMake/try_compile/NoCopyFile2.cmake
+++ b/Tests/RunCMake/try_compile/NoCopyFile2.cmake
@@ -1,2 +1,4 @@
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
COPY_FILE CMAKE_FLAGS -DA=B)
diff --git a/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt b/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt
index ed552fd8e..7ca185d9e 100644
--- a/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt
+++ b/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt
@@ -1,4 +1,7 @@
-CMake Error at NoCopyFileError.cmake:1 \(try_compile\):
- COPY_FILE_ERROR must be followed by a variable name
+CMake Error at NoCopyFileError.cmake:[0-9]+ \(try_compile\):
+ Error after keyword "COPY_FILE_ERROR":
+
+ missing required value
+
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NoCopyFileError.cmake b/Tests/RunCMake/try_compile/NoCopyFileError.cmake
index d4d69ee01..1a56e86e8 100644
--- a/Tests/RunCMake/try_compile/NoCopyFileError.cmake
+++ b/Tests/RunCMake/try_compile/NoCopyFileError.cmake
@@ -1,2 +1,4 @@
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copied.bin COPY_FILE_ERROR)
diff --git a/Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt b/Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt
index 18ad751cf..ec29f0bee 100644
--- a/Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt
+++ b/Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt
@@ -1,4 +1,7 @@
-CMake Error at NoOutputVariable.cmake:1 \(try_compile\):
- OUTPUT_VARIABLE must be followed by a variable name
+CMake Error at NoOutputVariable.cmake:[0-9]+ \(try_compile\):
+ Error after keyword "OUTPUT_VARIABLE":
+
+ missing required value
+
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NoOutputVariable.cmake b/Tests/RunCMake/try_compile/NoOutputVariable.cmake
index 3b9cb345b..13dc4b49f 100644
--- a/Tests/RunCMake/try_compile/NoOutputVariable.cmake
+++ b/Tests/RunCMake/try_compile/NoOutputVariable.cmake
@@ -1,2 +1,4 @@
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
OUTPUT_VARIABLE)
diff --git a/Tests/RunCMake/try_compile/NoOutputVariable2-stderr.txt b/Tests/RunCMake/try_compile/NoOutputVariable2-stderr.txt
index 8b2cc254c..dd345593c 100644
--- a/Tests/RunCMake/try_compile/NoOutputVariable2-stderr.txt
+++ b/Tests/RunCMake/try_compile/NoOutputVariable2-stderr.txt
@@ -1,4 +1,7 @@
-CMake Error at NoOutputVariable2.cmake:1 \(try_compile\):
- OUTPUT_VARIABLE must be followed by a variable name
+CMake Error at NoOutputVariable2.cmake:[0-9]+ \(try_compile\):
+ Error after keyword "OUTPUT_VARIABLE":
+
+ missing required value
+
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NoOutputVariable2.cmake b/Tests/RunCMake/try_compile/NoOutputVariable2.cmake
index ad9ac9ac5..4d5dda399 100644
--- a/Tests/RunCMake/try_compile/NoOutputVariable2.cmake
+++ b/Tests/RunCMake/try_compile/NoOutputVariable2.cmake
@@ -1,2 +1,4 @@
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
OUTPUT_VARIABLE CMAKE_FLAGS -DA=B)
diff --git a/Tests/RunCMake/try_compile/NoSources-stderr.txt b/Tests/RunCMake/try_compile/NoSources-stderr.txt
index 023032b60..55603dca1 100644
--- a/Tests/RunCMake/try_compile/NoSources-stderr.txt
+++ b/Tests/RunCMake/try_compile/NoSources-stderr.txt
@@ -1,4 +1,7 @@
-CMake Error at NoSources.cmake:1 \(try_compile\):
- SOURCES must be followed by at least one source file
+CMake Error at NoSources.cmake:[0-9]+ \(try_compile\):
+ Error after keyword "SOURCES":
+
+ missing required value
+
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt b/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt
index 025e65868..dcd5c7a76 100644
--- a/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt
+++ b/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at NonSourceCompileDefinitions.cmake:1 \(try_compile\):
- COMPILE_DEFINITIONS specified on a srcdir type TRY_COMPILE
+CMake Error at NonSourceCompileDefinitions.cmake:[0-9]+ \(try_compile\):
+ COMPILE_DEFINITIONS allowed only in source file signature
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt b/Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt
index f5893e19f..1b7dfeb24 100644
--- a/Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt
+++ b/Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at NonSourceCopyFile.cmake:1 \(try_compile\):
- COPY_FILE specified on a srcdir type TRY_COMPILE
+CMake Error at NonSourceCopyFile.cmake:[0-9]+ \(try_compile\):
+ COPY_FILE allowed only in source file signature
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt b/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt
index f1b4df9e0..59f1d73f9 100644
--- a/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt
+++ b/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt
@@ -1,4 +1,4 @@
-^CMake Error at .*/Tests/RunCMake/try_compile/ObjCStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\):
+^CMake Error at .*/Tests/RunCMake/try_compile/ObjCStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\):
OBJC_STANDARD is set to invalid value '3'
+
CMake Error at ObjCStandard.cmake:[0-9]+ \(try_compile\):
diff --git a/Tests/RunCMake/try_compile/ObjCStandard.cmake b/Tests/RunCMake/try_compile/ObjCStandard.cmake
index b2066f957..a691dddfc 100644
--- a/Tests/RunCMake/try_compile/ObjCStandard.cmake
+++ b/Tests/RunCMake/try_compile/ObjCStandard.cmake
@@ -1,7 +1,11 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(OBJC)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.m
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.m
OBJC_STANDARD 3
OUTPUT_VARIABLE out
)
+
message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt b/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt
index a2f91b48f..21fa20f91 100644
--- a/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt
+++ b/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt
@@ -1,4 +1,4 @@
-^CMake Error at .*/Tests/RunCMake/try_compile/ObjCxxStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\):
+^CMake Error at .*/Tests/RunCMake/try_compile/ObjCxxStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\):
OBJCXX_STANDARD is set to invalid value '3'
+
CMake Error at ObjCxxStandard.cmake:[0-9]+ \(try_compile\):
diff --git a/Tests/RunCMake/try_compile/ObjCxxStandard.cmake b/Tests/RunCMake/try_compile/ObjCxxStandard.cmake
index 1221805c0..b03f56016 100644
--- a/Tests/RunCMake/try_compile/ObjCxxStandard.cmake
+++ b/Tests/RunCMake/try_compile/ObjCxxStandard.cmake
@@ -1,7 +1,11 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(OBJCXX)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.mm
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.mm
OBJCXX_STANDARD 3
OUTPUT_VARIABLE out
)
+
message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-result.txt b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-stderr.txt b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-stderr.txt
new file mode 100644
index 000000000..e9ec4509e
--- /dev/null
+++ b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at OldProjectBinDirEmpty.cmake:[0-9]+ \(try_compile\):
+ No <bindir> specified.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/try_compile/OldProjectBinDirEmpty.cmake b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty.cmake
new file mode 100644
index 000000000..fa922d922
--- /dev/null
+++ b/Tests/RunCMake/try_compile/OldProjectBinDirEmpty.cmake
@@ -0,0 +1 @@
+try_compile(RESULT "" ${CMAKE_CURRENT_SOURCE_DIR}/proj Foo)
diff --git a/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-result.txt b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-stderr.txt b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-stderr.txt
new file mode 100644
index 000000000..47dd60f8d
--- /dev/null
+++ b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at OldProjectSrcDirEmpty.cmake:[0-9]+ \(try_compile\):
+ No <srcdir> specified.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty.cmake b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty.cmake
new file mode 100644
index 000000000..dfbfba6af
--- /dev/null
+++ b/Tests/RunCMake/try_compile/OldProjectSrcDirEmpty.cmake
@@ -0,0 +1 @@
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} "" Foo)
diff --git a/Tests/RunCMake/try_compile/OneArg-stderr.txt b/Tests/RunCMake/try_compile/OneArg-stderr.txt
index 12835bed6..a2e983efb 100644
--- a/Tests/RunCMake/try_compile/OneArg-stderr.txt
+++ b/Tests/RunCMake/try_compile/OneArg-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at OneArg.cmake:1 \(try_compile\):
- try_compile unknown error.
+CMake Error at OneArg.cmake:[0-9]+ \(try_compile\):
+ The try_compile\(\) command requires at least 3 arguments.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/OutputDirAsFlag.cmake b/Tests/RunCMake/try_compile/OutputDirAsFlag.cmake
new file mode 100644
index 000000000..1214bbb18
--- /dev/null
+++ b/Tests/RunCMake/try_compile/OutputDirAsFlag.cmake
@@ -0,0 +1,9 @@
+enable_language(C)
+set(CMAKE_BUILD_TYPE RelWithDebInfo)
+
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT
+ ${try_compile_bindir_or_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/out.bin"
+ CMAKE_FLAGS "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=bin"
+ )
diff --git a/Tests/RunCMake/try_compile/PlatformVariables-stderr.txt b/Tests/RunCMake/try_compile/PlatformVariables-stderr.txt
new file mode 100644
index 000000000..4a42b2d5b
--- /dev/null
+++ b/Tests/RunCMake/try_compile/PlatformVariables-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Debug Log at [^
+]*/Modules/CMakeDetermineCompilerABI.cmake:[0-9]+ \(try_compile\):
+ Executing try_compile \(CMAKE_C_ABI_COMPILED\) in:
+
+ [^
+]*/Tests/RunCMake/try_compile/PlatformVariables-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+
+Call Stack \(most recent call first\):
+ [^
+]*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)
+ PlatformVariables.cmake:[0-9]+ \(enable_language\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/try_compile/ProjectBinDirEmpty-result.txt b/Tests/RunCMake/try_compile/ProjectBinDirEmpty-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectBinDirEmpty-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/ProjectBinDirEmpty-stderr.txt b/Tests/RunCMake/try_compile/ProjectBinDirEmpty-stderr.txt
new file mode 100644
index 000000000..57a2bd0d2
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectBinDirEmpty-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at ProjectBinDirEmpty.cmake:[0-9]+ \(try_compile\):
+ No <bindir> specified.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/try_compile/ProjectBinDirEmpty.cmake b/Tests/RunCMake/try_compile/ProjectBinDirEmpty.cmake
new file mode 100644
index 000000000..e867cc693
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectBinDirEmpty.cmake
@@ -0,0 +1,4 @@
+try_compile(RESULT PROJECT Foo
+ SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/proj
+ BINARY_DIR ""
+ )
diff --git a/Tests/RunCMake/try_compile/ProjectCopyFile-result.txt b/Tests/RunCMake/try_compile/ProjectCopyFile-result.txt
new file mode 100644
index 000000000..573541ac9
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectCopyFile-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/try_compile/ProjectCopyFile-stderr.txt b/Tests/RunCMake/try_compile/ProjectCopyFile-stderr.txt
new file mode 100644
index 000000000..45241c930
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectCopyFile-stderr.txt
@@ -0,0 +1,7 @@
+CMake Warning \(dev\) at ProjectCopyFile.cmake:[0-9]+ \(try_compile\):
+ Unknown arguments:
+
+ "COPY_FILE"
+ "result"
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/ProjectCopyFile.cmake b/Tests/RunCMake/try_compile/ProjectCopyFile.cmake
new file mode 100644
index 000000000..6bfec994f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectCopyFile.cmake
@@ -0,0 +1,4 @@
+try_compile(RESULT
+ PROJECT TestProject
+ SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/proj
+ COPY_FILE result)
diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-result.txt b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-stderr.txt b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-stderr.txt
new file mode 100644
index 000000000..dc6f3543d
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at ProjectSrcDirEmpty.cmake:[0-9]+ \(try_compile\):
+ No <srcdir> specified.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirEmpty.cmake b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty.cmake
new file mode 100644
index 000000000..ac33ed0df
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectSrcDirEmpty.cmake
@@ -0,0 +1 @@
+try_compile(RESULT PROJECT Foo SOURCE_DIR "")
diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirMissing-result.txt b/Tests/RunCMake/try_compile/ProjectSrcDirMissing-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectSrcDirMissing-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirMissing-stderr.txt b/Tests/RunCMake/try_compile/ProjectSrcDirMissing-stderr.txt
new file mode 100644
index 000000000..af6edd528
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectSrcDirMissing-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at ProjectSrcDirMissing.cmake:[0-9]+ \(try_compile\):
+ No <srcdir> specified.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/ProjectSrcDirMissing.cmake b/Tests/RunCMake/try_compile/ProjectSrcDirMissing.cmake
new file mode 100644
index 000000000..e32cdf4a3
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ProjectSrcDirMissing.cmake
@@ -0,0 +1 @@
+try_compile(RESULT PROJECT Foo)
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index 3cfbfbff7..724547126 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -1,32 +1,39 @@
include(RunCMake)
-run_cmake(CopyFileErrorNoCopyFile)
run_cmake(NoArgs)
run_cmake(OneArg)
run_cmake(TwoArgs)
-run_cmake(NoCopyFile)
-run_cmake(NoCopyFile2)
-run_cmake(NoCopyFileError)
-run_cmake(NoOutputVariable)
-run_cmake(NoOutputVariable2)
run_cmake(NoSources)
-run_cmake(BadLinkLibraries)
-run_cmake(BadSources1)
-run_cmake(BadSources2)
+run_cmake(BinDirEmpty)
+run_cmake(BinDirRelative)
+run_cmake(ProjectSrcDirMissing)
+run_cmake(ProjectSrcDirEmpty)
+run_cmake(ProjectBinDirEmpty)
+run_cmake(OldProjectSrcDirEmpty)
+run_cmake(OldProjectBinDirEmpty)
+
+set(RunCMake_TEST_OPTIONS -Dtry_compile_DEFS=old_signature.cmake)
+include(${RunCMake_SOURCE_DIR}/old_and_new_signature_tests.cmake)
+unset(RunCMake_TEST_OPTIONS)
+
+set(RunCMake_TEST_OPTIONS -Dtry_compile_DEFS=new_signature.cmake)
+include(${RunCMake_SOURCE_DIR}/old_and_new_signature_tests.cmake)
+unset(RunCMake_TEST_OPTIONS)
+
+run_cmake(SourceFromOneArg)
+run_cmake(SourceFromThreeArgs)
+run_cmake(SourceFromBadName)
+run_cmake(SourceFromBadFile)
+
+run_cmake(ProjectCopyFile)
run_cmake(NonSourceCopyFile)
run_cmake(NonSourceCompileDefinitions)
-run_cmake(EnvConfig)
-
set(RunCMake_TEST_OPTIONS --debug-trycompile)
run_cmake(PlatformVariables)
run_cmake(WarnDeprecated)
unset(RunCMake_TEST_OPTIONS)
-run_cmake(TargetTypeExe)
-run_cmake(TargetTypeInvalid)
-run_cmake(TargetTypeStatic)
-
if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND
CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|LCC|Clang|AppleClang)$")
set (RunCMake_TEST_OPTIONS -DRunCMake_C_COMPILER_ID=${CMAKE_C_COMPILER_ID})
@@ -34,41 +41,6 @@ if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND
unset (RunCMake_TEST_OPTIONS)
endif()
-if(CMAKE_C_STANDARD_DEFAULT)
- run_cmake(CStandard)
-elseif(DEFINED CMAKE_C_STANDARD_DEFAULT)
- run_cmake(CStandardNoDefault)
-endif()
-if(CMAKE_OBJC_STANDARD_DEFAULT)
- run_cmake(ObjCStandard)
-endif()
-if(CMAKE_CXX_STANDARD_DEFAULT)
- run_cmake(CxxStandard)
-elseif(DEFINED CMAKE_CXX_STANDARD_DEFAULT)
- run_cmake(CxxStandardNoDefault)
-endif()
-if(CMAKE_OBJCXX_STANDARD_DEFAULT)
- run_cmake(ObjCxxStandard)
-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 MATCHES "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) OR CMAKE_C_COMPILER_ID MATCHES "LCC")
- run_cmake(CStandardGNU)
-endif()
-if((CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) OR CMAKE_C_COMPILER_ID MATCHES "LCC")
- run_cmake(CxxStandardGNU)
-endif()
-
run_cmake(CMP0056)
run_cmake(CMP0066)
run_cmake(CMP0067)
diff --git a/Tests/RunCMake/try_compile/SourceFromBadFile-result.txt b/Tests/RunCMake/try_compile/SourceFromBadFile-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_compile/SourceFromBadFile-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/SourceFromBadFile-stderr.txt b/Tests/RunCMake/try_compile/SourceFromBadFile-stderr.txt
new file mode 100644
index 000000000..53a6d8df6
--- /dev/null
+++ b/Tests/RunCMake/try_compile/SourceFromBadFile-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at SourceFromBadFile.cmake:[0-9]+ \(try_compile\):
+ SOURCE_FROM_FILE failed to copy "bad#source.c": No such file or directory
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/SourceFromBadFile.cmake b/Tests/RunCMake/try_compile/SourceFromBadFile.cmake
new file mode 100644
index 000000000..0a37f1168
--- /dev/null
+++ b/Tests/RunCMake/try_compile/SourceFromBadFile.cmake
@@ -0,0 +1 @@
+try_compile(RESULT SOURCE_FROM_FILE bad.c "bad#source.c")
diff --git a/Tests/RunCMake/try_compile/SourceFromBadName-result.txt b/Tests/RunCMake/try_compile/SourceFromBadName-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_compile/SourceFromBadName-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/SourceFromBadName-stderr.txt b/Tests/RunCMake/try_compile/SourceFromBadName-stderr.txt
new file mode 100644
index 000000000..041f3f144
--- /dev/null
+++ b/Tests/RunCMake/try_compile/SourceFromBadName-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at SourceFromBadName.cmake:[0-9]+ \(try_compile\):
+ SOURCE_FROM_CONTENT given invalid filename "bad/name.c"
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/SourceFromBadName.cmake b/Tests/RunCMake/try_compile/SourceFromBadName.cmake
new file mode 100644
index 000000000..44d92fdd6
--- /dev/null
+++ b/Tests/RunCMake/try_compile/SourceFromBadName.cmake
@@ -0,0 +1 @@
+try_compile(RESULT SOURCE_FROM_CONTENT bad/name.c "int main();")
diff --git a/Tests/RunCMake/try_compile/SourceFromOneArg-result.txt b/Tests/RunCMake/try_compile/SourceFromOneArg-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_compile/SourceFromOneArg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/SourceFromOneArg-stderr.txt b/Tests/RunCMake/try_compile/SourceFromOneArg-stderr.txt
new file mode 100644
index 000000000..8b2248a7a
--- /dev/null
+++ b/Tests/RunCMake/try_compile/SourceFromOneArg-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at SourceFromOneArg.cmake:[0-9]+ \(try_compile\):
+ SOURCE_FROM_CONTENT requires exactly two arguments
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/SourceFromOneArg.cmake b/Tests/RunCMake/try_compile/SourceFromOneArg.cmake
new file mode 100644
index 000000000..5a504998e
--- /dev/null
+++ b/Tests/RunCMake/try_compile/SourceFromOneArg.cmake
@@ -0,0 +1 @@
+try_compile(RESULT SOURCE_FROM_CONTENT test.c)
diff --git a/Tests/RunCMake/try_compile/SourceFromThreeArgs-result.txt b/Tests/RunCMake/try_compile/SourceFromThreeArgs-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_compile/SourceFromThreeArgs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/SourceFromThreeArgs-stderr.txt b/Tests/RunCMake/try_compile/SourceFromThreeArgs-stderr.txt
new file mode 100644
index 000000000..5f2ff618a
--- /dev/null
+++ b/Tests/RunCMake/try_compile/SourceFromThreeArgs-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at SourceFromThreeArgs.cmake:[0-9]+ \(try_compile\):
+ SOURCE_FROM_CONTENT requires exactly two arguments
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/SourceFromThreeArgs.cmake b/Tests/RunCMake/try_compile/SourceFromThreeArgs.cmake
new file mode 100644
index 000000000..196851aa1
--- /dev/null
+++ b/Tests/RunCMake/try_compile/SourceFromThreeArgs.cmake
@@ -0,0 +1 @@
+try_compile(RESULT SOURCE_FROM_CONTENT test.c "int" "main();")
diff --git a/Tests/RunCMake/try_compile/TargetTypeExe.cmake b/Tests/RunCMake/try_compile/TargetTypeExe.cmake
index 9b6e7272f..330f5f5d4 100644
--- a/Tests/RunCMake/try_compile/TargetTypeExe.cmake
+++ b/Tests/RunCMake/try_compile/TargetTypeExe.cmake
@@ -1,14 +1,20 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(C)
+
set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
OUTPUT_VARIABLE out
COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copy
COPY_FILE_ERROR copy_err
)
+
if(NOT result)
message(FATAL_ERROR "try_compile failed:\n${out}")
endif()
+
if(copy_err)
message(FATAL_ERROR "try_compile COPY_FILE failed:\n${copy_err}")
endif()
diff --git a/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt b/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt
index 08b281a45..e9123e32b 100644
--- a/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt
+++ b/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt
@@ -1,4 +1,4 @@
-^CMake Error at TargetTypeInvalid.cmake:2 \(try_compile\):
+^CMake Error at TargetTypeInvalid.cmake:[0-9]+ \(try_compile\):
Invalid value 'INVALID' for CMAKE_TRY_COMPILE_TARGET_TYPE. Only
'EXECUTABLE' and 'STATIC_LIBRARY' are allowed.
Call Stack \(most recent call first\):
diff --git a/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake b/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake
index 0bbc4ac82..15a20bb2d 100644
--- a/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake
+++ b/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake
@@ -1,2 +1,6 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
set(CMAKE_TRY_COMPILE_TARGET_TYPE INVALID)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c)
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c)
diff --git a/Tests/RunCMake/try_compile/TargetTypeStatic.cmake b/Tests/RunCMake/try_compile/TargetTypeStatic.cmake
index 006b8b898..98dea41ef 100644
--- a/Tests/RunCMake/try_compile/TargetTypeStatic.cmake
+++ b/Tests/RunCMake/try_compile/TargetTypeStatic.cmake
@@ -1,14 +1,20 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(C)
+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/other.c
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/other.c
OUTPUT_VARIABLE out
COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copy
COPY_FILE_ERROR copy_err
)
+
if(NOT result)
message(FATAL_ERROR "try_compile failed:\n${out}")
endif()
+
if(copy_err)
message(FATAL_ERROR "try_compile COPY_FILE failed:\n${copy_err}")
endif()
diff --git a/Tests/RunCMake/try_compile/TryRunArgs-stderr.txt b/Tests/RunCMake/try_compile/TryRunArgs-stderr.txt
new file mode 100644
index 000000000..2a58e71ac
--- /dev/null
+++ b/Tests/RunCMake/try_compile/TryRunArgs-stderr.txt
@@ -0,0 +1,18 @@
+^CMake Warning \(dev\) at TryRunArgs.cmake:[0-9]+ \(try_compile\):
+ Unknown arguments:
+
+ "COMPILE_OUTPUT_VARIABLE"
+ "compOutputVar"
+ "RUN_OUTPUT_VARIABLE"
+ "runOutputVar"
+ "RUN_OUTPUT_STDOUT_VARIABLE"
+ "runOutputStdOutVar"
+ "RUN_OUTPUT_STDERR_VARIABLE"
+ "runOutputStdErrVar"
+ "WORKING_DIRECTORY"
+ "runWorkDir"
+ "ARGS"
+ "runArgs"
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/try_compile/TryRunArgs.cmake b/Tests/RunCMake/try_compile/TryRunArgs.cmake
new file mode 100644
index 000000000..e4cb1fe2a
--- /dev/null
+++ b/Tests/RunCMake/try_compile/TryRunArgs.cmake
@@ -0,0 +1,14 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
+enable_language(C)
+
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/out.bin"
+ COMPILE_OUTPUT_VARIABLE compOutputVar
+ RUN_OUTPUT_VARIABLE runOutputVar
+ RUN_OUTPUT_STDOUT_VARIABLE runOutputStdOutVar
+ RUN_OUTPUT_STDERR_VARIABLE runOutputStdErrVar
+ WORKING_DIRECTORY runWorkDir
+ ARGS runArgs
+ )
diff --git a/Tests/RunCMake/try_compile/TwoArgs-stderr.txt b/Tests/RunCMake/try_compile/TwoArgs-stderr.txt
index b9c08fc9d..b68e78e37 100644
--- a/Tests/RunCMake/try_compile/TwoArgs-stderr.txt
+++ b/Tests/RunCMake/try_compile/TwoArgs-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at TwoArgs.cmake:1 \(try_compile\):
- try_compile unknown error.
+CMake Error at TwoArgs.cmake:[0-9]+ \(try_compile\):
+ The try_compile\(\) command requires at least 3 arguments.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/WarnDeprecated-stderr.txt b/Tests/RunCMake/try_compile/WarnDeprecated-stderr.txt
new file mode 100644
index 000000000..647499051
--- /dev/null
+++ b/Tests/RunCMake/try_compile/WarnDeprecated-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Debug Log at [^
+]*/Modules/CMakeDetermineCompilerABI.cmake:[0-9]+ \(try_compile\):
+ Executing try_compile \(CMAKE_C_ABI_COMPILED\) in:
+
+ [^
+]*/Tests/RunCMake/try_compile/WarnDeprecated-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+
+Call Stack \(most recent call first\):
+ [^
+]*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)
+ WarnDeprecated.cmake:[0-9]+ \(enable_language\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/try_compile/new_signature.cmake b/Tests/RunCMake/try_compile/new_signature.cmake
new file mode 100644
index 000000000..cbcb26181
--- /dev/null
+++ b/Tests/RunCMake/try_compile/new_signature.cmake
@@ -0,0 +1,2 @@
+set(try_compile_bindir_or_SOURCES SOURCES)
+set(try_compile_redundant_SOURCES "")
diff --git a/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake
new file mode 100644
index 000000000..ac07ad32e
--- /dev/null
+++ b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake
@@ -0,0 +1,66 @@
+# These tests are performed using both the historic and the newer SOURCES
+# signatures of try_compile. It is critical that they behave the same and
+# produce comparable output for both signatures. Tests that cannot do this
+# belong in RunCMakeTests.txt, not here.
+#
+# Tests here MUST include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) and
+# use the variables defined therein appropriately. Refer to existing tests for
+# examples.
+
+run_cmake(CopyFileErrorNoCopyFile)
+run_cmake(NoCopyFile)
+run_cmake(NoCopyFile2)
+run_cmake(NoCopyFileError)
+run_cmake(NoCStandard)
+run_cmake(NoOutputVariable)
+run_cmake(NoOutputVariable2)
+run_cmake(BadLinkLibraries)
+run_cmake(BadSources1)
+run_cmake(BadSources2)
+run_cmake(EmptyValueArgs)
+run_cmake(EmptyListArgs)
+run_cmake(TryRunArgs)
+run_cmake(BuildType)
+run_cmake(BuildTypeAsFlag)
+run_cmake(OutputDirAsFlag)
+
+run_cmake(EnvConfig)
+
+run_cmake(TargetTypeExe)
+run_cmake(TargetTypeInvalid)
+run_cmake(TargetTypeStatic)
+
+if(CMAKE_C_STANDARD_DEFAULT)
+ run_cmake(CStandard)
+elseif(DEFINED CMAKE_C_STANDARD_DEFAULT)
+ run_cmake(CStandardNoDefault)
+endif()
+if(CMAKE_OBJC_STANDARD_DEFAULT)
+ run_cmake(ObjCStandard)
+endif()
+if(CMAKE_CXX_STANDARD_DEFAULT)
+ run_cmake(CxxStandard)
+elseif(DEFINED CMAKE_CXX_STANDARD_DEFAULT)
+ run_cmake(CxxStandardNoDefault)
+endif()
+if(CMAKE_OBJCXX_STANDARD_DEFAULT)
+ run_cmake(ObjCxxStandard)
+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 MATCHES "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) OR CMAKE_C_COMPILER_ID MATCHES "LCC")
+ run_cmake(CStandardGNU)
+endif()
+if((CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) OR CMAKE_C_COMPILER_ID MATCHES "LCC")
+ run_cmake(CxxStandardGNU)
+endif()
diff --git a/Tests/RunCMake/try_compile/old_signature.cmake b/Tests/RunCMake/try_compile/old_signature.cmake
new file mode 100644
index 000000000..94b12dece
--- /dev/null
+++ b/Tests/RunCMake/try_compile/old_signature.cmake
@@ -0,0 +1,2 @@
+set(try_compile_bindir_or_SOURCES ${CMAKE_CURRENT_BINARY_DIR})
+set(try_compile_redundant_SOURCES SOURCES)
diff --git a/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt b/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt
index dcd1bfcbc..f9cc50e3c 100644
--- a/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt
+++ b/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at BadLinkLibraries.cmake:2 \(try_run\):
+CMake Error at BadLinkLibraries.cmake:[0-9+] \(try_run\):
Only libraries may be used as try_compile or try_run IMPORTED
LINK_LIBRARIES. Got not_a_library of type UTILITY.
Call Stack \(most recent call first\):
diff --git a/Tests/RunCMake/try_run/BadLinkLibraries.cmake b/Tests/RunCMake/try_run/BadLinkLibraries.cmake
index a124bf6e1..950a94253 100644
--- a/Tests/RunCMake/try_run/BadLinkLibraries.cmake
+++ b/Tests/RunCMake/try_run/BadLinkLibraries.cmake
@@ -1,4 +1,7 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
add_custom_target(not_a_library)
-try_run(RUN_RESULT COMPILE_RESULT
- ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+
+try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
LINK_LIBRARIES not_a_library)
diff --git a/Tests/RunCMake/try_run/BinDirEmpty-result.txt b/Tests/RunCMake/try_run/BinDirEmpty-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_run/BinDirEmpty-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_run/BinDirEmpty-stderr.txt b/Tests/RunCMake/try_run/BinDirEmpty-stderr.txt
new file mode 100644
index 000000000..def1c22ea
--- /dev/null
+++ b/Tests/RunCMake/try_run/BinDirEmpty-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at BinDirEmpty.cmake:[0-9]+ \(try_run\):
+ No <bindir> specified.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/try_run/BinDirEmpty.cmake b/Tests/RunCMake/try_run/BinDirEmpty.cmake
new file mode 100644
index 000000000..d4b7ee392
--- /dev/null
+++ b/Tests/RunCMake/try_run/BinDirEmpty.cmake
@@ -0,0 +1 @@
+try_run(runResultVar compileResultVar "" ${CMAKE_CURRENT_SOURCE_DIR}/src.c)
diff --git a/Tests/RunCMake/try_run/BinDirRelative-result.txt b/Tests/RunCMake/try_run/BinDirRelative-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_run/BinDirRelative-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_run/BinDirRelative-stderr.txt b/Tests/RunCMake/try_run/BinDirRelative-stderr.txt
new file mode 100644
index 000000000..54d4e8666
--- /dev/null
+++ b/Tests/RunCMake/try_run/BinDirRelative-stderr.txt
@@ -0,0 +1,6 @@
+^CMake Error at BinDirRelative.cmake:[0-9]+ \(try_run\):
+ <bindir> is not an absolute path:
+
+ 'bin_dir_relative'
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/try_run/BinDirRelative.cmake b/Tests/RunCMake/try_run/BinDirRelative.cmake
new file mode 100644
index 000000000..a277403ec
--- /dev/null
+++ b/Tests/RunCMake/try_run/BinDirRelative.cmake
@@ -0,0 +1 @@
+try_run(runResultVar compileResultVar bin_dir_relative ${CMAKE_CURRENT_SOURCE_DIR}/src.c)
diff --git a/Tests/RunCMake/try_run/NoCompileOutputVariable-result.txt b/Tests/RunCMake/try_run/NoCompileOutputVariable-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_run/NoCompileOutputVariable-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_run/NoCompileOutputVariable-stderr.txt b/Tests/RunCMake/try_run/NoCompileOutputVariable-stderr.txt
new file mode 100644
index 000000000..e8baffb12
--- /dev/null
+++ b/Tests/RunCMake/try_run/NoCompileOutputVariable-stderr.txt
@@ -0,0 +1,7 @@
+^CMake Error at NoCompileOutputVariable.cmake:[0-9]+ \(try_run\):
+ Error after keyword "COMPILE_OUTPUT_VARIABLE":
+
+ missing required value
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/try_run/NoCompileOutputVariable.cmake b/Tests/RunCMake/try_run/NoCompileOutputVariable.cmake
new file mode 100644
index 000000000..9eb7c5e9d
--- /dev/null
+++ b/Tests/RunCMake/try_run/NoCompileOutputVariable.cmake
@@ -0,0 +1,6 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
+try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ COMPILE_OUTPUT_VARIABLE
+ )
diff --git a/Tests/RunCMake/try_run/NoOutputCompileVariable-result.txt b/Tests/RunCMake/try_run/NoOutputCompileVariable-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_run/NoOutputCompileVariable-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_run/NoOutputVariable-result.txt b/Tests/RunCMake/try_run/NoOutputVariable-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_run/NoOutputVariable-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_run/NoOutputVariable-stderr.txt b/Tests/RunCMake/try_run/NoOutputVariable-stderr.txt
new file mode 100644
index 000000000..46cfca07d
--- /dev/null
+++ b/Tests/RunCMake/try_run/NoOutputVariable-stderr.txt
@@ -0,0 +1,7 @@
+^CMake Error at NoOutputVariable.cmake:[0-9]+ \(try_run\):
+ Error after keyword "OUTPUT_VARIABLE":
+
+ missing required value
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/try_run/NoOutputVariable.cmake b/Tests/RunCMake/try_run/NoOutputVariable.cmake
new file mode 100644
index 000000000..1901b30bf
--- /dev/null
+++ b/Tests/RunCMake/try_run/NoOutputVariable.cmake
@@ -0,0 +1,4 @@
+try_run(RUN_RESULT COMPILE_RESULT
+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ OUTPUT_VARIABLE
+ )
diff --git a/Tests/RunCMake/try_run/NoRunOutputVariable-result.txt b/Tests/RunCMake/try_run/NoRunOutputVariable-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_run/NoRunOutputVariable-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_run/NoRunOutputVariable-stderr.txt b/Tests/RunCMake/try_run/NoRunOutputVariable-stderr.txt
new file mode 100644
index 000000000..8ccbdab16
--- /dev/null
+++ b/Tests/RunCMake/try_run/NoRunOutputVariable-stderr.txt
@@ -0,0 +1,7 @@
+^CMake Error at NoRunOutputVariable.cmake:[0-9]+ \(try_run\):
+ Error after keyword "RUN_OUTPUT_VARIABLE":
+
+ missing required value
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/try_run/NoRunOutputVariable.cmake b/Tests/RunCMake/try_run/NoRunOutputVariable.cmake
new file mode 100644
index 000000000..f9e5e0bc9
--- /dev/null
+++ b/Tests/RunCMake/try_run/NoRunOutputVariable.cmake
@@ -0,0 +1,6 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
+try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ RUN_OUTPUT_VARIABLE
+ )
diff --git a/Tests/RunCMake/try_run/NoRunStdErrVariable-result.txt b/Tests/RunCMake/try_run/NoRunStdErrVariable-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_run/NoRunStdErrVariable-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_run/NoRunStdErrVariable-stderr.txt b/Tests/RunCMake/try_run/NoRunStdErrVariable-stderr.txt
new file mode 100644
index 000000000..1443ab2eb
--- /dev/null
+++ b/Tests/RunCMake/try_run/NoRunStdErrVariable-stderr.txt
@@ -0,0 +1,7 @@
+^CMake Error at NoRunStdErrVariable.cmake:[0-9]+ \(try_run\):
+ Error after keyword "RUN_OUTPUT_STDERR_VARIABLE":
+
+ missing required value
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/try_run/NoRunStdErrVariable.cmake b/Tests/RunCMake/try_run/NoRunStdErrVariable.cmake
new file mode 100644
index 000000000..888bc25ef
--- /dev/null
+++ b/Tests/RunCMake/try_run/NoRunStdErrVariable.cmake
@@ -0,0 +1,7 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
+try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp/workdir
+ RUN_OUTPUT_STDERR_VARIABLE
+ )
diff --git a/Tests/RunCMake/try_run/NoRunStdOutVariable-result.txt b/Tests/RunCMake/try_run/NoRunStdOutVariable-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_run/NoRunStdOutVariable-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_run/NoRunStdOutVariable-stderr.txt b/Tests/RunCMake/try_run/NoRunStdOutVariable-stderr.txt
new file mode 100644
index 000000000..8b90e9453
--- /dev/null
+++ b/Tests/RunCMake/try_run/NoRunStdOutVariable-stderr.txt
@@ -0,0 +1,7 @@
+^CMake Error at NoRunStdOutVariable.cmake:[0-9]+ \(try_run\):
+ Error after keyword "RUN_OUTPUT_STDOUT_VARIABLE":
+
+ missing required value
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/try_run/NoRunStdOutVariable.cmake b/Tests/RunCMake/try_run/NoRunStdOutVariable.cmake
new file mode 100644
index 000000000..ed6ab8878
--- /dev/null
+++ b/Tests/RunCMake/try_run/NoRunStdOutVariable.cmake
@@ -0,0 +1,7 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
+try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp/workdir
+ RUN_OUTPUT_STDOUT_VARIABLE
+ )
diff --git a/Tests/RunCMake/try_run/NoWorkingDirectory-result.txt b/Tests/RunCMake/try_run/NoWorkingDirectory-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/try_run/NoWorkingDirectory-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_run/NoWorkingDirectory-stderr.txt b/Tests/RunCMake/try_run/NoWorkingDirectory-stderr.txt
new file mode 100644
index 000000000..b6e258f8e
--- /dev/null
+++ b/Tests/RunCMake/try_run/NoWorkingDirectory-stderr.txt
@@ -0,0 +1,7 @@
+^CMake Error at NoWorkingDirectory.cmake:[0-9]+ \(try_run\):
+ Error after keyword "WORKING_DIRECTORY":
+
+ missing required value
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/try_run/NoWorkingDirectory.cmake b/Tests/RunCMake/try_run/NoWorkingDirectory.cmake
new file mode 100644
index 000000000..0d6818205
--- /dev/null
+++ b/Tests/RunCMake/try_run/NoWorkingDirectory.cmake
@@ -0,0 +1,6 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
+try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ WORKING_DIRECTORY
+ )
diff --git a/Tests/RunCMake/try_run/RunCMakeTest.cmake b/Tests/RunCMake/try_run/RunCMakeTest.cmake
index d74add05c..dbea089e4 100644
--- a/Tests/RunCMake/try_run/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_run/RunCMakeTest.cmake
@@ -1,6 +1,16 @@
include(RunCMake)
-run_cmake(BadLinkLibraries)
+run_cmake(BinDirEmpty)
+run_cmake(BinDirRelative)
+run_cmake(NoOutputVariable)
+
+set(RunCMake_TEST_OPTIONS -Dtry_compile_DEFS=old_signature.cmake)
+include(${RunCMake_SOURCE_DIR}/old_and_new_signature_tests.cmake)
+unset(RunCMake_TEST_OPTIONS)
+
+set(RunCMake_TEST_OPTIONS -Dtry_compile_DEFS=new_signature.cmake)
+include(${RunCMake_SOURCE_DIR}/old_and_new_signature_tests.cmake)
+unset(RunCMake_TEST_OPTIONS)
if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND
CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|LCC|Clang|AppleClang)$")
@@ -8,5 +18,3 @@ if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND
run_cmake(LinkOptions)
unset (RunCMake_TEST_OPTIONS)
endif()
-
-run_cmake(WorkingDirArg)
diff --git a/Tests/RunCMake/try_run/WorkingDirArg.cmake b/Tests/RunCMake/try_run/WorkingDirArg.cmake
index b58382333..375a7033d 100644
--- a/Tests/RunCMake/try_run/WorkingDirArg.cmake
+++ b/Tests/RunCMake/try_run/WorkingDirArg.cmake
@@ -1,6 +1,8 @@
-try_run(RUN_RESULT COMPILE_RESULT
- ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp ${CMAKE_CURRENT_SOURCE_DIR}/src.c
- RUN_OUTPUT_VARIABLE OUTPUT_VARIABLE
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
+try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ RUN_OUTPUT_VARIABLE RUN_OUTPUT
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp/workdir
)
diff --git a/Tests/RunCMake/try_run/new_signature.cmake b/Tests/RunCMake/try_run/new_signature.cmake
new file mode 100644
index 000000000..cbcb26181
--- /dev/null
+++ b/Tests/RunCMake/try_run/new_signature.cmake
@@ -0,0 +1,2 @@
+set(try_compile_bindir_or_SOURCES SOURCES)
+set(try_compile_redundant_SOURCES "")
diff --git a/Tests/RunCMake/try_run/old_and_new_signature_tests.cmake b/Tests/RunCMake/try_run/old_and_new_signature_tests.cmake
new file mode 100644
index 000000000..e1c1784b7
--- /dev/null
+++ b/Tests/RunCMake/try_run/old_and_new_signature_tests.cmake
@@ -0,0 +1,20 @@
+# These tests are performed using both the historic and the newer SOURCES
+# signatures of try_run. It is critical that they behave the same and produce
+# comparable output for both signatures. Tests that cannot do this belong in
+# RunCMakeTests.txt, not here.
+#
+# Tests here MUST include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) and
+# use the variables defined therein appropriately. Refer to existing tests for
+# examples.
+
+run_cmake(BadLinkLibraries)
+run_cmake(BinDirEmpty)
+run_cmake(BinDirRelative)
+
+run_cmake(WorkingDirArg)
+
+run_cmake(NoCompileOutputVariable)
+run_cmake(NoRunOutputVariable)
+run_cmake(NoRunStdOutVariable)
+run_cmake(NoRunStdErrVariable)
+run_cmake(NoWorkingDirectory)
diff --git a/Tests/RunCMake/try_run/old_signature.cmake b/Tests/RunCMake/try_run/old_signature.cmake
new file mode 100644
index 000000000..94b12dece
--- /dev/null
+++ b/Tests/RunCMake/try_run/old_signature.cmake
@@ -0,0 +1,2 @@
+set(try_compile_bindir_or_SOURCES ${CMAKE_CURRENT_BINARY_DIR})
+set(try_compile_redundant_SOURCES SOURCES)
diff --git a/Tests/SwiftMix/CMain.c b/Tests/SwiftMix/CMain.c
index 519058efe..b274322c8 100644
--- a/Tests/SwiftMix/CMain.c
+++ b/Tests/SwiftMix/CMain.c
@@ -1,3 +1,16 @@
+#if !defined(FOO)
+# error "FOO not defined"
+#endif
+#if BAR != 3
+# error "FOO not defined to 3"
+#endif
+#if CCOND != 2
+# error "CCOND not defined to 2"
+#endif
+#if defined(SWIFTCOND)
+# error "SWIFTCOND defined"
+#endif
+
extern int ObjCMain(void);
int main(void)
{
diff --git a/Tests/SwiftMix/CMakeLists.txt b/Tests/SwiftMix/CMakeLists.txt
index 6d8e48bd0..e8b65213f 100644
--- a/Tests/SwiftMix/CMakeLists.txt
+++ b/Tests/SwiftMix/CMakeLists.txt
@@ -4,3 +4,4 @@ project(SwiftMix C Swift)
add_executable(SwiftMix CMain.c ObjCMain.m SwiftMain.swift ObjC-Swift.h)
set_property(TARGET SwiftMix PROPERTY XCODE_ATTRIBUTE_SWIFT_OBJC_BRIDGING_HEADER "ObjC-Swift.h")
target_compile_options(SwiftMix PRIVATE "$<$<COMPILE_LANGUAGE:C>:-Werror=objc-method-access>")
+target_compile_definitions(SwiftMix PRIVATE "$<IF:$<COMPILE_LANGUAGE:Swift>,SWIFTCOND,CCOND=2>" FOO BAR=3)
diff --git a/Tests/SwiftMix/SwiftMain.swift b/Tests/SwiftMix/SwiftMain.swift
index d9c8cd756..238059d72 100644
--- a/Tests/SwiftMix/SwiftMain.swift
+++ b/Tests/SwiftMix/SwiftMain.swift
@@ -3,6 +3,26 @@ import Foundation
@objc class SwiftMainClass : NSObject {
@objc class func SwiftMain() -> Int32 {
dump("Hello World!");
+#if FOO
+ dump("FOO defined");
+#else
+ fatalError("FOO not defined");
+#endif
+#if BAR
+ dump("BAR defined");
+#else
+ fatalError("BAR not defined");
+#endif
+#if CCOND
+ fatalError("CCOND defined");
+#else
+ dump("CCOND not defined");
+#endif
+#if SWIFTCOND
+ dump("SWIFTCOND defined");
+#else
+ fatalError("SWIFTCOND not defined");
+#endif
return 0;
}
}
diff --git a/Tests/SwiftMixLib/CMakeLists.txt b/Tests/SwiftMixLib/CMakeLists.txt
new file mode 100644
index 000000000..40d3498d5
--- /dev/null
+++ b/Tests/SwiftMixLib/CMakeLists.txt
@@ -0,0 +1,6 @@
+cmake_minimum_required(VERSION 3.24)
+project(SwiftMixLib C CXX Swift)
+
+add_library(SwiftMixedLib lib.c lib.cpp lib.swift)
+add_executable(Swifty main.swift)
+target_link_libraries(Swifty PUBLIC SwiftMixedLib)
diff --git a/Tests/SwiftMixLib/lib.c b/Tests/SwiftMixLib/lib.c
new file mode 100644
index 000000000..8eca51246
--- /dev/null
+++ b/Tests/SwiftMixLib/lib.c
@@ -0,0 +1,4 @@
+int add_int(int a, int b)
+{
+ return a + b;
+}
diff --git a/Tests/SwiftMixLib/lib.cpp b/Tests/SwiftMixLib/lib.cpp
new file mode 100644
index 000000000..3e156b80b
--- /dev/null
+++ b/Tests/SwiftMixLib/lib.cpp
@@ -0,0 +1,4 @@
+int add(int a, int b)
+{
+ return a + b;
+}
diff --git a/Tests/SwiftMixLib/lib.swift b/Tests/SwiftMixLib/lib.swift
new file mode 100644
index 000000000..61009d876
--- /dev/null
+++ b/Tests/SwiftMixLib/lib.swift
@@ -0,0 +1,3 @@
+public func add(a: Int, b: Int) -> Int {
+ a + b
+}
diff --git a/Tests/SwiftMixLib/main.swift b/Tests/SwiftMixLib/main.swift
new file mode 100644
index 000000000..d2e93645d
--- /dev/null
+++ b/Tests/SwiftMixLib/main.swift
@@ -0,0 +1,3 @@
+import SwiftMixedLib
+
+print(add(a: 1, b: 2))
diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt
index 01c2222dc..fa8687d5d 100644
--- a/Tests/SwiftOnly/CMakeLists.txt
+++ b/Tests/SwiftOnly/CMakeLists.txt
@@ -22,9 +22,13 @@ elseif(NOT XCODE_VERSION VERSION_LESS 8.0)
set(CMAKE_Swift_LANGUAGE_VERSION 3.0)
endif()
+add_subdirectory(SubA)
+add_subdirectory(SubB)
+
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
add_executable(SwiftOnly main.swift)
+target_compile_definitions(SwiftOnly PRIVATE SWIFTONLY)
add_library(L L.swift)
diff --git a/Tests/SwiftOnly/SubA/CMakeLists.txt b/Tests/SwiftOnly/SubA/CMakeLists.txt
new file mode 100644
index 000000000..edebc1697
--- /dev/null
+++ b/Tests/SwiftOnly/SubA/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(SubA SubA.swift)
+target_include_directories(SubA INTERFACE "$<TARGET_FILE_DIR:SubA>")
diff --git a/Tests/SwiftOnly/SubA/SubA.swift b/Tests/SwiftOnly/SubA/SubA.swift
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/SwiftOnly/SubA/SubA.swift
diff --git a/Tests/SwiftOnly/SubB/CMakeLists.txt b/Tests/SwiftOnly/SubB/CMakeLists.txt
new file mode 100644
index 000000000..6e929270f
--- /dev/null
+++ b/Tests/SwiftOnly/SubB/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(SubB SubB.swift)
+target_link_libraries(SubB PRIVATE SubA)
diff --git a/Tests/SwiftOnly/SubB/SubB.swift b/Tests/SwiftOnly/SubB/SubB.swift
new file mode 100644
index 000000000..d593c4cd3
--- /dev/null
+++ b/Tests/SwiftOnly/SubB/SubB.swift
@@ -0,0 +1 @@
+import SubA
diff --git a/Tests/SwiftOnly/main.swift b/Tests/SwiftOnly/main.swift
index 28560d076..a3f1a2c1d 100644
--- a/Tests/SwiftOnly/main.swift
+++ b/Tests/SwiftOnly/main.swift
@@ -1 +1,7 @@
dump("SwiftOnly")
+
+#if SWIFTONLY
+dump("SWIFTONLY defined")
+#else
+fatalError("SWIFTONLY NOT defined")
+#endif
diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt
index 000fd2cbc..3e46ed501 100644
--- a/Tests/TryCompile/CMakeLists.txt
+++ b/Tests/TryCompile/CMakeLists.txt
@@ -4,163 +4,96 @@ if(POLICY CMP0129)
endif()
project(TryCompile)
-macro(TEST_ASSERT value msg)
- if (NOT ${value})
- message (SEND_ERROR "Assertion failure:" ${msg} )
- endif ()
+macro(EXPECT_PASS var out)
+ if(NOT ${var})
+ message(SEND_ERROR "Should pass failed:\n${out}")
+ endif()
endmacro()
-macro(TEST_FAIL value msg)
- if (${value})
- message (SEND_ERROR "Failing test succeeded:" ${msg} )
- endif ()
+macro(EXPECT_FAIL var out)
+ if(${var})
+ message(SEND_ERROR "Should fail passed:\n${out}")
+ endif()
endmacro()
-macro(TEST_EXPECT_EXACT command expected)
- if(NOT "x${result}" STREQUAL "x${expected}")
- message(SEND_ERROR "${CMAKE_CURRENT_LIST_LINE}: TEST \"${command}\" failed: \"${result}\" expected: \"${expected}\"")
+macro(EXPECT_COMPILED name var out)
+ if(NOT ${var})
+ message(SEND_ERROR "${name} failed compiling:\n${out}")
endif()
endmacro()
-macro(TEST_EXPECT_CONTAINS command expected)
- if(NOT "${result}" MATCHES "${expected}")
- message(SEND_ERROR "${CMAKE_CURRENT_LIST_LINE}: TEST \"${command}\" failed: \"${result}\" expected: \"${expected}\"")
+macro(EXPECT_RUN_RESULT name var expected)
+ if(NOT ${var} EQUAL ${expected})
+ message(SEND_ERROR " ${name} gave unexpected run result: ${${var}} expected: ${expected}")
endif()
endmacro()
+macro(TEST_ASSERT value msg)
+ if (NOT ${value})
+ message (SEND_ERROR "Assertion failure:" ${msg} )
+ endif ()
+endmacro()
-# try to compile a file that should compile
-# also check that COPY_FILE works
-try_compile(SHOULD_PASS
- ${TryCompile_BINARY_DIR}
- ${TryCompile_SOURCE_DIR}/pass.c
- OUTPUT_VARIABLE TRY_OUT
- COPY_FILE ${TryCompile_BINARY_DIR}/CopyOfPass
- )
-
-if(NOT SHOULD_PASS)
- message(SEND_ERROR "should pass failed ${TRY_OUT}")
-endif()
-if(NOT EXISTS "${TryCompile_BINARY_DIR}/CopyOfPass")
- message(SEND_ERROR "COPY_FILE to \"${TryCompile_BINARY_DIR}/CopyOfPass\" failed")
-else()
- file(REMOVE "${TryCompile_BINARY_DIR}/CopyOfPass")
-endif()
-
-# try to compile a file that should compile
-# also check that COPY_FILE_ERROR works
-file(WRITE ${TryCompile_BINARY_DIR}/invalid "")
-try_compile(SHOULD_PASS
- ${TryCompile_BINARY_DIR}
- ${TryCompile_SOURCE_DIR}/pass.c
- OUTPUT_VARIABLE TRY_OUT
- COPY_FILE ${TryCompile_BINARY_DIR}/invalid/path
- COPY_FILE_ERROR _captured
- )
-if(NOT SHOULD_PASS)
- message(SEND_ERROR "should pass failed ${TRY_OUT}")
-endif()
-if(NOT _captured MATCHES "Cannot copy output executable.*/invalid/path")
- message(SEND_ERROR "COPY_FILE_ERROR did not capture expected message")
-endif()
-
-# try to compile a file that should not compile
-try_compile(SHOULD_FAIL
- ${TryCompile_BINARY_DIR}
- ${TryCompile_SOURCE_DIR}/fail.c
- OUTPUT_VARIABLE TRY_OUT)
-if(SHOULD_FAIL)
- message(SEND_ERROR "Should fail passed ${TRY_OUT}")
-endif()
-
-# try to compile a file that should compile
-try_compile(SHOULD_PASS
- ${TryCompile_BINARY_DIR}
- ${TryCompile_SOURCE_DIR}/pass.c
- OUTPUT_VARIABLE TRY_OUT)
-if(NOT SHOULD_PASS)
- message(SEND_ERROR "should pass failed ${TRY_OUT}")
-endif()
-
-# try to compile a file that should not compile
-try_compile(SHOULD_FAIL
- ${TryCompile_BINARY_DIR}
- ${TryCompile_SOURCE_DIR}/fail.c
- OUTPUT_VARIABLE TRY_OUT)
-if(SHOULD_FAIL)
- message(SEND_ERROR "Should fail passed ${TRY_OUT}")
-endif()
-
-# try to compile two files that should compile
-try_compile(SHOULD_PASS
- ${TryCompile_BINARY_DIR}
- SOURCES ${TryCompile_SOURCE_DIR}/pass2a.c ${TryCompile_SOURCE_DIR}/pass2b.cxx
- OUTPUT_VARIABLE TRY_OUT)
-if(NOT SHOULD_PASS)
- message(SEND_ERROR "should pass failed ${TRY_OUT}")
-endif()
-
-# try to compile two files that should not compile
-try_compile(SHOULD_FAIL
- ${TryCompile_BINARY_DIR}
- SOURCES ${TryCompile_SOURCE_DIR}/fail2a.c ${TryCompile_SOURCE_DIR}/fail2b.c
- OUTPUT_VARIABLE TRY_OUT)
-if(SHOULD_FAIL)
- message(SEND_ERROR "Should fail passed ${TRY_OUT}")
-endif()
-
-# try to compile a file that should compile
-set(_c_flags "${CMAKE_C_FLAGS}")
-if(WATCOM)
- string(APPEND CMAKE_C_FLAGS " -dTESTDEF")
-else()
- string(APPEND CMAKE_C_FLAGS " \"-DTESTDEF\"")
-endif()
+# run old signature tests
+set(try_compile_bindir_or_SOURCES ${TryCompile_BINARY_DIR})
+set(try_compile_redundant_SOURCES SOURCES)
+set(try_compile_output_vars OUTPUT_VARIABLE TRY_OUT)
+set(try_compile_compile_output_var TRY_OUT)
+set(try_compile_run_output_var TRY_OUT)
+include(old_and_new_signature_tests.cmake)
+
+# run new signature tests
+set(try_compile_bindir_or_SOURCES SOURCES)
+set(try_compile_redundant_SOURCES "")
+set(try_compile_output_vars
+ COMPILE_OUTPUT_VARIABLE COMPILE_OUT
+ RUN_OUTPUT_VARIABLE RUN_OUTPUT)
+set(try_compile_compile_output_var COMPILE_OUT)
+set(try_compile_run_output_var RUN_OUTPUT)
+include(old_and_new_signature_tests.cmake)
+
+# try to compile an empty source specified directly
+try_compile(SHOULD_FAIL_DUE_TO_EMPTY_SOURCE
+ SOURCE_FROM_CONTENT empty.c "")
+if(SHOULD_FAIL_DUE_TO_EMPTY_SOURCE)
+ message(SEND_ERROR "Trying to compile an empty source succeeded?")
+endif()
+
+try_compile(SHOULD_FAIL_DUE_TO_EMPTY_SOURCE
+ SOURCE_FROM_VAR empty.c NAME_OF_A_VAR_THAT_IS_NOT_SET)
+if(SHOULD_FAIL_DUE_TO_EMPTY_SOURCE)
+ message(SEND_ERROR "Trying to compile an empty source succeeded?")
+endif()
+
+# try to compile a copied source
try_compile(SHOULD_PASS
- ${TryCompile_BINARY_DIR}
- ${TryCompile_SOURCE_DIR}/testdef.c
- OUTPUT_VARIABLE TRY_OUT)
-if(NOT SHOULD_PASS)
- message(SEND_ERROR "should pass failed ${TRY_OUT}")
-endif()
-set(CMAKE_C_FLAGS "${_c_flags}")
-
-if(NOT SHOULD_FAIL)
- if(SHOULD_PASS)
- message("All Tests passed, ignore all previous output.")
- else()
- message("Test failed")
- endif()
-else()
- message("Test failed")
-endif()
-try_compile(CMAKE_ANSI_FOR_SCOPE
- ${TryCompile_BINARY_DIR}
- ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx OUTPUT_VARIABLE OUT)
-if (CMAKE_ANSI_FOR_SCOPE)
- message("Compiler supports ansi for")
-else()
- message("Compiler does not support ansi for scope")
-endif()
+ SOURCE_FROM_FILE pass.c ${TryCompile_SOURCE_DIR}/pass.c
+ OUTPUT_VARIABLE TRY_OUT)
+EXPECT_COMPILED("SOURCE_FROM_FILE" SHOULD_PASS "${TRY_OUT}")
-try_compile(CMAKE_ANSI_FOR_SCOPE
- ${TryCompile_BINARY_DIR}
- ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx OUTPUT_VARIABLE OUT)
-if (CMAKE_ANSI_FOR_SCOPE)
- message("Compiler supports ansi for")
-else()
- message("Compiler does not support ansi for scope")
-endif()
+# try to run a source specified directly
+set(TRY_RUN_MAIN_CODE
+ "extern int answer(); \n"
+ "int main() { return answer(); }\n")
+set(TRY_RUN_EXT_CODE
+ "int answer() { return 42; }\n")
-message("use the module now")
-include(${CMAKE_ROOT}/Modules/TestForANSIForScope.cmake)
-if (CMAKE_ANSI_FOR_SCOPE)
- message("Compiler supports ansi for")
-else()
- message("Compiler does not support ansi for scope")
-endif()
+try_run(SHOULD_EXIT_WITH_ERROR SHOULD_COMPILE
+ SOURCE_FROM_CONTENT main.c "${TRY_RUN_MAIN_CODE}"
+ SOURCE_FROM_CONTENT answer.c "${TRY_RUN_EXT_CODE}"
+ COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT)
+EXPECT_COMPILED("SOURCE_FROM_CONTENT" SHOULD_COMPILE "${COMPILE_OUTPUT}")
+EXPECT_RUN_RESULT("SOURCE_FROM_CONTENT" SHOULD_EXIT_WITH_ERROR 42)
-message("Testing try_compile project mode")
+try_run(SHOULD_EXIT_WITH_ERROR SHOULD_COMPILE
+ SOURCE_FROM_VAR main.c TRY_RUN_MAIN_CODE
+ SOURCE_FROM_VAR answer.c TRY_RUN_EXT_CODE
+ COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT)
+EXPECT_COMPILED("SOURCE_FROM_VAR" SHOULD_COMPILE "${COMPILE_OUTPUT}")
+EXPECT_RUN_RESULT("SOURCE_FROM_VAR" SHOULD_EXIT_WITH_ERROR 42)
+
+# try to compile a project (old signature)
+message("Testing try_compile project mode (old signature)")
try_compile(TEST_INNER
${TryCompile_BINARY_DIR}/CMakeFiles/Inner
${TryCompile_SOURCE_DIR}/Inner
@@ -168,241 +101,17 @@ try_compile(TEST_INNER
OUTPUT_VARIABLE output)
TEST_ASSERT(TEST_INNER "try_compile project mode failed:\n${output}")
-try_compile(COMPILE_DEFINITIONS_LIST_EXPANDED
- ${TryCompile_BINARY_DIR}
- ${TryCompile_SOURCE_DIR}/check_a_b.c
- OUTPUT_VARIABLE output
- COMPILE_DEFINITIONS "-DDEF_A;-DDEF_B"
- )
-if(COMPILE_DEFINITIONS_LIST_EXPANDED)
- message(STATUS "COMPILE_DEFINITIONS list expanded correctly")
-else()
- string(REPLACE "\n" "\n " output " ${output}")
- message(SEND_ERROR "COMPILE_DEFINITIONS list did not expand correctly\n${output}")
-endif()
-
-try_compile(SHOULD_FAIL_DUE_TO_BAD_SOURCE
- ${TryCompile_BINARY_DIR}
- ${TryCompile_SOURCE_DIR}/pass.c
- OUTPUT_VARIABLE output
- COMPILE_DEFINITIONS "bad#source.c"
- )
-if(SHOULD_FAIL_DUE_TO_BAD_SOURCE AND NOT CMAKE_GENERATOR MATCHES "Watcom WMake|NMake Makefiles")
- string(REPLACE "\n" "\n " output " ${output}")
- message(SEND_ERROR "try_compile with bad#source.c did not fail:\n${output}")
-elseif(NOT output MATCHES [[(bad#source\.c|bad\.c|bad')]])
- string(REPLACE "\n" "\n " output " ${output}")
- message(SEND_ERROR "try_compile with bad#source.c failed without mentioning bad source:\n${output}")
-else()
- message(STATUS "try_compile with bad#source.c correctly failed")
-endif()
+# try to compile a project (new signature)
+message("Testing try_compile project mode (new signature)")
+try_compile(TEST_INNER
+ PROJECT TryCompileInner
+ SOURCE_DIR ${TryCompile_SOURCE_DIR}/Inner
+ TARGET innerexe
+ OUTPUT_VARIABLE output)
+TEST_ASSERT(TEST_INNER "try_compile project mode failed:\n${output}")
add_executable(TryCompile pass.c)
-######################################
-
-# now two tests for try_run()
-
-# try to run a file that should compile and run without error
-# also check that OUTPUT_VARIABLE contains both the compile output
-# and the run output
-try_run(SHOULD_RUN SHOULD_COMPILE
- ${TryCompile_BINARY_DIR}
- ${TryCompile_SOURCE_DIR}/exit_success.c
- OUTPUT_VARIABLE TRY_OUT)
-if(NOT SHOULD_COMPILE)
- message(SEND_ERROR "exit_success failed compiling: ${TRY_OUT}")
-endif()
-if(NOT "${SHOULD_RUN}" STREQUAL "0")
- message(SEND_ERROR "exit_success failed running with exit code ${SHOULD_RUN}")
-endif()
-# check the compile output for the filename
-if(NOT "${TRY_OUT}" MATCHES "exit_success")
- message(SEND_ERROR " TRY_OUT didn't contain \"exit_success\": \"${TRY_OUT}\"")
-endif()
-# check the run output
-if(NOT "${TRY_OUT}" MATCHES "hello world")
- message(SEND_ERROR " TRY_OUT didn't contain \"hello world\": \"${TRY_OUT}\"")
-endif()
-
-try_run(ARG_TEST_RUN ARG_TEST_COMPILE
- ${TryCompile_BINARY_DIR}
- ${TryCompile_SOURCE_DIR}/expect_arg.c
- OUTPUT_VARIABLE TRY_OUT
- ARGS arg1 arg2)
-if(NOT ARG_TEST_COMPILE)
- message(SEND_ERROR "expect_arg failed compiling: ${TRY_OUT}")
-endif()
-if(NOT "${ARG_TEST_RUN}" STREQUAL "0")
- message(SEND_ERROR "expect_arg failed running with exit code ${ARG_TEST_RUN} ${TRY_OUT}")
-endif()
-
-# try to run a file that should compile and run, but return an error
-try_run(SHOULD_EXIT_WITH_ERROR SHOULD_COMPILE
- ${TryCompile_BINARY_DIR}
- ${TryCompile_SOURCE_DIR}/exit_with_error.c
- COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT
- RUN_OUTPUT_VARIABLE RUN_OUTPUT)
-
-if(NOT SHOULD_COMPILE)
- message(STATUS " exit_with_error failed compiling: ${COMPILE_OUTPUT}")
-endif()
-if("${SHOULD_EXIT_WITH_ERROR}" STREQUAL "0")
- message(SEND_ERROR " exit_with_error passed with exit code ${SHOULD_EXIT_WITH_ERROR}")
-endif()
-
-# check the compile output, it should contain the filename
-if(NOT "${COMPILE_OUTPUT}" MATCHES "exit_with_error")
- message(SEND_ERROR " COMPILE_OUT didn't contain \"exit_with_error\": \"${COMPILE_OUTPUT}\"")
-endif()
-#... but not the run time output
-if("${COMPILE_OUTPUT}" MATCHES "hello world")
- message(SEND_ERROR " COMPILE_OUT contains the run output: \"${COMPILE_OUTPUT}\"")
-endif()
-# check the run output, it should stdout
-if(NOT "${RUN_OUTPUT}" MATCHES "hello world")
- message(SEND_ERROR " RUN_OUTPUT didn't contain \"hello world\": \"${RUN_OUTPUT}\"")
-endif()
-
-#######################################################################
-#
-# also test that the CHECK_C_SOURCE_COMPILES, CHECK_CXX_SOURCE_COMPILES
-# CHECK_C_SOURCE_RUNS and CHECK_CXX_SOURCE_RUNS macros work
-
-include(CheckCSourceCompiles)
-include(CheckCXXSourceCompiles)
-include(CheckCSourceRuns)
-include(CheckCXXSourceRuns)
-
-CHECK_C_SOURCE_COMPILES("I don't build" C_BUILD_SHOULD_FAIL)
-CHECK_C_SOURCE_COMPILES("int main() {return 0;}" C_BUILD_SHOULD_WORK)
-CHECK_C_SOURCE_RUNS("int main() {return 1;}" C_RUN_SHOULD_FAIL)
-CHECK_C_SOURCE_RUNS("int main() {return 0;}" C_RUN_SHOULD_WORK)
-
-TEST_FAIL(C_BUILD_SHOULD_FAIL "CHECK_C_SOURCE_COMPILES() succeeded, but should have failed")
-TEST_ASSERT(C_BUILD_SHOULD_WORK "CHECK_C_SOURCE_COMPILES() failed")
-TEST_FAIL(C_RUN_SHOULD_FAIL "CHECK_C_SOURCE_RUNS() succeeded, but should have failed")
-TEST_ASSERT(C_RUN_SHOULD_WORK "CHECK_C_SOURCE_RUNS() failed")
-
-CHECK_CXX_SOURCE_COMPILES("I don't build" CXX_BUILD_SHOULD_FAIL)
-CHECK_CXX_SOURCE_COMPILES("int main() {return 0;}" CXX_BUILD_SHOULD_WORK)
-CHECK_CXX_SOURCE_COMPILES("void l(char const (&x)[2]){}; int main() { l(\"\\\\n\"); return 0;}"
- CXX_BUILD_SHOULD_WORK_COMPLEX)
-
-CHECK_CXX_SOURCE_RUNS("int main() {return 2;}" CXX_RUN_SHOULD_FAIL)
-CHECK_CXX_SOURCE_RUNS("int main() {return 0;}" CXX_RUN_SHOULD_WORK)
-
-TEST_FAIL(CXX_BUILD_SHOULD_FAIL "CHECK_CXX_SOURCE_COMPILES() succeeded, but should have failed")
-TEST_ASSERT(CXX_BUILD_SHOULD_WORK "CHECK_CXX_SOURCE_COMPILES() failed")
-TEST_ASSERT(CXX_BUILD_SHOULD_WORK_COMPLEX "CHECK_CXX_SOURCE_COMPILES() failed")
-TEST_FAIL(CXX_RUN_SHOULD_FAIL "CHECK_CXX_SOURCE_RUNS() succeeded, but should have failed")
-TEST_ASSERT(CXX_RUN_SHOULD_WORK "CHECK_CXX_SOURCE_RUNS() failed")
-
-foreach(lang C CXX)
- if(NOT CMAKE_${lang}_COMPILER_ID STREQUAL "PathScale")
- set(${lang}_DD --)
- endif()
-endforeach()
-
-unset(C_BOGUS_FLAG CACHE)
-include(CheckCCompilerFlag)
-CHECK_C_COMPILER_FLAG(${C_DD}-_this_is_not_a_flag_ C_BOGUS_FLAG)
-TEST_FAIL(C_BOGUS_FLAG "CHECK_C_COMPILER_FLAG() succeeded, but should have failed")
-unset(C_BOGUS_FLAG CACHE)
-if(DEFINED C_BOGUS_FLAG)
- # Verify that CHECK_C_COMPILER_FLAG didn't construct a normal variable
- message(SEND_ERROR "CHECK_C_COMPILER_FLAG shouldn't construct C_BOGUS_FLAG as a normal variable")
-endif()
-
-unset(CXX_BOGUS_FLAG CACHE)
-include(CheckCXXCompilerFlag)
-CHECK_CXX_COMPILER_FLAG(${CXX_DD}-_this_is_not_a_flag_ CXX_BOGUS_FLAG)
-TEST_FAIL(CXX_BOGUS_FLAG "CHECK_CXX_COMPILER_FLAG() succeeded, but should have failed")
-unset(CXX_BOGUS_FLAG CACHE)
-if(DEFINED CXX_BOGUS_FLAG)
- # Verify that CHECK_C_COMPILER_FLAG didn't construct a normal variable
- message(SEND_ERROR "CHECK_CXX_COMPILER_FLAG shouldn't construct CXX_BOGUS_FLAG as a normal variable")
-endif()
-
-if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "LCC")
- unset(C_STRICT_PROTOTYPES CACHE)
- CHECK_C_COMPILER_FLAG("-Werror;-Wstrict-prototypes" C_STRICT_PROTOTYPES)
- TEST_ASSERT(C_STRICT_PROTOTYPES "CHECK_C_COMPILER_FLAG failed -Werror -Wstrict-prototypes")
-endif()
-
-#########################################################################
-#
-# Test that the CHECK_OBJCC_SOURCE_COMPILES, CHECK_OBJCXX_SOURCE_COMPILES
-# CHECK_OBJC_SOURCE_RUNS and CHECK_OBJCXX_SOURCE_RUNS macros work
-
-if (APPLE)
- enable_language(OBJC)
- enable_language(OBJCXX)
-
- include(CheckOBJCSourceCompiles)
- include(CheckOBJCXXSourceCompiles)
- include(CheckOBJCSourceRuns)
- include(CheckOBJCXXSourceRuns)
-
- CHECK_OBJC_SOURCE_COMPILES("I don't build in Objective-C" OBJC_BUILD_SHOULD_FAIL)
- CHECK_OBJC_SOURCE_COMPILES("int main() { return 0; }" SIMPLE_OBJC_BUILD_SHOULD_WORK)
-
- TEST_FAIL(OBJC_BUILD_SHOULD_FAIL "CHECK_OBJC_SOURCE_COMPILES() succeeded, but should have failed")
- TEST_ASSERT(SIMPLE_OBJC_BUILD_SHOULD_WORK "CHECK_OBJC_SOURCE_COMPILES() failed, but should have succeeded")
-
- set(CMAKE_REQUIRED_LIBRARIES "-framework Foundation")
-
- CHECK_OBJC_SOURCE_COMPILES("#import <Foundation/Foundation.h>\nint main()\n{\nNSObject *foo;\nreturn 0;\n}\n" OBJC_BUILD_SHOULD_WORK)
- CHECK_OBJC_SOURCE_RUNS("int main() { return 2; }" SIMPLE_OBJC_RUN_SHOULD_FAIL)
- CHECK_OBJC_SOURCE_RUNS("int main() { return 0; }" SIMPLE_OBJC_RUN_SHOULD_WORK)
- CHECK_OBJC_SOURCE_RUNS("#import <Foundation/Foundation.h>\nint main()\n{\nNSObject *foo;\nreturn 2;\n}\n" OBJC_RUN_SHOULD_FAIL)
- CHECK_OBJC_SOURCE_RUNS("#import <Foundation/Foundation.h>\nint main()\n{\nNSObject *foo;\nreturn 0;\n}\n" OBJC_RUN_SHOULD_WORK)
-
- TEST_ASSERT(OBJC_BUILD_SHOULD_WORK "CHECK_OBJC_SOURCE_COMPILES() failed, but should have succeeded")
- TEST_FAIL(SIMPLE_OBJC_RUN_SHOULD_FAIL "CHECK_OBJC_SOURC_RUNS() succeeds, but should have failed")
- TEST_ASSERT(SIMPLE_OBJC_RUN_SHOULD_WORK "CHECK_OBJC_SOURCE_RUNS() failed, but should have succeeded")
- TEST_FAIL(OBJC_RUN_SHOULD_FAIL "CHECK_OBJC_SOURCE_RUNS() succeeds, but should have failed")
- TEST_ASSERT(OBJC_RUN_SHOULD_WORK "CHECK_OBJC_SOURCE_RUNS() failed, but should have succeeded")
-
-
- CHECK_OBJCXX_SOURCE_COMPILES("I don't build in Objective-C++" OBJCXX_BUILD_SHOULD_FAIL)
- CHECK_OBJCXX_SOURCE_COMPILES("int main() { return 0; }" SIMPLE_OBJCXX_BUILD_SHOULD_WORK)
-
- TEST_FAIL(OBJCXX_BUILD_SHOULD_FAIL "CHECK_OBJCXX_SOURCE_COMPILES() succeeded, but should have failed")
- TEST_ASSERT(SIMPLE_OBJCXX_BUILD_SHOULD_WORK "CHECK_OBJCXX_SOURCE_COMPILES() failed, but should have succeeded")
-
- CHECK_OBJCXX_SOURCE_COMPILES("#import <Foundation/Foundation.h>\n#include <iostream>\nint main()\n{\nNSObject *foo;\nstd::cout << \"Hello\" << std::endl;\nreturn 0;\n}\n" OBJCXX_BUILD_SHOULD_WORK)
- CHECK_OBJCXX_SOURCE_RUNS("int main() { return 2; }" SIMPLE_OBJCXX_RUN_SHOULD_FAIL)
- CHECK_OBJCXX_SOURCE_RUNS("int main() { return 0; }" SIMPLE_OBJCXX_RUN_SHOULD_WORK)
- CHECK_OBJCXX_SOURCE_RUNS("#import <Foundation/Foundation.h>\n#include <vector>\nint main()\n{\nNSObject *foo;\nstd::vector<int> bar;\nreturn 2;\n}\n" OBJCXX_RUN_SHOULD_FAIL)
- CHECK_OBJCXX_SOURCE_RUNS("#import <Foundation/Foundation.h>\n#include <vector>\nint main()\n{\nNSObject *foo;\nstd::vector<int> bar;\nreturn 0;\n}\n" OBJCXX_RUN_SHOULD_WORK)
-
- TEST_ASSERT(OBJCXX_BUILD_SHOULD_WORK "CHECK_OBJCXX_SOURCE_COMPILES() failed, but should have succeeded")
- TEST_FAIL(SIMPLE_OBJCXX_RUN_SHOULD_FAIL "CHECK_OBJCXX_SOURC_RUNS() succeeds, but should have failed")
- TEST_ASSERT(SIMPLE_OBJCXX_RUN_SHOULD_WORK "CHECK_OBJCXX_SOURCE_RUNS() failed, but should have succeeded")
- TEST_FAIL(OBJCXX_RUN_SHOULD_FAIL "CHECK_OBJCXX_SOURCE_RUNS() succeeds, but should have failed")
- TEST_ASSERT(OBJCXX_RUN_SHOULD_WORK "CHECK_OBJCXX_SOURCE_RUNS() failed, but should have succeeded")
-
- # try to compile a file that should compile
- try_compile(SHOULD_PASS
- ${TryCompile_BINARY_DIR}
- ${TryCompile_SOURCE_DIR}/pass.m
- OUTPUT_VARIABLE TRY_OUT)
- if(NOT SHOULD_PASS)
- message(SEND_ERROR "should pass failed ${TRY_OUT}")
- endif()
-
- # try to compile a file that should not compile
- try_compile(SHOULD_FAIL
- ${TryCompile_BINARY_DIR}
- ${TryCompile_SOURCE_DIR}/fail.m
- OUTPUT_VARIABLE TRY_OUT)
- if(SHOULD_FAIL)
- message(SEND_ERROR "Should fail passed ${TRY_OUT}")
- endif()
-
-endif()
-
#######################################################################
#
# also test that the check_prototype_definition macro works
diff --git a/Tests/TryCompile/exit_with_error.c b/Tests/TryCompile/exit_with_error.c
index f3c523d37..dbddcf583 100644
--- a/Tests/TryCompile/exit_with_error.c
+++ b/Tests/TryCompile/exit_with_error.c
@@ -3,5 +3,5 @@
int main()
{
printf("hello world\n");
- return -1;
+ return 1;
}
diff --git a/Tests/TryCompile/old_and_new_signature_tests.cmake b/Tests/TryCompile/old_and_new_signature_tests.cmake
new file mode 100644
index 000000000..1373ad7fd
--- /dev/null
+++ b/Tests/TryCompile/old_and_new_signature_tests.cmake
@@ -0,0 +1,276 @@
+# try to compile a file that should compile
+try_compile(SHOULD_PASS
+ ${try_compile_bindir_or_SOURCES}
+ ${TryCompile_SOURCE_DIR}/pass.c
+ OUTPUT_VARIABLE TRY_OUT)
+EXPECT_PASS(SHOULD_PASS "${TRY_OUT}")
+
+# try to compile a file that should compile
+# also check that COPY_FILE works
+try_compile(SHOULD_PASS
+ ${try_compile_bindir_or_SOURCES}
+ ${TryCompile_SOURCE_DIR}/pass.c
+ OUTPUT_VARIABLE TRY_OUT
+ COPY_FILE ${TryCompile_BINARY_DIR}/CopyOfPass
+ )
+EXPECT_PASS(SHOULD_PASS "${TRY_OUT}")
+
+if(NOT EXISTS "${TryCompile_BINARY_DIR}/CopyOfPass")
+ message(SEND_ERROR "COPY_FILE to \"${TryCompile_BINARY_DIR}/CopyOfPass\" failed")
+else()
+ file(REMOVE "${TryCompile_BINARY_DIR}/CopyOfPass")
+endif()
+
+# try to compile a file that should compile
+# also check that COPY_FILE_ERROR works
+file(WRITE ${TryCompile_BINARY_DIR}/invalid "")
+try_compile(SHOULD_PASS
+ ${try_compile_bindir_or_SOURCES}
+ ${TryCompile_SOURCE_DIR}/pass.c
+ OUTPUT_VARIABLE TRY_OUT
+ COPY_FILE ${TryCompile_BINARY_DIR}/invalid/path
+ COPY_FILE_ERROR _captured
+ )
+EXPECT_PASS(SHOULD_PASS "${TRY_OUT}")
+
+if(NOT _captured MATCHES "Cannot copy output executable.*/invalid/path")
+ message(SEND_ERROR "COPY_FILE_ERROR did not capture expected message")
+endif()
+
+# try to compile a file that should not compile
+try_compile(SHOULD_FAIL
+ ${try_compile_bindir_or_SOURCES}
+ ${TryCompile_SOURCE_DIR}/fail.c
+ OUTPUT_VARIABLE TRY_OUT)
+EXPECT_FAIL(SHOULD_FAIL "${TRY_OUT}")
+
+# try to compile two files that should compile
+try_compile(SHOULD_PASS
+ ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES}
+ ${TryCompile_SOURCE_DIR}/pass2a.c
+ ${TryCompile_SOURCE_DIR}/pass2b.cxx
+ OUTPUT_VARIABLE TRY_OUT)
+EXPECT_PASS(SHOULD_PASS "${TRY_OUT}")
+
+# try to compile two files that should not compile
+try_compile(SHOULD_FAIL
+ ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES}
+ ${TryCompile_SOURCE_DIR}/fail2a.c
+ ${TryCompile_SOURCE_DIR}/fail2b.c
+ OUTPUT_VARIABLE TRY_OUT)
+EXPECT_FAIL(SHOULD_FAIL "${TRY_OUT}")
+
+# try to compile a file that should compile
+set(_c_flags "${CMAKE_C_FLAGS}")
+if(WATCOM)
+ string(APPEND CMAKE_C_FLAGS " -dTESTDEF")
+else()
+ string(APPEND CMAKE_C_FLAGS " \"-DTESTDEF\"")
+endif()
+try_compile(SHOULD_PASS
+ ${try_compile_bindir_or_SOURCES}
+ ${TryCompile_SOURCE_DIR}/testdef.c
+ OUTPUT_VARIABLE TRY_OUT)
+EXPECT_PASS(SHOULD_PASS "${TRY_OUT}")
+set(CMAKE_C_FLAGS "${_c_flags}")
+
+try_compile(CMAKE_ANSI_FOR_SCOPE
+ ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx OUTPUT_VARIABLE OUT)
+if(CMAKE_ANSI_FOR_SCOPE)
+ message("Compiler supports ansi for")
+else()
+ message("Compiler does not support ansi for scope")
+endif()
+
+message("use the module now")
+include(${CMAKE_ROOT}/Modules/TestForANSIForScope.cmake)
+if(CMAKE_ANSI_FOR_SCOPE)
+ message("Compiler supports ansi for")
+else()
+ message("Compiler does not support ansi for scope")
+endif()
+
+# test that COMPILE_DEFINITIONS are correctly expanded
+try_compile(COMPILE_DEFINITIONS_LIST_EXPANDED
+ ${try_compile_bindir_or_SOURCES}
+ ${TryCompile_SOURCE_DIR}/check_a_b.c
+ OUTPUT_VARIABLE output
+ COMPILE_DEFINITIONS "-DDEF_A;-DDEF_B"
+ )
+if(COMPILE_DEFINITIONS_LIST_EXPANDED)
+ message(STATUS "COMPILE_DEFINITIONS list expanded correctly")
+else()
+ string(REPLACE "\n" "\n " output " ${output}")
+ message(SEND_ERROR "COMPILE_DEFINITIONS list did not expand correctly\n${output}")
+endif()
+
+# try to compile a file that doesn't exist
+try_compile(SHOULD_FAIL_DUE_TO_BAD_SOURCE
+ ${try_compile_bindir_or_SOURCES}
+ ${TryCompile_SOURCE_DIR}/pass.c
+ OUTPUT_VARIABLE output
+ COMPILE_DEFINITIONS "bad#source.c"
+ )
+if(SHOULD_FAIL_DUE_TO_BAD_SOURCE AND NOT CMAKE_GENERATOR MATCHES "Watcom WMake|NMake Makefiles")
+ string(REPLACE "\n" "\n " output " ${output}")
+ message(SEND_ERROR "try_compile with bad#source.c did not fail:\n${output}")
+elseif(NOT output MATCHES [[(bad#source\.c|bad\.c|bad[':])]])
+ string(REPLACE "\n" "\n " output " ${output}")
+ message(SEND_ERROR "try_compile with bad#source.c failed without mentioning bad source:\n${output}")
+else()
+ message(STATUS "try_compile with bad#source.c correctly failed")
+endif()
+
+if(APPLE)
+ # try to compile a file that should compile
+ try_compile(SHOULD_PASS
+ ${try_compile_bindir_or_SOURCES}
+ ${TryCompile_SOURCE_DIR}/pass.m
+ OUTPUT_VARIABLE TRY_OUT)
+ EXPECT_PASS(SHOULD_PASS "${TRY_OUT}")
+
+ # try to compile a file that should not compile
+ try_compile(SHOULD_FAIL
+ ${try_compile_bindir_or_SOURCES}
+ ${TryCompile_SOURCE_DIR}/fail.m
+ OUTPUT_VARIABLE TRY_OUT)
+ EXPECT_FAIL(SHOULD_FAIL "${TRY_OUT}")
+endif()
+
+# check that try_compile honors NO_CACHE
+function(try_compile_scope_test)
+ try_compile(
+ CACHED_RESULT
+ ${try_compile_bindir_or_SOURCES}
+ ${TryCompile_SOURCE_DIR}/pass.c)
+ try_compile(
+ SHOULD_NOT_ESCAPE_SCOPE_RESULT
+ ${try_compile_bindir_or_SOURCES}
+ ${TryCompile_SOURCE_DIR}/pass.c
+ NO_CACHE)
+endfunction()
+
+try_compile_scope_test()
+
+if(NOT DEFINED CACHE{CACHED_RESULT})
+ message(SEND_ERROR " Result from try_compile was not cached")
+endif()
+if(DEFINED SHOULD_NOT_ESCAPE_SCOPE_RESULT)
+ message(SEND_ERROR " Result from try_compile(NO_CACHE) leaked")
+endif()
+
+######################################
+
+# now test try_run()
+
+# try to run a file that should compile and run without error
+# also check that OUTPUT_VARIABLE contains both the compile output
+# and the run output
+try_run(SHOULD_RUN SHOULD_COMPILE
+ ${try_compile_bindir_or_SOURCES}
+ ${TryCompile_SOURCE_DIR}/exit_success.c
+ ${try_compile_output_vars})
+EXPECT_COMPILED("exit_success" SHOULD_COMPILE "${${try_compile_compile_output_var}}")
+EXPECT_RUN_RESULT("exit_success" SHOULD_RUN 0)
+
+# check the compile output for the filename
+if(NOT "${${try_compile_compile_output_var}}" MATCHES "exit_success")
+ message(SEND_ERROR
+ " ${try_compile_compile_output_var} didn't contain \"exit_success\":"
+ " \"${${try_compile_compile_output_var}}\"")
+endif()
+# check the run output
+if(NOT "${${try_compile_run_output_var}}" MATCHES "hello world")
+ message(SEND_ERROR
+ " ${try_compile_run_output_var} didn't contain \"hello world\":"
+ " \"${${try_compile_run_output_var}}\"")
+endif()
+
+try_run(ARG_TEST_RUN ARG_TEST_COMPILE
+ ${try_compile_bindir_or_SOURCES}
+ ${TryCompile_SOURCE_DIR}/expect_arg.c
+ COMPILE_OUTPUT_VARIABLE TRY_OUT
+ ARGS arg1 arg2)
+EXPECT_COMPILED("expect_arg" ARG_TEST_COMPILE "${TRY_OUT}")
+EXPECT_RUN_RESULT("expect_arg" ARG_TEST_RUN 0)
+
+# try to run a file that should compile and run, but return an error
+try_run(SHOULD_EXIT_WITH_ERROR SHOULD_COMPILE
+ ${try_compile_bindir_or_SOURCES}
+ ${TryCompile_SOURCE_DIR}/exit_with_error.c
+ COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT
+ RUN_OUTPUT_VARIABLE RUN_OUTPUT)
+EXPECT_COMPILED("exit_with_error" SHOULD_COMPILE "${COMPILE_OUTPUT}")
+EXPECT_RUN_RESULT("exit_with_error" SHOULD_EXIT_WITH_ERROR 1)
+
+# check the compile output, it should contain the filename
+if(NOT "${COMPILE_OUTPUT}" MATCHES "exit_with_error")
+ message(SEND_ERROR " COMPILE_OUT didn't contain \"exit_with_error\": \"${COMPILE_OUTPUT}\"")
+endif()
+#... but not the run time output
+if("${COMPILE_OUTPUT}" MATCHES "hello world")
+ message(SEND_ERROR " COMPILE_OUT contains the run output: \"${COMPILE_OUTPUT}\"")
+endif()
+# check the run output, it should contain stdout
+if(NOT "${RUN_OUTPUT}" MATCHES "hello world")
+ message(SEND_ERROR " RUN_OUTPUT didn't contain \"hello world\": \"${RUN_OUTPUT}\"")
+endif()
+
+# try to run a file and parse stdout and stderr separately
+# also check that COPY_FILE works
+try_run(SHOULD_EXIT_WITH_ERROR SHOULD_COMPILE
+ ${try_compile_bindir_or_SOURCES}
+ ${TryCompile_SOURCE_DIR}/stdout_and_stderr.c
+ COPY_FILE ${TryCompile_BINARY_DIR}/CopyOfRun
+ COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT
+ RUN_OUTPUT_STDOUT_VARIABLE RUN_OUTPUT_STDOUT
+ RUN_OUTPUT_STDERR_VARIABLE RUN_OUTPUT_STDERR)
+EXPECT_PASS(SHOULD_COMPILE "${COMPILE_OUTPUT}")
+
+if(NOT EXISTS "${TryCompile_BINARY_DIR}/CopyOfRun")
+ message(SEND_ERROR "COPY_FILE to \"${TryCompile_BINARY_DIR}/CopyOfRun\" failed")
+else()
+ file(REMOVE "${TryCompile_BINARY_DIR}/CopyOfRun")
+endif()
+
+# check the run stdout output
+if(NOT "${RUN_OUTPUT_STDOUT}" MATCHES "hello world")
+ message(SEND_ERROR " RUN_OUTPUT_STDOUT didn't contain \"hello world\": \"${RUN_OUTPUT_STDOUT}\"")
+endif()
+# check the run stderr output
+if(NOT "${RUN_OUTPUT_STDERR}" MATCHES "error")
+ message(SEND_ERROR " RUN_OUTPUT_STDERR didn't contain \"error\": \"${RUN_OUTPUT_STDERR}\"")
+endif()
+
+# check that try_run honors NO_CACHE
+function(try_run_scope_test)
+ try_run(
+ CACHED_RUN_RESULT
+ CACHED_COMPILE_RESULT
+ ${try_compile_bindir_or_SOURCES}
+ ${TryCompile_SOURCE_DIR}/exit_success.c)
+ try_run(
+ SHOULD_NOT_ESCAPE_SCOPE_RUN_RESULT
+ SHOULD_NOT_ESCAPE_SCOPE_COMPILE_RESULT
+ ${try_compile_bindir_or_SOURCES}
+ ${TryCompile_SOURCE_DIR}/exit_success.c
+ NO_CACHE)
+endfunction()
+
+try_run_scope_test()
+
+if(NOT DEFINED CACHE{CACHED_COMPILE_RESULT})
+ message(SEND_ERROR " Compile result from try_run was not cached")
+endif()
+if(NOT DEFINED CACHE{CACHED_RUN_RESULT})
+ message(SEND_ERROR " Run result from try_run was not cached")
+endif()
+if(DEFINED SHOULD_NOT_ESCAPE_SCOPE_COMPILE_RESULT)
+ message(SEND_ERROR " Compile result from try_run(NO_CACHE) leaked")
+endif()
+if(DEFINED SHOULD_NOT_ESCAPE_SCOPE_RUN_RESULT)
+ message(SEND_ERROR " Run result from try_run(NO_CACHE) leaked")
+endif()
diff --git a/Tests/TryCompile/stdout_and_stderr.c b/Tests/TryCompile/stdout_and_stderr.c
new file mode 100644
index 000000000..84ded1f79
--- /dev/null
+++ b/Tests/TryCompile/stdout_and_stderr.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+int main()
+{
+ fputs("error\n", stderr);
+ puts("hello world\n");
+ return 0;
+}
diff --git a/Tests/VSGNUFortran/CMakeLists.txt b/Tests/VSGNUFortran/CMakeLists.txt
index 993d0d65f..2b4f4fa9c 100644
--- a/Tests/VSGNUFortran/CMakeLists.txt
+++ b/Tests/VSGNUFortran/CMakeLists.txt
@@ -11,7 +11,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
# to be in the same directory.
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig)
- foreach(config ${CMAKE_CONFIGURATION_TYPES})
+ foreach(config IN LISTS CMAKE_CONFIGURATION_TYPES)
string(TOUPPER "${config}" config)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${config}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
diff --git a/Tests/VSWinStorePhone/VerifyAppPackage.cmake b/Tests/VSWinStorePhone/VerifyAppPackage.cmake
index f9440d75e..52e8a5474 100644
--- a/Tests/VSWinStorePhone/VerifyAppPackage.cmake
+++ b/Tests/VSWinStorePhone/VerifyAppPackage.cmake
@@ -26,7 +26,7 @@ if(NOT result EQUAL 0)
message(FATAL_ERROR "Listing app package content failed with: ${error}")
endif()
-foreach(app_pkg_item ${EXPECTED_APP_PKG_CONTENT})
+foreach(app_pkg_item IN LISTS EXPECTED_APP_PKG_CONTENT)
string(FIND ${APP_PKG_CONTENT_OUTPUT} ${app_pkg_item} _found)
if(_found EQUAL -1)
message(FATAL_ERROR "Generated app package is missing an expected item: ${app_pkg_item}")