summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitlab/ci/configure_fedora31_common.cmake1
-rw-r--r--.gitlab/ci/configure_fedora31_makefiles.cmake1
-rw-r--r--.gitlab/ci/configure_fedora31_ninja.cmake1
-rw-r--r--.gitlab/ci/configure_fedora31_ninja_multi.cmake1
-rw-r--r--.gitlab/ci/docker/fedora31/Dockerfile3
-rwxr-xr-x.gitlab/ci/docker/fedora31/install_ispc.sh14
-rw-r--r--.gitlab/os-linux.yml2
-rw-r--r--.gitlab/rules.yml8
-rw-r--r--Auxiliary/vim/syntax/cmake.vim1
-rw-r--r--Help/command/add_custom_command.rst23
-rw-r--r--Help/command/add_custom_target.rst13
-rw-r--r--Help/command/add_library.rst4
-rw-r--r--Help/command/cmake_path.rst641
-rw-r--r--Help/command/enable_language.rst3
-rw-r--r--Help/command/file.rst76
-rw-r--r--Help/command/get_filename_component.rst6
-rw-r--r--Help/command/project.rst2
-rw-r--r--Help/dev/source.rst3
-rw-r--r--Help/envvar/ISPC.rst13
-rw-r--r--Help/envvar/ISPCFLAGS.rst15
-rw-r--r--Help/manual/cmake-commands.7.rst1
-rw-r--r--Help/manual/cmake-env-variables.7.rst2
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst44
-rw-r--r--Help/manual/cmake-policies.7.rst2
-rw-r--r--Help/manual/cmake-properties.7.rst3
-rw-r--r--Help/manual/cmake-variables.7.rst3
-rw-r--r--Help/policy/CMP0112.rst39
-rw-r--r--Help/policy/CMP0113.rst43
-rw-r--r--Help/prop_sf/LANGUAGE.rst2
-rw-r--r--Help/prop_tgt/ISPC_HEADER_DIRECTORY.rst13
-rw-r--r--Help/prop_tgt/ISPC_INSTRUCTION_SETS.rst21
-rw-r--r--Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst2
-rw-r--r--Help/prop_tgt/XCODE_LINK_BUILD_PHASE_MODE.rst52
-rw-r--r--Help/release/dev/cmake_path-command.rst5
-rw-r--r--Help/release/dev/cuda-fail-fast.rst6
-rw-r--r--Help/release/dev/custom-command-dedup.rst5
-rw-r--r--Help/release/dev/file-CHMOD.rst5
-rw-r--r--Help/release/dev/file-REAL_PATH.rst5
-rw-r--r--Help/release/dev/ispc-language-support.rst11
-rw-r--r--Help/release/dev/relax-target-generator-expression-dependency-addition.rst17
-rw-r--r--Help/release/dev/xcode-link-phase-all.rst9
-rw-r--r--Help/variable/CMAKE_ISPC_HEADER_DIRECTORY.rst10
-rw-r--r--Help/variable/CMAKE_ISPC_INSTRUCTION_SETS.rst9
-rw-r--r--Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst2
-rw-r--r--Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst2
-rw-r--r--Help/variable/CMAKE_XCODE_LINK_BUILD_PHASE_MODE.rst7
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake3
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake41
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake31
-rw-r--r--Modules/CMakeDetermineISPCCompiler.cmake96
-rw-r--r--Modules/CMakeFindBinUtils.cmake1
-rw-r--r--Modules/CMakeISPCCompiler.cmake.in30
-rw-r--r--Modules/CMakeISPCCompilerABI.ispc20
-rw-r--r--Modules/CMakeISPCCompilerId.ispc.in62
-rw-r--r--Modules/CMakeISPCInformation.cmake61
-rw-r--r--Modules/CMakeOBJCXXInformation.cmake2
-rw-r--r--Modules/CMakeTestISPCCompiler.cmake43
-rw-r--r--Modules/Compiler/ARMClang-ASM.cmake2
-rw-r--r--Modules/Compiler/Clang.cmake7
-rw-r--r--Modules/Compiler/Intel-ISPC.cmake22
-rw-r--r--Modules/ExternalData.cmake2
-rw-r--r--Modules/FindPython/Support.cmake38
-rw-r--r--Modules/Platform/Windows-Clang.cmake7
-rw-r--r--Modules/Platform/Windows-Embarcadero.cmake7
-rw-r--r--Modules/Platform/Windows-Intel-ISPC.cmake8
-rw-r--r--Modules/UseSWIG.cmake10
-rw-r--r--Source/CMakeLists.txt5
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/IFW/cmCPackIFWCommon.h5
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.h5
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.h5
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.h5
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.h5
-rw-r--r--Source/CPack/WiX/cmCMakeToWixPath.h5
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.h5
-rw-r--r--Source/CPack/WiX/cmWIXAccessControlList.h5
-rw-r--r--Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h5
-rw-r--r--Source/CPack/WiX/cmWIXFeaturesSourceWriter.h5
-rw-r--r--Source/CPack/WiX/cmWIXFilesSourceWriter.h5
-rw-r--r--Source/CPack/WiX/cmWIXPatch.h5
-rw-r--r--Source/CPack/WiX/cmWIXPatchParser.h5
-rw-r--r--Source/CPack/WiX/cmWIXRichTextFormatWriter.h5
-rw-r--r--Source/CPack/WiX/cmWIXShortcut.h5
-rw-r--r--Source/CPack/WiX/cmWIXSourceWriter.h5
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.h5
-rw-r--r--Source/CPack/cmCPackBundleGenerator.h5
-rw-r--r--Source/CPack/cmCPackComponentGroup.h5
-rw-r--r--Source/CPack/cmCPackCygwinBinaryGenerator.h5
-rw-r--r--Source/CPack/cmCPackCygwinSourceGenerator.h5
-rw-r--r--Source/CPack/cmCPackDebGenerator.h5
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.h5
-rw-r--r--Source/CPack/cmCPackExternalGenerator.h5
-rw-r--r--Source/CPack/cmCPackFreeBSDGenerator.h5
-rw-r--r--Source/CPack/cmCPackGenerator.cxx31
-rw-r--r--Source/CPack/cmCPackGenerator.h5
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.h5
-rw-r--r--Source/CPack/cmCPackLog.h5
-rw-r--r--Source/CPack/cmCPackNSISGenerator.h5
-rw-r--r--Source/CPack/cmCPackNuGetGenerator.h5
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.h5
-rw-r--r--Source/CPack/cmCPackPKGGenerator.h5
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.h5
-rw-r--r--Source/CPack/cmCPackProductBuildGenerator.h5
-rw-r--r--Source/CPack/cmCPackRPMGenerator.h5
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.h5
-rw-r--r--Source/CPack/cpack.cxx31
-rw-r--r--Source/CTest/cmCTestBZR.h5
-rw-r--r--Source/CTest/cmCTestBinPacker.h5
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.h5
-rw-r--r--Source/CTest/cmCTestBuildCommand.cxx55
-rw-r--r--Source/CTest/cmCTestBuildCommand.h5
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx10
-rw-r--r--Source/CTest/cmCTestBuildHandler.h5
-rw-r--r--Source/CTest/cmCTestCVS.h5
-rw-r--r--Source/CTest/cmCTestCommand.h5
-rw-r--r--Source/CTest/cmCTestConfigureCommand.cxx18
-rw-r--r--Source/CTest/cmCTestConfigureCommand.h5
-rw-r--r--Source/CTest/cmCTestConfigureHandler.h5
-rw-r--r--Source/CTest/cmCTestCoverageCommand.h5
-rw-r--r--Source/CTest/cmCTestCoverageHandler.h5
-rw-r--r--Source/CTest/cmCTestCurl.h5
-rw-r--r--Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h5
-rw-r--r--Source/CTest/cmCTestGIT.h5
-rw-r--r--Source/CTest/cmCTestGenericHandler.h5
-rw-r--r--Source/CTest/cmCTestGlobalVC.h5
-rw-r--r--Source/CTest/cmCTestHG.h5
-rw-r--r--Source/CTest/cmCTestHandlerCommand.cxx5
-rw-r--r--Source/CTest/cmCTestHandlerCommand.h5
-rw-r--r--Source/CTest/cmCTestLaunch.h5
-rw-r--r--Source/CTest/cmCTestMemCheckCommand.h5
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.h5
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.h5
-rw-r--r--Source/CTest/cmCTestP4.h5
-rw-r--r--Source/CTest/cmCTestReadCustomFilesCommand.h5
-rw-r--r--Source/CTest/cmCTestResourceAllocator.h5
-rw-r--r--Source/CTest/cmCTestResourceGroupsLexerHelper.h5
-rw-r--r--Source/CTest/cmCTestResourceSpec.cxx221
-rw-r--r--Source/CTest/cmCTestResourceSpec.h7
-rw-r--r--Source/CTest/cmCTestRunScriptCommand.h5
-rw-r--r--Source/CTest/cmCTestRunTest.h5
-rw-r--r--Source/CTest/cmCTestSVN.h5
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx17
-rw-r--r--Source/CTest/cmCTestScriptHandler.h5
-rw-r--r--Source/CTest/cmCTestSleepCommand.h5
-rw-r--r--Source/CTest/cmCTestStartCommand.cxx29
-rw-r--r--Source/CTest/cmCTestStartCommand.h5
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx11
-rw-r--r--Source/CTest/cmCTestSubmitCommand.h5
-rw-r--r--Source/CTest/cmCTestSubmitHandler.h5
-rw-r--r--Source/CTest/cmCTestTestCommand.cxx17
-rw-r--r--Source/CTest/cmCTestTestCommand.h5
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx5
-rw-r--r--Source/CTest/cmCTestTestHandler.h5
-rw-r--r--Source/CTest/cmCTestUpdateCommand.cxx3
-rw-r--r--Source/CTest/cmCTestUpdateCommand.h5
-rw-r--r--Source/CTest/cmCTestUpdateHandler.h5
-rw-r--r--Source/CTest/cmCTestUploadCommand.h5
-rw-r--r--Source/CTest/cmCTestUploadHandler.h5
-rw-r--r--Source/CTest/cmCTestVC.h5
-rw-r--r--Source/CTest/cmParseBlanketJSCoverage.h4
-rw-r--r--Source/CTest/cmParseCacheCoverage.h5
-rw-r--r--Source/CTest/cmParseCoberturaCoverage.h5
-rw-r--r--Source/CTest/cmParseDelphiCoverage.h4
-rw-r--r--Source/CTest/cmParseGTMCoverage.h5
-rw-r--r--Source/CTest/cmParseJacocoCoverage.h5
-rw-r--r--Source/CTest/cmParseMumpsCoverage.h5
-rw-r--r--Source/CTest/cmParsePHPCoverage.h5
-rw-r--r--Source/CTest/cmProcess.h5
-rw-r--r--Source/Checks/cm_cxx_features.cmake29
-rw-r--r--Source/Checks/cm_cxx_filesystem.cxx19
-rw-r--r--Source/CursesDialog/cmCursesBoolWidget.h5
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.h5
-rw-r--r--Source/CursesDialog/cmCursesColor.h5
-rw-r--r--Source/CursesDialog/cmCursesDummyWidget.h5
-rw-r--r--Source/CursesDialog/cmCursesFilePathWidget.h5
-rw-r--r--Source/CursesDialog/cmCursesForm.h5
-rw-r--r--Source/CursesDialog/cmCursesLabelWidget.h5
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.h5
-rw-r--r--Source/CursesDialog/cmCursesMainForm.h5
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.h5
-rw-r--r--Source/CursesDialog/cmCursesPathWidget.h5
-rw-r--r--Source/CursesDialog/cmCursesStandardIncludes.h5
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.h5
-rw-r--r--Source/CursesDialog/cmCursesWidget.h5
-rw-r--r--Source/LexerParser/cmCommandArgumentLexer.cxx22
-rw-r--r--Source/LexerParser/cmCommandArgumentLexer.in.l7
-rw-r--r--Source/QtDialog/AddCacheEntry.h5
-rw-r--r--Source/QtDialog/CMakeSetupDialog.h5
-rw-r--r--Source/QtDialog/Compilers.h5
-rw-r--r--Source/QtDialog/FirstConfigure.h5
-rw-r--r--Source/QtDialog/QCMake.h5
-rw-r--r--Source/QtDialog/QCMakeCacheView.h5
-rw-r--r--Source/QtDialog/QCMakeWidgets.h5
-rw-r--r--Source/QtDialog/RegexExplorer.h5
-rw-r--r--Source/QtDialog/WarningMessagesDialog.h5
-rw-r--r--Source/bindexplib.h4
-rw-r--r--Source/cmAddCompileDefinitionsCommand.h5
-rw-r--r--Source/cmAddCompileOptionsCommand.h5
-rw-r--r--Source/cmAddCustomCommandCommand.h5
-rw-r--r--Source/cmAddCustomTargetCommand.h5
-rw-r--r--Source/cmAddDefinitionsCommand.h5
-rw-r--r--Source/cmAddDependenciesCommand.h5
-rw-r--r--Source/cmAddExecutableCommand.h5
-rw-r--r--Source/cmAddLibraryCommand.h5
-rw-r--r--Source/cmAddLinkOptionsCommand.h5
-rw-r--r--Source/cmAddSubDirectoryCommand.h5
-rw-r--r--Source/cmAddTestCommand.h5
-rw-r--r--Source/cmAlgorithms.h5
-rw-r--r--Source/cmArchiveWrite.h5
-rw-r--r--Source/cmArgumentParser.h5
-rw-r--r--Source/cmAuxSourceDirectoryCommand.cxx5
-rw-r--r--Source/cmAuxSourceDirectoryCommand.h5
-rw-r--r--Source/cmBase32.h5
-rw-r--r--Source/cmBinUtilsLinker.h5
-rw-r--r--Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h5
-rw-r--r--Source/cmBinUtilsLinuxELFLinker.h5
-rw-r--r--Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h5
-rw-r--r--Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h5
-rw-r--r--Source/cmBinUtilsMacOSMachOLinker.h5
-rw-r--r--Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h5
-rw-r--r--Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h5
-rw-r--r--Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h5
-rw-r--r--Source/cmBinUtilsWindowsPELinker.h5
-rw-r--r--Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h5
-rw-r--r--Source/cmBreakCommand.h5
-rw-r--r--Source/cmBuildCommand.cxx3
-rw-r--r--Source/cmBuildCommand.h5
-rw-r--r--Source/cmBuildNameCommand.cxx7
-rw-r--r--Source/cmBuildNameCommand.h5
-rw-r--r--Source/cmCLocaleEnvironmentScope.h5
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.h5
-rw-r--r--Source/cmCMakeLanguageCommand.h5
-rw-r--r--Source/cmCMakeMinimumRequired.h5
-rw-r--r--Source/cmCMakePath.cxx146
-rw-r--r--Source/cmCMakePath.h571
-rw-r--r--Source/cmCMakePathCommand.cxx1019
-rw-r--r--Source/cmCMakePathCommand.h14
-rw-r--r--Source/cmCMakePolicyCommand.h5
-rw-r--r--Source/cmCPackPropertiesGenerator.h5
-rw-r--r--Source/cmCPluginAPI.cxx6
-rw-r--r--Source/cmCTest.cxx10
-rw-r--r--Source/cmCTest.h5
-rw-r--r--Source/cmCacheManager.h5
-rw-r--r--Source/cmCallVisualStudioMacro.h5
-rw-r--r--Source/cmCheckCustomOutputs.h5
-rw-r--r--Source/cmCommand.h5
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx44
-rw-r--r--Source/cmCommandArgumentParserHelper.h16
-rw-r--r--Source/cmCommands.cxx2
-rw-r--r--Source/cmCommands.h5
-rw-r--r--Source/cmCommonTargetGenerator.cxx8
-rw-r--r--Source/cmCommonTargetGenerator.h5
-rw-r--r--Source/cmComputeComponentGraph.h5
-rw-r--r--Source/cmComputeLinkDepends.cxx12
-rw-r--r--Source/cmComputeLinkDepends.h5
-rw-r--r--Source/cmComputeLinkInformation.cxx66
-rw-r--r--Source/cmComputeLinkInformation.h5
-rw-r--r--Source/cmComputeTargetDepends.h5
-rw-r--r--Source/cmConditionEvaluator.cxx76
-rw-r--r--Source/cmConditionEvaluator.h11
-rw-r--r--Source/cmConfigure.cmake.h.in5
-rw-r--r--Source/cmConfigureFileCommand.h4
-rw-r--r--Source/cmContinueCommand.h5
-rw-r--r--Source/cmCoreTryCompile.cxx75
-rw-r--r--Source/cmCoreTryCompile.h5
-rw-r--r--Source/cmCreateTestSourceList.h5
-rw-r--r--Source/cmCryptoHash.h5
-rw-r--r--Source/cmCurl.h5
-rw-r--r--Source/cmCustomCommand.h5
-rw-r--r--Source/cmCustomCommandGenerator.h5
-rw-r--r--Source/cmCustomCommandLines.h5
-rw-r--r--Source/cmCustomCommandTypes.h5
-rw-r--r--Source/cmDefinePropertyCommand.h5
-rw-r--r--Source/cmDefinitions.h5
-rw-r--r--Source/cmDepends.cxx7
-rw-r--r--Source/cmDepends.h5
-rw-r--r--Source/cmDependsC.cxx9
-rw-r--r--Source/cmDependsC.h5
-rw-r--r--Source/cmDependsFortran.cxx5
-rw-r--r--Source/cmDependsFortran.h5
-rw-r--r--Source/cmDependsJava.h5
-rw-r--r--Source/cmDependsJavaParserHelper.h5
-rw-r--r--Source/cmDocumentation.h5
-rw-r--r--Source/cmDocumentationEntry.h5
-rw-r--r--Source/cmDocumentationFormatter.h5
-rw-r--r--Source/cmDocumentationSection.h5
-rw-r--r--Source/cmDynamicLoader.h5
-rw-r--r--Source/cmELF.h5
-rw-r--r--Source/cmEnableLanguageCommand.h5
-rw-r--r--Source/cmEnableTestingCommand.h5
-rw-r--r--Source/cmExecProgramCommand.h5
-rw-r--r--Source/cmExecuteProcessCommand.h5
-rw-r--r--Source/cmExecutionStatus.h5
-rw-r--r--Source/cmExpandedCommandArgument.cxx5
-rw-r--r--Source/cmExpandedCommandArgument.h7
-rw-r--r--Source/cmExportBuildAndroidMKGenerator.h5
-rw-r--r--Source/cmExportBuildFileGenerator.h5
-rw-r--r--Source/cmExportCommand.h5
-rw-r--r--Source/cmExportFileGenerator.h5
-rw-r--r--Source/cmExportInstallAndroidMKGenerator.h5
-rw-r--r--Source/cmExportInstallFileGenerator.h5
-rw-r--r--Source/cmExportLibraryDependenciesCommand.h5
-rw-r--r--Source/cmExportSet.h5
-rw-r--r--Source/cmExportTryCompileFileGenerator.h5
-rw-r--r--Source/cmExprParserHelper.h5
-rw-r--r--Source/cmExternalMakefileProjectGenerator.h5
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx13
-rw-r--r--Source/cmExtraCodeBlocksGenerator.h5
-rw-r--r--Source/cmExtraCodeLiteGenerator.h5
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx12
-rw-r--r--Source/cmExtraEclipseCDT4Generator.h5
-rw-r--r--Source/cmExtraKateGenerator.cxx5
-rw-r--r--Source/cmExtraKateGenerator.h5
-rw-r--r--Source/cmExtraSublimeTextGenerator.h5
-rw-r--r--Source/cmFLTKWrapUICommand.h5
-rw-r--r--Source/cmFSPermissions.h5
-rw-r--r--Source/cmFileAPI.h5
-rw-r--r--Source/cmFileAPICMakeFiles.h5
-rw-r--r--Source/cmFileAPICache.h5
-rw-r--r--Source/cmFileAPICodemodel.cxx16
-rw-r--r--Source/cmFileAPICodemodel.h5
-rw-r--r--Source/cmFileCommand.cxx219
-rw-r--r--Source/cmFileCommand.h5
-rw-r--r--Source/cmFileCopier.cxx5
-rw-r--r--Source/cmFileCopier.h5
-rw-r--r--Source/cmFileInstaller.h5
-rw-r--r--Source/cmFileLock.h5
-rw-r--r--Source/cmFileLockPool.h5
-rw-r--r--Source/cmFileLockResult.h5
-rw-r--r--Source/cmFilePathChecksum.h5
-rw-r--r--Source/cmFileTime.h5
-rw-r--r--Source/cmFileTimeCache.h5
-rw-r--r--Source/cmFileTimes.h5
-rw-r--r--Source/cmFindBase.cxx5
-rw-r--r--Source/cmFindBase.h5
-rw-r--r--Source/cmFindCommon.cxx27
-rw-r--r--Source/cmFindCommon.h5
-rw-r--r--Source/cmFindFileCommand.h5
-rw-r--r--Source/cmFindLibraryCommand.cxx5
-rw-r--r--Source/cmFindLibraryCommand.h5
-rw-r--r--Source/cmFindPackageCommand.cxx34
-rw-r--r--Source/cmFindPackageCommand.h5
-rw-r--r--Source/cmFindPathCommand.h5
-rw-r--r--Source/cmFindProgramCommand.h5
-rw-r--r--Source/cmForEachCommand.cxx9
-rw-r--r--Source/cmForEachCommand.h4
-rw-r--r--Source/cmFortranParser.h5
-rw-r--r--Source/cmFunctionBlocker.h5
-rw-r--r--Source/cmFunctionCommand.h5
-rw-r--r--Source/cmGccDepfileLexerHelper.h5
-rw-r--r--Source/cmGccDepfileReader.h5
-rw-r--r--Source/cmGccDepfileReaderTypes.h5
-rw-r--r--Source/cmGeneratedFileStream.h5
-rw-r--r--Source/cmGeneratorExpression.h5
-rw-r--r--Source/cmGeneratorExpressionContext.h5
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.h5
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.h5
-rw-r--r--Source/cmGeneratorExpressionEvaluator.h5
-rw-r--r--Source/cmGeneratorExpressionLexer.h5
-rw-r--r--Source/cmGeneratorExpressionNode.cxx77
-rw-r--r--Source/cmGeneratorExpressionNode.h5
-rw-r--r--Source/cmGeneratorExpressionParser.h5
-rw-r--r--Source/cmGeneratorTarget.cxx259
-rw-r--r--Source/cmGeneratorTarget.h22
-rw-r--r--Source/cmGetCMakePropertyCommand.h5
-rw-r--r--Source/cmGetDirectoryPropertyCommand.cxx4
-rw-r--r--Source/cmGetDirectoryPropertyCommand.h5
-rw-r--r--Source/cmGetFilenameComponentCommand.cxx5
-rw-r--r--Source/cmGetFilenameComponentCommand.h5
-rw-r--r--Source/cmGetPipes.h5
-rw-r--r--Source/cmGetPropertyCommand.cxx14
-rw-r--r--Source/cmGetPropertyCommand.h5
-rw-r--r--Source/cmGetSourceFilePropertyCommand.h5
-rw-r--r--Source/cmGetTargetPropertyCommand.h5
-rw-r--r--Source/cmGetTestPropertyCommand.h5
-rw-r--r--Source/cmGhsMultiGpj.h5
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx4
-rw-r--r--Source/cmGhsMultiTargetGenerator.h5
-rw-r--r--Source/cmGlobVerificationManager.h5
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.h5
-rw-r--r--Source/cmGlobalCommonGenerator.h5
-rw-r--r--Source/cmGlobalGenerator.cxx101
-rw-r--r--Source/cmGlobalGenerator.h13
-rw-r--r--Source/cmGlobalGeneratorFactory.h5
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx13
-rw-r--r--Source/cmGlobalGhsMultiGenerator.h5
-rw-r--r--Source/cmGlobalJOMMakefileGenerator.h5
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.h5
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.h5
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.h5
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx57
-rw-r--r--Source/cmGlobalNinjaGenerator.h11
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h5
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h4
-rw-r--r--Source/cmGlobalVisualStudio11Generator.h4
-rw-r--r--Source/cmGlobalVisualStudio12Generator.h4
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx4
-rw-r--r--Source/cmGlobalVisualStudio14Generator.h4
-rw-r--r--Source/cmGlobalVisualStudio71Generator.h4
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx7
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio8Generator.h4
-rw-r--r--Source/cmGlobalVisualStudio9Generator.h4
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h5
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.h4
-rw-r--r--Source/cmGlobalWatcomWMakeGenerator.h5
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx502
-rw-r--r--Source/cmGlobalXCodeGenerator.h14
-rw-r--r--Source/cmGraphAdjacencyList.h5
-rw-r--r--Source/cmGraphVizWriter.cxx9
-rw-r--r--Source/cmGraphVizWriter.h5
-rw-r--r--Source/cmHexFileConverter.h5
-rw-r--r--Source/cmIDEFlagTable.h5
-rw-r--r--Source/cmIDEOptions.h5
-rw-r--r--Source/cmIfCommand.h5
-rw-r--r--Source/cmIncludeCommand.h5
-rw-r--r--Source/cmIncludeDirectoryCommand.h5
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.h5
-rw-r--r--Source/cmIncludeGuardCommand.cxx2
-rw-r--r--Source/cmIncludeGuardCommand.h5
-rw-r--r--Source/cmIncludeRegularExpressionCommand.h5
-rw-r--r--Source/cmInstallCommand.h5
-rw-r--r--Source/cmInstallCommandArguments.h5
-rw-r--r--Source/cmInstallDirectoryGenerator.h5
-rw-r--r--Source/cmInstallExportGenerator.h5
-rw-r--r--Source/cmInstallFilesCommand.h5
-rw-r--r--Source/cmInstallFilesGenerator.h5
-rw-r--r--Source/cmInstallGenerator.h5
-rw-r--r--Source/cmInstallProgramsCommand.h5
-rw-r--r--Source/cmInstallScriptGenerator.h5
-rw-r--r--Source/cmInstallSubdirectoryGenerator.h5
-rw-r--r--Source/cmInstallTargetGenerator.cxx6
-rw-r--r--Source/cmInstallTargetGenerator.h5
-rw-r--r--Source/cmInstallTargetsCommand.h5
-rw-r--r--Source/cmInstallType.h5
-rw-r--r--Source/cmInstalledFile.h5
-rw-r--r--Source/cmJSONHelpers.h304
-rw-r--r--Source/cmJsonObjects.cxx4
-rw-r--r--Source/cmJsonObjects.h5
-rw-r--r--Source/cmLDConfigLDConfigTool.h5
-rw-r--r--Source/cmLDConfigTool.h5
-rw-r--r--Source/cmLinkDirectoriesCommand.h5
-rw-r--r--Source/cmLinkItem.h5
-rw-r--r--Source/cmLinkItemGraphVisitor.h5
-rw-r--r--Source/cmLinkLibrariesCommand.h5
-rw-r--r--Source/cmLinkLineComputer.h5
-rw-r--r--Source/cmLinkLineDeviceComputer.h5
-rw-r--r--Source/cmLinkedTree.h5
-rw-r--r--Source/cmListCommand.cxx5
-rw-r--r--Source/cmListCommand.h5
-rw-r--r--Source/cmListFileCache.h5
-rw-r--r--Source/cmListFileLexer.h5
-rw-r--r--Source/cmLoadCacheCommand.h5
-rw-r--r--Source/cmLoadCommandCommand.h5
-rw-r--r--Source/cmLocalCommonGenerator.cxx5
-rw-r--r--Source/cmLocalCommonGenerator.h5
-rw-r--r--Source/cmLocalGenerator.cxx300
-rw-r--r--Source/cmLocalGenerator.h11
-rw-r--r--Source/cmLocalGhsMultiGenerator.cxx36
-rw-r--r--Source/cmLocalGhsMultiGenerator.h10
-rw-r--r--Source/cmLocalNinjaGenerator.cxx4
-rw-r--r--Source/cmLocalNinjaGenerator.h5
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx58
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h15
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx38
-rw-r--r--Source/cmLocalVisualStudio10Generator.h18
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx73
-rw-r--r--Source/cmLocalVisualStudio7Generator.h17
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx5
-rw-r--r--Source/cmLocalVisualStudioGenerator.h5
-rw-r--r--Source/cmLocalXCodeGenerator.h5
-rw-r--r--Source/cmLocale.h5
-rw-r--r--Source/cmMSVC60LinkLineComputer.h5
-rw-r--r--Source/cmMachO.h5
-rw-r--r--Source/cmMacroCommand.h5
-rw-r--r--Source/cmMakeDirectoryCommand.h5
-rw-r--r--Source/cmMakefile.cxx129
-rw-r--r--Source/cmMakefile.h10
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.h5
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.h5
-rw-r--r--Source/cmMakefileProfilingData.h4
-rw-r--r--Source/cmMakefileTargetGenerator.cxx181
-rw-r--r--Source/cmMakefileTargetGenerator.h10
-rw-r--r--Source/cmMakefileUtilityTargetGenerator.h5
-rw-r--r--Source/cmMarkAsAdvancedCommand.h5
-rw-r--r--Source/cmMathCommand.h5
-rw-r--r--Source/cmMessageCommand.h5
-rw-r--r--Source/cmMessageType.h5
-rw-r--r--Source/cmMessenger.h5
-rw-r--r--Source/cmNewLineStyle.h5
-rw-r--r--Source/cmNinjaLinkLineComputer.h5
-rw-r--r--Source/cmNinjaLinkLineDeviceComputer.h5
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx29
-rw-r--r--Source/cmNinjaNormalTargetGenerator.h5
-rw-r--r--Source/cmNinjaTargetGenerator.cxx81
-rw-r--r--Source/cmNinjaTargetGenerator.h5
-rw-r--r--Source/cmNinjaTypes.h5
-rw-r--r--Source/cmNinjaUtilityTargetGenerator.cxx2
-rw-r--r--Source/cmNinjaUtilityTargetGenerator.h5
-rw-r--r--Source/cmOSXBundleGenerator.h5
-rw-r--r--Source/cmOptionCommand.h4
-rw-r--r--Source/cmOrderDirectories.h5
-rw-r--r--Source/cmOutputConverter.h5
-rw-r--r--Source/cmOutputRequiredFilesCommand.h5
-rw-r--r--Source/cmParseArgumentsCommand.cxx5
-rw-r--r--Source/cmParseArgumentsCommand.h5
-rw-r--r--Source/cmPathLabel.h5
-rw-r--r--Source/cmPolicies.h17
-rw-r--r--Source/cmProcessOutput.h5
-rw-r--r--Source/cmProcessTools.h5
-rw-r--r--Source/cmProjectCommand.cxx9
-rw-r--r--Source/cmProjectCommand.h5
-rw-r--r--Source/cmProperty.h13
-rw-r--r--Source/cmPropertyDefinition.h5
-rw-r--r--Source/cmPropertyMap.h5
-rw-r--r--Source/cmQTWrapCPPCommand.cxx2
-rw-r--r--Source/cmQTWrapCPPCommand.h5
-rw-r--r--Source/cmQTWrapUICommand.h5
-rw-r--r--Source/cmQtAutoGen.h5
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.h5
-rw-r--r--Source/cmQtAutoGenInitializer.cxx5
-rw-r--r--Source/cmQtAutoGenInitializer.h5
-rw-r--r--Source/cmQtAutoGenerator.h5
-rw-r--r--Source/cmQtAutoMocUic.cxx26
-rw-r--r--Source/cmQtAutoMocUic.h5
-rw-r--r--Source/cmQtAutoRcc.h5
-rw-r--r--Source/cmRST.h5
-rw-r--r--Source/cmRange.h5
-rw-r--r--Source/cmRemoveCommand.cxx5
-rw-r--r--Source/cmRemoveCommand.h5
-rw-r--r--Source/cmRemoveDefinitionsCommand.h5
-rw-r--r--Source/cmReturnCommand.h5
-rw-r--r--Source/cmRulePlaceholderExpander.cxx5
-rw-r--r--Source/cmRulePlaceholderExpander.h6
-rw-r--r--Source/cmRuntimeDependencyArchive.h5
-rw-r--r--Source/cmScriptGenerator.h5
-rw-r--r--Source/cmSearchPath.cxx15
-rw-r--r--Source/cmSearchPath.h5
-rw-r--r--Source/cmSeparateArgumentsCommand.cxx5
-rw-r--r--Source/cmSeparateArgumentsCommand.h5
-rw-r--r--Source/cmSetCommand.h5
-rw-r--r--Source/cmSetDirectoryPropertiesCommand.h5
-rw-r--r--Source/cmSetPropertyCommand.h5
-rw-r--r--Source/cmSetSourceFilesPropertiesCommand.h5
-rw-r--r--Source/cmSetTargetPropertiesCommand.h5
-rw-r--r--Source/cmSetTestsPropertiesCommand.h5
-rw-r--r--Source/cmSiteNameCommand.cxx7
-rw-r--r--Source/cmSiteNameCommand.h5
-rw-r--r--Source/cmSourceFile.h5
-rw-r--r--Source/cmSourceFileLocation.h5
-rw-r--r--Source/cmSourceFileLocationKind.h5
-rw-r--r--Source/cmSourceGroup.h5
-rw-r--r--Source/cmSourceGroupCommand.h5
-rw-r--r--Source/cmStandardLevelResolver.cxx26
-rw-r--r--Source/cmStandardLevelResolver.h4
-rw-r--r--Source/cmStandardLexer.h5
-rw-r--r--Source/cmState.cxx5
-rw-r--r--Source/cmState.h5
-rw-r--r--Source/cmStateDirectory.h5
-rw-r--r--Source/cmStatePrivate.h5
-rw-r--r--Source/cmStateSnapshot.cxx5
-rw-r--r--Source/cmStateSnapshot.h7
-rw-r--r--Source/cmStateTypes.h5
-rw-r--r--Source/cmString.hxx5
-rw-r--r--Source/cmStringAlgorithms.cxx50
-rw-r--r--Source/cmStringAlgorithms.h23
-rw-r--r--Source/cmStringCommand.cxx21
-rw-r--r--Source/cmStringCommand.h5
-rw-r--r--Source/cmStringReplaceHelper.h5
-rw-r--r--Source/cmSubcommandTable.h5
-rw-r--r--Source/cmSubdirCommand.h5
-rw-r--r--Source/cmSubdirDependsCommand.h5
-rw-r--r--Source/cmSystemTools.cxx224
-rw-r--r--Source/cmSystemTools.h6
-rw-r--r--Source/cmTarget.cxx23
-rw-r--r--Source/cmTarget.h5
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.h5
-rw-r--r--Source/cmTargetCompileFeaturesCommand.h5
-rw-r--r--Source/cmTargetCompileOptionsCommand.h5
-rw-r--r--Source/cmTargetDepend.h5
-rw-r--r--Source/cmTargetExport.h5
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.h5
-rw-r--r--Source/cmTargetLinkDirectoriesCommand.h5
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx8
-rw-r--r--Source/cmTargetLinkLibrariesCommand.h5
-rw-r--r--Source/cmTargetLinkLibraryType.h5
-rw-r--r--Source/cmTargetLinkOptionsCommand.h5
-rw-r--r--Source/cmTargetPrecompileHeadersCommand.h5
-rw-r--r--Source/cmTargetPropCommandBase.h5
-rw-r--r--Source/cmTargetPropertyComputer.h5
-rw-r--r--Source/cmTargetSourcesCommand.h5
-rw-r--r--Source/cmTest.h5
-rw-r--r--Source/cmTestGenerator.h5
-rw-r--r--Source/cmTimestamp.h5
-rw-r--r--Source/cmTryCompileCommand.h5
-rw-r--r--Source/cmTryRunCommand.cxx10
-rw-r--r--Source/cmTryRunCommand.h5
-rw-r--r--Source/cmUVProcessChain.h5
-rw-r--r--Source/cmUVStreambuf.h5
-rw-r--r--Source/cmUnsetCommand.h5
-rw-r--r--Source/cmUseMangledMesaCommand.h5
-rw-r--r--Source/cmUtilitySourceCommand.cxx12
-rw-r--r--Source/cmUtilitySourceCommand.h5
-rw-r--r--Source/cmUtils.hxx5
-rw-r--r--Source/cmUuid.h5
-rw-r--r--Source/cmVSSetupHelper.h5
-rw-r--r--Source/cmVariableRequiresCommand.cxx5
-rw-r--r--Source/cmVariableRequiresCommand.h5
-rw-r--r--Source/cmVariableWatch.h5
-rw-r--r--Source/cmVariableWatchCommand.cxx5
-rw-r--r--Source/cmVariableWatchCommand.h5
-rw-r--r--Source/cmVersion.h5
-rw-r--r--Source/cmVersionMacros.h5
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx42
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h5
-rw-r--r--Source/cmVisualStudio10ToolsetOptions.h4
-rw-r--r--Source/cmVisualStudioGeneratorOptions.h5
-rw-r--r--Source/cmVisualStudioSlnData.h5
-rw-r--r--Source/cmVisualStudioSlnParser.h5
-rw-r--r--Source/cmVisualStudioWCEPlatformParser.h5
-rw-r--r--Source/cmWhileCommand.h5
-rw-r--r--Source/cmWorkerPool.h5
-rw-r--r--Source/cmWorkingDirectory.h5
-rw-r--r--Source/cmWriteFileCommand.h5
-rw-r--r--Source/cmXCode21Object.cxx2
-rw-r--r--Source/cmXCode21Object.h4
-rw-r--r--Source/cmXCodeObject.h10
-rw-r--r--Source/cmXCodeScheme.h5
-rw-r--r--Source/cmXMLParser.h5
-rw-r--r--Source/cmXMLSafe.h5
-rw-r--r--Source/cmXMLWriter.h5
-rw-r--r--Source/cm_codecvt.hxx5
-rw-r--r--Source/cm_get_date.h5
-rw-r--r--Source/cm_sys_stat.h5
-rw-r--r--Source/cm_utf8.h5
-rw-r--r--Source/cmake.cxx6
-rw-r--r--Source/cmake.h9
-rw-r--r--Source/cmcmd.h5
-rw-r--r--Tests/CMakeLib/CMakeLists.txt1
-rw-r--r--Tests/CMakeLib/testJSONHelpers.cxx493
-rw-r--r--Tests/CMakeLib/testOptional.cxx315
-rw-r--r--Tests/CMakeLib/testStringAlgorithms.cxx10
-rw-r--r--Tests/CMakeLists.txt4
-rw-r--r--Tests/ISPC/CMakeLists.txt16
-rw-r--r--Tests/ISPC/ChainedStaticLibraries/CMakeLists.txt22
-rw-r--r--Tests/ISPC/ChainedStaticLibraries/extra.cxx17
-rw-r--r--Tests/ISPC/ChainedStaticLibraries/extra.ispc12
-rw-r--r--Tests/ISPC/ChainedStaticLibraries/main.cxx15
-rw-r--r--Tests/ISPC/ChainedStaticLibraries/simple.ispc12
-rw-r--r--Tests/ISPC/Defines/CMakeLists.txt16
-rw-r--r--Tests/ISPC/Defines/main.cxx15
-rw-r--r--Tests/ISPC/Defines/simple.ispc15
-rw-r--r--Tests/ISPC/DynamicLibrary/CMakeLists.txt20
-rw-r--r--Tests/ISPC/DynamicLibrary/extra.cxx17
-rw-r--r--Tests/ISPC/DynamicLibrary/extra.ispc12
-rw-r--r--Tests/ISPC/DynamicLibrary/main.cxx15
-rw-r--r--Tests/ISPC/DynamicLibrary/simple.ispc12
-rw-r--r--Tests/ISPC/ObjectGenex/CMakeLists.txt45
-rw-r--r--Tests/ISPC/ObjectGenex/main.cxx87
-rw-r--r--Tests/ISPC/ObjectGenex/simple.ispc12
-rw-r--r--Tests/ISPC/ObjectLibrary/CMakeLists.txt18
-rw-r--r--Tests/ISPC/ObjectLibrary/extra.cxx17
-rw-r--r--Tests/ISPC/ObjectLibrary/extra.ispc12
-rw-r--r--Tests/ISPC/ObjectLibrary/main.cxx15
-rw-r--r--Tests/ISPC/ObjectLibrary/simple.ispc12
-rw-r--r--Tests/ISPC/ResponseAndDefine/CMakeLists.txt28
-rw-r--r--Tests/ISPC/ResponseAndDefine/main.cxx15
-rw-r--r--Tests/ISPC/ResponseAndDefine/simple.ispc16
-rw-r--r--Tests/ISPC/StaticLibrary/CMakeLists.txt15
-rw-r--r--Tests/ISPC/StaticLibrary/main.cxx15
-rw-r--r--Tests/ISPC/StaticLibrary/simple.ispc12
-rw-r--r--Tests/ISPC/TryCompile/CMakeLists.txt16
-rw-r--r--Tests/ISPC/TryCompile/main.cxx19
-rw-r--r--Tests/ISPC/TryCompile/simple.ispc12
-rw-r--r--Tests/QtAutogen/RerunMocOnAddFile/CMakeLists.txt96
-rw-r--r--Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/CMakeLists.txt.in9
-rw-r--r--Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/anotherobject.cpp15
-rw-r--r--Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/main.cpp.in6
-rw-r--r--Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.cpp6
-rw-r--r--Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.h13
-rw-r--r--Tests/QtAutogen/RerunMocOnMissingDependency/CMakeLists.txt80
-rw-r--r--Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/CMakeLists.txt.in7
-rw-r--r--Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/inc1/foo.h2
-rw-r--r--Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/inc2/foo.h2
-rw-r--r--Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/main.cpp9
-rw-r--r--Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/myobject.cpp6
-rw-r--r--Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/myobject.h10
-rw-r--r--Tests/QtAutogen/Tests.cmake2
-rw-r--r--Tests/RunCMake/CMakeLists.txt17
-rw-r--r--Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt21
-rw-r--r--Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt21
-rw-r--r--Tests/RunCMake/CompilerLauncher/ISPC-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/ISPC-common.cmake4
-rw-r--r--Tests/RunCMake/CompilerLauncher/ISPC-env-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/ISPC-env-launch-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/ISPC-env.cmake1
-rw-r--r--Tests/RunCMake/CompilerLauncher/ISPC-launch-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/ISPC-launch-env.cmake3
-rw-r--r--Tests/RunCMake/CompilerLauncher/ISPC-launch.cmake3
-rw-r--r--Tests/RunCMake/CompilerLauncher/ISPC.cmake2
-rw-r--r--Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/CompilerLauncher/test.ispc4
-rw-r--r--Tests/RunCMake/ExternalProject/DownloadServer.py6
-rw-r--r--Tests/RunCMake/ExternalProject/MultiCommand.cmake4
-rw-r--r--Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-result.txt1
-rw-r--r--Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-stderr.txt6
-rw-r--r--Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency.cmake12
-rw-r--r--Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-no-dependency.cmake12
-rw-r--r--Tests/RunCMake/Make/CMP0113-Common.cmake17
-rw-r--r--Tests/RunCMake/Make/CMP0113-NEW-build-gnu-stderr.txt5
-rw-r--r--Tests/RunCMake/Make/CMP0113-NEW-build-result.txt1
-rw-r--r--Tests/RunCMake/Make/CMP0113-NEW-build-stderr.txt1
-rw-r--r--Tests/RunCMake/Make/CMP0113-NEW-build-stdout.txt1
-rw-r--r--Tests/RunCMake/Make/CMP0113-NEW.cmake2
-rw-r--r--Tests/RunCMake/Make/CMP0113-OLD-build-stdout.txt1
-rw-r--r--Tests/RunCMake/Make/CMP0113-OLD.cmake2
-rw-r--r--Tests/RunCMake/Make/CMP0113-WARN-build-stdout.txt1
-rw-r--r--Tests/RunCMake/Make/CMP0113-WARN.cmake2
-rw-r--r--Tests/RunCMake/Make/RunCMakeTest.cmake22
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-clean-build-check.cmake3
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-leaf-custom-ninja-check.cmake6
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-leaf-exe-ninja-check.cmake6
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets.cmake12
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithNewline-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithTabs-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/ParenInENV-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt2
-rw-r--r--Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt2
-rw-r--r--Tests/RunCMake/XcodeProject/DeploymentTarget.cmake3
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase.cmake87
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY-check.cmake19
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_Funcs.cmake55
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-result.txt1
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-stderr.txt1
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID.cmake4
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION-check.cmake19
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE-check.cmake19
-rw-r--r--Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject/RunCMakeTest.cmake13
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeBundles.cmake2
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake1
-rw-r--r--Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/ABSOLUTE_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/ABSOLUTE_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake39
-rw-r--r--Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/APPEND-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/APPEND.cmake77
-rw-r--r--Tests/RunCMake/cmake_path/CMAKE_PATH-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CMAKE_PATH-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CMAKE_PATH-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CMAKE_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CMAKE_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CMAKE_PATH.cmake43
-rw-r--r--Tests/RunCMake/cmake_path/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE-EQUAL-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE-EQUAL-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE-EQUAL-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE-wrong-operator-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE-wrong-operator-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE-wrong-operator.cmake3
-rw-r--r--Tests/RunCMake/cmake_path/COMPARE.cmake22
-rw-r--r--Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONCAT-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONCAT.cmake20
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT-wrong-operator-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT-wrong-operator-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT-wrong-operator.cmake2
-rw-r--r--Tests/RunCMake/cmake_path/CONVERT.cmake110
-rw-r--r--Tests/RunCMake/cmake_path/GET-EXTENSION-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-EXTENSION-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-EXTENSION-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-EXTENSION-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-FILENAME-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-FILENAME-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-FILENAME-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-FILENAME-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-PARENT_PATH-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-PARENT_PATH-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-PARENT_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-PARENT_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_NAME-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_NAME-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_NAME-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_NAME-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_PATH-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_PATH-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-ROOT_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-STEM-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-STEM-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-STEM-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-STEM-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-wrong-operator-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/GET-wrong-operator-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_path/GET-wrong-operator.cmake3
-rw-r--r--Tests/RunCMake/cmake_path/GET.cmake248
-rw-r--r--Tests/RunCMake/cmake_path/HASH-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HASH-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HASH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HASH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HASH.cmake27
-rw-r--r--Tests/RunCMake/cmake_path/HAS_EXTENSION-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_EXTENSION-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_EXTENSION-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_EXTENSION-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_FILENAME-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_FILENAME-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_FILENAME-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_FILENAME-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ITEM.cmake232
-rw-r--r--Tests/RunCMake/cmake_path/HAS_PARENT_PATH-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_PARENT_PATH-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_PARENT_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_PARENT_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_NAME-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_NAME-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_NAME-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_NAME-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_PATH-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_PATH-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_ROOT_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_STEM-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_STEM-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_STEM-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/HAS_STEM-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_ABSOLUTE-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_ABSOLUTE-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_ABSOLUTE-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_ABSOLUTE-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_ABSOLUTE.cmake48
-rw-r--r--Tests/RunCMake/cmake_path/IS_PREFIX-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_PREFIX-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_PREFIX-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_PREFIX-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_PREFIX.cmake22
-rw-r--r--Tests/RunCMake/cmake_path/IS_RELATIVE-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_RELATIVE-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_RELATIVE-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_RELATIVE-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/IS_RELATIVE.cmake48
-rw-r--r--Tests/RunCMake/cmake_path/NATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/NATIVE_PATH-invalid-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/NATIVE_PATH-missing-output-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/NATIVE_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/NATIVE_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/NATIVE_PATH.cmake37
-rw-r--r--Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/NORMAL_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/NORMAL_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/NORMAL_PATH.cmake46
-rw-r--r--Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/PROXIMATE_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/PROXIMATE_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/PROXIMATE_PATH.cmake41
-rw-r--r--Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/RELATIVE_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/RELATIVE_PATH-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/RELATIVE_PATH.cmake76
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_EXTENSION-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_EXTENSION-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_EXTENSION.cmake52
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_FILENAME-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_FILENAME-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REMOVE_FILENAME.cmake25
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_EXTENSION-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_EXTENSION-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_EXTENSION.cmake58
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_FILENAME-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_FILENAME-wrong-path-result.txt1
-rw-r--r--Tests/RunCMake/cmake_path/REPLACE_FILENAME.cmake26
-rw-r--r--Tests/RunCMake/cmake_path/RunCMakeTest.cmake191
-rw-r--r--Tests/RunCMake/cmake_path/call-cmake_path.cmake19
-rw-r--r--Tests/RunCMake/cmake_path/check_errors.cmake12
-rw-r--r--Tests/RunCMake/cmake_path/invalid-output-var-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_path/missing-output-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_path/unexpected-arg-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_path/wrong-path-stderr.txt2
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt5
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake6
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt6
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake4
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt4
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake5
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt4
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake5
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt4
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake5
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake5
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-override.cmake6
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt1
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt6
-rw-r--r--Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake6
-rw-r--r--Tests/RunCMake/file-CHMOD/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake19
-rw-r--r--Tests/RunCMake/file/REAL_PATH-no-base-dir-result.txt1
-rw-r--r--Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt2
-rw-r--r--Tests/RunCMake/file/REAL_PATH-no-base-dir.cmake2
-rw-r--r--Tests/RunCMake/file/REAL_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/file/REAL_PATH-unexpected-arg-stderr.txt2
-rw-r--r--Tests/RunCMake/file/REAL_PATH-unexpected-arg.cmake2
-rw-r--r--Tests/RunCMake/file/REAL_PATH.cmake14
-rw-r--r--Tests/RunCMake/file/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake11
-rw-r--r--Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake4
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/install/obj1.ispc4
-rw-r--r--Tests/RunCMake/install/obj2.ispc4
-rw-r--r--Tests/RunCMake/try_compile/ISPCDuplicateTarget-stderr.txt1
-rw-r--r--Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake8
-rw-r--r--Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-stderr.txt1
-rw-r--r--Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake11
-rw-r--r--Tests/RunCMake/try_compile/ISPCInvalidTarget-stderr.txt1
-rw-r--r--Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake7
-rw-r--r--Tests/RunCMake/try_compile/ISPCTargets-stderr.txt1
-rw-r--r--Tests/RunCMake/try_compile/ISPCTargets-stdout.txt1
-rw-r--r--Tests/RunCMake/try_compile/ISPCTargets.cmake7
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/try_compile/src.ispc4
-rw-r--r--Tests/UseSWIG/CMakeLists.txt9
-rw-r--r--Tests/UseSWIG/MultipleFiles/CMakeLists.txt30
-rw-r--r--Tests/UseSWIG/MultipleFiles/add.cxx6
-rw-r--r--Tests/UseSWIG/MultipleFiles/add.h1
-rw-r--r--Tests/UseSWIG/MultipleFiles/add.i4
-rw-r--r--Tests/UseSWIG/MultipleFiles/sub.cxx6
-rw-r--r--Tests/UseSWIG/MultipleFiles/sub.h1
-rw-r--r--Tests/UseSWIG/MultipleFiles/sub.i5
-rw-r--r--Tests/XCTest/CMakeLists.txt4
-rw-r--r--Utilities/cm3p/Setup.Configuration.h5
-rw-r--r--Utilities/cm3p/archive.h5
-rw-r--r--Utilities/cm3p/archive_entry.h5
-rw-r--r--Utilities/cm3p/bzlib.h5
-rw-r--r--Utilities/cm3p/curl/curl.h5
-rw-r--r--Utilities/cm3p/expat.h5
-rw-r--r--Utilities/cm3p/json/reader.h5
-rw-r--r--Utilities/cm3p/json/value.h5
-rw-r--r--Utilities/cm3p/json/writer.h5
-rw-r--r--Utilities/cm3p/kwiml/abi.h5
-rw-r--r--Utilities/cm3p/kwiml/int.h5
-rw-r--r--Utilities/cm3p/lzma.h5
-rw-r--r--Utilities/cm3p/rhash.h5
-rw-r--r--Utilities/cm3p/uv.h5
-rw-r--r--Utilities/cm3p/zlib.h5
-rw-r--r--Utilities/cm3p/zstd.h5
-rw-r--r--Utilities/cmThirdParty.h.in5
-rw-r--r--Utilities/std/cm/algorithm5
-rw-r--r--Utilities/std/cm/bits/erase_if.hxx5
-rw-r--r--Utilities/std/cm/bits/fs_path.cxx2
-rw-r--r--Utilities/std/cm/deque5
-rw-r--r--Utilities/std/cm/filesystem9
-rw-r--r--Utilities/std/cm/iomanip5
-rw-r--r--Utilities/std/cm/iterator5
-rw-r--r--Utilities/std/cm/list5
-rw-r--r--Utilities/std/cm/map5
-rw-r--r--Utilities/std/cm/memory5
-rw-r--r--Utilities/std/cm/optional209
-rw-r--r--Utilities/std/cm/set5
-rw-r--r--Utilities/std/cm/shared_mutex5
-rw-r--r--Utilities/std/cm/string5
-rw-r--r--Utilities/std/cm/string_view4
-rw-r--r--Utilities/std/cm/type_traits5
-rw-r--r--Utilities/std/cm/unordered_map5
-rw-r--r--Utilities/std/cm/unordered_set5
-rw-r--r--Utilities/std/cm/utility5
-rw-r--r--Utilities/std/cm/vector5
-rw-r--r--Utilities/std/cmSTL.hxx.in5
-rw-r--r--Utilities/std/cmext/algorithm5
-rw-r--r--Utilities/std/cmext/iterator5
-rw-r--r--Utilities/std/cmext/memory5
-rw-r--r--Utilities/std/cmext/string_view5
-rw-r--r--Utilities/std/cmext/type_traits5
-rwxr-xr-xbootstrap6
1037 files changed, 10898 insertions, 3581 deletions
diff --git a/.gitlab/ci/configure_fedora31_common.cmake b/.gitlab/ci/configure_fedora31_common.cmake
index dc068d5..90b9d90 100644
--- a/.gitlab/ci/configure_fedora31_common.cmake
+++ b/.gitlab/ci/configure_fedora31_common.cmake
@@ -1,4 +1,5 @@
set(BUILD_CursesDialog ON CACHE BOOL "")
set(BUILD_QtDialog ON CACHE BOOL "")
+
include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake")
diff --git a/.gitlab/ci/configure_fedora31_makefiles.cmake b/.gitlab/ci/configure_fedora31_makefiles.cmake
index 20863a2..efb4b84 100644
--- a/.gitlab/ci/configure_fedora31_makefiles.cmake
+++ b/.gitlab/ci/configure_fedora31_makefiles.cmake
@@ -1 +1,2 @@
+set(CMake_TEST_ISPC "ON" CACHE STRING "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_fedora31_ninja.cmake b/.gitlab/ci/configure_fedora31_ninja.cmake
index 74768b7..dad6d45 100644
--- a/.gitlab/ci/configure_fedora31_ninja.cmake
+++ b/.gitlab/ci/configure_fedora31_ninja.cmake
@@ -1 +1,2 @@
+set(CMake_TEST_ISPC "ON" CACHE STRING "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora31_common.cmake")
diff --git a/.gitlab/ci/configure_fedora31_ninja_multi.cmake b/.gitlab/ci/configure_fedora31_ninja_multi.cmake
index 20863a2..efb4b84 100644
--- a/.gitlab/ci/configure_fedora31_ninja_multi.cmake
+++ b/.gitlab/ci/configure_fedora31_ninja_multi.cmake
@@ -1 +1,2 @@
+set(CMake_TEST_ISPC "ON" CACHE STRING "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/docker/fedora31/Dockerfile b/.gitlab/ci/docker/fedora31/Dockerfile
index 5588a85..4ad8d45 100644
--- a/.gitlab/ci/docker/fedora31/Dockerfile
+++ b/.gitlab/ci/docker/fedora31/Dockerfile
@@ -3,3 +3,6 @@ MAINTAINER Ben Boeckel <ben.boeckel@kitware.com>
COPY install_deps.sh /root/install_deps.sh
RUN sh /root/install_deps.sh
+
+COPY install_ispc.sh /root/install_ispc.sh
+RUN sh /root/install_ispc.sh
diff --git a/.gitlab/ci/docker/fedora31/install_ispc.sh b/.gitlab/ci/docker/fedora31/install_ispc.sh
new file mode 100755
index 0000000..fdc14b5
--- /dev/null
+++ b/.gitlab/ci/docker/fedora31/install_ispc.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+set -e
+
+readonly version="1.13.0"
+readonly sha256sum="8ab1189bd5db596b3eee9d9465d3528b6626a7250675d67102761bb0d284cd21"
+
+readonly filename="ispc-v$version-linux"
+readonly tarball="$filename.tar.gz"
+
+echo "$sha256sum $tarball" > ispc.sha256sum
+curl -OL "https://github.com/ispc/ispc/releases/download/v$version/$tarball"
+sha256sum --check ispc.sha256sum
+tar --strip-components=1 -C /usr/local -xf "$tarball" "$filename/bin/ispc"
diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml
index 9ad8fc7..dfd94f5 100644
--- a/.gitlab/os-linux.yml
+++ b/.gitlab/os-linux.yml
@@ -30,7 +30,7 @@
### Fedora
.fedora31:
- image: "kitware/cmake:ci-fedora31-x86_64-2020-06-01"
+ image: "kitware/cmake:ci-fedora31-x86_64-2020-08-18"
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
diff --git a/.gitlab/rules.yml b/.gitlab/rules.yml
index 88756eb..3bb8ae4 100644
--- a/.gitlab/rules.yml
+++ b/.gitlab/rules.yml
@@ -2,17 +2,17 @@
.run_manually:
rules:
+ - if: '$CI_MERGE_REQUEST_ID'
+ when: manual
- if: '$CI_PROJECT_PATH == "cmake/cmake"'
when: delayed
start_in: 5 minutes
- - if: '$CI_MERGE_REQUEST_ID'
- when: manual
- when: never
.run_automatically:
rules:
- - if: '$CI_PROJECT_PATH == "cmake/cmake"'
- when: on_success
- if: '$CI_MERGE_REQUEST_ID'
when: on_success
+ - if: '$CI_PROJECT_PATH == "cmake/cmake"'
+ when: on_success
- when: never
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim
index 2d63eb0..2dd3174 100644
--- a/Auxiliary/vim/syntax/cmake.vim
+++ b/Auxiliary/vim/syntax/cmake.vim
@@ -1048,6 +1048,7 @@ syn keyword cmakeVariable contained
\ CMAKE_HOST_UNIX
\ CMAKE_HOST_WIN32
\ CMAKE_IGNORE_PATH
+ \ CMAKE_ISPC_HEADER_DIRECTORY
\ CMAKE_IMPORT_LIBRARY_PREFIX
\ CMAKE_IMPORT_LIBRARY_SUFFIX
\ CMAKE_INCLUDE_CURRENT_DIR
diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst
index 9279748..231f9da 100644
--- a/Help/command/add_custom_command.rst
+++ b/Help/command/add_custom_command.rst
@@ -102,13 +102,22 @@ The options are:
a target later in the command line (i.e. as a command argument rather
than as the command to execute).
- Whenever a target is used as a command to execute or is mentioned in a
- generator expression as a command argument, a target-level dependency
- will be added automatically so that the mentioned target will be built
- before any target using this custom command. However this does NOT add
- a file-level dependency that would cause the custom command to re-run
- whenever the executable is recompiled. List target names with
- the ``DEPENDS`` option to add such file-level dependencies.
+ Whenever one of the following target based generator expressions are used as
+ a command to execute or is mentioned in a command argument, a target-level
+ dependency will be added automatically so that the mentioned target will be
+ built before any target using this custom command
+ (see policy :policy:`CMP0112`).
+
+ * ``TARGET_FILE``
+ * ``TARGET_LINKER_FILE``
+ * ``TARGET_SONAME_FILE``
+ * ``TARGET_PDB_FILE``
+
+ This target-level dependency does NOT add a file-level dependency that would
+ cause the custom command to re-run whenever the executable is recompiled.
+ List target names with the ``DEPENDS`` option to add such file-level
+ dependencies.
+
``COMMENT``
Display the given message before the commands are executed at
diff --git a/Help/command/add_custom_target.rst b/Help/command/add_custom_target.rst
index 56ab414..2eb0c88 100644
--- a/Help/command/add_custom_target.rst
+++ b/Help/command/add_custom_target.rst
@@ -81,10 +81,15 @@ The options are:
a target later in the command line (i.e. as a command argument rather
than as the command to execute).
- Whenever a target is used as a command to execute or is mentioned in a
- generator expression as a command argument, a target-level dependency
- will be added automatically so that the mentioned target will be built
- before this custom target.
+ Whenever one of the following target based generator expressions are used as
+ a command to execute or is mentioned in a command argument, a target-level
+ dependency will be added automatically so that the mentioned target will be
+ built before this custom target (see policy :policy:`CMP0112`).
+
+ * ``TARGET_FILE``
+ * ``TARGET_LINKER_FILE``
+ * ``TARGET_SONAME_FILE``
+ * ``TARGET_PDB_FILE``
The command and arguments are optional and if not specified an empty
target will be created.
diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst
index f3df631..b7dfabc 100644
--- a/Help/command/add_library.rst
+++ b/Help/command/add_library.rst
@@ -14,7 +14,7 @@ Normal Libraries
add_library(<name> [STATIC | SHARED | MODULE]
[EXCLUDE_FROM_ALL]
- [source1] [source2 ...])
+ [<source>...])
Adds a library target called ``<name>`` to be built from the source files
listed in the command invocation. (The source files can be omitted here
@@ -69,7 +69,7 @@ Object Libraries
.. code-block:: cmake
- add_library(<name> OBJECT <src>...)
+ add_library(<name> OBJECT [<source>...])
Creates an :ref:`Object Library <Object Libraries>`. An object library
compiles source files but does not archive or link their object files into a
diff --git a/Help/command/cmake_path.rst b/Help/command/cmake_path.rst
new file mode 100644
index 0000000..9248eae
--- /dev/null
+++ b/Help/command/cmake_path.rst
@@ -0,0 +1,641 @@
+cmake_path
+----------
+
+.. versionadded:: 3.19
+
+Filesystem path manipulation command.
+
+This command is dedicated to the manipulation of objects of type path which
+represent paths on a filesystem. Only syntactic aspects of paths are handled:
+the pathname may represent a non-existing path or even one that is not allowed
+to exist on the current file system or OS.
+
+For operations involving the filesystem, have a look at the :command:`file`
+command.
+
+The path name has the following syntax:
+
+1. ``root-name`` (optional): identifies the root on a filesystem with multiple
+ roots (such as ``"C:"`` or ``"//myserver"``).
+
+2. ``root-directory`` (optional): a directory separator that, if present, marks
+ this path as absolute. If it is missing (and the first element other than
+ the root name is a file name), then the path is relative.
+
+Zero or more of the following:
+
+3. ``file-name``: sequence of characters that aren't directory separators. This
+ name may identify a file, a hard link, a symbolic link, or a directory. Two
+ special file-names are recognized:
+
+ * ``dot``: the file name consisting of a single dot character ``.`` is a
+ directory name that refers to the current directory.
+
+ * ``dot-dot``: the file name consisting of two dot characters ``..`` is a
+ directory name that refers to the parent directory.
+
+4. ``directory-separator``: the forward slash character ``/``. If this
+ character is repeated, it is treated as a single directory separator:
+ ``/usr///////lib`` is the same as ``/usr/lib``.
+
+.. _EXTENSION_DEF:
+
+A ``file-name`` can have an extension. By default, the extension is defined as
+the sub-string beginning at the leftmost period (including the period) and
+until the end of the pathname. When the option ``LAST_ONLY`` is specified, the
+extension is the sub-string beginning at the rightmost period.
+
+.. note::
+
+ ``cmake_path`` command handles paths in the format of the build system, not
+ the target system. So this is not generally applicable to the target system
+ in cross-compiling environment.
+
+For all commands, ``<path>`` placeholder expect a variable name. An error will
+be raised if the variable does not exist, except for `APPEND`_ and
+`CMAKE_PATH`_ sub-commands. ``<input>`` placeholder expect a string literal.
+``[<input>...]`` placeholder expect zero or more arguments. ``<output>``
+placeholder expect a variable name.
+
+.. note::
+
+ ``cmake_path`` command does not support list of paths. The ``<path>``
+ placeholder must store only one path name.
+
+To initialize a path variable, three possibilities can be used:
+
+1. :command:`set` command.
+2. :ref:`cmake_path(APPEND) <APPEND>` command. Can be used to build a path from
+ already available path fragments.
+3. :ref:`cmake_path(CMAKE_PATH) <CMAKE_PATH>` command. Mainly used to build a
+ path variable from a native path.
+
+ .. code-block:: cmake
+
+ # To build the path "${CMAKE_CURRENT_SOURCE_DIR}/data"
+
+ set (path1 "${CMAKE_CURRENT_SOURCE_DIR}/data")
+
+ cmake_path(APPEND path2 "${CMAKE_CURRENT_SOURCE_DIR}" "data")
+
+ cmake_path(CMAKE_PATH path3 "${CMAKE_CURRENT_SOURCE_DIR}/data")
+
+`Modification`_ and `Generation`_ sub-commands store the result in-place or in
+the variable specified by ``OUTPUT_VARIABLE`` option. All other sub-commands,
+except `CMAKE_PATH`_, store the result in the required ``<output>`` variable.
+
+Sub-commands supporting ``NORMALIZE`` option will :ref:`normalize <NORMAL_PATH>`
+the path.
+
+Synopsis
+^^^^^^^^
+
+.. parsed-literal::
+
+ `Decomposition`_
+ cmake_path(`GET`_ <path> :ref:`ROOT_NAME <GET_ROOT_NAME>` <output>)
+ cmake_path(`GET`_ <path> :ref:`ROOT_DIRECTORY <GET_ROOT_DIRECTORY>` <output>)
+ cmake_path(`GET`_ <path> :ref:`ROOT_PATH <GET_ROOT_PATH>` <output>)
+ cmake_path(`GET`_ <path> :ref:`FILENAME <GET_FILENAME>` <output>)
+ cmake_path(`GET`_ <path> :ref:`EXTENSION <GET_EXTENSION>` [LAST_ONLY] <output>)
+ cmake_path(`GET`_ <path> :ref:`STEM <GET_STEM>` [LAST_ONLY] <output>)
+ cmake_path(`GET`_ <path> :ref:`RELATIVE_PATH <GET_RELATIVE_PATH>` <output>)
+ cmake_path(`GET`_ <path> :ref:`PARENT_PATH <GET_PARENT_PATH>` <output>)
+
+ `Modification`_
+ cmake_path(`APPEND`_ <path> [<input>...] [OUTPUT_VARIABLE <output>])
+ cmake_path(`CONCAT`_ <path> [<input>...] [OUTPUT_VARIABLE <output>])
+ cmake_path(`REMOVE_FILENAME`_ <path> [OUTPUT_VARIABLE <output>])
+ cmake_path(`REPLACE_FILENAME`_ <path> <input> [OUTPUT_VARIABLE <output>])
+ cmake_path(`REMOVE_EXTENSION`_ <path> [LAST_ONLY]
+ [OUTPUT_VARIABLE <output>])
+ cmake_path(`REPLACE_EXTENSION`_ <path> [LAST_ONLY] <input>
+ [OUTPUT_VARIABLE <output>])
+
+ `Generation`_
+ cmake_path(`NORMAL_PATH`_ <path> [OUTPUT_VARIABLE <output>])
+ cmake_path(`RELATIVE_PATH`_ <path> [BASE_DIRECTORY <path>]
+ [OUTPUT_VARIABLE <output>])
+ cmake_path(`PROXIMATE_PATH`_ <path> [BASE_DIRECTORY <path>]
+ [OUTPUT_VARIABLE <output>])
+ cmake_path(`ABSOLUTE_PATH`_ <path> [BASE_DIRECTORY <path>] [NORMALIZE]
+ [OUTPUT_VARIABLE <output>])
+
+ `Conversion`_
+ cmake_path(`CMAKE_PATH`_ <path> [NORMALIZE] <input>)
+ cmake_path(`NATIVE_PATH`_ <path> [NORMALIZE] <output>)
+ cmake_path(`CONVERT`_ <input> `TO_CMAKE_PATH_LIST`_ <output>)
+ cmake_path(`CONVERT`_ <input> `TO_NATIVE_PATH_LIST`_ <output>)
+
+ `Comparison`_
+ cmake_path(`COMPARE`_ <path> <OP> <input> <output>)
+
+ `Query`_
+ cmake_path(`HAS_ROOT_NAME`_ <path> <output>)
+ cmake_path(`HAS_ROOT_DIRECTORY`_ <path> <output>)
+ cmake_path(`HAS_ROOT_PATH`_ <path> <output>)
+ cmake_path(`HAS_FILENAME`_ <path> <output>)
+ cmake_path(`HAS_EXTENSION`_ <path> <output>)
+ cmake_path(`HAS_STEM`_ <path> <output>)
+ cmake_path(`HAS_RELATIVE_PATH`_ <path> <output>)
+ cmake_path(`HAS_PARENT_PATH`_ <path> <output>)
+ cmake_path(`IS_ABSOLUTE`_ <path> <output>)
+ cmake_path(`IS_RELATIVE`_ <path> <output>)
+ cmake_path(`IS_PREFIX`_ <path> <input> [NORMALIZE] <output>)
+
+ `Hashing`_
+ cmake_path(`HASH`_ <path> [NORMALIZE] <output>)
+
+Decomposition
+^^^^^^^^^^^^^
+
+.. _GET:
+.. _GET_ROOT_NAME:
+
+.. code-block:: cmake
+
+ cmake_path(GET <path> ROOT_NAME <output>)
+
+Returns the root name of the path. If the path does not include a root name,
+returns an empty path.
+
+.. _GET_ROOT_DIRECTORY:
+
+.. code-block:: cmake
+
+ cmake_path(GET <path> ROOT_DIRECTORY <output>)
+
+Returns the root directory of the path. If the path does not include a root
+directory, returns an empty path.
+
+.. _GET_ROOT_PATH:
+
+.. code-block:: cmake
+
+ cmake_path(GET <path> ROOT_PATH <output>)
+
+Returns the root path of the path. If the path does not include a root path,
+returns an empty path.
+
+Effectively, returns the following: ``root-name / root-directory``.
+
+.. _GET_FILENAME:
+
+.. code-block:: cmake
+
+ cmake_path(GET <path> FILENAME <output>)
+
+Returns the filename component of the path. If the path ends with a
+``directory-separator``, there is no filename, so returns an empty path.
+
+.. _GET_EXTENSION:
+
+.. code-block:: cmake
+
+ cmake_path(GET <path> EXTENSION [LAST_ONLY] <output>)
+
+Returns the :ref:`extension <EXTENSION_DEF>` of the filename component.
+
+If the ``FILENAME`` component of the path contains a period (``.``), and is not
+one of the special filesystem elements ``dot`` or ``dot-dot``, then the
+:ref:`extension <EXTENSION_DEF>` is returned.
+
+ .. code-block:: cmake
+
+ set (path "name.ext1.ext2")
+ cmake_path (GET path EXTENSION result)
+ cmake_path (GET path EXTENSION LAST_ONLY result)
+
+First extension extraction will return ``.ex1.ext2``, while the second one will
+return only ``.ext2``.
+
+The following exceptions apply:
+
+ * If the first character in the filename is a period, that period is ignored
+ (a filename like ``".profile"`` is not treated as an extension).
+
+ * If the pathname is either ``.`` or ``..``, or if ``FILENAME`` component
+ does not contain the ``.`` character, then an empty path is returned.
+
+.. _GET_STEM:
+
+.. code-block:: cmake
+
+ cmake_path(GET <path> STEM [LAST_ONLY] <output>)
+
+Returns the ``FILENAME`` component of the path stripped of its
+:ref:`extension <EXTENSION_DEF>`.
+
+ .. code-block:: cmake
+
+ set (path "name.ext1.ext2")
+ cmake_path (GET path STEM result)
+ cmake_path (GET path STEM LAST_ONLY result)
+
+First stem extraction will return only ``name``, while the second one will
+return ``name.ext1``.
+
+The following exceptions apply:
+
+ * If the first character in the filename is a period, that period is ignored
+ (a filename like ``".profile"`` is not treated as an extension).
+
+ * If the filename is one of the special filesystem components ``dot`` or
+ ``dot-dot``, or if it has no periods, the function returns the entire
+ ``FILENAME`` component.
+
+.. _GET_RELATIVE_PATH:
+
+.. code-block:: cmake
+
+ cmake_path(GET <path> RELATIVE_PATH <output>)
+
+Returns path relative to ``root-path``, that is, a pathname composed of
+every component of ``<path>`` after ``root-path``. If ``<path>`` is an empty
+path, returns an empty path.
+
+.. _GET_PARENT_PATH:
+
+.. code-block:: cmake
+
+ cmake_path(GET <path> PARENT_PATH <output>)
+
+Returns the path to the parent directory.
+
+If `HAS_RELATIVE_PATH`_ sub-command returns false, the result is a copy of
+``<path>``. Otherwise, the result is ``<path>`` with one fewer element.
+
+Modification
+^^^^^^^^^^^^
+
+.. _APPEND:
+
+.. code-block:: cmake
+
+ cmake_path(APPEND <path> [<input>...] [OUTPUT_VARIABLE <output>])
+
+Append all the ``<input>`` arguments to the ``<path>`` using ``/`` as
+``directory-separator``.
+
+For each ``<input>`` argument, the following algorithm (pseudo-code) applies:
+
+ .. code-block:: cmake
+
+ IF (<input>.is_absolute() OR
+ (<input>.has_root_name() AND
+ NOT <input>.root_name() STREQUAL <path>.root_name()))
+ replaces <path> with <input>
+ RETURN()
+ ENDIF()
+
+ IF (<input>.has_root_directory())
+ remove any root-directory and the entire relative path from <path>
+ ELSEIF (<path>.has_filename() OR
+ (NOT <path>.has_root_directory() OR <path>.is_absolute()))
+ appends directory-separator to <path>
+ ENDIF()
+
+ appends <input> omitting any root-name to <path>
+
+.. _CONCAT:
+
+.. code-block:: cmake
+
+ cmake_path(CONCAT <path> [<input>...] [OUTPUT_VARIABLE <output>])
+
+Concatenates all the ``<input>`` arguments to the ``<path>`` without
+``directory-separator``.
+
+.. _REMOVE_FILENAME:
+
+.. code-block:: cmake
+
+ cmake_path(REMOVE_FILENAME <path> [OUTPUT_VARIABLE <output>])
+
+Removes a single filename component (as returned by
+:ref:`GET ... FILENAME <GET_FILENAME>`) from ``<path>``.
+
+After this function returns, if change is done in-place, `HAS_FILENAME`_
+returns false for ``<path>``.
+
+.. _REPLACE_FILENAME:
+
+.. code-block:: cmake
+
+ cmake_path(REPLACE_FILENAME <path> <input> [OUTPUT_VARIABLE <output>])
+
+Replaces a single filename component from ``<path>`` with ``<input>``.
+
+Equivalent to the following:
+
+ .. code-block:: cmake
+
+ cmake_path(REMOVE_FILENAME path)
+ cmake_path(APPEND path "replacement");
+
+If ``<path>`` has no filename component (`HAS_FILENAME`_ returns false), the
+path is unchanged.
+
+.. _REMOVE_EXTENSION:
+
+.. code-block:: cmake
+
+ cmake_path(REMOVE_EXTENSION <path> [LAST_ONLY] [OUTPUT_VARIABLE <output>])
+
+Removes the :ref:`extension <EXTENSION_DEF>`, if any, from ``<path>``.
+
+.. _REPLACE_EXTENSION:
+
+.. code-block:: cmake
+
+ cmake_path(REPLACE_EXTENSION <path> [LAST_ONLY] <input>
+ [OUTPUT_VARIABLE <output>])
+
+Replaces the :ref:`extension <EXTENSION_DEF>` with ``<input>``.
+
+First, if ``<path>`` has an :ref:`extension <EXTENSION_DEF>` (`HAS_EXTENSION`_
+is true), it is removed. Then, a ``dot`` character is appended to ``<path>``,
+if ``<input>`` is not empty or does not begin with a ``dot`` character.
+
+Then ``<input>`` is appended as if `CONCAT`_ was used.
+
+Generation
+^^^^^^^^^^
+
+.. _NORMAL_PATH:
+
+.. code-block:: cmake
+
+ cmake_path(NORMAL_PATH <path> [OUTPUT_VARIABLE <output>])
+
+Normalize ``<path>``.
+
+A path can be normalized by following this algorithm:
+
+ 1. If the path is empty, stop (normal form of an empty path is an empty
+ path).
+ 2. Replace each ``directory-separator`` (which may consist of multiple
+ separators) with a single ``/``.
+ 3. Replace each ``directory-separator`` character in the ``root-name`` with
+ ``/``.
+ 4. Remove each ``dot`` and any immediately following ``directory-separator``.
+ 5. Remove each non-dot-dot filename immediately followed by a
+ ``directory-separator`` and a ``dot-dot``, along with any immediately
+ following ``directory-separator``.
+ 6. If there is ``root-directory``, remove all ``dot-dots`` and any
+ ``directory-separators`` immediately following them.
+ 7. If the last filename is ``dot-dot``, remove any trailing
+ ``directory-separator``.
+ 8. If the path is empty, add a ``dot`` (normal form of ``./`` is ``.``).
+
+.. _cmake_path-RELATIVE_PATH:
+.. _RELATIVE_PATH:
+
+.. code-block:: cmake
+
+ cmake_path(RELATIVE_PATH <path> [BASE_DIRECTORY <path>]
+ [OUTPUT_VARIABLE <output>])
+
+Returns ``<path>`` made relative to ``BASE_DIRECTORY`` argument. If
+``BASE_DIRECTORY`` is not specified, the default base directory will be
+:variable:`CMAKE_CURRENT_SOURCE_DIR`.
+
+For reference, the algorithm used to compute the relative path is described
+`here <https://en.cppreference.com/w/cpp/filesystem/path/lexically_normal>`_.
+
+.. _PROXIMATE_PATH:
+
+.. code-block:: cmake
+
+ cmake_path(PROXIMATE_PATH <path> [BASE_DIRECTORY <path>]
+ [OUTPUT_VARIABLE <output>])
+
+If the value of `RELATIVE_PATH`_ is not an empty path, return
+it. Otherwise return ``<path>``.
+
+If ``BASE_DIRECTORY`` is not specified, the default base directory will be
+:variable:`CMAKE_CURRENT_SOURCE_DIR`.
+
+.. _ABSOLUTE_PATH:
+
+.. code-block:: cmake
+
+ cmake_path(ABSOLUTE_PATH <path> [BASE_DIRECTORY <path>] [NORMALIZE]
+ [OUTPUT_VARIABLE <output>])
+
+If ``<path>`` is a relative path, it is evaluated relative to the given base
+directory specified by ``BASE_DIRECTORY`` option. If no base directory is
+provided, the default base directory will be
+:variable:`CMAKE_CURRENT_SOURCE_DIR`.
+
+When ``NORMALIZE`` option is specified, the path is :ref:`normalized
+<NORMAL_PATH>` after the path computation.
+
+Because ``cmake_path`` does not access to the filesystem, symbolic links are
+not resolved. To compute a real path, use :command:`get_filename_component`
+command with ``REALPATH`` sub-command.
+
+Conversion
+^^^^^^^^^^
+
+.. _cmake_path-CMAKE_PATH:
+.. _CMAKE_PATH:
+
+.. code-block:: cmake
+
+ cmake_path(CMAKE_PATH <path> [NORMALIZE] <input>)
+
+Converts a native ``<input>`` path into cmake-style path with forward-slashes
+(``/``). On Windows, the long filename marker is taken into account.
+
+When ``NORMALIZE`` option is specified, the path is :ref:`normalized
+<NORMAL_PATH>` before the conversion.
+
+.. _cmake_path-NATIVE_PATH:
+.. _NATIVE_PATH:
+
+.. code-block:: cmake
+
+ cmake_path(NATIVE_PATH <path> [NORMALIZE] <output>)
+
+Converts a cmake-style ``<path>`` into a native
+path with platform-specific slashes (``\`` on Windows and ``/`` elsewhere).
+
+When ``NORMALIZE`` option is specified, the path is :ref:`normalized
+<NORMAL_PATH>` before the conversion.
+
+.. _CONVERT:
+.. _cmake_path-TO_CMAKE_PATH_LIST:
+.. _TO_CMAKE_PATH_LIST:
+
+.. code-block:: cmake
+
+ cmake_path(CONVERT <input> TO_CMAKE_PATH_LIST <output> [NORMALIZE])
+
+Converts a native ``<input>`` path into cmake-style path with forward-slashes
+(``/``). On Windows, the long filename marker is taken into account. The input can
+be a single path or a system search path like ``$ENV{PATH}``. A search path
+will be converted to a cmake-style list separated by ``;`` characters. The
+result of the conversion is stored in the ``<output>`` variable.
+
+When ``NORMALIZE`` option is specified, the path is :ref:`normalized
+<NORMAL_PATH>` before the conversion.
+
+.. _cmake_path-TO_NATIVE_PATH_LIST:
+.. _TO_NATIVE_PATH_LIST:
+
+.. code-block:: cmake
+
+ cmake_path(CONVERT <input> TO_NATIVE_PATH_LIST <output> [NORMALIZE])
+
+Converts a cmake-style ``<input>`` path into a native path with
+platform-specific slashes (``\`` on Windows and ``/`` elsewhere). The input can
+be a single path or a cmake-style list. A list will be converted into a native
+search path. The result of the conversion is stored in the ``<output>``
+variable.
+
+When ``NORMALIZE`` option is specified, the path is :ref:`normalized
+<NORMAL_PATH>` before the conversion.
+
+Comparison
+^^^^^^^^^^
+
+.. _COMPARE:
+
+.. code-block:: cmake
+
+ cmake_path(COMPARE <path> EQUAL <input> <output>)
+ cmake_path(COMPARE <path> NOT_EQUAL <input> <output>)
+
+Compares the lexical representations of the path and another path.
+
+For testing equality, the following algorithm (pseudo-code) apply:
+
+ .. code-block:: cmake
+
+ IF (NOT <path>.root_name() STREQUAL <input>.root_name())
+ returns FALSE
+ ELSEIF (<path>.has_root_directory() XOR <input>.has_root_directory())
+ returns FALSE
+ ENDIF()
+
+ returns TRUE or FALSE if the relative portion of <path> is
+ lexicographically equal or not to the relative portion of <input>.
+ Comparison is performed path component-wise
+
+Query
+^^^^^
+
+.. _HAS_ROOT_NAME:
+
+.. code-block:: cmake
+
+ cmake_path(HAS_ROOT_NAME <path> <output>)
+
+Checks if ``<path>`` has ``root-name``.
+
+.. _HAS_ROOT_DIRECTORY:
+
+.. code-block:: cmake
+
+ cmake_path(HAS_ROOT_DIRECTORY <path> <output>)
+
+Checks if ``<path>`` has ``root-directory``.
+
+.. _HAS_ROOT_PATH:
+
+.. code-block:: cmake
+
+ cmake_path(HAS_ROOT_PATH <path> <output>)
+
+Checks if ``<path>`` has root path.
+
+Effectively, checks the following: ``root-name / root-directory``.
+
+.. _HAS_FILENAME:
+
+.. code-block:: cmake
+
+ cmake_path(HAS_FILENAME <path> <output>)
+
+Checks if ``<path>`` has ``file-name``.
+
+.. _HAS_EXTENSION:
+
+.. code-block:: cmake
+
+ cmake_path(HAS_EXTENSION <path> <output>)
+
+Checks if ``<path>`` has an :ref:`<extension <EXTENSION_DEF>`. If the first
+character in the filename is a period, it is not treated as an extension (for
+example ".profile").
+
+.. _HAS_STEM:
+
+.. code-block:: cmake
+
+ cmake_path(HAS_STEM <path> <output>)
+
+Checks if ``<path>`` has stem.
+
+.. _HAS_RELATIVE_PATH:
+
+.. code-block:: cmake
+
+ cmake_path(HAS_RELATIVE_PATH <path> <output>)
+
+Checks if ``<path>`` has relative path.
+
+.. _HAS_PARENT_PATH:
+
+.. code-block:: cmake
+
+ cmake_path(HAS_PARENT_PATH <path> <output>)
+
+Checks if ``<path>`` has parent path.
+
+.. _IS_ABSOLUTE:
+
+.. code-block:: cmake
+
+ cmake_path(IS_ABSOLUTE <path> <output>)
+
+Checks if ``<path>`` is absolute.
+
+An absolute path is a path that unambiguously identifies the location of a file
+without reference to an additional starting location.
+
+.. _IS_RELATIVE:
+
+.. code-block:: cmake
+
+ cmake_path(IS_RELATIVE <path> <output>)
+
+Checks if path is relative.
+
+.. _IS_PREFIX:
+
+.. code-block:: cmake
+
+ cmake_path(IS_PREFIX <path> <input> [NORMALIZE] <output>)
+
+Checks if ``<path>`` is the prefix of ``<input>``.
+
+When ``NORMALIZE`` option is specified, the paths are :ref:`normalized
+<NORMAL_PATH>` before the check.
+
+Hashing
+^^^^^^^
+
+.. _HASH:
+
+.. code-block:: cmake
+
+ cmake_path(HASH <path> [NORMALIZE] <output>)
+
+Compute hash value of ``<path>`` such that if for two paths (``p1`` and ``p2``)
+are equal (:ref:`COMPARE ... EQUAL <COMPARE>`) then hash value of p1 is equal
+to hash value of p2.
+
+When ``NORMALIZE`` option is specified, the paths are :ref:`normalized
+<NORMAL_PATH>` before the check.
diff --git a/Help/command/enable_language.rst b/Help/command/enable_language.rst
index fdc44f2..e8640ea 100644
--- a/Help/command/enable_language.rst
+++ b/Help/command/enable_language.rst
@@ -9,7 +9,8 @@ Enable a language (CXX/C/OBJC/OBJCXX/Fortran/etc)
Enables support for the named language in CMake. This is
the same as the :command:`project` command but does not create any of the extra
variables that are created by the project command. Example languages
-are ``CXX``, ``C``, ``CUDA``, ``OBJC``, ``OBJCXX``, ``Fortran``, and ``ASM``.
+are ``CXX``, ``C``, ``CUDA``, ``OBJC``, ``OBJCXX``, ``Fortran``,
+``ISPC``, and ``ASM``.
If enabling ``ASM``, enable it last so that CMake can check whether
compilers for other languages like ``C`` work for assembly too.
diff --git a/Help/command/file.rst b/Help/command/file.rst
index 953172b..d77ad2d 100644
--- a/Help/command/file.rst
+++ b/Help/command/file.rst
@@ -3,6 +3,21 @@ file
File manipulation command.
+This command is dedicated to file and path manipulation requiring access to the
+filesystem.
+
+For other path manipulation, handling only syntactic aspects, have a look at
+:command:`cmake_path` command.
+
+.. note::
+
+ The sub-commands `RELATIVE_PATH`_, `TO_CMAKE_PATH`_ and `TO_NATIVE_PATH`_ has
+ been superseded, respectively, by sub-commands
+ :ref:`RELATIVE_PATH <cmake_path-RELATIVE_PATH>`,
+ :ref:`CONVERT ... TO_CMAKE_PATH_LIST <cmake_path-TO_CMAKE_PATH_LIST>` and
+ :ref:`CONVERT ... TO_NATIVE_PATH_LIST <cmake_path-TO_NATIVE_PATH_LIST>` of
+ :command:`cmake_path` command.
+
Synopsis
^^^^^^^^
@@ -30,8 +45,11 @@ Synopsis
file(`SIZE`_ <filename> <out-var>)
file(`READ_SYMLINK`_ <linkname> <out-var>)
file(`CREATE_LINK`_ <original> <linkname> [...])
+ file(`CHMOD`_ <files>... <directories>... PERMISSIONS <permissions>... [...])
+ file(`CHMOD_RECURSE`_ <files>... <directories>... PERMISSIONS <permissions>... [...])
`Path Conversion`_
+ file(`REAL_PATH`_ <path> <out-var> [BASE_DIRECTORY <dir>])
file(`RELATIVE_PATH`_ <out-var> <directory> <file>)
file({`TO_CMAKE_PATH`_ | `TO_NATIVE_PATH`_} <path> <out-var>)
@@ -741,9 +759,67 @@ creating the link fails. It can be useful for handling situations such as
``<original>`` and ``<linkname>`` being on different drives or mount points,
which would make them unable to support a hard link.
+.. _CHMOD:
+
+.. code-block:: cmake
+
+ file(CHMOD <files>... <directories>... [PERMISSIONS <permissions>...]
+ [FILE_PERMISSIONS <permissions>...]
+ [DIRECTORY_PERMISSIONS <permissions>...])
+
+Set the permissions for the ``<files>...`` and ``<directories>...`` specified.
+Valid permissions are ``OWNER_READ``, ``OWNER_WRITE``, ``OWNER_EXECUTE``,
+``GROUP_READ``, ``GROUP_WRITE``, ``GROUP_EXECUTE``, ``WORLD_READ``,
+``WORLD_WRITE``, ``WORLD_EXECUTE``.
+
+Valid combination of keywords are:
+
+``PERMISSIONS``
+ all items are changed
+
+``FILE_PERMISSIONS``
+ only files are changed
+
+``DIRECTORY_PERMISSIONS``
+ only directories are changed
+
+``PERMISSIONS`` and ``FILE_PERMISSIONS``
+ ``FILE_PERMISSIONS`` overrides ``PERMISSIONS`` for files
+
+``PERMISSIONS`` and ``DIRECTORY_PERMISSIONS``
+ ``DIRECTORY_PERMISSIONS`` overrides ``PERMISSIONS`` for directories
+
+``FILE_PERMISSIONS`` and ``DIRECTORY_PERMISSIONS``
+ use ``FILE_PERMISSIONS`` for files and ``DIRECTORY_PERMISSIONS`` for
+ directories
+
+
+.. _CHMOD_RECURSE:
+
+.. code-block:: cmake
+
+ file(CHMOD_RECURSE <files>... <directories>... PERMISSIONS <permissions>...
+ FILE_PERMISSIONS <permissions>... DIRECTORY_PERMISSIONS <permissions>...)
+
+Same as `CHMOD`_, but change the permissions of files and directories present in
+the ``<directories>..`` recursively.
+
Path Conversion
^^^^^^^^^^^^^^^
+.. _REAL_PATH:
+
+.. code-block:: cmake
+
+ file(REAL_PATH <path> <out-var> [BASE_DIRECTORY <dir>])
+
+Compute the absolute path to an existing file or directory with symlinks
+resolved.
+
+If the provided ``<path>`` is a relative path, it is evaluated relative to the
+given base directory ``<dir>``. If no base directory is provided, the default
+base directory will be :variable:`CMAKE_CURRENT_SOURCE_DIR`.
+
.. _RELATIVE_PATH:
.. code-block:: cmake
diff --git a/Help/command/get_filename_component.rst b/Help/command/get_filename_component.rst
index 9bbf877..e8c68b2 100644
--- a/Help/command/get_filename_component.rst
+++ b/Help/command/get_filename_component.rst
@@ -44,6 +44,12 @@ Paths are returned with forward slashes and have no trailing slashes. If the
optional ``CACHE`` argument is specified, the result variable is added to the
cache.
+.. note::
+
+ All previous sub-commands has been superseded by
+ :command:`cmake_path` command, except ``REALPATH`` now offered by
+ :ref:`file(REAL_PATH) <REAL_PATH>` command.
+
.. code-block:: cmake
get_filename_component(<var> <FileName> PROGRAM [PROGRAM_ARGS <arg_var>] [CACHE])
diff --git a/Help/command/project.rst b/Help/command/project.rst
index b6093d3..c325050 100644
--- a/Help/command/project.rst
+++ b/Help/command/project.rst
@@ -88,7 +88,7 @@ The options are:
Selects which programming languages are needed to build the project.
Supported languages include ``C``, ``CXX`` (i.e. C++), ``CUDA``,
- ``OBJC`` (i.e. Objective-C), ``OBJCXX``, ``Fortran``, and ``ASM``.
+ ``OBJC`` (i.e. Objective-C), ``OBJCXX``, ``Fortran``, ``ISPC``, and ``ASM``.
By default ``C`` and ``CXX`` are enabled if no language options are given.
Specify language ``NONE``, or use the ``LANGUAGES`` keyword and list no languages,
to skip enabling any languages.
diff --git a/Help/dev/source.rst b/Help/dev/source.rst
index d93e55c..9be4451 100644
--- a/Help/dev/source.rst
+++ b/Help/dev/source.rst
@@ -158,6 +158,9 @@ These are:
* ``cm::is_unique_ptr``:
Checks if a type is a ``std::unique_ptr`` type.
+CMake assumes the compiler supports ``#pragma once``. Use this for all
+hand-written header files.
+
Dynamic Memory Management
=========================
diff --git a/Help/envvar/ISPC.rst b/Help/envvar/ISPC.rst
new file mode 100644
index 0000000..bcd6260
--- /dev/null
+++ b/Help/envvar/ISPC.rst
@@ -0,0 +1,13 @@
+ISPC
+-------
+
+.. versionadded:: 3.19
+
+.. include:: ENV_VAR.txt
+
+Preferred executable for compiling ``ISPC`` language files. Will only be used by
+CMake on the first configuration to determine ``ISPC`` compiler, after which the
+value for ``ISPC`` is stored in the cache as
+:variable:`CMAKE_ISPC_COMPILER <CMAKE_<LANG>_COMPILER>`. For any configuration
+run (including the first), the environment variable will be ignored if the
+:variable:`CMAKE_ISPC_COMPILER <CMAKE_<LANG>_COMPILER>` variable is defined.
diff --git a/Help/envvar/ISPCFLAGS.rst b/Help/envvar/ISPCFLAGS.rst
new file mode 100644
index 0000000..21df037
--- /dev/null
+++ b/Help/envvar/ISPCFLAGS.rst
@@ -0,0 +1,15 @@
+ISPCFLAGS
+---------
+
+.. versionadded:: 3.19
+
+.. include:: ENV_VAR.txt
+
+Default compilation flags to be used when compiling ``ISPC`` files. Will only be
+used by CMake on the first configuration to determine ``ISPC`` default
+compilation flags, after which the value for ``ISPCFLAGS`` is stored in the
+cache as :variable:`CMAKE_ISPC_FLAGS <CMAKE_<LANG>_FLAGS>`. For any configuration
+run (including the first), the environment variable will be ignored if
+the :variable:`CMAKE_ISPC_FLAGS <CMAKE_<LANG>_FLAGS>` variable is defined.
+
+See also :variable:`CMAKE_ISPC_FLAGS_INIT <CMAKE_<LANG>_FLAGS_INIT>`.
diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst
index 0aa4f75..036fa8f 100644
--- a/Help/manual/cmake-commands.7.rst
+++ b/Help/manual/cmake-commands.7.rst
@@ -20,6 +20,7 @@ These commands are always available.
/command/cmake_language
/command/cmake_minimum_required
/command/cmake_parse_arguments
+ /command/cmake_path
/command/cmake_policy
/command/configure_file
/command/continue
diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst
index ce1e360..13e0d39 100644
--- a/Help/manual/cmake-env-variables.7.rst
+++ b/Help/manual/cmake-env-variables.7.rst
@@ -63,6 +63,8 @@ Environment Variables for Languages
/envvar/CXXFLAGS
/envvar/FC
/envvar/FFLAGS
+ /envvar/ISPC
+ /envvar/ISPCFLAGS
/envvar/OBJC
/envvar/OBJCXX
/envvar/RC
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index c7f6b27..ff9d1bf 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -146,6 +146,11 @@ Variable Queries
``1`` if the CMake's compiler id of the Fortran compiler matches any one
of the entries in ``compiler_ids``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
+``$<ISPC_COMPILER_ID:compiler_ids>``
+ where ``compiler_ids`` is a comma-separated list.
+ ``1`` if the CMake's compiler id of the ISPC compiler matches any one
+ of the entries in ``compiler_ids``, otherwise ``0``.
+ See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
``$<C_COMPILER_VERSION:version>``
``1`` if the version of the C compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
@@ -164,6 +169,9 @@ Variable Queries
``$<Fortran_COMPILER_VERSION:version>``
``1`` if the version of the Fortran compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
+``$<ISPC_COMPILER_VERSION:version>``
+ ``1`` if the version of the ISPC compiler matches ``version``, otherwise ``0``.
+ See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
``$<TARGET_POLICY:policy>``
``1`` if the ``policy`` was NEW when the 'head' target was created,
else ``0``. If the ``policy`` was not set, the warning message for the policy
@@ -543,6 +551,9 @@ Variable Queries
``$<Fortran_COMPILER_ID>``
The CMake's compiler id of the Fortran compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
+``$<ISPC_COMPILER_ID>``
+ The CMake's compiler id of the ISPC compiler used.
+ See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
``$<C_COMPILER_VERSION>``
The version of the C compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
@@ -561,6 +572,9 @@ Variable Queries
``$<Fortran_COMPILER_VERSION>``
The version of the Fortran compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
+``$<ISPC_COMPILER_VERSION>``
+ The version of the ISPC compiler used.
+ See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
``$<COMPILE_LANGUAGE>``
The compile language of source files when evaluating compile options.
See :ref:`the related boolean expression
@@ -596,6 +610,9 @@ which is just the string ``tgt``.
``$<TARGET_NAME_IF_EXISTS:tgt>``
The target name ``tgt`` if the target exists, an empty string otherwise.
+
+ Note that ``tgt`` is not added as a dependency of the target this
+ expression is evaluated on.
``$<TARGET_FILE:tgt>``
Full path to the ``tgt`` binary file.
``$<TARGET_FILE_BASE_NAME:tgt>``
@@ -633,6 +650,9 @@ which is just the string ``tgt``.
The ``tgt`` filename.
``$<TARGET_FILE_DIR:tgt>``
Directory of the ``tgt`` binary file.
+
+ Note that ``tgt`` is not added as a dependency of the target this
+ expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_LINKER_FILE:tgt>``
File used when linking to the ``tgt`` target. This will usually
be the library that ``tgt`` represents (``.a``, ``.lib``, ``.so``),
@@ -674,14 +694,26 @@ which is just the string ``tgt``.
expression is evaluated on.
``$<TARGET_LINKER_FILE_NAME:tgt>``
Name of file used to link target ``tgt``.
+
+ Note that ``tgt`` is not added as a dependency of the target this
+ expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_LINKER_FILE_DIR:tgt>``
Directory of file used to link target ``tgt``.
+
+ Note that ``tgt`` is not added as a dependency of the target this
+ expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_SONAME_FILE:tgt>``
File with soname (``.so.3``) where ``tgt`` is the name of a target.
``$<TARGET_SONAME_FILE_NAME:tgt>``
Name of file with soname (``.so.3``).
+
+ Note that ``tgt`` is not added as a dependency of the target this
+ expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_SONAME_FILE_DIR:tgt>``
Directory of with soname (``.so.3``).
+
+ Note that ``tgt`` is not added as a dependency of the target this
+ expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_PDB_FILE:tgt>``
Full path to the linker generated program database file (.pdb)
where ``tgt`` is the name of a target.
@@ -707,17 +739,29 @@ which is just the string ``tgt``.
expression is evaluated on.
``$<TARGET_PDB_FILE_NAME:tgt>``
Name of the linker generated program database file (.pdb).
+
+ Note that ``tgt`` is not added as a dependency of the target this
+ expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_PDB_FILE_DIR:tgt>``
Directory of the linker generated program database file (.pdb).
+
+ Note that ``tgt`` is not added as a dependency of the target this
+ expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_BUNDLE_DIR:tgt>``
Full path to the bundle directory (``my.app``, ``my.framework``, or
``my.bundle``) where ``tgt`` is the name of a target.
+
+ Note that ``tgt`` is not added as a dependency of the target this
+ expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_BUNDLE_CONTENT_DIR:tgt>``
Full path to the bundle content directory where ``tgt`` is the name of a
target. For the macOS SDK it leads to ``my.app/Contents``, ``my.framework``,
or ``my.bundle/Contents``. For all other SDKs (e.g. iOS) it leads to
``my.app``, ``my.framework``, or ``my.bundle`` due to the flat bundle
structure.
+
+ Note that ``tgt`` is not added as a dependency of the target this
+ expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_PROPERTY:tgt,prop>``
Value of the property ``prop`` on the target ``tgt``.
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index ce8969b..3821dc3 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -57,6 +57,8 @@ Policies Introduced by CMake 3.19
.. toctree::
:maxdepth: 1
+ CMP0113: Makefile generators do not repeat custom commands from target dependencies. </policy/CMP0113>
+ CMP0112: Target file component generator expressions do not add target dependencies. </policy/CMP0112>
CMP0111: An imported target with a missing location fails during generation. </policy/CMP0111>
CMP0110: add_test() supports arbitrary characters in test names. </policy/CMP0110>
CMP0109: find_program() requires permission to execute but not to read. </policy/CMP0109>
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index b2e3995..cb9579e 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -258,6 +258,8 @@ Properties on Targets
/prop_tgt/INTERPROCEDURAL_OPTIMIZATION_CONFIG
/prop_tgt/INTERPROCEDURAL_OPTIMIZATION
/prop_tgt/IOS_INSTALL_COMBINED
+ /prop_tgt/ISPC_HEADER_DIRECTORY
+ /prop_tgt/ISPC_INSTRUCTION_SETS
/prop_tgt/JOB_POOL_COMPILE
/prop_tgt/JOB_POOL_LINK
/prop_tgt/JOB_POOL_PRECOMPILE_HEADER
@@ -396,6 +398,7 @@ Properties on Targets
/prop_tgt/XCODE_ATTRIBUTE_an-attribute
/prop_tgt/XCODE_EXPLICIT_FILE_TYPE
/prop_tgt/XCODE_GENERATE_SCHEME
+ /prop_tgt/XCODE_LINK_BUILD_PHASE_MODE
/prop_tgt/XCODE_PRODUCT_TYPE
/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER
/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index baf4a55..d50005c 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -247,6 +247,7 @@ Variables that Change Behavior
/variable/CMAKE_WARN_DEPRECATED
/variable/CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION
/variable/CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY
+ /variable/CMAKE_XCODE_LINK_BUILD_PHASE_MODE
/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER
/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN
/variable/CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING
@@ -511,6 +512,8 @@ Variables for Languages
/variable/CMAKE_Fortran_MODDIR_DEFAULT
/variable/CMAKE_Fortran_MODDIR_FLAG
/variable/CMAKE_Fortran_MODOUT_FLAG
+ /variable/CMAKE_ISPC_HEADER_DIRECTORY
+ /variable/CMAKE_ISPC_INSTRUCTION_SETS
/variable/CMAKE_LANG_ANDROID_TOOLCHAIN_MACHINE
/variable/CMAKE_LANG_ANDROID_TOOLCHAIN_PREFIX
/variable/CMAKE_LANG_ANDROID_TOOLCHAIN_SUFFIX
diff --git a/Help/policy/CMP0112.rst b/Help/policy/CMP0112.rst
new file mode 100644
index 0000000..3eab6d2
--- /dev/null
+++ b/Help/policy/CMP0112.rst
@@ -0,0 +1,39 @@
+CMP0112
+-------
+
+.. versionadded:: 3.19
+
+Target file component generator expressions do not add target dependencies.
+
+The following target-based generator expressions that query for directory or
+file name components no longer add a dependency on the evaluated target.
+
+ - ``TARGET_FILE_DIR``
+ - ``TARGET_LINKER_FILE_BASE_NAME``
+ - ``TARGET_LINKER_FILE_NAME``
+ - ``TARGET_LINKER_FILE_DIR``
+ - ``TARGET_SONAME_FILE_NAME``
+ - ``TARGET_SONAME_FILE_DIR``
+ - ``TARGET_PDB_FILE_NAME``
+ - ``TARGET_PDB_FILE_DIR``
+ - ``TARGET_BUNDLE_DIR``
+ - ``TARGET_BUNDLE_CONTENT_DIR``
+
+
+In CMake 3.18 and lower a dependency on the evaluated target of the above
+generator expressions would be always added. CMake 3.19 and above prefer
+to not add this dependency. This policy provides compatibility for projects
+that have not been updated to expect the new behavior.
+
+The ``OLD`` behavior for this policy is to add a dependency on the evaluated
+target for the the above generator expressions. The ``NEW`` behavior of
+this policy is to not add a dependency on the evaluated target for the the
+above generator expressions.
+
+This policy was introduced in CMake version 3.19. Unlike many policies,
+CMake version |release| does *not* warn by default when this policy
+is not set and simply uses ``OLD`` behavior. See documentation of the
+:variable:`CMAKE_POLICY_WARNING_CMP0112 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
+variable to control the warning.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0113.rst b/Help/policy/CMP0113.rst
new file mode 100644
index 0000000..6f56902
--- /dev/null
+++ b/Help/policy/CMP0113.rst
@@ -0,0 +1,43 @@
+CMP0113
+-------
+
+.. versionadded:: 3.19
+
+:ref:`Makefile Generators` do not repeat custom commands from target
+dependencies.
+
+Consider a chain of custom commands split across two dependent targets:
+
+.. code-block:: cmake
+
+ add_custom_command(OUTPUT output-not-created
+ COMMAND ... DEPENDS ...)
+ set_property(SOURCE output-not-created PROPERTY SYMBOLIC 1)
+ add_custom_command(OUTPUT output-created
+ COMMAND ... DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/output-not-created)
+ add_custom_target(first DEPENDS output-not-created)
+ add_custom_target(second DEPENDS output-created)
+ add_dependencies(second first)
+
+In CMake 3.18 and lower, the Makefile generators put a copy of both custom
+commands in the Makefile for target ``second`` even though its dependency on
+target ``first`` ensures that the first custom command runs before the second.
+Running ``make second`` would cause the first custom command to run once in
+the ``first`` target and then again in the ``second`` target.
+
+CMake 3.19 and above prefer to not duplicate custom commands in a target that
+are already generated in other targets on which the target depends (directly or
+indirectly). This policy provides compatibility for projects that have not
+been updated to expect the new behavior. In particular, projects that relied
+on the duplicate execution or that did not properly set the :prop_sf:`SYMBOLIC`
+source file property may be affected.
+
+The ``OLD`` behavior for this policy is to duplicate custom commands in
+dependent targets. The ``NEW`` behavior of this policy is to not duplicate
+custom commands in dependent targets.
+
+This policy was introduced in CMake version 3.19. Unlike many policies,
+CMake version |release| does *not* warn when this policy is not set and
+simply uses ``OLD`` behavior.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/prop_sf/LANGUAGE.rst b/Help/prop_sf/LANGUAGE.rst
index 88d438e..1dd2554 100644
--- a/Help/prop_sf/LANGUAGE.rst
+++ b/Help/prop_sf/LANGUAGE.rst
@@ -6,6 +6,6 @@ What programming language is the file.
A property that can be set to indicate what programming language the
source file is. If it is not set the language is determined based on
the file extension. Typical values are ``CXX`` (i.e. C++), ``C``,
-``CSharp``, ``CUDA``, ``Fortran``, and ``ASM``. Setting this
+``CSharp``, ``CUDA``, ``Fortran``, ``ISPC``, and ``ASM``. Setting this
property for a file means this file will be compiled. Do not set this
for headers or files that should not be compiled.
diff --git a/Help/prop_tgt/ISPC_HEADER_DIRECTORY.rst b/Help/prop_tgt/ISPC_HEADER_DIRECTORY.rst
new file mode 100644
index 0000000..2a3a8bc
--- /dev/null
+++ b/Help/prop_tgt/ISPC_HEADER_DIRECTORY.rst
@@ -0,0 +1,13 @@
+ISPC_HEADER_DIRECTORY
+---------------------
+
+.. versionadded:: 3.19
+
+Specify relative output directory for ISPC headers provided by the target.
+
+If the target contains ISPC source files, this specifies the directory in which
+the generated headers will be placed. Relative paths are treated with respect to
+the value of :variable:`CMAKE_CURRENT_BINARY_DIR`. When this property is not set, the
+headers will be placed a generator defined build directory. If the variable
+:variable:`CMAKE_ISPC_HEADER_DIRECTORY` is set when a target is created
+its value is used to initialize this property.
diff --git a/Help/prop_tgt/ISPC_INSTRUCTION_SETS.rst b/Help/prop_tgt/ISPC_INSTRUCTION_SETS.rst
new file mode 100644
index 0000000..cad116f
--- /dev/null
+++ b/Help/prop_tgt/ISPC_INSTRUCTION_SETS.rst
@@ -0,0 +1,21 @@
+ISPC_INSTRUCTION_SETS
+---------------------
+
+.. versionadded:: 3.19
+
+List of instruction set architectures to generate code for.
+
+This property is initialized by the value of the :variable:`CMAKE_ISPC_INSTRUCTION_SETS`
+variable if it is set when a target is created.
+
+The ``ISPC_INSTRUCTION_SETS`` target property must be used when generating for multiple
+instruction sets so that CMake can track what object files will be generated.
+
+Examples
+^^^^^^^^
+
+.. code-block:: cmake
+
+ set_property(TARGET tgt PROPERTY ISPC_INSTRUCTION_SETS avx2-i32x4 avx512skx-i32x835)
+
+Generates code for avx2 and avx512skx target architectures.
diff --git a/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst b/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst
index 77ae1f6..16be3cd 100644
--- a/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst
+++ b/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst
@@ -4,7 +4,7 @@
.. versionadded:: 3.4
This property is implemented only when ``<LANG>`` is ``C``, ``CXX``,
-``Fortran``, ``OBJC``, ``OBJCXX``, or ``CUDA``.
+``Fortran``, ``ISPC``, ``OBJC``, ``OBJCXX``, or ``CUDA``.
Specify a :ref:`semicolon-separated list <CMake Language Lists>` containing a command line
for a compiler launching tool. The :ref:`Makefile Generators` and the
diff --git a/Help/prop_tgt/XCODE_LINK_BUILD_PHASE_MODE.rst b/Help/prop_tgt/XCODE_LINK_BUILD_PHASE_MODE.rst
new file mode 100644
index 0000000..10cdedc
--- /dev/null
+++ b/Help/prop_tgt/XCODE_LINK_BUILD_PHASE_MODE.rst
@@ -0,0 +1,52 @@
+XCODE_LINK_BUILD_PHASE_MODE
+---------------------------
+
+When using the :generator:`Xcode` generator, libraries to be linked will be
+specified in the Xcode project file using either the "Link Binary With
+Libraries" build phase or directly as linker flags. The former allows Xcode
+to manage build paths, which may be necessary when creating Xcode archives
+because it may use different build paths to a regular build.
+
+This property controls usage of "Link Binary With Libraries" build phase for
+a target that is an app bundle, executable, shared library, shared framework
+or a module library.
+
+Possible values are:
+
+* ``NONE``
+ The libraries will be linked by specifying the linker flags directly.
+
+* ``BUILT_ONLY``
+ The "Link Binary With Libraries" build phase will be used to link to another
+ target under the following conditions:
+
+ - The target to be linked to is a regular non-imported, non-interface library
+ target.
+ - The output directory of the target being built has not been changed from
+ its default (see :prop_tgt:`RUNTIME_OUTPUT_DIRECTORY` and
+ :prop_tgt:`LIBRARY_OUTPUT_DIRECTORY`).
+
+* ``KNOWN_LOCATION``
+ The "Link Binary With Libraries" build phase will be used to link to another
+ target under the same conditions as with ``BUILT_ONLY`` and also:
+ - Imported library targets except those of type ``UNKNOWN``.
+ - Any non-target library specified directly with a path.
+
+For all other cases, the libraries will be linked by specifying the linker
+flags directly.
+
+.. warning::
+ Libraries linked using "Link Binary With Libraries" are linked after the
+ ones linked through regular linker flags. This order should be taken into
+ account when different static libraries contain symbols with the same name,
+ as the former ones will take precedence over the latter.
+
+.. warning::
+ If two or more directories contain libraries with identical file names and
+ some libraries are linked from those directories, the library search path
+ lookup will end up linking libraries from the first directory. This is a
+ known limitation of Xcode.
+
+This property is initialized by the value of the
+:variable:`CMAKE_XCODE_LINK_BUILD_PHASE_MODE` variable if it is set when a
+target is created.
diff --git a/Help/release/dev/cmake_path-command.rst b/Help/release/dev/cmake_path-command.rst
new file mode 100644
index 0000000..f4d9f27
--- /dev/null
+++ b/Help/release/dev/cmake_path-command.rst
@@ -0,0 +1,5 @@
+cmake_path-command
+------------------
+
+* The :command:`cmake_path` command was added for operations on
+ filesystem paths.
diff --git a/Help/release/dev/cuda-fail-fast.rst b/Help/release/dev/cuda-fail-fast.rst
new file mode 100644
index 0000000..d857eb2
--- /dev/null
+++ b/Help/release/dev/cuda-fail-fast.rst
@@ -0,0 +1,6 @@
+cuda-fail-fast
+--------------
+
+* If ``CUDA`` compiler detection fails with user-specified
+ :variable:`CMAKE_CUDA_ARCHITECTURES` or :variable:`CMAKE_CUDA_HOST_COMPILER`
+ an error is raised.
diff --git a/Help/release/dev/custom-command-dedup.rst b/Help/release/dev/custom-command-dedup.rst
new file mode 100644
index 0000000..65fa303
--- /dev/null
+++ b/Help/release/dev/custom-command-dedup.rst
@@ -0,0 +1,5 @@
+custom-command-dedup
+--------------------
+
+* :ref:`Makefile Generators` no longer repeat custom commands from target
+ dependencies. See policy :policy:`CMP0113`.
diff --git a/Help/release/dev/file-CHMOD.rst b/Help/release/dev/file-CHMOD.rst
new file mode 100644
index 0000000..994b529
--- /dev/null
+++ b/Help/release/dev/file-CHMOD.rst
@@ -0,0 +1,5 @@
+file-CHMOD
+----------
+
+* Add :command:`file(CHMOD)` and :command:`file(CHMOD_RECURSE)` to
+ set permissions of files and directories.
diff --git a/Help/release/dev/file-REAL_PATH.rst b/Help/release/dev/file-REAL_PATH.rst
new file mode 100644
index 0000000..32768ca
--- /dev/null
+++ b/Help/release/dev/file-REAL_PATH.rst
@@ -0,0 +1,5 @@
+file-REAL_PATH
+--------------
+
+* The :command:`file` gained sub-command `REAL_PATH` to compute a path with
+ symlinks resolved.
diff --git a/Help/release/dev/ispc-language-support.rst b/Help/release/dev/ispc-language-support.rst
new file mode 100644
index 0000000..254442e
--- /dev/null
+++ b/Help/release/dev/ispc-language-support.rst
@@ -0,0 +1,11 @@
+cmake-ispc-support
+------------------
+
+
+* CMake learned to support ``ISPC`` as a first-class language that can be
+ enabled via the :command:`project` and :command:`enable_language` commands.
+
+* ``ISPC`` is currently supported by the :ref:`Makefile Generators`
+ and the :generator:`Ninja` generator on Linux, macOS, and Windows.
+
+* The Intel ISPC compiler (``ispc``) is supported.
diff --git a/Help/release/dev/relax-target-generator-expression-dependency-addition.rst b/Help/release/dev/relax-target-generator-expression-dependency-addition.rst
new file mode 100644
index 0000000..6d30596
--- /dev/null
+++ b/Help/release/dev/relax-target-generator-expression-dependency-addition.rst
@@ -0,0 +1,17 @@
+relax-target-generator-expression-dependency-addition
+-----------------------------------------------------
+
+* The following target-based generator expressions that query for directory or
+ file name components no longer add a dependency on the evaluated target.
+ See policy :policy:`CMP0112`.
+
+ - ``TARGET_FILE_DIR``
+ - ``TARGET_LINKER_FILE_BASE_NAME``
+ - ``TARGET_LINKER_FILE_NAME``
+ - ``TARGET_LINKER_FILE_DIR``
+ - ``TARGET_SONAME_FILE_NAME``
+ - ``TARGET_SONAME_FILE_DIR``
+ - ``TARGET_PDB_FILE_NAME``
+ - ``TARGET_PDB_FILE_DIR``
+ - ``TARGET_BUNDLE_DIR``
+ - ``TARGET_BUNDLE_CONTENT_DIR``
diff --git a/Help/release/dev/xcode-link-phase-all.rst b/Help/release/dev/xcode-link-phase-all.rst
new file mode 100644
index 0000000..a38f70c
--- /dev/null
+++ b/Help/release/dev/xcode-link-phase-all.rst
@@ -0,0 +1,9 @@
+xcode-link-phase-all
+--------------------
+
+* The Xcode generator gained support for linking libraries and frameworks
+ via the *Link Binaries With Libraries* build phase instead of always by
+ embedding linker flags directly. This behavior is controlled by a new
+ :prop_tgt:`XCODE_LINK_BUILD_PHASE_MODE` target property, which is
+ initialized by a new :variable:`CMAKE_XCODE_LINK_BUILD_PHASE_MODE`
+ variable.
diff --git a/Help/variable/CMAKE_ISPC_HEADER_DIRECTORY.rst b/Help/variable/CMAKE_ISPC_HEADER_DIRECTORY.rst
new file mode 100644
index 0000000..a7c9cf6
--- /dev/null
+++ b/Help/variable/CMAKE_ISPC_HEADER_DIRECTORY.rst
@@ -0,0 +1,10 @@
+CMAKE_ISPC_HEADER_DIRECTORY
+----------------------------
+
+.. versionadded:: 3.19
+
+ISPC generated header output directory.
+
+This variable is used to initialize the :prop_tgt:`ISPC_HEADER_DIRECTORY`
+property on all the targets. See the target property for additional
+information.
diff --git a/Help/variable/CMAKE_ISPC_INSTRUCTION_SETS.rst b/Help/variable/CMAKE_ISPC_INSTRUCTION_SETS.rst
new file mode 100644
index 0000000..8a6005e
--- /dev/null
+++ b/Help/variable/CMAKE_ISPC_INSTRUCTION_SETS.rst
@@ -0,0 +1,9 @@
+CMAKE_ISPC_INSTRUCTION_SETS
+---------------------------
+
+.. versionadded:: 3.19
+
+Default value for :prop_tgt:`ISPC_INSTRUCTION_SETS` property of targets.
+
+This variable is used to initialize the :prop_tgt:`ISPC_INSTRUCTION_SETS` property
+on all targets. See the target property for additional information.
diff --git a/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst b/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst
index 98634c2..89fd7bc 100644
--- a/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst
+++ b/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst
@@ -6,7 +6,7 @@ CMAKE_<LANG>_COMPILER_LAUNCHER
Default value for :prop_tgt:`<LANG>_COMPILER_LAUNCHER` target property.
This variable is used to initialize the property on each target as it is
created. This is done only when ``<LANG>`` is ``C``, ``CXX``, ``Fortran``,
-``OBJC``, ``OBJCXX``, or ``CUDA``.
+``ISPC``, ``OBJC``, ``OBJCXX``, or ``CUDA``.
This variable is initialized to the :envvar:`CMAKE_<LANG>_COMPILER_LAUNCHER`
environment variable if it is set.
diff --git a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
index de71d0e..d35595a 100644
--- a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
+++ b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst
@@ -25,6 +25,8 @@ warn by default:
policy :policy:`CMP0089`.
* ``CMAKE_POLICY_WARNING_CMP0102`` controls the warning for
policy :policy:`CMP0102`.
+* ``CMAKE_POLICY_WARNING_CMP0112`` controls the warning for
+ policy :policy:`CMP0112`.
This variable should not be set by a project in CMake code. Project
developers running CMake may set this variable in their cache to
diff --git a/Help/variable/CMAKE_XCODE_LINK_BUILD_PHASE_MODE.rst b/Help/variable/CMAKE_XCODE_LINK_BUILD_PHASE_MODE.rst
new file mode 100644
index 0000000..ee4d37e
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_LINK_BUILD_PHASE_MODE.rst
@@ -0,0 +1,7 @@
+CMAKE_XCODE_LINK_BUILD_PHASE_MODE
+---------------------------------
+
+This variable is used to initialize the
+:prop_tgt:`XCODE_LINK_BUILD_PHASE_MODE` property on targets.
+It affects the methods that the :generator:`Xcode` generator uses to link
+different kinds of libraries. Its default value is ``NONE``.
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index acd15df..a0f0dfa 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -13,7 +13,8 @@ endfunction()
function(compiler_id_detection outvar lang)
- if (NOT lang STREQUAL Fortran AND NOT lang STREQUAL CSharp)
+ if (NOT lang STREQUAL Fortran AND NOT lang STREQUAL CSharp
+ AND NOT lang STREQUAL ISPC)
file(GLOB lang_files
"${CMAKE_ROOT}/Modules/Compiler/*-DetermineCompiler.cmake")
set(nonlang CXX)
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index daca382..6bdd06b 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -189,6 +189,10 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
set(nvcc_test_flags "--keep --keep-dir tmp")
if(CMAKE_CUDA_HOST_COMPILER)
string(APPEND nvcc_test_flags " -ccbin=\"${CMAKE_CUDA_HOST_COMPILER}\"")
+
+ # If the user has specified a host compiler we should fail instead of trying without.
+ # Succeeding detection without may result in confusing errors later on, see #21076.
+ set(CMAKE_CUDA_COMPILER_ID_REQUIRE_SUCCESS ON)
endif()
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
if(WIN32)
@@ -202,34 +206,35 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
endif()
endif()
- # First try with the user-specified architectures.
+ # Append user-specified architectures.
if(CMAKE_CUDA_ARCHITECTURES)
- set(clang_archs "${clang_test_flags}")
- set(nvcc_archs "${nvcc_test_flags}")
-
foreach(arch ${CMAKE_CUDA_ARCHITECTURES})
# Strip specifiers as PTX vs binary doesn't matter.
string(REGEX MATCH "[0-9]+" arch_name "${arch}")
- string(APPEND clang_archs " --cuda-gpu-arch=sm_${arch_name}")
- string(APPEND nvcc_archs " -gencode=arch=compute_${arch_name},code=sm_${arch_name}")
+ string(APPEND clang_test_flags " --cuda-gpu-arch=sm_${arch_name}")
+ string(APPEND nvcc_test_flags " -gencode=arch=compute_${arch_name},code=sm_${arch_name}")
list(APPEND tested_architectures "${arch_name}")
endforeach()
- list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${clang_archs}")
- list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${nvcc_archs}")
+ # If the user has specified architectures we'll want to fail during compiler detection if they don't work.
+ set(CMAKE_CUDA_COMPILER_ID_REQUIRE_SUCCESS ON)
endif()
- # Fallback default NVCC flags.
- list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST ${nvcc_test_flags})
-
- # Clang doesn't automatically select an architecture supported by the SDK.
- # Try in reverse order of deprecation with the most recent at front (i.e. the most likely to work for new setups).
- foreach(arch "20" "30" "52")
- list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${clang_test_flags} --cuda-gpu-arch=sm_${arch}")
- endforeach()
+ if(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
+ if(NOT CMAKE_CUDA_ARCHITECTURES)
+ # Clang doesn't automatically select an architecture supported by the SDK.
+ # Try in reverse order of deprecation with the most recent at front (i.e. the most likely to work for new setups).
+ foreach(arch "20" "30" "52")
+ list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${clang_test_flags} --cuda-gpu-arch=sm_${arch}")
+ endforeach()
+ endif()
- # Finally also try the default.
- list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${clang_test_flags}")
+ # If the user specified CMAKE_CUDA_ARCHITECTURES this will include all the architecture flags.
+ # Otherwise this won't include any architecture flags and we'll fallback to Clang's defaults.
+ list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${clang_test_flags}")
+ elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
+ list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${nvcc_test_flags}")
+ endif()
# We perform compiler identification for a second time to extract implicit linking info and host compiler for NVCC.
# We also use it to verify that CMAKE_CUDA_ARCHITECTURES and additionally on Clang that CUDA toolkit path works.
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index d7a35e1..688e1d8 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -110,6 +110,28 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
endif()
endif()
+ # For ISPC we need to explicitly query the version.
+ if(lang STREQUAL "ISPC"
+ AND CMAKE_${lang}_COMPILER
+ AND NOT CMAKE_${lang}_COMPILER_VERSION)
+ execute_process(
+ COMMAND "${CMAKE_${lang}_COMPILER}"
+ --version
+ OUTPUT_VARIABLE output ERROR_VARIABLE output
+ RESULT_VARIABLE result
+ TIMEOUT 10
+ )
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Running the ${lang} compiler: \"${CMAKE_${lang}_COMPILER}\" -version\n"
+ "${output}\n"
+ )
+
+ if(output MATCHES [[ISPC\), ([0-9]+\.[0-9]+(\.[0-9]+)?)]])
+ set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_MATCH_1}")
+ endif()
+ endif()
+
+
if (COMPILER_QNXNTO AND CMAKE_${lang}_COMPILER_ID STREQUAL "GNU")
execute_process(
COMMAND "${CMAKE_${lang}_COMPILER}"
@@ -606,9 +628,12 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT}
")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "${MSG}")
- #if(NOT CMAKE_${lang}_COMPILER_ID_ALLOW_FAIL)
- # message(FATAL_ERROR "${MSG}")
- #endif()
+
+ # Some languages may know the correct/desired set of flags and want to fail right away if they don't work.
+ # This is currently only used by CUDA.
+ if(CMAKE_${lang}_COMPILER_ID_REQUIRE_SUCCESS)
+ message(FATAL_ERROR "${MSG}")
+ endif()
# No output files should be inspected.
set(COMPILER_${lang}_PRODUCED_FILES)
diff --git a/Modules/CMakeDetermineISPCCompiler.cmake b/Modules/CMakeDetermineISPCCompiler.cmake
new file mode 100644
index 0000000..ff2bf20
--- /dev/null
+++ b/Modules/CMakeDetermineISPCCompiler.cmake
@@ -0,0 +1,96 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+# determine the compiler to use for ISPC programs
+
+include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
+
+if( NOT (("${CMAKE_GENERATOR}" MATCHES "Make") OR ("${CMAKE_GENERATOR}" MATCHES "Ninja")) )
+ message(FATAL_ERROR "ISPC language not currently supported by \"${CMAKE_GENERATOR}\" generator")
+endif()
+
+# Load system-specific compiler preferences for this language.
+include(Platform/${CMAKE_SYSTEM_NAME}-Determine-ISPC OPTIONAL)
+include(Platform/${CMAKE_SYSTEM_NAME}-ISPC OPTIONAL)
+if(NOT CMAKE_ISPC_COMPILER_NAMES)
+ set(CMAKE_ISPC_COMPILER_NAMES ispc)
+endif()
+
+
+if(NOT CMAKE_ISPC_COMPILER)
+
+ set(CMAKE_ISPC_COMPILER_INIT NOTFOUND)
+
+ # prefer the environment variable CC
+ if(NOT $ENV{ISPC} STREQUAL "")
+ get_filename_component(CMAKE_ISPC_COMPILER_INIT $ENV{ISPC} PROGRAM PROGRAM_ARGS CMAKE_ISPC_FLAGS_ENV_INIT)
+ if(CMAKE_ISPC_FLAGS_ENV_INIT)
+ set(CMAKE_ISPC_COMPILER_ARG1 "${CMAKE_ISPC_FLAGS_ENV_INIT}" CACHE STRING "First argument to ISPC compiler")
+ endif()
+ if(NOT EXISTS ${CMAKE_ISPC_COMPILER_INIT})
+ message(FATAL_ERROR "Could not find compiler set in environment variable ISPC:\n$ENV{ISPC}.")
+ endif()
+ endif()
+
+ # next try prefer the compiler specified by the generator
+ if(CMAKE_GENERATOR_ISPC)
+ if(NOT CMAKE_ISPC_COMPILER_INIT)
+ set(CMAKE_ISPC_COMPILER_INIT ${CMAKE_GENERATOR_ISPC})
+ endif()
+ endif()
+
+ # finally list compilers to try
+ if(NOT CMAKE_ISPC_COMPILER_INIT)
+ set(CMAKE_ISPC_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}ispc ispc)
+ endif()
+
+ # Find the compiler.
+ _cmake_find_compiler(ISPC)
+
+else()
+ _cmake_find_compiler_path(ISPC)
+endif()
+mark_as_advanced(CMAKE_ISPC_COMPILER)
+
+if(NOT CMAKE_ISPC_COMPILER_ID_RUN)
+set(CMAKE_ISPC_COMPILER_ID_RUN 1)
+
+ # Try to identify the compiler.
+ set(CMAKE_ISPC_COMPILER_ID)
+ set(CMAKE_ISPC_PLATFORM_ID)
+
+
+ set(CMAKE_ISPC_COMPILER_ID_TEST_FLAGS_FIRST
+ # setup logic to make sure ISPC outputs a file
+ "-o cmake_ispc_output"
+ )
+
+ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
+ CMAKE_DETERMINE_COMPILER_ID(ISPC ISPCFLAGS CMakeISPCCompilerId.ispc)
+
+ _cmake_find_compiler_sysroot(ISPC)
+endif()
+
+if (NOT _CMAKE_TOOLCHAIN_LOCATION)
+ get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_ISPC_COMPILER}" PATH)
+endif ()
+
+set(_CMAKE_PROCESSING_LANGUAGE "ISPC")
+include(CMakeFindBinUtils)
+include(Compiler/${CMAKE_ISPC_COMPILER_ID}-FindBinUtils OPTIONAL)
+unset(_CMAKE_PROCESSING_LANGUAGE)
+
+if(CMAKE_ISPC_COMPILER_ID_VENDOR_MATCH)
+ set(_SET_CMAKE_ISPC_COMPILER_ID_VENDOR_MATCH
+ "set(CMAKE_ISPC_COMPILER_ID_VENDOR_MATCH [==[${CMAKE_ISPC_COMPILER_ID_VENDOR_MATCH}]==])")
+else()
+ set(_SET_CMAKE_ISPC_COMPILER_ID_VENDOR_MATCH "")
+endif()
+
+
+# configure variables set in this file for fast reload later on
+configure_file(${CMAKE_ROOT}/Modules/CMakeISPCCompiler.cmake.in
+ ${CMAKE_PLATFORM_INFO_DIR}/CMakeISPCCompiler.cmake @ONLY)
+
+set(CMAKE_ISPC_COMPILER_ENV_VAR "ISPC")
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index b2004f1..66adafa 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -66,6 +66,7 @@ if(("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC" AND
OR "x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xMSVC"
OR (CMAKE_HOST_WIN32 AND "x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xPGI")
OR (CMAKE_HOST_WIN32 AND "x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xNVIDIA")
+ OR (CMAKE_HOST_WIN32 AND "x${_CMAKE_PROCESSING_LANGUAGE}" STREQUAL "xISPC")
OR (CMAKE_GENERATOR MATCHES "Visual Studio"
AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android"))
diff --git a/Modules/CMakeISPCCompiler.cmake.in b/Modules/CMakeISPCCompiler.cmake.in
new file mode 100644
index 0000000..28c31cc
--- /dev/null
+++ b/Modules/CMakeISPCCompiler.cmake.in
@@ -0,0 +1,30 @@
+set(CMAKE_ISPC_COMPILER "@CMAKE_ISPC_COMPILER@")
+set(CMAKE_ISPC_COMPILER_ARG1 "@CMAKE_ISPC_COMPILER_ARG1@")
+set(CMAKE_ISPC_COMPILER_ID "@CMAKE_ISPC_COMPILER_ID@")
+set(CMAKE_ISPC_COMPILER_VERSION "@CMAKE_ISPC_COMPILER_VERSION@")
+set(CMAKE_ISPC_COMPILER_VERSION_INTERNAL "@CMAKE_ISPC_COMPILER_VERSION_INTERNAL@")
+
+set(CMAKE_ISPC_PLATFORM_ID "@CMAKE_ISPC_PLATFORM_ID@")
+set(CMAKE_ISPC_SIMULATE_ID "@CMAKE_ISPC_SIMULATE_ID@")
+set(CMAKE_ISPC_COMPILER_FRONTEND_VARIANT "@CMAKE_ISPC_COMPILER_FRONTEND_VARIANT@")
+set(CMAKE_ISPC_SIMULATE_VERSION "@CMAKE_ISPC_SIMULATE_VERSION@")
+
+set(CMAKE_AR "@CMAKE_AR@")
+set(CMAKE_ISPC_COMPILER_AR "@CMAKE_ISPC_COMPILER_AR@")
+set(CMAKE_RANLIB "@CMAKE_RANLIB@")
+set(CMAKE_ISPC_COMPILER_RANLIB "@CMAKE_ISPC_COMPILER_RANLIB@")
+
+set(CMAKE_ISPC_COMPILER_LOADED 1)
+set(CMAKE_ISPC_COMPILER_WORKS @CMAKE_ISPC_COMPILER_WORKS@)
+set(CMAKE_ISPC_ABI_COMPILED @CMAKE_ISPC_ABI_COMPILED@)
+
+set(CMAKE_ISPC_COMPILER_ENV_VAR "ISPC")
+
+set(CMAKE_ISPC_COMPILER_ID_RUN 1)
+set(CMAKE_ISPC_SOURCE_FILE_EXTENSIONS ispc)
+set(CMAKE_ISPC_IGNORE_EXTENSIONS o;O)
+
+set(CMAKE_ISPC_LINKER_PREFERENCE 0)
+set(CMAKE_ISPC_LINKER_PREFERENCE_PROPAGATES 0)
+
+@CMAKE_ISPC_COMPILER_CUSTOM_CODE@
diff --git a/Modules/CMakeISPCCompilerABI.ispc b/Modules/CMakeISPCCompilerABI.ispc
new file mode 100644
index 0000000..e23abce
--- /dev/null
+++ b/Modules/CMakeISPCCompilerABI.ispc
@@ -0,0 +1,20 @@
+
+export void ispcCompilerABI() {
+
+#if defined(__GNU__) && defined(__ELF__) && defined(__ARM_EABI__)
+ print("INFO:abi[ELF ARMEABI]");
+ static char const info_abi[] =
+#elif defined(__GNU__) && defined(__ELF__) && defined(__ARMEB__)
+ print("INFO:abi[ELF ARM]");
+#elif defined(__GNU__) && defined(__ELF__) && defined(__ARMEL__)
+ print("INFO:abi[ELF ARM]");
+
+#elif defined(__linux__) && defined(__ELF__) && defined(__amd64__) && \
+ defined(__ILP32__)
+print("INFO:abi[ELF X32]");
+
+#elif defined(__ELF__)
+print("INFO:abi[ELF]");
+#endif
+
+}
diff --git a/Modules/CMakeISPCCompilerId.ispc.in b/Modules/CMakeISPCCompilerId.ispc.in
new file mode 100644
index 0000000..03380f3
--- /dev/null
+++ b/Modules/CMakeISPCCompilerId.ispc.in
@@ -0,0 +1,62 @@
+
+export void ispcCompilerId() {
+
+// Identify the compiler
+#if defined(ISPC)
+ print("INFO:compiler[Intel]");
+#endif
+
+// Identify the platform
+#if defined(__linux) || defined(__linux__) || defined(linux)
+ print("INFO:platform[Linux]");
+#elif defined(__CYGWIN__)
+ print("INFO:platform[Cygwin]");
+#elif defined(__MINGW32__)
+ print("INFO:platform[MinGW]");
+#elif defined(__APPLE__)
+ print("INFO:platform[Darwin]");
+#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+ print("INFO:platform[Windows]");
+#elif defined(__FreeBSD__) || defined(__FreeBSD)
+ print("INFO:platform[FreeBSD]");
+#elif defined(__NetBSD__) || defined(__NetBSD)
+ print("INFO:platform[NetBSD]");
+#elif defined(__OpenBSD__) || defined(__OPENBSD)
+ print("INFO:platform[OpenBSD]");
+#elif defined(__sun) || defined(sun)
+ print("INFO:platform[SunOS]");
+#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
+ print("INFO:platform[AIX]");
+#elif defined(__hpux) || defined(__hpux__)
+ print("INFO:platform[HP-UX]");
+#elif defined(__HAIKU__)
+ print("INFO:platform[Haiku]");
+#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
+ print("INFO:platform[BeOS]");
+#elif defined(__QNX__) || defined(__QNXNTO__)
+ print("INFO:platform[QNX]");
+#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
+ print("INFO:platform[Tru64]");
+#elif defined(__riscos) || defined(__riscos__)
+ print("INFO:platform[RISCos]");
+#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
+ print("INFO:platform[SINIX]");
+#elif defined(__UNIX_SV__)
+ print("INFO:platform[UNIX_SV]");
+#elif defined(__bsdos__)
+ print("INFO:platform[BSDOS]");
+#elif defined(_MPRAS) || defined(MPRAS)
+ print("INFO:platform[MP-RAS]");
+#elif defined(__osf) || defined(__osf__)
+ print("INFO:platform[OSF1]");
+#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
+ print("INFO:platform[SCO_SV]");
+#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
+ print("INFO:platform[ULTRIX]");
+#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
+ print("INFO:platform[Xenix]");
+#else
+ print("INFO:platform[]");
+#endif
+
+}
diff --git a/Modules/CMakeISPCInformation.cmake b/Modules/CMakeISPCInformation.cmake
new file mode 100644
index 0000000..46bda5b
--- /dev/null
+++ b/Modules/CMakeISPCInformation.cmake
@@ -0,0 +1,61 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+set(CMAKE_ISPC_OUTPUT_EXTENSION .o)
+set(CMAKE_INCLUDE_FLAG_ISPC "-I")
+
+# Load compiler-specific information.
+if(CMAKE_ISPC_COMPILER_ID)
+ include(Compiler/${CMAKE_ISPC_COMPILER_ID}-ISPC OPTIONAL)
+endif()
+
+# load the system- and compiler specific files
+if(CMAKE_ISPC_COMPILER_ID)
+ # load a hardware specific file, mostly useful for embedded compilers
+ if(CMAKE_SYSTEM_PROCESSOR)
+ include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_ISPC_COMPILER_ID}-ISPC-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
+ endif()
+ include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_ISPC_COMPILER_ID}-ISPC OPTIONAL)
+endif()
+
+# add the flags to the cache based
+# on the initial values computed in the platform/*.cmake files
+# use _INIT variables so that this only happens the first time
+# and you can set these flags in the cmake cache
+set(CMAKE_ISPC_FLAGS_INIT "$ENV{ISPCFLAGS} ${CMAKE_ISPC_FLAGS_INIT}")
+
+cmake_initialize_per_config_variable(CMAKE_ISPC_FLAGS "Flags used by the ISPC compiler")
+
+if(CMAKE_ISPC_STANDARD_LIBRARIES_INIT)
+ set(CMAKE_ISPC_STANDARD_LIBRARIES "${CMAKE_ISPC_STANDARD_LIBRARIES_INIT}"
+ CACHE STRING "Libraries linked by default with all ISPC applications.")
+ mark_as_advanced(CMAKE_ISPC_STANDARD_LIBRARIES)
+endif()
+
+if(NOT CMAKE_ISPC_COMPILER_LAUNCHER AND DEFINED ENV{CMAKE_ISPC_COMPILER_LAUNCHER})
+ set(CMAKE_ISPC_COMPILER_LAUNCHER "$ENV{CMAKE_ISPC_COMPILER_LAUNCHER}"
+ CACHE STRING "Compiler launcher for ISPC.")
+endif()
+
+include(CMakeCommonLanguageInclude)
+
+# now define the following rules:
+# CMAKE_ISPC_COMPILE_OBJECT
+
+# Create a static archive incrementally for large object file counts.
+if(NOT DEFINED CMAKE_ISPC_ARCHIVE_CREATE)
+ set(CMAKE_ISPC_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
+endif()
+if(NOT DEFINED CMAKE_ISPC_ARCHIVE_APPEND)
+ set(CMAKE_ISPC_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
+endif()
+if(NOT DEFINED CMAKE_ISPC_ARCHIVE_FINISH)
+ set(CMAKE_ISPC_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
+endif()
+
+if(NOT CMAKE_ISPC_COMPILE_OBJECT)
+ set(CMAKE_ISPC_COMPILE_OBJECT
+ "<CMAKE_ISPC_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> --emit-obj <SOURCE> -h <ISPC_HEADER>")
+endif()
+
+set(CMAKE_ISPC_INFORMATION_LOADED 1)
diff --git a/Modules/CMakeOBJCXXInformation.cmake b/Modules/CMakeOBJCXXInformation.cmake
index 71beb7f..4be9762 100644
--- a/Modules/CMakeOBJCXXInformation.cmake
+++ b/Modules/CMakeOBJCXXInformation.cmake
@@ -263,7 +263,7 @@ endif()
# compile an Objective-C++ file into an object file
if(NOT CMAKE_OBJCXX_COMPILE_OBJECT)
set(CMAKE_OBJCXX_COMPILE_OBJECT
- "<CMAKE_OBJCXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -x objective-c++ -o <OBJECT> -c <SOURCE>")
+ "<CMAKE_OBJCXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
endif()
if(NOT CMAKE_OBJCXX_LINK_EXECUTABLE)
diff --git a/Modules/CMakeTestISPCCompiler.cmake b/Modules/CMakeTestISPCCompiler.cmake
new file mode 100644
index 0000000..6b16393
--- /dev/null
+++ b/Modules/CMakeTestISPCCompiler.cmake
@@ -0,0 +1,43 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+
+if(CMAKE_ISPC_COMPILER_FORCED)
+ # The compiler configuration was forced by the user.
+ # Assume the user has configured all compiler information.
+ set(CMAKE_ISPC_COMPILER_WORKS TRUE)
+ return()
+endif()
+
+include(CMakeTestCompilerCommon)
+
+# Make sure we try to compile as a STATIC_LIBRARY
+set(__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE})
+set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+
+# # Try to identify the ABI and configure it into CMakeISPCCompiler.cmake
+include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake)
+CMAKE_DETERMINE_COMPILER_ABI(ISPC ${CMAKE_ROOT}/Modules/CMakeISPCCompilerABI.ispc)
+if(CMAKE_ISPC_ABI_COMPILED)
+# # The compiler worked so skip dedicated test below.
+ set(CMAKE_ISPC_COMPILER_WORKS TRUE)
+ message(STATUS "Check for working ISPC compiler: ${CMAKE_ISPC_COMPILER} - skipped")
+endif()
+
+# Re-configure to save learned information.
+configure_file(
+ ${CMAKE_ROOT}/Modules/CMakeISPCCompiler.cmake.in
+ ${CMAKE_PLATFORM_INFO_DIR}/CMakeISPCCompiler.cmake
+ @ONLY
+ )
+include(${CMAKE_PLATFORM_INFO_DIR}/CMakeISPCCompiler.cmake)
+
+if(CMAKE_ISPC_SIZEOF_DATA_PTR)
+ foreach(f ${CMAKE_ISPC_ABI_FILES})
+ include(${f})
+ endforeach()
+ unset(CMAKE_ISPC_ABI_FILES)
+endif()
+
+set(CMAKE_TRY_COMPILE_TARGET_TYPE ${__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE})
diff --git a/Modules/Compiler/ARMClang-ASM.cmake b/Modules/Compiler/ARMClang-ASM.cmake
index ceff3e8..6a299be 100644
--- a/Modules/Compiler/ARMClang-ASM.cmake
+++ b/Modules/Compiler/ARMClang-ASM.cmake
@@ -3,7 +3,7 @@ include(Compiler/ARMClang)
set(CMAKE_ASM_OUTPUT_EXTENSION ".o")
set(CMAKE_ASM_OUTPUT_EXTENSION_REPLACE 1)
-set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <INCLUDES> <FLAGS> -c -o <OBJECT> <SOURCE>")
+set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -c -o <OBJECT> <SOURCE>")
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS S;s;asm;msa)
__compiler_armclang(ASM)
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index 6f0e9b3..c43265d 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -10,6 +10,11 @@ set(__COMPILER_CLANG 1)
include(Compiler/CMakeCommonCompilerMacros)
+set(__pch_header_C "c-header")
+set(__pch_header_CXX "c++-header")
+set(__pch_header_OBJC "objective-c-header")
+set(__pch_header_OBJCXX "objective-c++-header")
+
if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"
OR "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC")
@@ -105,7 +110,7 @@ else()
set(CMAKE_${lang}_COMPILE_OPTIONS_INSTANTIATE_TEMPLATES_PCH -fpch-instantiate-templates)
endif()
set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE> -Xclang -include -Xclang <PCH_HEADER>)
- set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER>)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER> -x ${__pch_header_${lang}})
endmacro()
endif()
diff --git a/Modules/Compiler/Intel-ISPC.cmake b/Modules/Compiler/Intel-ISPC.cmake
new file mode 100644
index 0000000..2e9792a
--- /dev/null
+++ b/Modules/Compiler/Intel-ISPC.cmake
@@ -0,0 +1,22 @@
+include(Compiler/CMakeCommonCompilerMacros)
+
+# Not aware of any verbose flag for ISPC
+#set(CMAKE_ISPC_VERBOSE_FLAG )
+
+set(CMAKE_DEPFILE_FLAGS_ISPC "-M -MT <OBJECT> -MF <DEPFILE>")
+
+string(APPEND CMAKE_ISPC_FLAGS_INIT " ")
+string(APPEND CMAKE_ISPC_FLAGS_DEBUG_INIT "-O0 -g")
+string(APPEND CMAKE_ISPC_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
+string(APPEND CMAKE_ISPC_FLAGS_MINSIZEREL_INIT " -O1 -DNDEBUG")
+string(APPEND CMAKE_ISPC_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
+
+set(CMAKE_ISPC_COMPILE_OPTIONS_PIE --pic)
+set(CMAKE_ISPC_COMPILE_OPTIONS_PIC --pic)
+
+set(CMAKE_INCLUDE_SYSTEM_FLAG_ISPC -isystem=)
+
+set(CMAKE_ISPC_RESPONSE_FILE_FLAG "@")
+set(CMAKE_ISPC_USE_RESPONSE_FILE_FOR_INCLUDES 1)
+set(CMAKE_ISPC_USE_RESPONSE_FILE_FOR_LIBRARIES 1)
+set(CMAKE_ISPC_USE_RESPONSE_FILE_FOR_OBJECTS 1)
diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake
index e5dbcd9..6fe8685 100644
--- a/Modules/ExternalData.cmake
+++ b/Modules/ExternalData.cmake
@@ -179,7 +179,7 @@ calling any of the functions provided by this module.
.. variable:: ExternalData_URL_TEMPLATES
- The ``ExternalData_URL_TEMPLATES`` may be set to provide a list of
+ The ``ExternalData_URL_TEMPLATES`` may be set to provide a list
of URL templates using the placeholders ``%(algo)`` and ``%(hash)``
in each template. Data fetch rules try each URL template in order
by substituting the hash algorithm name for ``%(algo)`` and the hash
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 1d68c44..42bb9fe 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -9,6 +9,9 @@
# Initial configuration
#
+cmake_policy(PUSH)
+# numbers and boolean constants
+cmake_policy (SET CMP0012 NEW)
# IN_LIST operator
cmake_policy (SET CMP0057 NEW)
@@ -44,7 +47,6 @@ macro (_PYTHON_DISPLAY_FAILURE _PYTHON_MSG)
set (${_PYTHON_PREFIX}_FOUND FALSE)
string (TOUPPER "${_PYTHON_PREFIX}" _${_PYTHON_PREFIX}_UPPER_PREFIX)
set (${_PYTHON_UPPER_PREFIX}_FOUND FALSE)
- return()
endmacro()
@@ -607,14 +609,24 @@ function (_PYTHON_GET_VERSION)
# ABI not used on Windows
set (abi "")
else()
- if (config MATCHES "#[ ]*define[ ]+Py_DEBUG[ ]+1")
- string (APPEND abi "d")
- endif()
- if (config MATCHES "#[ ]*define[ ]+WITH_PYMALLOC[ ]+1")
- string (APPEND abi "m")
- endif()
- if (config MATCHES "#[ ]*define[ ]+Py_UNICODE_SIZE[ ]+4")
- string (APPEND abi "u")
+ if (NOT config)
+ # pyconfig.h can be a wrapper to a platform specific pyconfig.h
+ # In this case, try to identify ABI from include directory
+ if (_${_PYTHON_PREFIX}_INCLUDE_DIR MATCHES "python${version_major}\.${version_minor}+([dmu]*)")
+ set (abi "${CMAKE_MATCH_1}")
+ else()
+ set (abi "")
+ endif()
+ else()
+ if (config MATCHES "#[ ]*define[ ]+Py_DEBUG[ ]+1")
+ string (APPEND abi "d")
+ endif()
+ if (config MATCHES "#[ ]*define[ ]+WITH_PYMALLOC[ ]+1")
+ string (APPEND abi "m")
+ endif()
+ if (config MATCHES "#[ ]*define[ ]+Py_UNICODE_SIZE[ ]+4")
+ string (APPEND abi "u")
+ endif()
endif()
set (${_PGV_PREFIX}ABI "${abi}" PARENT_SCOPE)
endif()
@@ -1012,6 +1024,9 @@ endfunction()
if (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION_MAJOR
AND NOT ${_PYTHON_PREFIX}_FIND_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
_python_display_failure ("Could NOT find ${_PYTHON_PREFIX}: Wrong major version specified is \"${${_PYTHON_PREFIX}_FIND_VERSION_MAJOR}\", but expected major version is \"${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}\"")
+
+ cmake_policy(POP)
+ return()
endif()
@@ -2952,6 +2967,9 @@ endif()
if (${_PYTHON_PREFIX}_VERSION_MAJOR AND
NOT ${_PYTHON_PREFIX}_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
_python_display_failure ("Could NOT find ${_PYTHON_PREFIX}: Found unsuitable major version \"${${_PYTHON_PREFIX}_VERSION_MAJOR}\", but required major version is exact version \"${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}\"")
+
+ cmake_policy(POP)
+ return()
endif()
unset (_${_PYTHON_PREFIX}_REASON_FAILURE)
@@ -3160,3 +3178,5 @@ if (DEFINED _${_PYTHON_PREFIX}_CMAKE_FIND_FRAMEWORK)
else()
unset (CMAKE_FIND_FRAMEWORK)
endif()
+
+cmake_policy(POP)
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
index c8c91de..0d74d30 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -8,6 +8,11 @@ if(__WINDOWS_CLANG)
endif()
set(__WINDOWS_CLANG 1)
+set(__pch_header_C "c-header")
+set(__pch_header_CXX "c++-header")
+set(__pch_header_OBJC "objective-c-header")
+set(__pch_header_OBJCXX "objective-c++-header")
+
macro(__windows_compiler_clang_gnu lang)
set(CMAKE_LIBRARY_PATH_FLAG "-L")
set(CMAKE_LINK_LIBRARY_FLAG "-l")
@@ -87,7 +92,7 @@ macro(__windows_compiler_clang_gnu lang)
set(CMAKE_PCH_EXTENSION .pch)
set(CMAKE_PCH_PROLOGUE "#pragma clang system_header")
set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE> -Xclang -include -Xclang <PCH_HEADER>)
- set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER>)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER> -x ${__pch_header_${lang}})
unset(__ADDED_FLAGS)
unset(__ADDED_FLAGS_DEBUG)
diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake
index 0c24739..59f3ca5 100644
--- a/Modules/Platform/Windows-Embarcadero.cmake
+++ b/Modules/Platform/Windows-Embarcadero.cmake
@@ -10,6 +10,11 @@ set(__WINDOWS_EMBARCADERO 1)
set(BORLAND 1)
+set(__pch_header_C "c-header")
+set(__pch_header_CXX "c++-header")
+set(__pch_header_OBJC "objective-c-header")
+set(__pch_header_OBJCXX "objective-c++-header")
+
if("${CMAKE_${_lang}_COMPILER_VERSION}" VERSION_LESS 6.30)
# Borland target type flags (bcc32 -h -t):
set(_tW "-tW") # -tW GUI App (implies -U__CONSOLE__)
@@ -123,7 +128,7 @@ macro(__embarcadero_language lang)
if (EMBARCADERO)
set(CMAKE_PCH_EXTENSION .pch)
set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE> -Xclang -include -Xclang <PCH_HEADER>)
- set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER>)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER> -x ${__pch_header_${lang}})
endif()
# Initial configuration flags.
diff --git a/Modules/Platform/Windows-Intel-ISPC.cmake b/Modules/Platform/Windows-Intel-ISPC.cmake
new file mode 100644
index 0000000..cd26302
--- /dev/null
+++ b/Modules/Platform/Windows-Intel-ISPC.cmake
@@ -0,0 +1,8 @@
+
+if(CMAKE_VERBOSE_MAKEFILE)
+ set(CMAKE_CL_NOLOGO)
+else()
+ set(CMAKE_CL_NOLOGO "/nologo")
+endif()
+
+set(CMAKE_ISPC_CREATE_STATIC_LIBRARY "<CMAKE_AR> ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index b75eb5e..59a0707 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -496,7 +496,8 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
endif()
endif()
if (SWIG_MODULE_${name}_LANGUAGE STREQUAL "PYTHON" AND NOT SWIG_MODULE_${name}_NOPROXY)
- if(NOT ("-interface" IN_LIST swig_source_file_flags OR "-interface" IN_LIST SWIG_MODULE_${name}_EXTRA_FLAGS))
+ if(SWIG_USE_INTERFACE AND
+ NOT ("-interface" IN_LIST swig_source_file_flags OR "-interface" IN_LIST SWIG_MODULE_${name}_EXTRA_FLAGS))
# This makes sure that the name used in the proxy code
# matches the library name created by CMake
list (APPEND SWIG_MODULE_${name}_EXTRA_FLAGS "-interface" "$<TARGET_FILE_PREFIX:${target_name}>$<TARGET_FILE_BASE_NAME:${target_name}>")
@@ -724,6 +725,13 @@ function(SWIG_ADD_LIBRARY name)
set(swig_generated_sources)
set(swig_generated_timestamps)
+ list(LENGTH swig_dot_i_sources swig_sources_count)
+ if (swig_sources_count GREATER "1")
+ # option -interface cannot be used
+ set(SWIG_USE_INTERFACE FALSE)
+ else()
+ set(SWIG_USE_INTERFACE TRUE)
+ endif()
foreach(swig_it IN LISTS swig_dot_i_sources)
SWIG_ADD_SOURCE_TO_MODULE(${name} swig_generated_source "${swig_it}")
list (APPEND swig_generated_sources "${swig_generated_source}")
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index ee8767f..1be424a 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -182,6 +182,8 @@ set(SRCS
cmCheckCustomOutputs.cxx
cmCLocaleEnvironmentScope.h
cmCLocaleEnvironmentScope.cxx
+ cmCMakePath.h
+ cmCMakePath.cxx
cmCommandArgumentParserHelper.cxx
cmCommonTargetGenerator.cxx
cmCommonTargetGenerator.h
@@ -334,6 +336,7 @@ set(SRCS
cmInstallTargetGenerator.cxx
cmInstallDirectoryGenerator.h
cmInstallDirectoryGenerator.cxx
+ cmJSONHelpers.h
cmLDConfigLDConfigTool.cxx
cmLDConfigLDConfigTool.h
cmLDConfigTool.cxx
@@ -498,6 +501,8 @@ set(SRCS
cmCMakeLanguageCommand.h
cmCMakeMinimumRequired.cxx
cmCMakeMinimumRequired.h
+ cmCMakePathCommand.h
+ cmCMakePathCommand.cxx
cmCMakePolicyCommand.cxx
cmCMakePolicyCommand.h
cmConditionEvaluator.cxx
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index af25ce6..835b785 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 18)
-set(CMake_VERSION_PATCH 20200901)
+set(CMake_VERSION_PATCH 20200910)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CPack/IFW/cmCPackIFWCommon.h b/Source/CPack/IFW/cmCPackIFWCommon.h
index 354d849..95ed213 100644
--- a/Source/CPack/IFW/cmCPackIFWCommon.h
+++ b/Source/CPack/IFW/cmCPackIFWCommon.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackIFWCommon_h
-#define cmCPackIFWCommon_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -77,5 +76,3 @@ protected:
cmCPackLog_msg.str().c_str()); \
} \
} while (false)
-
-#endif // cmCPackIFWCommon_h
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h
index 86a73c8..024d25d 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.h
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackIFWGenerator_h
-#define cmCPackIFWGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -152,5 +151,3 @@ private:
std::vector<std::string> PkgsDirsVector;
std::vector<std::string> RepoDirsVector;
};
-
-#endif
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h
index 8b3f96a..6f398e3 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.h
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackIFWInstaller_h
-#define cmCPackIFWInstaller_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -132,5 +131,3 @@ protected:
void printSkippedOptionWarning(const std::string& optionName,
const std::string& optionValue);
};
-
-#endif // cmCPackIFWInstaller_h
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h
index 6a4a170..dbd5540 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.h
+++ b/Source/CPack/IFW/cmCPackIFWPackage.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackIFWPackage_h
-#define cmCPackIFWPackage_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -149,5 +148,3 @@ public:
// Patch to package directory
std::string Directory;
};
-
-#endif // cmCPackIFWPackage_h
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.h b/Source/CPack/IFW/cmCPackIFWRepository.h
index c293981..21afd8b 100644
--- a/Source/CPack/IFW/cmCPackIFWRepository.h
+++ b/Source/CPack/IFW/cmCPackIFWRepository.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackIFWRepository_h
-#define cmCPackIFWRepository_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -84,5 +83,3 @@ public:
RepositoriesVector RepositoryUpdate;
std::string Directory;
};
-
-#endif // cmCPackIFWRepository_h
diff --git a/Source/CPack/WiX/cmCMakeToWixPath.h b/Source/CPack/WiX/cmCMakeToWixPath.h
index 8bb9e04..074cc8e 100644
--- a/Source/CPack/WiX/cmCMakeToWixPath.h
+++ b/Source/CPack/WiX/cmCMakeToWixPath.h
@@ -1,12 +1,9 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCMakeToWixPath_h
-#define cmCMakeToWixPath_h
+#pragma once
#include "cmConfigure.h" //IWYU pragma: keep
#include <string>
std::string CMakeToWixPath(const std::string& cygpath);
-
-#endif // cmCMakeToWixPath_h
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h
index b9c37e9..8609cf3 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.h
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackWIXGenerator_h
-#define cmCPackWIXGenerator_h
+#pragma once
#include <map>
#include <memory>
@@ -171,5 +170,3 @@ private:
cmWIXSourceWriter::GuidType ComponentGuidType;
};
-
-#endif
diff --git a/Source/CPack/WiX/cmWIXAccessControlList.h b/Source/CPack/WiX/cmWIXAccessControlList.h
index 64f9a13..ee5efa5 100644
--- a/Source/CPack/WiX/cmWIXAccessControlList.h
+++ b/Source/CPack/WiX/cmWIXAccessControlList.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmWIXAccessControlList_h
-#define cmWIXAccessControlList_h
+#pragma once
#include "cmCPackLog.h"
#include "cmInstalledFile.h"
@@ -29,5 +28,3 @@ private:
cmInstalledFile const& InstalledFile;
cmWIXSourceWriter& SourceWriter;
};
-
-#endif
diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h
index a907d6d..0af3094 100644
--- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmWIXDirectoriesSourceWriter_h
-#define cmWIXDirectoriesSourceWriter_h
+#pragma once
#include <string>
@@ -29,5 +28,3 @@ public:
void EndInstallationPrefixDirectory(size_t size);
};
-
-#endif
diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h
index e03e87b..0facf97 100644
--- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmWIXFeaturesSourceWriter_h
-#define cmWIXFeaturesSourceWriter_h
+#pragma once
#include "cmCPackGenerator.h"
#include "cmWIXPatch.h"
@@ -27,5 +26,3 @@ public:
void EmitComponentRef(std::string const& id);
};
-
-#endif
diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h
index 8cc98f5..60dddd4 100644
--- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmWIXFilesSourceWriter_h
-#define cmWIXFilesSourceWriter_h
+#pragma once
#include "cmCPackGenerator.h"
#include "cmWIXPatch.h"
@@ -37,5 +36,3 @@ public:
std::string const& filePath, cmWIXPatch& patch,
cmInstalledFile const* installedFile);
};
-
-#endif
diff --git a/Source/CPack/WiX/cmWIXPatch.h b/Source/CPack/WiX/cmWIXPatch.h
index 31a60f4..c78722d 100644
--- a/Source/CPack/WiX/cmWIXPatch.h
+++ b/Source/CPack/WiX/cmWIXPatch.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmWIXPatch_h
-#define cmWIXPatch_h
+#pragma once
#include <string>
@@ -33,5 +32,3 @@ private:
cmWIXPatchParser::fragment_map_t Fragments;
};
-
-#endif
diff --git a/Source/CPack/WiX/cmWIXPatchParser.h b/Source/CPack/WiX/cmWIXPatchParser.h
index 8d5d2ad..70a21bc 100644
--- a/Source/CPack/WiX/cmWIXPatchParser.h
+++ b/Source/CPack/WiX/cmWIXPatchParser.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackWIXPatchParser_h
-#define cmCPackWIXPatchParser_h
+#pragma once
#include <map>
#include <memory>
@@ -91,5 +90,3 @@ private:
std::vector<cmWIXPatchElement*> ElementStack;
};
-
-#endif
diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
index a879f3d..99471f1 100644
--- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
+++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmWIXRichTextFormatWriter_h
-#define cmWIXRichTextFormatWriter_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -42,5 +41,3 @@ private:
cmsys::ofstream File;
};
-
-#endif
diff --git a/Source/CPack/WiX/cmWIXShortcut.h b/Source/CPack/WiX/cmWIXShortcut.h
index c67baf3..315b5ea 100644
--- a/Source/CPack/WiX/cmWIXShortcut.h
+++ b/Source/CPack/WiX/cmWIXShortcut.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmWIXShortcut_h
-#define cmWIXShortcut_h
+#pragma once
#include <map>
#include <set>
@@ -56,5 +55,3 @@ private:
shortcut_type_map_t Shortcuts;
shortcut_id_map_t EmptyIdMap;
};
-
-#endif
diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h
index 6030ea3..f643acd 100644
--- a/Source/CPack/WiX/cmWIXSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXSourceWriter.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmWIXSourceWriter_h
-#define cmWIXSourceWriter_h
+#pragma once
#include <string>
#include <vector>
@@ -76,5 +75,3 @@ private:
GuidType ComponentGuidType;
};
-
-#endif
diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h
index 7eb5665..5b40013 100644
--- a/Source/CPack/cmCPackArchiveGenerator.h
+++ b/Source/CPack/cmCPackArchiveGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackArchiveGenerator_h
-#define cmCPackArchiveGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -93,5 +92,3 @@ private:
std::string ArchiveFormat;
std::string OutputExtension;
};
-
-#endif
diff --git a/Source/CPack/cmCPackBundleGenerator.h b/Source/CPack/cmCPackBundleGenerator.h
index 27bac3a..072d14f 100644
--- a/Source/CPack/cmCPackBundleGenerator.h
+++ b/Source/CPack/cmCPackBundleGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackBundleGenerator_h
-#define cmCPackBundleGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -33,5 +32,3 @@ protected:
std::string InstallPrefix;
};
-
-#endif
diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h
index bb980d7..58377d4 100644
--- a/Source/CPack/cmCPackComponentGroup.h
+++ b/Source/CPack/cmCPackComponentGroup.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackComponentGroup_h
-#define cmCPackComponentGroup_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -167,5 +166,3 @@ public:
/// The list of components.
std::vector<cmCPackComponent*> Components;
};
-
-#endif
diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.h b/Source/CPack/cmCPackCygwinBinaryGenerator.h
index 47bd41e..f5f7700 100644
--- a/Source/CPack/cmCPackCygwinBinaryGenerator.h
+++ b/Source/CPack/cmCPackCygwinBinaryGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackCygwinBinaryGenerator_h
-#define cmCPackCygwinBinaryGenerator_h
+#pragma once
#include "cmCPackArchiveGenerator.h"
@@ -25,5 +24,3 @@ protected:
virtual const char* GetOutputExtension();
std::string OutputExtension;
};
-
-#endif
diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.h b/Source/CPack/cmCPackCygwinSourceGenerator.h
index 98d8f0a..964a4d4 100644
--- a/Source/CPack/cmCPackCygwinSourceGenerator.h
+++ b/Source/CPack/cmCPackCygwinSourceGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackCygwinSourceGenerator_h
-#define cmCPackCygwinSourceGenerator_h
+#pragma once
#include "cmCPackArchiveGenerator.h"
@@ -27,5 +26,3 @@ protected:
std::string InstallPrefix;
std::string OutputExtension;
};
-
-#endif
diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h
index ce77e08..ee8f39a 100644
--- a/Source/CPack/cmCPackDebGenerator.h
+++ b/Source/CPack/cmCPackDebGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackDebGenerator_h
-#define cmCPackDebGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -69,5 +68,3 @@ private:
std::vector<std::string> packageFiles;
};
-
-#endif
diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h
index dbd190c..310b0ab 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.h
+++ b/Source/CPack/cmCPackDragNDropGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackDragNDropGenerator_h
-#define cmCPackDragNDropGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -81,5 +80,3 @@ private:
bool BreakLongLine(const std::string& line, std::vector<std::string>& lines,
std::string* error);
};
-
-#endif
diff --git a/Source/CPack/cmCPackExternalGenerator.h b/Source/CPack/cmCPackExternalGenerator.h
index 80011fd..dfd13e8 100644
--- a/Source/CPack/cmCPackExternalGenerator.h
+++ b/Source/CPack/cmCPackExternalGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackExternalGenerator_h
-#define cmCPackExternalGenerator_h
+#pragma once
#include <memory>
#include <string>
@@ -86,5 +85,3 @@ private:
std::unique_ptr<cmCPackExternalVersionGenerator> Generator;
};
-
-#endif
diff --git a/Source/CPack/cmCPackFreeBSDGenerator.h b/Source/CPack/cmCPackFreeBSDGenerator.h
index a18b72f..eed8053 100644
--- a/Source/CPack/cmCPackFreeBSDGenerator.h
+++ b/Source/CPack/cmCPackFreeBSDGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackFreeBSDGenerator_h
-#define cmCPackFreeBSDGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -33,5 +32,3 @@ protected:
std::string var_lookup(const char* var_name);
void write_manifest_fields(cmGeneratedFileStream&);
};
-
-#endif
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 3880f65..a9fe91c 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -20,6 +20,7 @@
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStateSnapshot.h"
#include "cmStringAlgorithms.h"
@@ -905,8 +906,8 @@ int cmCPackGenerator::InstallCMakeProject(
// forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES
// to CPack (may be used by generators like CPack RPM or DEB)
// in order to transparently handle ABSOLUTE PATH
- if (const char* def = mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")) {
- mf.AddDefinition("CPACK_ABSOLUTE_DESTINATION_FILES", def);
+ if (cmProp def = mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")) {
+ mf.AddDefinition("CPACK_ABSOLUTE_DESTINATION_FILES", *def);
}
// Now rebuild the list of files after installation
@@ -939,11 +940,11 @@ int cmCPackGenerator::InstallCMakeProject(
}
}
- if (auto d = mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
+ if (cmProp d = mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
if (!absoluteDestFiles.empty()) {
absoluteDestFiles += ";";
}
- absoluteDestFiles += d;
+ absoluteDestFiles += *d;
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Got some ABSOLUTE DESTINATION FILES: " << absoluteDestFiles
<< std::endl);
@@ -954,12 +955,13 @@ int cmCPackGenerator::InstallCMakeProject(
GetComponentInstallDirNameSuffix(component);
if (nullptr != this->GetOption(absoluteDestFileComponent)) {
std::string absoluteDestFilesListComponent =
- cmStrCat(this->GetOption(absoluteDestFileComponent), ';', d);
+ cmStrCat(this->GetOption(absoluteDestFileComponent), ';', *d);
this->SetOption(absoluteDestFileComponent,
absoluteDestFilesListComponent.c_str());
} else {
- this->SetOption(absoluteDestFileComponent,
- mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"));
+ this->SetOption(
+ absoluteDestFileComponent,
+ cmToCStr(mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")));
}
}
}
@@ -982,7 +984,7 @@ bool cmCPackGenerator::ReadListFile(const char* moduleName)
void cmCPackGenerator::SetOptionIfNotSet(const std::string& op,
const char* value)
{
- const char* def = this->MakefileMap->GetDefinition(op);
+ cmProp def = this->MakefileMap->GetDefinition(op);
if (cmNonempty(def)) {
return;
}
@@ -1214,30 +1216,31 @@ bool cmCPackGenerator::IsOn(const std::string& name) const
bool cmCPackGenerator::IsSetToOff(const std::string& op) const
{
- const char* ret = this->MakefileMap->GetDefinition(op);
+ cmProp ret = this->MakefileMap->GetDefinition(op);
if (cmNonempty(ret)) {
- return cmIsOff(ret);
+ return cmIsOff(*ret);
}
return false;
}
bool cmCPackGenerator::IsSetToEmpty(const std::string& op) const
{
- const char* ret = this->MakefileMap->GetDefinition(op);
+ cmProp ret = this->MakefileMap->GetDefinition(op);
if (ret) {
- return !*ret;
+ return ret->empty();
}
return false;
}
const char* cmCPackGenerator::GetOption(const std::string& op) const
{
- const char* ret = this->MakefileMap->GetDefinition(op);
+ cmProp ret = this->MakefileMap->GetDefinition(op);
if (!ret) {
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Warning, GetOption return NULL for: " << op << std::endl);
+ return nullptr;
}
- return ret;
+ return ret->c_str();
}
std::vector<std::string> cmCPackGenerator::GetOptions() const
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 33026c1..2512d42 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackGenerator_h
-#define cmCPackGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -339,5 +338,3 @@ protected:
this->Logger->Log(logType, __FILE__, __LINE__, \
cmCPackLog_msg.str().c_str()); \
} while (false)
-
-#endif
diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h
index 62b7484..0846573 100644
--- a/Source/CPack/cmCPackGeneratorFactory.h
+++ b/Source/CPack/cmCPackGeneratorFactory.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackGeneratorFactory_h
-#define cmCPackGeneratorFactory_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -44,5 +43,3 @@ private:
DescriptionsMap GeneratorDescriptions;
cmCPackLog* Logger;
};
-
-#endif
diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h
index 68ffcce..6cec39c 100644
--- a/Source/CPack/cmCPackLog.h
+++ b/Source/CPack/cmCPackLog.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackLog_h
-#define cmCPackLog_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -139,5 +138,3 @@ inline std::ostream& operator<<(std::ostream& os, const cmCPackLogWrite& c)
os.flush();
return os;
}
-
-#endif
diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h
index 88cba45..ded02de 100644
--- a/Source/CPack/cmCPackNSISGenerator.h
+++ b/Source/CPack/cmCPackNSISGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackNSISGenerator_h
-#define cmCPackNSISGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -85,5 +84,3 @@ protected:
bool Nsis64;
};
-
-#endif
diff --git a/Source/CPack/cmCPackNuGetGenerator.h b/Source/CPack/cmCPackNuGetGenerator.h
index a59db2d..609ec79 100644
--- a/Source/CPack/cmCPackNuGetGenerator.h
+++ b/Source/CPack/cmCPackNuGetGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackNuGetGenerator_h
-#define cmCPackNuGetGenerator_h
+#pragma once
#include "cmCPackGenerator.h"
@@ -33,5 +32,3 @@ protected:
*/
void AddGeneratedPackageNames();
};
-
-#endif
diff --git a/Source/CPack/cmCPackOSXX11Generator.h b/Source/CPack/cmCPackOSXX11Generator.h
index a6461c8..8fae136 100644
--- a/Source/CPack/cmCPackOSXX11Generator.h
+++ b/Source/CPack/cmCPackOSXX11Generator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackOSXX11Generator_h
-#define cmCPackOSXX11Generator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -38,5 +37,3 @@ protected:
bool copyOnly = false);
std::string InstallPrefix;
};
-
-#endif
diff --git a/Source/CPack/cmCPackPKGGenerator.h b/Source/CPack/cmCPackPKGGenerator.h
index be730ab..17cdcdf 100644
--- a/Source/CPack/cmCPackPKGGenerator.h
+++ b/Source/CPack/cmCPackPKGGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackPKGGenerator_h
-#define cmCPackPKGGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -94,5 +93,3 @@ protected:
// The PostFlight component when creating a metapackage
cmCPackComponent PostFlightComponent;
};
-
-#endif
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h
index 0575587..cda9277 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.h
+++ b/Source/CPack/cmCPackPackageMakerGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackPackageMakerGenerator_h
-#define cmCPackPackageMakerGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -49,5 +48,3 @@ protected:
double PackageMakerVersion;
unsigned int PackageCompatibilityVersion;
};
-
-#endif
diff --git a/Source/CPack/cmCPackProductBuildGenerator.h b/Source/CPack/cmCPackProductBuildGenerator.h
index 015fe4a..462e2fc 100644
--- a/Source/CPack/cmCPackProductBuildGenerator.h
+++ b/Source/CPack/cmCPackProductBuildGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackProductBuildGenerator_h
-#define cmCPackProductBuildGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -49,5 +48,3 @@ protected:
const char* GetComponentScript(const char* script,
const char* script_component);
};
-
-#endif
diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h
index 075ce84..0288f2f 100644
--- a/Source/CPack/cmCPackRPMGenerator.h
+++ b/Source/CPack/cmCPackRPMGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackRPMGenerator_h
-#define cmCPackRPMGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -68,5 +67,3 @@ protected:
void AddGeneratedPackageNames();
};
-
-#endif
diff --git a/Source/CPack/cmCPackSTGZGenerator.h b/Source/CPack/cmCPackSTGZGenerator.h
index 79d7035..d2df1f2 100644
--- a/Source/CPack/cmCPackSTGZGenerator.h
+++ b/Source/CPack/cmCPackSTGZGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackSTGZGenerator_h
-#define cmCPackSTGZGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -30,5 +29,3 @@ protected:
int InitializeInternal() override;
int GenerateHeader(std::ostream* os) override;
};
-
-#endif
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 3a400b7..6c80753 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -12,6 +12,7 @@
#include "cmDocumentationFormatter.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStateSnapshot.h"
#include "cmStringAlgorithms.h"
@@ -324,21 +325,22 @@ int main(int argc, char const* const* argv)
}
// Force CPACK_PACKAGE_DIRECTORY as absolute path
- cpackProjectDirectory = globalMF.GetDefinition("CPACK_PACKAGE_DIRECTORY");
+ cpackProjectDirectory =
+ globalMF.GetSafeDefinition("CPACK_PACKAGE_DIRECTORY");
cpackProjectDirectory =
cmSystemTools::CollapseFullPath(cpackProjectDirectory);
globalMF.AddDefinition("CPACK_PACKAGE_DIRECTORY", cpackProjectDirectory);
- const char* cpackModulesPath = globalMF.GetDefinition("CPACK_MODULE_PATH");
+ cmProp cpackModulesPath = globalMF.GetDefinition("CPACK_MODULE_PATH");
if (cpackModulesPath) {
- globalMF.AddDefinition("CMAKE_MODULE_PATH", cpackModulesPath);
+ globalMF.AddDefinition("CMAKE_MODULE_PATH", *cpackModulesPath);
}
- const char* genList = globalMF.GetDefinition("CPACK_GENERATOR");
+ cmProp genList = globalMF.GetDefinition("CPACK_GENERATOR");
if (!genList) {
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
"CPack generator not specified" << std::endl);
} else {
- std::vector<std::string> generatorsVector = cmExpandedList(genList);
+ std::vector<std::string> generatorsVector = cmExpandedList(*genList);
for (std::string const& gen : generatorsVector) {
cmMakefile::ScopePushPop raii(&globalMF);
cmMakefile* mf = &globalMF;
@@ -411,32 +413,31 @@ int main(int argc, char const* const* argv)
parsed = 0;
}
if (parsed) {
- const char* projName = mf->GetDefinition("CPACK_PACKAGE_NAME");
+ cmProp projName = mf->GetDefinition("CPACK_PACKAGE_NAME");
cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE,
"Use generator: " << cpackGenerator->GetNameOfClass()
<< std::endl);
cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE,
- "For project: " << projName << std::endl);
+ "For project: " << *projName << std::endl);
- const char* projVersion =
- mf->GetDefinition("CPACK_PACKAGE_VERSION");
+ cmProp projVersion = mf->GetDefinition("CPACK_PACKAGE_VERSION");
if (!projVersion) {
- const char* projVersionMajor =
+ cmProp projVersionMajor =
mf->GetDefinition("CPACK_PACKAGE_VERSION_MAJOR");
- const char* projVersionMinor =
+ cmProp projVersionMinor =
mf->GetDefinition("CPACK_PACKAGE_VERSION_MINOR");
- const char* projVersionPatch =
+ cmProp projVersionPatch =
mf->GetDefinition("CPACK_PACKAGE_VERSION_PATCH");
std::ostringstream ostr;
- ostr << projVersionMajor << "." << projVersionMinor << "."
- << projVersionPatch;
+ ostr << *projVersionMajor << "." << *projVersionMinor << "."
+ << *projVersionPatch;
mf->AddDefinition("CPACK_PACKAGE_VERSION", ostr.str());
}
int res = cpackGenerator->DoPackage();
if (!res) {
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
- "Error when generating package: " << projName
+ "Error when generating package: " << *projName
<< std::endl);
return 1;
}
diff --git a/Source/CTest/cmCTestBZR.h b/Source/CTest/cmCTestBZR.h
index d7c6321..eb0dbbe 100644
--- a/Source/CTest/cmCTestBZR.h
+++ b/Source/CTest/cmCTestBZR.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestBZR_h
-#define cmCTestBZR_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -50,5 +49,3 @@ private:
friend class UpdateParser;
friend class StatusParser;
};
-
-#endif
diff --git a/Source/CTest/cmCTestBinPacker.h b/Source/CTest/cmCTestBinPacker.h
index ff02b85..e56a437 100644
--- a/Source/CTest/cmCTestBinPacker.h
+++ b/Source/CTest/cmCTestBinPacker.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestBinPacker_h
-#define cmCTestBinPacker_h
+#pragma once
#include <cstddef>
#include <map>
@@ -27,5 +26,3 @@ bool cmAllocateCTestResourcesRoundRobin(
bool cmAllocateCTestResourcesBlock(
const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
std::vector<cmCTestBinPackerAllocation>& allocations);
-
-#endif
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h
index 0c8a040..b9cc35c 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.h
+++ b/Source/CTest/cmCTestBuildAndTestHandler.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestBuildAndTestHandler_h
-#define cmCTestBuildAndTestHandler_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -71,5 +70,3 @@ protected:
bool BuildNoCMake;
cmDuration Timeout;
};
-
-#endif
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx
index 8aab167..1cc267e 100644
--- a/Source/CTest/cmCTestBuildCommand.cxx
+++ b/Source/CTest/cmCTestBuildCommand.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestBuildCommand.h"
-#include <cstring>
#include <sstream>
#include <cmext/string_view>
@@ -39,12 +38,13 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
this->Handler = handler;
- cmProp ctestBuildCommand = this->Makefile->GetDef("CTEST_BUILD_COMMAND");
+ cmProp ctestBuildCommand =
+ this->Makefile->GetDefinition("CTEST_BUILD_COMMAND");
if (cmNonempty(ctestBuildCommand)) {
this->CTest->SetCTestConfiguration("MakeCommand", *ctestBuildCommand,
this->Quiet);
} else {
- const char* cmakeGeneratorName =
+ cmProp cmakeGeneratorName =
this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
// Build configuration is determined by: CONFIGURATION argument,
@@ -52,49 +52,51 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
// CTEST_CONFIGURATION_TYPE script variable, or ctest -C command
// line argument... in that order.
//
- const char* ctestBuildConfiguration =
+ cmProp ctestBuildConfiguration =
this->Makefile->GetDefinition("CTEST_BUILD_CONFIGURATION");
- const char* cmakeBuildConfiguration = !this->Configuration.empty()
- ? this->Configuration.c_str()
- : (cmNonempty(ctestBuildConfiguration)
- ? ctestBuildConfiguration
- : this->CTest->GetConfigType().c_str());
-
- const char* cmakeBuildAdditionalFlags = !this->Flags.empty()
- ? this->Flags.c_str()
+ const std::string* cmakeBuildConfiguration = !this->Configuration.empty()
+ ? &this->Configuration
+ : (cmNonempty(ctestBuildConfiguration) ? ctestBuildConfiguration
+ : &this->CTest->GetConfigType());
+
+ const std::string* cmakeBuildAdditionalFlags = !this->Flags.empty()
+ ? &this->Flags
: this->Makefile->GetDefinition("CTEST_BUILD_FLAGS");
- const char* cmakeBuildTarget = !this->Target.empty()
- ? this->Target.c_str()
+ const std::string* cmakeBuildTarget = !this->Target.empty()
+ ? &this->Target
: this->Makefile->GetDefinition("CTEST_BUILD_TARGET");
if (cmNonempty(cmakeGeneratorName)) {
if (!cmakeBuildConfiguration) {
- cmakeBuildConfiguration = "Release";
+ static const std::string sRelease = "Release";
+ cmakeBuildConfiguration = &sRelease;
}
if (this->GlobalGenerator) {
- if (this->GlobalGenerator->GetName() != cmakeGeneratorName) {
+ if (this->GlobalGenerator->GetName() != *cmakeGeneratorName) {
this->GlobalGenerator.reset();
}
}
if (!this->GlobalGenerator) {
this->GlobalGenerator =
this->Makefile->GetCMakeInstance()->CreateGlobalGenerator(
- cmakeGeneratorName);
+ *cmakeGeneratorName);
if (!this->GlobalGenerator) {
std::string e = cmStrCat("could not create generator named \"",
- cmakeGeneratorName, '"');
+ *cmakeGeneratorName, '"');
this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e);
cmSystemTools::SetFatalErrorOccured();
return nullptr;
}
}
- if (strlen(cmakeBuildConfiguration) == 0) {
- const char* config = nullptr;
+ if (cmakeBuildConfiguration->empty()) {
+ const std::string* config = nullptr;
#ifdef CMAKE_INTDIR
- config = CMAKE_INTDIR;
+ static const std::string sIntDir = CMAKE_INTDIR;
+ config = &sIntDir;
#endif
if (!config) {
- config = "Debug";
+ static const std::string sDebug = "Debug";
+ config = &sDebug;
}
cmakeBuildConfiguration = config;
}
@@ -102,8 +104,8 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
std::string dir = this->CTest->GetCTestConfiguration("BuildDirectory");
std::string buildCommand =
this->GlobalGenerator->GenerateCMakeBuildCommand(
- cmakeBuildTarget ? cmakeBuildTarget : "", cmakeBuildConfiguration,
- cmakeBuildAdditionalFlags ? cmakeBuildAdditionalFlags : "",
+ cmakeBuildTarget ? *cmakeBuildTarget : "", *cmakeBuildConfiguration,
+ cmakeBuildAdditionalFlags ? *cmakeBuildAdditionalFlags : "",
this->Makefile->IgnoreErrorsCMP0061());
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"SetMakeCommand:" << buildCommand << "\n",
@@ -123,13 +125,14 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
}
}
- if (cmProp useLaunchers = this->Makefile->GetDef("CTEST_USE_LAUNCHERS")) {
+ if (cmProp useLaunchers =
+ this->Makefile->GetDefinition("CTEST_USE_LAUNCHERS")) {
this->CTest->SetCTestConfiguration("UseLaunchers", *useLaunchers,
this->Quiet);
}
if (cmProp labelsForSubprojects =
- this->Makefile->GetDef("CTEST_LABELS_FOR_SUBPROJECTS")) {
+ this->Makefile->GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) {
this->CTest->SetCTestConfiguration("LabelsForSubprojects",
*labelsForSubprojects, this->Quiet);
}
diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h
index 0f82817..00dbcc4 100644
--- a/Source/CTest/cmCTestBuildCommand.h
+++ b/Source/CTest/cmCTestBuildCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestBuildCommand_h
-#define cmCTestBuildCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -62,5 +61,3 @@ protected:
std::string Flags;
std::string ProjectName;
};
-
-#endif
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 35c2b11..9997548 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -19,6 +19,7 @@
#include "cmGeneratedFileStream.h"
#include "cmMakefile.h"
#include "cmProcessOutput.h"
+#include "cmProperty.h"
#include "cmStringAlgorithms.h"
#include "cmStringReplaceHelper.h"
#include "cmSystemTools.h"
@@ -248,13 +249,14 @@ void cmCTestBuildHandler::PopulateCustomVectors(cmMakefile* mf)
}
// Record the user-specified custom warning rules.
- if (const char* customWarningMatchers =
+ if (cmProp customWarningMatchers =
mf->GetDefinition("CTEST_CUSTOM_WARNING_MATCH")) {
- cmExpandList(customWarningMatchers, this->ReallyCustomWarningMatches);
+ cmExpandList(*customWarningMatchers, this->ReallyCustomWarningMatches);
}
- if (const char* customWarningExceptions =
+ if (cmProp customWarningExceptions =
mf->GetDefinition("CTEST_CUSTOM_WARNING_EXCEPTION")) {
- cmExpandList(customWarningExceptions, this->ReallyCustomWarningExceptions);
+ cmExpandList(*customWarningExceptions,
+ this->ReallyCustomWarningExceptions);
}
}
diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h
index a5193f6..58e8d9c 100644
--- a/Source/CTest/cmCTestBuildHandler.h
+++ b/Source/CTest/cmCTestBuildHandler.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestBuildHandler_h
-#define cmCTestBuildHandler_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -156,5 +155,3 @@ private:
friend class LaunchHelper;
class FragmentCompare;
};
-
-#endif
diff --git a/Source/CTest/cmCTestCVS.h b/Source/CTest/cmCTestCVS.h
index 7d33d8f..d20239b 100644
--- a/Source/CTest/cmCTestCVS.h
+++ b/Source/CTest/cmCTestCVS.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestCVS_h
-#define cmCTestCVS_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -51,5 +50,3 @@ private:
friend class LogParser;
friend class UpdateParser;
};
-
-#endif
diff --git a/Source/CTest/cmCTestCommand.h b/Source/CTest/cmCTestCommand.h
index 8efb419..007378d 100644
--- a/Source/CTest/cmCTestCommand.h
+++ b/Source/CTest/cmCTestCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestCommand_h
-#define cmCTestCommand_h
+#pragma once
#include "cmCommand.h"
@@ -27,5 +26,3 @@ public:
cmCTest* CTest;
cmCTestScriptHandler* CTestScriptHandler;
};
-
-#endif
diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx
index ac57130..db9923e 100644
--- a/Source/CTest/cmCTestConfigureCommand.cxx
+++ b/Source/CTest/cmCTestConfigureCommand.cxx
@@ -40,13 +40,13 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
}
cmProp ctestConfigureCommand =
- this->Makefile->GetDef("CTEST_CONFIGURE_COMMAND");
+ this->Makefile->GetDefinition("CTEST_CONFIGURE_COMMAND");
if (cmNonempty(ctestConfigureCommand)) {
this->CTest->SetCTestConfiguration("ConfigureCommand",
*ctestConfigureCommand, this->Quiet);
} else {
- const char* cmakeGeneratorName =
+ cmProp cmakeGeneratorName =
this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
if (cmNonempty(cmakeGeneratorName)) {
const std::string& source_dir =
@@ -71,7 +71,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
bool cmakeBuildTypeInOptions = false;
auto gg = this->Makefile->GetCMakeInstance()->CreateGlobalGenerator(
- cmakeGeneratorName);
+ *cmakeGeneratorName);
if (gg) {
multiConfig = gg->IsMultiConfig();
gg.reset();
@@ -103,22 +103,22 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
}
cmakeConfigureCommand += " \"-G";
- cmakeConfigureCommand += cmakeGeneratorName;
+ cmakeConfigureCommand += *cmakeGeneratorName;
cmakeConfigureCommand += "\"";
- const char* cmakeGeneratorPlatform =
+ cmProp cmakeGeneratorPlatform =
this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR_PLATFORM");
if (cmNonempty(cmakeGeneratorPlatform)) {
cmakeConfigureCommand += " \"-A";
- cmakeConfigureCommand += cmakeGeneratorPlatform;
+ cmakeConfigureCommand += *cmakeGeneratorPlatform;
cmakeConfigureCommand += "\"";
}
- const char* cmakeGeneratorToolset =
+ cmProp cmakeGeneratorToolset =
this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR_TOOLSET");
if (cmNonempty(cmakeGeneratorToolset)) {
cmakeConfigureCommand += " \"-T";
- cmakeConfigureCommand += cmakeGeneratorToolset;
+ cmakeConfigureCommand += *cmakeGeneratorToolset;
cmakeConfigureCommand += "\"";
}
@@ -138,7 +138,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
}
if (cmProp labelsForSubprojects =
- this->Makefile->GetDef("CTEST_LABELS_FOR_SUBPROJECTS")) {
+ this->Makefile->GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) {
this->CTest->SetCTestConfiguration("LabelsForSubprojects",
*labelsForSubprojects, this->Quiet);
}
diff --git a/Source/CTest/cmCTestConfigureCommand.h b/Source/CTest/cmCTestConfigureCommand.h
index 3f5944a..f338637 100644
--- a/Source/CTest/cmCTestConfigureCommand.h
+++ b/Source/CTest/cmCTestConfigureCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestConfigureCommand_h
-#define cmCTestConfigureCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -45,5 +44,3 @@ protected:
std::string Options;
};
-
-#endif
diff --git a/Source/CTest/cmCTestConfigureHandler.h b/Source/CTest/cmCTestConfigureHandler.h
index 01fe801..2aad98c 100644
--- a/Source/CTest/cmCTestConfigureHandler.h
+++ b/Source/CTest/cmCTestConfigureHandler.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestConfigureHandler_h
-#define cmCTestConfigureHandler_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -25,5 +24,3 @@ public:
void Initialize() override;
};
-
-#endif
diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h
index 76aaf46..9344852 100644
--- a/Source/CTest/cmCTestCoverageCommand.h
+++ b/Source/CTest/cmCTestCoverageCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestCoverageCommand_h
-#define cmCTestCoverageCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -48,5 +47,3 @@ protected:
bool LabelsMentioned;
std::vector<std::string> Labels;
};
-
-#endif
diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h
index 991b89d..8732723 100644
--- a/Source/CTest/cmCTestCoverageHandler.h
+++ b/Source/CTest/cmCTestCoverageHandler.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestCoverageHandler_h
-#define cmCTestCoverageHandler_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -149,5 +148,3 @@ private:
bool IntersectsFilter(LabelSet const& labels);
bool IsFilteredOut(std::string const& source);
};
-
-#endif
diff --git a/Source/CTest/cmCTestCurl.h b/Source/CTest/cmCTestCurl.h
index b0d7f07..d9aa916 100644
--- a/Source/CTest/cmCTestCurl.h
+++ b/Source/CTest/cmCTestCurl.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestCurl_h
-#define cmCTestCurl_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -52,5 +51,3 @@ private:
bool Quiet;
int TimeOutSeconds;
};
-
-#endif
diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
index ac96a4e..ba2b0eb 100644
--- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
+++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestEmptyBinaryDirectoryCommand_h
-#define cmCTestEmptyBinaryDirectoryCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -45,5 +44,3 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
};
-
-#endif
diff --git a/Source/CTest/cmCTestGIT.h b/Source/CTest/cmCTestGIT.h
index 3103d84..a15aef5 100644
--- a/Source/CTest/cmCTestGIT.h
+++ b/Source/CTest/cmCTestGIT.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestGIT_h
-#define cmCTestGIT_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -53,5 +52,3 @@ public:
friend class DiffParser;
friend class OneLineParser;
};
-
-#endif
diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h
index 94e5418..591d9cd 100644
--- a/Source/CTest/cmCTestGenericHandler.h
+++ b/Source/CTest/cmCTestGenericHandler.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestGenericHandler_h
-#define cmCTestGenericHandler_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -105,5 +104,3 @@ protected:
cmCTestCommand* Command;
int SubmitIndex;
};
-
-#endif
diff --git a/Source/CTest/cmCTestGlobalVC.h b/Source/CTest/cmCTestGlobalVC.h
index ff86591..679b0e1 100644
--- a/Source/CTest/cmCTestGlobalVC.h
+++ b/Source/CTest/cmCTestGlobalVC.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestGlobalVC_h
-#define cmCTestGlobalVC_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -73,5 +72,3 @@ protected:
void WriteXMLDirectory(cmXMLWriter& xml, std::string const& path,
Directory const& dir);
};
-
-#endif
diff --git a/Source/CTest/cmCTestHG.h b/Source/CTest/cmCTestHG.h
index 2900139..b81f042 100644
--- a/Source/CTest/cmCTestHG.h
+++ b/Source/CTest/cmCTestHG.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestHG_h
-#define cmCTestHG_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -42,5 +41,3 @@ private:
friend class LogParser;
friend class StatusParser;
};
-
-#endif
diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx
index 03b7173..731932e 100644
--- a/Source/CTest/cmCTestHandlerCommand.cxx
+++ b/Source/CTest/cmCTestHandlerCommand.cxx
@@ -126,7 +126,8 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
// CTEST_CONFIGURATION_TYPE script variable if it is defined.
// The current script value trumps the -C argument on the command
// line.
- cmProp ctestConfigType = this->Makefile->GetDef("CTEST_CONFIGURATION_TYPE");
+ cmProp ctestConfigType =
+ this->Makefile->GetDefinition("CTEST_CONFIGURATION_TYPE");
if (ctestConfigType) {
this->CTest->SetConfigType(*ctestConfigType);
}
@@ -160,7 +161,7 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
this->Quiet);
}
- if (cmProp changeId = this->Makefile->GetDef("CTEST_CHANGE_ID")) {
+ if (cmProp changeId = this->Makefile->GetDefinition("CTEST_CHANGE_ID")) {
this->CTest->SetCTestConfiguration("ChangeId", *changeId, this->Quiet);
}
diff --git a/Source/CTest/cmCTestHandlerCommand.h b/Source/CTest/cmCTestHandlerCommand.h
index a20d607..756952d 100644
--- a/Source/CTest/cmCTestHandlerCommand.h
+++ b/Source/CTest/cmCTestHandlerCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestHandlerCommand_h
-#define cmCTestHandlerCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -58,5 +57,3 @@ protected:
"The APPEND option marks results for append to those previously " \
"submitted to a dashboard server since the last ctest_start. " \
"Append semantics are defined by the dashboard server in use."
-
-#endif
diff --git a/Source/CTest/cmCTestLaunch.h b/Source/CTest/cmCTestLaunch.h
index 79a7712..33ff82c 100644
--- a/Source/CTest/cmCTestLaunch.h
+++ b/Source/CTest/cmCTestLaunch.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestLaunch_h
-#define cmCTestLaunch_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -103,5 +102,3 @@ private:
void LoadConfig();
std::string SourceDir;
};
-
-#endif
diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h
index 8f4ffb8..6544f16 100644
--- a/Source/CTest/cmCTestMemCheckCommand.h
+++ b/Source/CTest/cmCTestMemCheckCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestMemCheckCommand_h
-#define cmCTestMemCheckCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -43,5 +42,3 @@ protected:
std::string DefectCount;
};
-
-#endif
diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h
index 63ab573..6ef5d20 100644
--- a/Source/CTest/cmCTestMemCheckHandler.h
+++ b/Source/CTest/cmCTestMemCheckHandler.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestMemCheckHandler_h
-#define cmCTestMemCheckHandler_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -157,5 +156,3 @@ private:
//! generate the output filename for the given test index
void TestOutputFileNames(int test, std::vector<std::string>& files);
};
-
-#endif
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index e21b912..5de42f9 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestMultiProcessHandler_h
-#define cmCTestMultiProcessHandler_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -200,5 +199,3 @@ protected:
bool Quiet;
bool SerialTestRunning;
};
-
-#endif
diff --git a/Source/CTest/cmCTestP4.h b/Source/CTest/cmCTestP4.h
index e19472e..d03f9cb 100644
--- a/Source/CTest/cmCTestP4.h
+++ b/Source/CTest/cmCTestP4.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestP4_h
-#define cmCTestP4_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -72,5 +71,3 @@ private:
friend class DescribeParser;
friend class DiffParser;
};
-
-#endif
diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h
index cbb9390..03714f6 100644
--- a/Source/CTest/cmCTestReadCustomFilesCommand.h
+++ b/Source/CTest/cmCTestReadCustomFilesCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestReadCustomFilesCommand_h
-#define cmCTestReadCustomFilesCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -44,5 +43,3 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
};
-
-#endif
diff --git a/Source/CTest/cmCTestResourceAllocator.h b/Source/CTest/cmCTestResourceAllocator.h
index 9f0b9c9..129e64e 100644
--- a/Source/CTest/cmCTestResourceAllocator.h
+++ b/Source/CTest/cmCTestResourceAllocator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestResourceAllocator_h
-#define cmCTestResourceAllocator_h
+#pragma once
#include <map>
#include <string>
@@ -35,5 +34,3 @@ public:
private:
std::map<std::string, std::map<std::string, Resource>> Resources;
};
-
-#endif
diff --git a/Source/CTest/cmCTestResourceGroupsLexerHelper.h b/Source/CTest/cmCTestResourceGroupsLexerHelper.h
index 2cb6cb1..ae4fa99 100644
--- a/Source/CTest/cmCTestResourceGroupsLexerHelper.h
+++ b/Source/CTest/cmCTestResourceGroupsLexerHelper.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestResourceGroupsLexerHelper_h
-#define cmCTestResourceGroupsLexerHelper_h
+#pragma once
#include <string>
#include <vector>
@@ -40,5 +39,3 @@ private:
};
#define YY_EXTRA_TYPE cmCTestResourceGroupsLexerHelper*
-
-#endif
diff --git a/Source/CTest/cmCTestResourceSpec.cxx b/Source/CTest/cmCTestResourceSpec.cxx
index 21c97de..101dc2c 100644
--- a/Source/CTest/cmCTestResourceSpec.cxx
+++ b/Source/CTest/cmCTestResourceSpec.cxx
@@ -2,19 +2,140 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestResourceSpec.h"
+#include <functional>
#include <map>
#include <string>
#include <utility>
#include <vector>
+#include <cmext/string_view>
+
#include <cm3p/json/reader.h>
#include <cm3p/json/value.h>
#include "cmsys/FStream.hxx"
#include "cmsys/RegularExpression.hxx"
-static const cmsys::RegularExpression IdentifierRegex{ "^[a-z_][a-z0-9_]*$" };
-static const cmsys::RegularExpression IdRegex{ "^[a-z0-9_]+$" };
+#include "cmJSONHelpers.h"
+
+namespace {
+const cmsys::RegularExpression IdentifierRegex{ "^[a-z_][a-z0-9_]*$" };
+const cmsys::RegularExpression IdRegex{ "^[a-z0-9_]+$" };
+
+struct Version
+{
+ int Major = 1;
+ int Minor = 0;
+};
+
+struct TopVersion
+{
+ struct Version Version;
+};
+
+auto const VersionFieldHelper =
+ cmJSONIntHelper<cmCTestResourceSpec::ReadFileResult>(
+ cmCTestResourceSpec::ReadFileResult::READ_OK,
+ cmCTestResourceSpec::ReadFileResult::INVALID_VERSION);
+
+auto const VersionHelper =
+ cmJSONRequiredHelper<Version, cmCTestResourceSpec::ReadFileResult>(
+ cmCTestResourceSpec::ReadFileResult::NO_VERSION,
+ cmJSONObjectHelper<Version, cmCTestResourceSpec::ReadFileResult>(
+ cmCTestResourceSpec::ReadFileResult::READ_OK,
+ cmCTestResourceSpec::ReadFileResult::INVALID_VERSION)
+ .Bind("major"_s, &Version::Major, VersionFieldHelper)
+ .Bind("minor"_s, &Version::Minor, VersionFieldHelper));
+
+auto const RootVersionHelper =
+ cmJSONObjectHelper<TopVersion, cmCTestResourceSpec::ReadFileResult>(
+ cmCTestResourceSpec::ReadFileResult::READ_OK,
+ cmCTestResourceSpec::ReadFileResult::INVALID_ROOT)
+ .Bind("version"_s, &TopVersion::Version, VersionHelper, false);
+
+cmCTestResourceSpec::ReadFileResult ResourceIdHelper(std::string& out,
+ const Json::Value* value)
+{
+ auto result = cmJSONStringHelper(
+ cmCTestResourceSpec::ReadFileResult::READ_OK,
+ cmCTestResourceSpec::ReadFileResult::INVALID_RESOURCE)(out, value);
+ if (result != cmCTestResourceSpec::ReadFileResult::READ_OK) {
+ return result;
+ }
+ cmsys::RegularExpressionMatch match;
+ if (!IdRegex.find(out.c_str(), match)) {
+ return cmCTestResourceSpec::ReadFileResult::INVALID_RESOURCE;
+ }
+ return cmCTestResourceSpec::ReadFileResult::READ_OK;
+}
+
+auto const ResourceHelper =
+ cmJSONObjectHelper<cmCTestResourceSpec::Resource,
+ cmCTestResourceSpec::ReadFileResult>(
+ cmCTestResourceSpec::ReadFileResult::READ_OK,
+ cmCTestResourceSpec::ReadFileResult::INVALID_RESOURCE)
+ .Bind("id"_s, &cmCTestResourceSpec::Resource::Id, ResourceIdHelper)
+ .Bind("slots"_s, &cmCTestResourceSpec::Resource::Capacity,
+ cmJSONUIntHelper(
+ cmCTestResourceSpec::ReadFileResult::READ_OK,
+ cmCTestResourceSpec::ReadFileResult::INVALID_RESOURCE, 1),
+ false);
+
+auto const ResourceListHelper =
+ cmJSONVectorHelper<cmCTestResourceSpec::Resource,
+ cmCTestResourceSpec::ReadFileResult>(
+ cmCTestResourceSpec::ReadFileResult::READ_OK,
+ cmCTestResourceSpec::ReadFileResult::INVALID_RESOURCE_TYPE,
+ ResourceHelper);
+
+auto const ResourceMapHelper =
+ cmJSONMapFilterHelper<std::vector<cmCTestResourceSpec::Resource>,
+ cmCTestResourceSpec::ReadFileResult>(
+ cmCTestResourceSpec::ReadFileResult::READ_OK,
+ cmCTestResourceSpec::ReadFileResult::INVALID_SOCKET_SPEC,
+ ResourceListHelper, [](const std::string& key) -> bool {
+ cmsys::RegularExpressionMatch match;
+ return IdentifierRegex.find(key.c_str(), match);
+ });
+
+auto const SocketSetHelper = cmJSONVectorHelper<
+ std::map<std::string, std::vector<cmCTestResourceSpec::Resource>>>(
+ cmCTestResourceSpec::ReadFileResult::READ_OK,
+ cmCTestResourceSpec::ReadFileResult::INVALID_SOCKET_SPEC, ResourceMapHelper);
+
+cmCTestResourceSpec::ReadFileResult SocketHelper(
+ cmCTestResourceSpec::Socket& out, const Json::Value* value)
+{
+ std::vector<
+ std::map<std::string, std::vector<cmCTestResourceSpec::Resource>>>
+ sockets;
+ cmCTestResourceSpec::ReadFileResult result = SocketSetHelper(sockets, value);
+ if (result != cmCTestResourceSpec::ReadFileResult::READ_OK) {
+ return result;
+ }
+ if (sockets.size() > 1) {
+ return cmCTestResourceSpec::ReadFileResult::INVALID_SOCKET_SPEC;
+ }
+ if (sockets.empty()) {
+ out.Resources.clear();
+ } else {
+ out.Resources = std::move(sockets[0]);
+ }
+ return cmCTestResourceSpec::ReadFileResult::READ_OK;
+}
+
+auto const LocalRequiredHelper =
+ cmJSONRequiredHelper<cmCTestResourceSpec::Socket,
+ cmCTestResourceSpec::ReadFileResult>(
+ cmCTestResourceSpec::ReadFileResult::INVALID_SOCKET_SPEC, SocketHelper);
+
+auto const RootHelper =
+ cmJSONObjectHelper<cmCTestResourceSpec, cmCTestResourceSpec::ReadFileResult>(
+ cmCTestResourceSpec::ReadFileResult::READ_OK,
+ cmCTestResourceSpec::ReadFileResult::INVALID_ROOT)
+ .Bind("local", &cmCTestResourceSpec::LocalSocket, LocalRequiredHelper,
+ false);
+}
cmCTestResourceSpec::ReadFileResult cmCTestResourceSpec::ReadFromJSONFile(
const std::string& filename)
@@ -30,99 +151,17 @@ cmCTestResourceSpec::ReadFileResult cmCTestResourceSpec::ReadFromJSONFile(
return ReadFileResult::JSON_PARSE_ERROR;
}
- if (!root.isObject()) {
- return ReadFileResult::INVALID_ROOT;
- }
-
- int majorVersion = 1;
- int minorVersion = 0;
- if (root.isMember("version")) {
- auto const& version = root["version"];
- if (version.isObject()) {
- if (!version.isMember("major") || !version.isMember("minor")) {
- return ReadFileResult::INVALID_VERSION;
- }
- auto const& major = version["major"];
- auto const& minor = version["minor"];
- if (!major.isInt() || !minor.isInt()) {
- return ReadFileResult::INVALID_VERSION;
- }
- majorVersion = major.asInt();
- minorVersion = minor.asInt();
- } else {
- return ReadFileResult::INVALID_VERSION;
- }
- } else {
- return ReadFileResult::NO_VERSION;
+ TopVersion version;
+ ReadFileResult result;
+ if ((result = RootVersionHelper(version, &root)) !=
+ ReadFileResult::READ_OK) {
+ return result;
}
-
- if (majorVersion != 1 || minorVersion != 0) {
+ if (version.Version.Major != 1 || version.Version.Minor != 0) {
return ReadFileResult::UNSUPPORTED_VERSION;
}
- auto const& local = root["local"];
- if (!local.isArray()) {
- return ReadFileResult::INVALID_SOCKET_SPEC;
- }
- if (local.size() > 1) {
- return ReadFileResult::INVALID_SOCKET_SPEC;
- }
-
- if (local.empty()) {
- this->LocalSocket.Resources.clear();
- return ReadFileResult::READ_OK;
- }
-
- auto const& localSocket = local[0];
- if (!localSocket.isObject()) {
- return ReadFileResult::INVALID_SOCKET_SPEC;
- }
- std::map<std::string, std::vector<cmCTestResourceSpec::Resource>> resources;
- cmsys::RegularExpressionMatch match;
- for (auto const& key : localSocket.getMemberNames()) {
- if (IdentifierRegex.find(key.c_str(), match)) {
- auto const& value = localSocket[key];
- auto& r = resources[key];
- if (value.isArray()) {
- for (auto const& item : value) {
- if (item.isObject()) {
- cmCTestResourceSpec::Resource resource;
-
- if (!item.isMember("id")) {
- return ReadFileResult::INVALID_RESOURCE;
- }
- auto const& id = item["id"];
- if (!id.isString()) {
- return ReadFileResult::INVALID_RESOURCE;
- }
- resource.Id = id.asString();
- if (!IdRegex.find(resource.Id.c_str(), match)) {
- return ReadFileResult::INVALID_RESOURCE;
- }
-
- if (item.isMember("slots")) {
- auto const& capacity = item["slots"];
- if (!capacity.isConvertibleTo(Json::uintValue)) {
- return ReadFileResult::INVALID_RESOURCE;
- }
- resource.Capacity = capacity.asUInt();
- } else {
- resource.Capacity = 1;
- }
-
- r.push_back(resource);
- } else {
- return ReadFileResult::INVALID_RESOURCE;
- }
- }
- } else {
- return ReadFileResult::INVALID_RESOURCE_TYPE;
- }
- }
- }
-
- this->LocalSocket.Resources = std::move(resources);
- return ReadFileResult::READ_OK;
+ return RootHelper(*this, &root);
}
const char* cmCTestResourceSpec::ResultToString(ReadFileResult result)
diff --git a/Source/CTest/cmCTestResourceSpec.h b/Source/CTest/cmCTestResourceSpec.h
index cb242c0..72628a3 100644
--- a/Source/CTest/cmCTestResourceSpec.h
+++ b/Source/CTest/cmCTestResourceSpec.h
@@ -1,7 +1,8 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestResourceSpec_h
-#define cmCTestResourceSpec_h
+#pragma once
+
+#include "cmConfigure.h" // IWYU pragma: keep
#include <map>
#include <string>
@@ -51,5 +52,3 @@ public:
bool operator==(const cmCTestResourceSpec& other) const;
bool operator!=(const cmCTestResourceSpec& other) const;
};
-
-#endif
diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h
index 2d8bde1..510b748 100644
--- a/Source/CTest/cmCTestRunScriptCommand.h
+++ b/Source/CTest/cmCTestRunScriptCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestRunScriptCommand_h
-#define cmCTestRunScriptCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -45,5 +44,3 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
};
-
-#endif
diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h
index d831247..863ac1b 100644
--- a/Source/CTest/cmCTestRunTest.h
+++ b/Source/CTest/cmCTestRunTest.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestRunTest_h
-#define cmCTestRunTest_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -159,5 +158,3 @@ inline int getNumWidth(size_t n)
}
return w;
}
-
-#endif
diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h
index b74dc12..370d176 100644
--- a/Source/CTest/cmCTestSVN.h
+++ b/Source/CTest/cmCTestSVN.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestSVN_h
-#define cmCTestSVN_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -103,5 +102,3 @@ private:
friend class UpdateParser;
friend class ExternalParser;
};
-
-#endif
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 4fa4dc0..4808c36 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -35,6 +35,7 @@
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
@@ -372,8 +373,8 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
int cmCTestScriptHandler::ExtractVariables()
{
// Temporary variables
- const char* minInterval;
- const char* contDuration;
+ cmProp minInterval;
+ cmProp contDuration;
this->SourceDir =
this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY");
@@ -412,7 +413,7 @@ int cmCTestScriptHandler::ExtractVariables()
int i;
for (i = 1; i < 10; ++i) {
sprintf(updateVar, "CTEST_EXTRA_UPDATES_%i", i);
- const char* updateVal = this->Makefile->GetDefinition(updateVar);
+ cmProp updateVal = this->Makefile->GetDefinition(updateVar);
if (updateVal) {
if (this->UpdateCmd.empty()) {
cmSystemTools::Error(
@@ -420,7 +421,7 @@ int cmCTestScriptHandler::ExtractVariables()
" specified without specifying CTEST_CVS_COMMAND.");
return 12;
}
- this->ExtraUpdates.emplace_back(updateVal);
+ this->ExtraUpdates.emplace_back(*updateVal);
}
}
@@ -455,10 +456,10 @@ int cmCTestScriptHandler::ExtractVariables()
// the script may override the minimum continuous interval
if (minInterval) {
- this->MinimumInterval = 60 * atof(minInterval);
+ this->MinimumInterval = 60 * atof(minInterval->c_str());
}
if (contDuration) {
- this->ContinuousDuration = 60.0 * atof(contDuration);
+ this->ContinuousDuration = 60.0 * atof(contDuration->c_str());
}
this->UpdateElapsedTime();
@@ -932,13 +933,13 @@ cmDuration cmCTestScriptHandler::GetRemainingTimeAllowed()
return cmCTest::MaxDuration();
}
- const char* timelimitS = this->Makefile->GetDefinition("CTEST_TIME_LIMIT");
+ cmProp timelimitS = this->Makefile->GetDefinition("CTEST_TIME_LIMIT");
if (!timelimitS) {
return cmCTest::MaxDuration();
}
- auto timelimit = cmDuration(atof(timelimitS));
+ auto timelimit = cmDuration(atof(timelimitS->c_str()));
auto duration = std::chrono::duration_cast<cmDuration>(
std::chrono::steady_clock::now() - this->ScriptStartTime);
diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h
index ebb7905..8eb9658 100644
--- a/Source/CTest/cmCTestScriptHandler.h
+++ b/Source/CTest/cmCTestScriptHandler.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestScriptHandler_h
-#define cmCTestScriptHandler_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -176,5 +175,3 @@ private:
std::unique_ptr<cmGlobalGenerator> GlobalGenerator;
std::unique_ptr<cmake> CMake;
};
-
-#endif
diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h
index 1c3b8a1..9425576 100644
--- a/Source/CTest/cmCTestSleepCommand.h
+++ b/Source/CTest/cmCTestSleepCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestSleepCommand_h
-#define cmCTestSleepCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -45,5 +44,3 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
};
-
-#endif
diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx
index 6398d66..53e1b2f 100644
--- a/Source/CTest/cmCTestStartCommand.cxx
+++ b/Source/CTest/cmCTestStartCommand.cxx
@@ -9,6 +9,7 @@
#include "cmCTestVC.h"
#include "cmGeneratedFileStream.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmSystemTools.h"
class cmExecutionStatus;
@@ -29,8 +30,8 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
size_t cnt = 0;
const char* smodel = nullptr;
- const char* src_dir = nullptr;
- const char* bld_dir = nullptr;
+ const std::string* src_dir = nullptr;
+ const std::string* bld_dir = nullptr;
while (cnt < args.size()) {
if (args[cnt] == "GROUP" || args[cnt] == "TRACK") {
@@ -54,10 +55,10 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
smodel = args[cnt].c_str();
cnt++;
} else if (!src_dir) {
- src_dir = args[cnt].c_str();
+ src_dir = &args[cnt];
cnt++;
} else if (!bld_dir) {
- bld_dir = args[cnt].c_str();
+ bld_dir = &args[cnt];
cnt++;
} else {
this->SetError("Too many arguments");
@@ -87,13 +88,13 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
return false;
}
- cmSystemTools::AddKeepPath(src_dir);
- cmSystemTools::AddKeepPath(bld_dir);
+ cmSystemTools::AddKeepPath(*src_dir);
+ cmSystemTools::AddKeepPath(*bld_dir);
this->CTest->EmptyCTestConfiguration();
- std::string sourceDir = cmSystemTools::CollapseFullPath(src_dir);
- std::string binaryDir = cmSystemTools::CollapseFullPath(bld_dir);
+ std::string sourceDir = cmSystemTools::CollapseFullPath(*src_dir);
+ std::string binaryDir = cmSystemTools::CollapseFullPath(*bld_dir);
this->CTest->SetCTestConfiguration("SourceDirectory", sourceDir,
this->Quiet);
this->CTest->SetCTestConfiguration("BuildDirectory", binaryDir, this->Quiet);
@@ -102,16 +103,16 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
"Run dashboard with model "
<< smodel << std::endl
- << " Source directory: " << src_dir << std::endl
- << " Build directory: " << bld_dir << std::endl,
+ << " Source directory: " << *src_dir << std::endl
+ << " Build directory: " << *bld_dir << std::endl,
this->Quiet);
} else {
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
"Run dashboard with "
"to-be-determined model"
<< std::endl
- << " Source directory: " << src_dir << std::endl
- << " Build directory: " << bld_dir << std::endl,
+ << " Source directory: " << *src_dir << std::endl
+ << " Build directory: " << *bld_dir << std::endl,
this->Quiet);
}
const char* group = this->CTest->GetSpecificGroup();
@@ -161,7 +162,7 @@ bool cmCTestStartCommand::InitialCheckout(std::ostream& ofs,
std::string const& sourceDir)
{
// Use the user-provided command to create the source tree.
- const char* initialCheckoutCommand =
+ cmProp initialCheckoutCommand =
this->Makefile->GetDefinition("CTEST_CHECKOUT_COMMAND");
if (!initialCheckoutCommand) {
initialCheckoutCommand =
@@ -171,7 +172,7 @@ bool cmCTestStartCommand::InitialCheckout(std::ostream& ofs,
// Use a generic VC object to run and log the command.
cmCTestVC vc(this->CTest, ofs);
vc.SetSourceDirectory(sourceDir);
- if (!vc.InitialCheckout(initialCheckoutCommand)) {
+ if (!vc.InitialCheckout(*initialCheckoutCommand)) {
return false;
}
}
diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h
index b30b1bb..b3d06a7 100644
--- a/Source/CTest/cmCTestStartCommand.h
+++ b/Source/CTest/cmCTestStartCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestStartCommand_h
-#define cmCTestStartCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -62,5 +61,3 @@ private:
bool CreateNewTag;
bool Quiet;
};
-
-#endif
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index 026e98f..bdba0e5 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -16,6 +16,7 @@
#include "cmCommand.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmProperty.h"
#include "cmRange.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -37,7 +38,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
{
const std::string* submitURL = !this->SubmitURL.empty()
? &this->SubmitURL
- : this->Makefile->GetDef("CTEST_SUBMIT_URL");
+ : this->Makefile->GetDefinition("CTEST_SUBMIT_URL");
if (submitURL) {
this->CTest->SetCTestConfiguration("SubmitURL", *submitURL, this->Quiet);
@@ -58,17 +59,17 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "CurlOptions", "CTEST_CURL_OPTIONS", this->Quiet);
- const char* notesFilesVariable =
+ cmProp notesFilesVariable =
this->Makefile->GetDefinition("CTEST_NOTES_FILES");
if (notesFilesVariable) {
- std::vector<std::string> notesFiles = cmExpandedList(notesFilesVariable);
+ std::vector<std::string> notesFiles = cmExpandedList(*notesFilesVariable);
this->CTest->GenerateNotesFile(notesFiles);
}
- const char* extraFilesVariable =
+ cmProp extraFilesVariable =
this->Makefile->GetDefinition("CTEST_EXTRA_SUBMIT_FILES");
if (extraFilesVariable) {
- std::vector<std::string> extraFiles = cmExpandedList(extraFilesVariable);
+ std::vector<std::string> extraFiles = cmExpandedList(*extraFilesVariable);
if (!this->CTest->SubmitExtraFiles(extraFiles)) {
this->SetError("problem submitting extra files.");
return nullptr;
diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h
index 9060771..c5d11df 100644
--- a/Source/CTest/cmCTestSubmitCommand.h
+++ b/Source/CTest/cmCTestSubmitCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestSubmitCommand_h
-#define cmCTestSubmitCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -55,5 +54,3 @@ protected:
std::vector<std::string> HttpHeaders;
std::vector<std::string> Parts;
};
-
-#endif
diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h
index 304daaa..809c615 100644
--- a/Source/CTest/cmCTestSubmitHandler.h
+++ b/Source/CTest/cmCTestSubmitHandler.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestSubmitHandler_h
-#define cmCTestSubmitHandler_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -77,5 +76,3 @@ private:
std::set<std::string> Files;
std::vector<std::string> HttpHeaders;
};
-
-#endif
diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx
index cbc3c0c..4403733 100644
--- a/Source/CTest/cmCTestTestCommand.cxx
+++ b/Source/CTest/cmCTestTestCommand.cxx
@@ -40,12 +40,11 @@ void cmCTestTestCommand::BindArguments()
cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
{
- const char* ctestTimeout =
- this->Makefile->GetDefinition("CTEST_TEST_TIMEOUT");
+ cmProp ctestTimeout = this->Makefile->GetDefinition("CTEST_TEST_TIMEOUT");
cmDuration timeout;
if (ctestTimeout) {
- timeout = cmDuration(atof(ctestTimeout));
+ timeout = cmDuration(atof(ctestTimeout->c_str()));
} else {
timeout = this->CTest->GetTimeOut();
if (timeout <= cmDuration::zero()) {
@@ -55,10 +54,10 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
}
this->CTest->SetTimeOut(timeout);
- const char* resourceSpecFile =
+ cmProp resourceSpecFile =
this->Makefile->GetDefinition("CTEST_RESOURCE_SPEC_FILE");
if (this->ResourceSpecFile.empty() && resourceSpecFile) {
- this->ResourceSpecFile = resourceSpecFile;
+ this->ResourceSpecFile = *resourceSpecFile;
}
cmCTestGenericHandler* handler = this->InitializeActualHandler();
@@ -115,7 +114,7 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
// or CTEST_TEST_LOAD script variable, or ctest --test-load
// command line argument... in that order.
unsigned long testLoad;
- const char* ctestTestLoad = this->Makefile->GetDefinition("CTEST_TEST_LOAD");
+ cmProp ctestTestLoad = this->Makefile->GetDefinition("CTEST_TEST_LOAD");
if (!this->TestLoad.empty()) {
if (!cmStrToULong(this->TestLoad, &testLoad)) {
testLoad = 0;
@@ -124,10 +123,10 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
<< std::endl);
}
} else if (cmNonempty(ctestTestLoad)) {
- if (!cmStrToULong(ctestTestLoad, &testLoad)) {
+ if (!cmStrToULong(*ctestTestLoad, &testLoad)) {
testLoad = 0;
cmCTestLog(this->CTest, WARNING,
- "Invalid value for 'CTEST_TEST_LOAD' : " << ctestTestLoad
+ "Invalid value for 'CTEST_TEST_LOAD' : " << *ctestTestLoad
<< std::endl);
}
} else {
@@ -136,7 +135,7 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
handler->SetTestLoad(testLoad);
if (cmProp labelsForSubprojects =
- this->Makefile->GetDef("CTEST_LABELS_FOR_SUBPROJECTS")) {
+ this->Makefile->GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) {
this->CTest->SetCTestConfiguration("LabelsForSubprojects",
*labelsForSubprojects, this->Quiet);
}
diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h
index 7925586..624cd91 100644
--- a/Source/CTest/cmCTestTestCommand.h
+++ b/Source/CTest/cmCTestTestCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestTestCommand_h
-#define cmCTestTestCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -62,5 +61,3 @@ protected:
std::string ResourceSpecFile;
bool StopOnFailure = false;
};
-
-#endif
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index abd1207..4d1a589 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -37,6 +37,7 @@
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStateSnapshot.h"
#include "cmStringAlgorithms.h"
@@ -1764,9 +1765,9 @@ bool cmCTestTestHandler::GetListOfTests()
// SEND_ERROR or FATAL_ERROR in CTestTestfile or TEST_INCLUDE_FILES
return false;
}
- const char* specFile = mf.GetDefinition("CTEST_RESOURCE_SPEC_FILE");
+ cmProp specFile = mf.GetDefinition("CTEST_RESOURCE_SPEC_FILE");
if (this->ResourceSpecFile.empty() && specFile) {
- this->ResourceSpecFile = specFile;
+ this->ResourceSpecFile = *specFile;
}
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Done constructing a list of tests" << std::endl,
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index f9e9391..aa29eeb 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestTestHandler_h
-#define cmCTestTestHandler_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -360,5 +359,3 @@ private:
int RepeatCount = 1;
bool RerunFailed;
};
-
-#endif
diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx
index 95cae13..6fef90a 100644
--- a/Source/CTest/cmCTestUpdateCommand.cxx
+++ b/Source/CTest/cmCTestUpdateCommand.cxx
@@ -5,6 +5,7 @@
#include "cmCTest.h"
#include "cmCTestUpdateHandler.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmSystemTools.h"
cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler()
@@ -17,7 +18,7 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler()
this->CTest->SetCTestConfiguration(
"SourceDirectory",
cmSystemTools::CollapseFullPath(
- this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY")),
+ cmToCStrSafe(this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY"))),
this->Quiet);
}
std::string source_dir =
diff --git a/Source/CTest/cmCTestUpdateCommand.h b/Source/CTest/cmCTestUpdateCommand.h
index 5555c16..e4c3453 100644
--- a/Source/CTest/cmCTestUpdateCommand.h
+++ b/Source/CTest/cmCTestUpdateCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestUpdateCommand_h
-#define cmCTestUpdateCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -42,5 +41,3 @@ public:
protected:
cmCTestGenericHandler* InitializeHandler() override;
};
-
-#endif
diff --git a/Source/CTest/cmCTestUpdateHandler.h b/Source/CTest/cmCTestUpdateHandler.h
index afc0e3d..25bbb2f 100644
--- a/Source/CTest/cmCTestUpdateHandler.h
+++ b/Source/CTest/cmCTestUpdateHandler.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestUpdateHandler_h
-#define cmCTestUpdateHandler_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -63,5 +62,3 @@ private:
int DetectVCS(const char* dir);
bool SelectVCS();
};
-
-#endif
diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h
index 8334a9e..fe155f6 100644
--- a/Source/CTest/cmCTestUploadCommand.h
+++ b/Source/CTest/cmCTestUploadCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestUploadCommand_h
-#define cmCTestUploadCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -48,5 +47,3 @@ protected:
std::vector<std::string> Files;
};
-
-#endif
diff --git a/Source/CTest/cmCTestUploadHandler.h b/Source/CTest/cmCTestUploadHandler.h
index dde14df..55d21c1 100644
--- a/Source/CTest/cmCTestUploadHandler.h
+++ b/Source/CTest/cmCTestUploadHandler.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestUploadHandler_h
-#define cmCTestUploadHandler_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -36,5 +35,3 @@ public:
private:
std::set<std::string> Files;
};
-
-#endif
diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h
index 3037e01..9bd7229 100644
--- a/Source/CTest/cmCTestVC.h
+++ b/Source/CTest/cmCTestVC.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTestVC_h
-#define cmCTestVC_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -150,5 +149,3 @@ protected:
// Count paths reported with each PathStatus value.
int PathCount[3];
};
-
-#endif
diff --git a/Source/CTest/cmParseBlanketJSCoverage.h b/Source/CTest/cmParseBlanketJSCoverage.h
index cd1b225..e107454 100644
--- a/Source/CTest/cmParseBlanketJSCoverage.h
+++ b/Source/CTest/cmParseBlanketJSCoverage.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmParseBlanketJSCoverage_h
-#define cmParseBlanketJSCoverage_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -39,4 +38,3 @@ protected:
cmCTestCoverageHandlerContainer& Coverage;
cmCTest* CTest;
};
-#endif
diff --git a/Source/CTest/cmParseCacheCoverage.h b/Source/CTest/cmParseCacheCoverage.h
index a8200b7..523f83b 100644
--- a/Source/CTest/cmParseCacheCoverage.h
+++ b/Source/CTest/cmParseCacheCoverage.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmParseCacheCoverage_h
-#define cmParseCacheCoverage_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -31,5 +30,3 @@ protected:
// Read a single mcov file
bool ReadCMCovFile(const char* f);
};
-
-#endif
diff --git a/Source/CTest/cmParseCoberturaCoverage.h b/Source/CTest/cmParseCoberturaCoverage.h
index cb6d097..0340433 100644
--- a/Source/CTest/cmParseCoberturaCoverage.h
+++ b/Source/CTest/cmParseCoberturaCoverage.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmParseCoberturaCoverage_h
-#define cmParseCoberturaCoverage_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -41,5 +40,3 @@ private:
cmCTest* CTest;
std::string CurFileName;
};
-
-#endif
diff --git a/Source/CTest/cmParseDelphiCoverage.h b/Source/CTest/cmParseDelphiCoverage.h
index 1b37405..2a014a1 100644
--- a/Source/CTest/cmParseDelphiCoverage.h
+++ b/Source/CTest/cmParseDelphiCoverage.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmParseDelphiCoverage_h
-#define cmParseDelphiCoverage_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -35,4 +34,3 @@ protected:
cmCTestCoverageHandlerContainer& Coverage;
cmCTest* CTest;
};
-#endif
diff --git a/Source/CTest/cmParseGTMCoverage.h b/Source/CTest/cmParseGTMCoverage.h
index 41cc7f5..c35bf6e 100644
--- a/Source/CTest/cmParseGTMCoverage.h
+++ b/Source/CTest/cmParseGTMCoverage.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmParseGTMCoverage_h
-#define cmParseGTMCoverage_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -37,5 +36,3 @@ protected:
bool ParseMCOVLine(std::string const& line, std::string& routine,
std::string& function, int& linenumber, int& count);
};
-
-#endif
diff --git a/Source/CTest/cmParseJacocoCoverage.h b/Source/CTest/cmParseJacocoCoverage.h
index f2aec6d..3442dd0 100644
--- a/Source/CTest/cmParseJacocoCoverage.h
+++ b/Source/CTest/cmParseJacocoCoverage.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmParseJacocoCoverage_h
-#define cmParseJacocoCoverage_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -49,5 +48,3 @@ private:
cmCTestCoverageHandlerContainer& Coverage;
cmCTest* CTest;
};
-
-#endif
diff --git a/Source/CTest/cmParseMumpsCoverage.h b/Source/CTest/cmParseMumpsCoverage.h
index 8c08702..00a8431 100644
--- a/Source/CTest/cmParseMumpsCoverage.h
+++ b/Source/CTest/cmParseMumpsCoverage.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmParseMumpsCoverage_h
-#define cmParseMumpsCoverage_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -43,5 +42,3 @@ protected:
cmCTestCoverageHandlerContainer& Coverage;
cmCTest* CTest;
};
-
-#endif
diff --git a/Source/CTest/cmParsePHPCoverage.h b/Source/CTest/cmParsePHPCoverage.h
index ff0e636..763a6bb 100644
--- a/Source/CTest/cmParsePHPCoverage.h
+++ b/Source/CTest/cmParsePHPCoverage.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmParsePHPCoverage_h
-#define cmParsePHPCoverage_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -35,5 +34,3 @@ private:
cmCTestCoverageHandlerContainer& Coverage;
cmCTest* CTest;
};
-
-#endif
diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h
index 1e6578c..9eec952 100644
--- a/Source/CTest/cmProcess.h
+++ b/Source/CTest/cmProcess.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmProcess_h
-#define cmProcess_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -132,5 +131,3 @@ private:
int Id;
int64_t ExitValue;
};
-
-#endif
diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake
index e726fc7..5c1593d 100644
--- a/Source/Checks/cm_cxx_features.cmake
+++ b/Source/Checks/cm_cxx_features.cmake
@@ -1,6 +1,7 @@
include(${CMAKE_CURRENT_LIST_DIR}/cm_message_checks_compat.cmake)
function(cm_check_cxx_feature name)
+ set(TRY_RUN_FEATURE "${ARGN}")
string(TOUPPER ${name} FEATURE)
if(NOT DEFINED CMake_HAVE_CXX_${FEATURE})
cm_message_checks_compat(
@@ -12,12 +13,26 @@ function(cm_check_cxx_feature name)
else()
set(maybe_cxx_standard "")
endif()
- try_compile(CMake_HAVE_CXX_${FEATURE}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_LIST_DIR}/cm_cxx_${name}.cxx
- CMAKE_FLAGS ${maybe_cxx_standard}
- OUTPUT_VARIABLE OUTPUT
- )
+ if (TRY_RUN_FEATURE)
+ try_run(CMake_RUN_CXX_${FEATURE} CMake_COMPILE_CXX_${FEATURE}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_LIST_DIR}/cm_cxx_${name}.cxx
+ CMAKE_FLAGS ${maybe_cxx_standard}
+ OUTPUT_VARIABLE OUTPUT
+ )
+ if (CMake_RUN_CXX_${FEATURE} EQUAL "0" AND CMake_COMPILE_CXX_${FEATURE})
+ set(CMake_HAVE_CXX_${FEATURE} ON CACHE INTERNAL "TRY_RUN" FORCE)
+ else()
+ set(CMake_HAVE_CXX_${FEATURE} OFF CACHE INTERNAL "TRY_RUN" FORCE)
+ endif()
+ else()
+ try_compile(CMake_HAVE_CXX_${FEATURE}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_LIST_DIR}/cm_cxx_${name}.cxx
+ CMAKE_FLAGS ${maybe_cxx_standard}
+ OUTPUT_VARIABLE OUTPUT
+ )
+ endif()
set(check_output "${OUTPUT}")
# Filter out MSBuild output that looks like a warning.
string(REGEX REPLACE " +0 Warning\\(s\\)" "" check_output "${check_output}")
@@ -64,7 +79,7 @@ if(CMake_HAVE_CXX_MAKE_UNIQUE)
endif()
cm_check_cxx_feature(unique_ptr)
if (NOT CMAKE_CXX_STANDARD LESS "17")
- cm_check_cxx_feature(filesystem)
+ cm_check_cxx_feature(filesystem TRY_RUN)
else()
set(CMake_HAVE_CXX_FILESYSTEM FALSE)
endif()
diff --git a/Source/Checks/cm_cxx_filesystem.cxx b/Source/Checks/cm_cxx_filesystem.cxx
index e508d1c..ae8acc5 100644
--- a/Source/Checks/cm_cxx_filesystem.cxx
+++ b/Source/Checks/cm_cxx_filesystem.cxx
@@ -3,8 +3,25 @@
int main()
{
+ std::filesystem::path p0(L"/a/b/c");
+
std::filesystem::path p1("/a/b/c");
std::filesystem::path p2("/a/b/c");
+ if (p1 != p2) {
+ return 1;
+ }
+
+#if defined(_WIN32)
+ std::filesystem::path p3("//host/a/b/../c");
+ if (p3.lexically_normal().generic_string() != "//host/a/c") {
+ return 1;
+ }
+
+ std::filesystem::path p4("c://a/.///b/../");
+ if (p4.lexically_normal().generic_string() != "c:/a/") {
+ return 1;
+ }
+#endif
- return p1 == p2 ? 0 : 1;
+ return 0;
}
diff --git a/Source/CursesDialog/cmCursesBoolWidget.h b/Source/CursesDialog/cmCursesBoolWidget.h
index 8c96256..746825b 100644
--- a/Source/CursesDialog/cmCursesBoolWidget.h
+++ b/Source/CursesDialog/cmCursesBoolWidget.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCursesBoolWidget_h
-#define cmCursesBoolWidget_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -29,5 +28,3 @@ public:
void SetValueAsBool(bool value);
bool GetValueAsBool();
};
-
-#endif // cmCursesBoolWidget_h
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h
index a711363..d414918 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.h
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCursesCacheEntryComposite_h
-#define cmCursesCacheEntryComposite_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -41,5 +40,3 @@ protected:
int LabelWidth;
int EntryWidth;
};
-
-#endif // cmCursesCacheEntryComposite_h
diff --git a/Source/CursesDialog/cmCursesColor.h b/Source/CursesDialog/cmCursesColor.h
index f83265f..4e8a1e4 100644
--- a/Source/CursesDialog/cmCursesColor.h
+++ b/Source/CursesDialog/cmCursesColor.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCursesColor_h
-#define cmCursesColor_h
+#pragma once
class cmCursesColor
{
@@ -23,5 +22,3 @@ public:
protected:
static short GetColor(char id, short fallback);
};
-
-#endif // cmCursesColor_h
diff --git a/Source/CursesDialog/cmCursesDummyWidget.h b/Source/CursesDialog/cmCursesDummyWidget.h
index 07b7288..4347746 100644
--- a/Source/CursesDialog/cmCursesDummyWidget.h
+++ b/Source/CursesDialog/cmCursesDummyWidget.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCursesDummyWidget_h
-#define cmCursesDummyWidget_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -24,5 +23,3 @@ public:
// handled.
bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) override;
};
-
-#endif // cmCursesDummyWidget_h
diff --git a/Source/CursesDialog/cmCursesFilePathWidget.h b/Source/CursesDialog/cmCursesFilePathWidget.h
index 3f71259..2ae5d14 100644
--- a/Source/CursesDialog/cmCursesFilePathWidget.h
+++ b/Source/CursesDialog/cmCursesFilePathWidget.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCursesFilePathWidget_h
-#define cmCursesFilePathWidget_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -15,5 +14,3 @@ public:
cmCursesFilePathWidget(cmCursesFilePathWidget const&) = delete;
cmCursesFilePathWidget& operator=(cmCursesFilePathWidget const&) = delete;
};
-
-#endif // cmCursesFilePathWidget_h
diff --git a/Source/CursesDialog/cmCursesForm.h b/Source/CursesDialog/cmCursesForm.h
index e3626e6..93459b9 100644
--- a/Source/CursesDialog/cmCursesForm.h
+++ b/Source/CursesDialog/cmCursesForm.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCursesForm_h
-#define cmCursesForm_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -62,5 +61,3 @@ protected:
FORM* Form;
};
-
-#endif // cmCursesForm_h
diff --git a/Source/CursesDialog/cmCursesLabelWidget.h b/Source/CursesDialog/cmCursesLabelWidget.h
index 9e75681..c10aa37 100644
--- a/Source/CursesDialog/cmCursesLabelWidget.h
+++ b/Source/CursesDialog/cmCursesLabelWidget.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCursesLabelWidget_h
-#define cmCursesLabelWidget_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -28,5 +27,3 @@ public:
// handled
bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) override;
};
-
-#endif // cmCursesLabelWidget_h
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.h b/Source/CursesDialog/cmCursesLongMessageForm.h
index da9fea2..4f69cb1 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.h
+++ b/Source/CursesDialog/cmCursesLongMessageForm.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCursesLongMessageForm_h
-#define cmCursesLongMessageForm_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -59,5 +58,3 @@ protected:
FIELD* Fields[2];
};
-
-#endif // cmCursesLongMessageForm_h
diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h
index 2e06b90..c6db66f 100644
--- a/Source/CursesDialog/cmCursesMainForm.h
+++ b/Source/CursesDialog/cmCursesMainForm.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCursesMainForm_h
-#define cmCursesMainForm_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -170,5 +169,3 @@ protected:
std::string OldSearchString;
bool SearchMode;
};
-
-#endif // cmCursesMainForm_h
diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h
index 0de8e64..cb06e4d 100644
--- a/Source/CursesDialog/cmCursesOptionsWidget.h
+++ b/Source/CursesDialog/cmCursesOptionsWidget.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCursesOptionsWidget_h
-#define cmCursesOptionsWidget_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -35,5 +34,3 @@ protected:
std::vector<std::string> Options;
std::vector<std::string>::size_type CurrentOption;
};
-
-#endif // cmCursesOptionsWidget_h
diff --git a/Source/CursesDialog/cmCursesPathWidget.h b/Source/CursesDialog/cmCursesPathWidget.h
index fb365e9..79e342e 100644
--- a/Source/CursesDialog/cmCursesPathWidget.h
+++ b/Source/CursesDialog/cmCursesPathWidget.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCursesPathWidget_h
-#define cmCursesPathWidget_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -34,5 +33,3 @@ protected:
bool Cycle;
std::string::size_type CurrentIndex;
};
-
-#endif // cmCursesPathWidget_h
diff --git a/Source/CursesDialog/cmCursesStandardIncludes.h b/Source/CursesDialog/cmCursesStandardIncludes.h
index 5b0ad58..9745b97 100644
--- a/Source/CursesDialog/cmCursesStandardIncludes.h
+++ b/Source/CursesDialog/cmCursesStandardIncludes.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCursesStandardIncludes_h
-#define cmCursesStandardIncludes_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -41,5 +40,3 @@ inline void curses_clear()
# undef __attribute__
#endif
#undef cm_no__attribute__
-
-#endif // cmCursesStandardIncludes_h
diff --git a/Source/CursesDialog/cmCursesStringWidget.h b/Source/CursesDialog/cmCursesStringWidget.h
index ce06c6d..faa2ade 100644
--- a/Source/CursesDialog/cmCursesStringWidget.h
+++ b/Source/CursesDialog/cmCursesStringWidget.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCursesStringWidget_h
-#define cmCursesStringWidget_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -65,5 +64,3 @@ protected:
std::string OriginalString;
bool Done;
};
-
-#endif // cmCursesStringWidget_h
diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h
index 9d03c6e..29ec28b 100644
--- a/Source/CursesDialog/cmCursesWidget.h
+++ b/Source/CursesDialog/cmCursesWidget.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCursesWidget_h
-#define cmCursesWidget_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -68,5 +67,3 @@ protected:
// The page in the main form this widget is in
int Page;
};
-
-#endif // cmCursesWidget_h
diff --git a/Source/LexerParser/cmCommandArgumentLexer.cxx b/Source/LexerParser/cmCommandArgumentLexer.cxx
index 5879912..46220ff 100644
--- a/Source/LexerParser/cmCommandArgumentLexer.cxx
+++ b/Source/LexerParser/cmCommandArgumentLexer.cxx
@@ -653,7 +653,7 @@ This file must be translated to C++ and modified to build everywhere.
Run flex >= 2.6 like this:
- flex --nounistd -DFLEXINT_H --noline --header-file=cmCommandArgumentLexer.h -ocmCommandArgumentLexer.cxx cmCommandArgumentLexer.in.l
+ flex --nounistd --never-interactive --batch -DFLEXINT_H --noline --header-file=cmCommandArgumentLexer.h -ocmCommandArgumentLexer.cxx cmCommandArgumentLexer.in.l
Modify cmCommandArgumentLexer.cxx:
- remove trailing whitespace: sed -i 's/\s*$//' cmCommandArgumentLexer.h cmCommandArgumentLexer.cxx
@@ -668,10 +668,7 @@ Modify cmCommandArgumentLexer.cxx:
#include "cmCommandArgumentParserHelper.h"
-/* Replace the lexer input function. */
-#undef YY_INPUT
-#define YY_INPUT(buf, result, max_size) \
- do { result = yyextra->LexInput(buf, max_size); } while (0)
+#define YY_USER_ACTION yyextra->UpdateInputPosition(yyleng);
/* Include the set of tokens from the parser. */
#include "cmCommandArgumentParserTokens.h"
@@ -967,16 +964,12 @@ yy_match:
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
++yy_cp;
}
- while ( yy_base[yy_current_state] != 41 );
+ while ( yy_current_state != 29 );
+ yy_cp = yyg->yy_last_accepting_cpos;
+ yy_current_state = yyg->yy_last_accepting_state;
yy_find_action:
yy_act = yy_accept[yy_current_state];
- if ( yy_act == 0 )
- { /* have to back up */
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
- yy_act = yy_accept[yy_current_state];
- }
YY_DO_BEFORE_ACTION;
@@ -1173,7 +1166,8 @@ case YY_STATE_EOF(NOESCAPES):
else
{
- yy_cp = yyg->yy_c_buf_p;
+ yy_cp = yyg->yy_last_accepting_cpos;
+ yy_current_state = yyg->yy_last_accepting_state;
goto yy_find_action;
}
}
@@ -1661,7 +1655,7 @@ static void yy_load_buffer_state (yyscan_t yyscanner)
b->yy_bs_column = 0;
}
- b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+ b->yy_is_interactive = 0;
errno = oerrno;
}
diff --git a/Source/LexerParser/cmCommandArgumentLexer.in.l b/Source/LexerParser/cmCommandArgumentLexer.in.l
index 010d54b..8ad2335 100644
--- a/Source/LexerParser/cmCommandArgumentLexer.in.l
+++ b/Source/LexerParser/cmCommandArgumentLexer.in.l
@@ -7,7 +7,7 @@ This file must be translated to C++ and modified to build everywhere.
Run flex >= 2.6 like this:
- flex --nounistd -DFLEXINT_H --noline --header-file=cmCommandArgumentLexer.h -ocmCommandArgumentLexer.cxx cmCommandArgumentLexer.in.l
+ flex --nounistd --never-interactive --batch -DFLEXINT_H --noline --header-file=cmCommandArgumentLexer.h -ocmCommandArgumentLexer.cxx cmCommandArgumentLexer.in.l
Modify cmCommandArgumentLexer.cxx:
- remove trailing whitespace: sed -i 's/\s*$//' cmCommandArgumentLexer.h cmCommandArgumentLexer.cxx
@@ -22,10 +22,7 @@ Modify cmCommandArgumentLexer.cxx:
#include "cmCommandArgumentParserHelper.h"
-/* Replace the lexer input function. */
-#undef YY_INPUT
-#define YY_INPUT(buf, result, max_size) \
- do { result = yyextra->LexInput(buf, max_size); } while (0)
+#define YY_USER_ACTION yyextra->UpdateInputPosition(yyleng);
/* Include the set of tokens from the parser. */
#include "cmCommandArgumentParserTokens.h"
diff --git a/Source/QtDialog/AddCacheEntry.h b/Source/QtDialog/AddCacheEntry.h
index e7a60dd..35522c5 100644
--- a/Source/QtDialog/AddCacheEntry.h
+++ b/Source/QtDialog/AddCacheEntry.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef AddCacheEntry_h
-#define AddCacheEntry_h
+#pragma once
#include "QCMake.h"
#include <QCheckBox>
@@ -32,5 +31,3 @@ private:
const QStringList& VarNames;
const QStringList& VarTypes;
};
-
-#endif
diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h
index 914be12..eba0b1e 100644
--- a/Source/QtDialog/CMakeSetupDialog.h
+++ b/Source/QtDialog/CMakeSetupDialog.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef CMakeSetupDialog_h
-#define CMakeSetupDialog_h
+#pragma once
#include <memory>
@@ -146,5 +145,3 @@ protected:
virtual void run();
std::unique_ptr<QCMake> CMakeInstance;
};
-
-#endif // CMakeSetupDialog_h
diff --git a/Source/QtDialog/Compilers.h b/Source/QtDialog/Compilers.h
index 931c935..5da0781 100644
--- a/Source/QtDialog/Compilers.h
+++ b/Source/QtDialog/Compilers.h
@@ -1,7 +1,6 @@
-#ifndef COMPILERS_HPP
-#define COMPILERS_HPP
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -21,5 +20,3 @@ public:
this->setupUi(this);
}
};
-
-#endif
diff --git a/Source/QtDialog/FirstConfigure.h b/Source/QtDialog/FirstConfigure.h
index c26f489..4c757da 100644
--- a/Source/QtDialog/FirstConfigure.h
+++ b/Source/QtDialog/FirstConfigure.h
@@ -1,6 +1,5 @@
-#ifndef FirstConfigure_h
-#define FirstConfigure_h
+#pragma once
#include <QWizard>
#include <QWizardPage>
@@ -201,5 +200,3 @@ protected:
ToolchainCompilerSetup* mToolchainCompilerSetupPage;
QString mDefaultGenerator;
};
-
-#endif // FirstConfigure_h
diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h
index 39555d6..e87660b 100644
--- a/Source/QtDialog/QCMake.h
+++ b/Source/QtDialog/QCMake.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef QCMake_h
-#define QCMake_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -182,5 +181,3 @@ protected:
QString CMakeExecutable;
QAtomicInt InterruptFlag;
};
-
-#endif // QCMake_h
diff --git a/Source/QtDialog/QCMakeCacheView.h b/Source/QtDialog/QCMakeCacheView.h
index a252708..836a939 100644
--- a/Source/QtDialog/QCMakeCacheView.h
+++ b/Source/QtDialog/QCMakeCacheView.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef QCMakeCacheView_h
-#define QCMakeCacheView_h
+#pragma once
#include "QCMake.h"
#include <QItemDelegate>
@@ -164,5 +163,3 @@ protected:
// properties changed by user via this delegate
QSet<QCMakeProperty> mChanges;
};
-
-#endif
diff --git a/Source/QtDialog/QCMakeWidgets.h b/Source/QtDialog/QCMakeWidgets.h
index 5d2368e..9a2a27e 100644
--- a/Source/QtDialog/QCMakeWidgets.h
+++ b/Source/QtDialog/QCMakeWidgets.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef QCMakeWidgets_h
-#define QCMakeWidgets_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -77,5 +76,3 @@ public:
}
}
};
-
-#endif
diff --git a/Source/QtDialog/RegexExplorer.h b/Source/QtDialog/RegexExplorer.h
index 1a1d770..9a42320 100644
--- a/Source/QtDialog/RegexExplorer.h
+++ b/Source/QtDialog/RegexExplorer.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef RegexExplorer_h
-#define RegexExplorer_h
+#pragma once
#include <string>
@@ -39,5 +38,3 @@ private:
std::string m_regex;
bool m_matched;
};
-
-#endif
diff --git a/Source/QtDialog/WarningMessagesDialog.h b/Source/QtDialog/WarningMessagesDialog.h
index f209dbd..bb01704 100644
--- a/Source/QtDialog/WarningMessagesDialog.h
+++ b/Source/QtDialog/WarningMessagesDialog.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef WarningMessagesDialog_h
-#define WarningMessagesDialog_h
+#pragma once
#include "QCMake.h"
#include <QDialog>
@@ -63,5 +62,3 @@ private:
*/
void setupSignals();
};
-
-#endif /* MessageDialog_h */
diff --git a/Source/bindexplib.h b/Source/bindexplib.h
index 538177d..bd1398f 100644
--- a/Source/bindexplib.h
+++ b/Source/bindexplib.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef bindexplib_h
-#define bindexplib_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -25,4 +24,3 @@ private:
std::set<std::string> DataSymbols;
std::string NmPath;
};
-#endif
diff --git a/Source/cmAddCompileDefinitionsCommand.h b/Source/cmAddCompileDefinitionsCommand.h
index 4bd621c..29282d6 100644
--- a/Source/cmAddCompileDefinitionsCommand.h
+++ b/Source/cmAddCompileDefinitionsCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmAddCompileDefinitionsCommand_h
-#define cmAddCompileDefinitionsCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmAddCompileDefinitionsCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmAddCompileOptionsCommand.h b/Source/cmAddCompileOptionsCommand.h
index b172412..076a427 100644
--- a/Source/cmAddCompileOptionsCommand.h
+++ b/Source/cmAddCompileOptionsCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmAddCompileOptionsCommand_h
-#define cmAddCompileOptionsCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmAddCompileOptionsCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h
index 4f8c58f..383d116 100644
--- a/Source/cmAddCustomCommandCommand.h
+++ b/Source/cmAddCustomCommandCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmAddCustomCommandCommand_h
-#define cmAddCustomCommandCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h
index e23ef9f..3b784cb 100644
--- a/Source/cmAddCustomTargetCommand.h
+++ b/Source/cmAddCustomTargetCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmAddCustomTargetCommand_h
-#define cmAddCustomTargetCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmAddCustomTargetCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h
index a67f095..45b4554 100644
--- a/Source/cmAddDefinitionsCommand.h
+++ b/Source/cmAddDefinitionsCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmAddDefinitionsCommand_h
-#define cmAddDefinitionsCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmAddDefinitionsCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h
index 0c60e3a..a767550 100644
--- a/Source/cmAddDependenciesCommand.h
+++ b/Source/cmAddDependenciesCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmDependenciessCommand_h
-#define cmDependenciessCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmAddDependenciesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h
index f7bc273..032c14d 100644
--- a/Source/cmAddExecutableCommand.h
+++ b/Source/cmAddExecutableCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExecutablesCommand_h
-#define cmExecutablesCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmAddExecutableCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h
index 609449c..a4a0ea0 100644
--- a/Source/cmAddLibraryCommand.h
+++ b/Source/cmAddLibraryCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLibrarysCommand_h
-#define cmLibrarysCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmAddLibraryCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmAddLinkOptionsCommand.h b/Source/cmAddLinkOptionsCommand.h
index 466fc32..5c9d5e4 100644
--- a/Source/cmAddLinkOptionsCommand.h
+++ b/Source/cmAddLinkOptionsCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmAddLinkOptionsCommand_h
-#define cmAddLinkOptionsCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmAddLinkOptionsCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h
index 87da840..ece3b27 100644
--- a/Source/cmAddSubDirectoryCommand.h
+++ b/Source/cmAddSubDirectoryCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmAddSubDirectoryCommand_h
-#define cmAddSubDirectoryCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmAddSubDirectoryCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h
index 5877547..8cba2b1 100644
--- a/Source/cmAddTestCommand.h
+++ b/Source/cmAddTestCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmAddTestCommand_h
-#define cmAddTestCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmAddTestCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index c8e8dcb..87000da 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmAlgorithms_h
-#define cmAlgorithms_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -143,5 +142,3 @@ typename Range::const_iterator cmFindNot(Range const& r, T const& t)
{
return std::find_if(r.begin(), r.end(), [&t](T const& i) { return i != t; });
}
-
-#endif
diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h
index b643bce..fff4556 100644
--- a/Source/cmArchiveWrite.h
+++ b/Source/cmArchiveWrite.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmArchiveWrite_h
-#define cmArchiveWrite_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -180,5 +179,3 @@ private:
cmArchiveWriteOptional<int> Permissions;
cmArchiveWriteOptional<int> PermissionsMask;
};
-
-#endif
diff --git a/Source/cmArgumentParser.h b/Source/cmArgumentParser.h
index 5d2dfa2..71ed844 100644
--- a/Source/cmArgumentParser.h
+++ b/Source/cmArgumentParser.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmArgumentParser_h
-#define cmArgumentParser_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -146,5 +145,3 @@ protected:
private:
ArgumentParser::ActionMap Bindings;
};
-
-#endif
diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx
index 53d4cb4..15edcc5 100644
--- a/Source/cmAuxSourceDirectoryCommand.cxx
+++ b/Source/cmAuxSourceDirectoryCommand.cxx
@@ -36,10 +36,7 @@ bool cmAuxSourceDirectoryCommand(std::vector<std::string> const& args,
}
// was the list already populated
- const char* def = mf.GetDefinition(args[1]);
- if (def) {
- sourceListValue = def;
- }
+ sourceListValue = mf.GetSafeDefinition(args[1]);
std::vector<std::string> files;
diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h
index ae26092..29ee429 100644
--- a/Source/cmAuxSourceDirectoryCommand.h
+++ b/Source/cmAuxSourceDirectoryCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmAuxSourceDirectoryCommand_h
-#define cmAuxSourceDirectoryCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmAuxSourceDirectoryCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmBase32.h b/Source/cmBase32.h
index d85198d..726f45d 100644
--- a/Source/cmBase32.h
+++ b/Source/cmBase32.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmBase32_h
-#define cmBase32_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -29,5 +28,3 @@ public:
std::string encodeString(const unsigned char* input, size_t len,
bool padding = true);
};
-
-#endif
diff --git a/Source/cmBinUtilsLinker.h b/Source/cmBinUtilsLinker.h
index 78d517b..5330070 100644
--- a/Source/cmBinUtilsLinker.h
+++ b/Source/cmBinUtilsLinker.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmBinUtilsLinker_h
-#define cmBinUtilsLinker_h
+#pragma once
#include <string>
@@ -26,5 +25,3 @@ protected:
void SetError(const std::string& e);
};
-
-#endif // cmBinUtilsLinker_h
diff --git a/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h b/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h
index d514e7f..15216a4 100644
--- a/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h
+++ b/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmBinUtilsLinuxELFGetRuntimeDependenciesTool_h
-#define cmBinUtilsLinuxELFGetRuntimeDependenciesTool_h
+#pragma once
#include <string>
#include <vector>
@@ -26,5 +25,3 @@ protected:
void SetError(const std::string& e);
};
-
-#endif // cmBinUtilsLinuxELFGetRuntimeDependenciesTool_h
diff --git a/Source/cmBinUtilsLinuxELFLinker.h b/Source/cmBinUtilsLinuxELFLinker.h
index b17df11..4e7e36d 100644
--- a/Source/cmBinUtilsLinuxELFLinker.h
+++ b/Source/cmBinUtilsLinuxELFLinker.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmBinUtilsLinuxELFLinker_h
-#define cmBinUtilsLinuxELFLinker_h
+#pragma once
#include <memory>
#include <string>
@@ -40,5 +39,3 @@ private:
bool GetLDConfigPaths();
};
-
-#endif // cmBinUtilsLinuxELFLinker_h
diff --git a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h
index 969e4d4..def1dd0 100644
--- a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h
+++ b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmBinUtilsLinuxELFGetRuntimeCollectDependenciesTool_h
-#define cmBinUtilsLinuxELFGetRuntimeCollectDependenciesTool_h
+#pragma once
#include <string>
#include <vector>
@@ -22,5 +21,3 @@ public:
std::vector<std::string>& rpaths,
std::vector<std::string>& runpaths) override;
};
-
-#endif // cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool_h
diff --git a/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h b/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h
index dbb2882..60d34aa 100644
--- a/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h
+++ b/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmBinUtilsMacOSMachOGetRuntimeDependenciesTool_h
-#define cmBinUtilsMacOSMachOGetRuntimeDependenciesTool_h
+#pragma once
#include <string>
#include <vector>
@@ -25,5 +24,3 @@ protected:
void SetError(const std::string& error);
};
-
-#endif // cmBinUtilsMacOSMachOGetRuntimeDependenciesTool_h
diff --git a/Source/cmBinUtilsMacOSMachOLinker.h b/Source/cmBinUtilsMacOSMachOLinker.h
index 4a24ea3..1c4a5fc 100644
--- a/Source/cmBinUtilsMacOSMachOLinker.h
+++ b/Source/cmBinUtilsMacOSMachOLinker.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmBinUtilsMacOSMachOLinker_h
-#define cmBinUtilsMacOSMachOLinker_h
+#pragma once
#include <memory>
#include <string>
@@ -55,5 +54,3 @@ private:
std::vector<std::string> const& rpaths,
std::string& path, bool& resolved);
};
-
-#endif // cmBinUtilsMacOSMachOLinker_h
diff --git a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h
index 8ac7e18..9d17450 100644
--- a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h
+++ b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool_h
-#define cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool_h
+#pragma once
#include <string>
#include <vector>
@@ -21,5 +20,3 @@ public:
bool GetFileInfo(std::string const& file, std::vector<std::string>& libs,
std::vector<std::string>& rpaths) override;
};
-
-#endif // cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool_h
diff --git a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h
index eae22ea..8609479 100644
--- a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h
+++ b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool_h
-#define cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool_h
+#pragma once
#include <string>
#include <vector>
@@ -21,5 +20,3 @@ public:
bool GetFileInfo(const std::string& file,
std::vector<std::string>& needed) override;
};
-
-#endif // cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool_h
diff --git a/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h b/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h
index e9e402b..da71aaa 100644
--- a/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h
+++ b/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmBinUtilsWindowsPEGetRuntimeDependenciesTool_h
-#define cmBinUtilsWindowsPEGetRuntimeDependenciesTool_h
+#pragma once
#include <string>
#include <vector>
@@ -24,5 +23,3 @@ protected:
void SetError(const std::string& error);
};
-
-#endif // cmBinUtilsWindowsPEGetRuntimeDependenciesTool_h
diff --git a/Source/cmBinUtilsWindowsPELinker.h b/Source/cmBinUtilsWindowsPELinker.h
index a8bb596..6bb7875 100644
--- a/Source/cmBinUtilsWindowsPELinker.h
+++ b/Source/cmBinUtilsWindowsPELinker.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmBinUtilsWindowsPELinker_h
-#define cmBinUtilsWindowsPELinker_h
+#pragma once
#include <memory>
#include <string>
@@ -29,5 +28,3 @@ private:
bool ResolveDependency(std::string const& name, std::string const& origin,
std::string& path, bool& resolved);
};
-
-#endif // cmBinUtilsWindowsPELinker_h
diff --git a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h
index a67cb0c..fe89a2d 100644
--- a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h
+++ b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool_h
-#define cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool_h
+#pragma once
#include <string>
#include <vector>
@@ -21,5 +20,3 @@ public:
bool GetFileInfo(const std::string& file,
std::vector<std::string>& needed) override;
};
-
-#endif // cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool_h
diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h
index e6ce6fe..6241867 100644
--- a/Source/cmBreakCommand.h
+++ b/Source/cmBreakCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmBreakCommand_h
-#define cmBreakCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -17,5 +16,3 @@ class cmExecutionStatus;
*/
bool cmBreakCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index b82fb9a..2eaf315 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -6,6 +6,7 @@
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmProperty.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -94,7 +95,7 @@ bool TwoArgsSignature(std::vector<std::string> const& args,
cmMakefile& mf = status.GetMakefile();
std::string const& define = args[0];
- const char* cacheValue = mf.GetDefinition(define);
+ cmProp cacheValue = mf.GetDefinition(define);
std::string configType;
if (!cmSystemTools::GetEnv("CMAKE_CONFIG_TYPE", configType) ||
diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h
index 45aa71d..eafe185 100644
--- a/Source/cmBuildCommand.h
+++ b/Source/cmBuildCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmBuildCommand_h
-#define cmBuildCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmBuildCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx
index ad4d665..f9b8f8f 100644
--- a/Source/cmBuildNameCommand.cxx
+++ b/Source/cmBuildNameCommand.cxx
@@ -8,6 +8,7 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
@@ -19,12 +20,12 @@ bool cmBuildNameCommand(std::vector<std::string> const& args,
return false;
}
cmMakefile& mf = status.GetMakefile();
- const char* cacheValue = mf.GetDefinition(args[0]);
+ cmProp cacheValue = mf.GetDefinition(args[0]);
if (cacheValue) {
// do we need to correct the value?
cmsys::RegularExpression reg("[()/]");
- if (reg.find(cacheValue)) {
- std::string cv = cacheValue;
+ std::string cv = *cacheValue;
+ if (reg.find(cv)) {
std::replace(cv.begin(), cv.end(), '/', '_');
std::replace(cv.begin(), cv.end(), '(', '_');
std::replace(cv.begin(), cv.end(), ')', '_');
diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h
index 37a7268..650dc74 100644
--- a/Source/cmBuildNameCommand.h
+++ b/Source/cmBuildNameCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmBuildNameCommand_h
-#define cmBuildNameCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmBuildNameCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmCLocaleEnvironmentScope.h b/Source/cmCLocaleEnvironmentScope.h
index aa2827e..0919acc 100644
--- a/Source/cmCLocaleEnvironmentScope.h
+++ b/Source/cmCLocaleEnvironmentScope.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCLocaleEnvironmentScope_h
-#define cmCLocaleEnvironmentScope_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -25,5 +24,3 @@ private:
using backup_map_t = std::map<std::string, std::string>;
backup_map_t EnvironmentBackup;
};
-
-#endif
diff --git a/Source/cmCMakeHostSystemInformationCommand.h b/Source/cmCMakeHostSystemInformationCommand.h
index 79e3f27..8a64f6a 100644
--- a/Source/cmCMakeHostSystemInformationCommand.h
+++ b/Source/cmCMakeHostSystemInformationCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCMakeHostSystemInformationCommand_h
-#define cmCMakeHostSystemInformationCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -18,5 +17,3 @@ class cmExecutionStatus;
*/
bool cmCMakeHostSystemInformationCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmCMakeLanguageCommand.h b/Source/cmCMakeLanguageCommand.h
index aeb8f60..d45003a 100644
--- a/Source/cmCMakeLanguageCommand.h
+++ b/Source/cmCMakeLanguageCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCMakeLanguageCommand_h
-#define cmCMakeLanguageCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -16,5 +15,3 @@ struct cmListFileArgument;
*/
bool cmCMakeLanguageCommand(std::vector<cmListFileArgument> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h
index 53f78f6..712d6d6 100644
--- a/Source/cmCMakeMinimumRequired.h
+++ b/Source/cmCMakeMinimumRequired.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCMakeMinimumRequired_h
-#define cmCMakeMinimumRequired_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -17,5 +16,3 @@ class cmExecutionStatus;
*/
bool cmCMakeMinimumRequired(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmCMakePath.cxx b/Source/cmCMakePath.cxx
new file mode 100644
index 0000000..b8215df
--- /dev/null
+++ b/Source/cmCMakePath.cxx
@@ -0,0 +1,146 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include "cmCMakePath.h"
+
+#include <string>
+
+#if defined(_WIN32)
+# include <cstdlib>
+#endif
+
+#include <cm/filesystem>
+#include <cm/string_view>
+
+#if defined(_WIN32)
+# include "cmStringAlgorithms.h"
+#endif
+
+cmCMakePath& cmCMakePath::ReplaceWideExtension(cm::string_view extension)
+{
+ auto file = this->Path.filename().string();
+ if (!file.empty() && file != "." && file != "..") {
+ auto pos = file.find('.', file[0] == '.' ? 1 : 0);
+ if (pos != std::string::npos) {
+ file.erase(pos);
+ }
+ }
+ if (!extension.empty()) {
+ if (extension[0] != '.') {
+ file += '.';
+ }
+ file.append(std::string(extension));
+ }
+ this->Path.replace_filename(file);
+ return *this;
+}
+
+cmCMakePath cmCMakePath::GetWideExtension() const
+{
+ auto file = this->Path.filename().string();
+ if (file.empty() || file == "." || file == "..") {
+ return cmCMakePath{};
+ }
+
+ auto pos = file.find('.', file[0] == '.' ? 1 : 0);
+ if (pos != std::string::npos) {
+ return cm::string_view(file.data() + pos, file.length() - pos);
+ }
+
+ return cmCMakePath{};
+}
+
+cmCMakePath cmCMakePath::GetNarrowStem() const
+{
+ auto stem = this->Path.stem().string();
+ if (!stem.empty()) {
+ auto pos = stem.find('.', stem[0] == '.' ? 1 : 0);
+ if (pos != std::string::npos) {
+ return stem.substr(0, pos);
+ }
+ }
+ return stem;
+}
+
+cmCMakePath cmCMakePath::Absolute(const cm::filesystem::path& base) const
+{
+ if (this->Path.is_relative()) {
+ auto path = base;
+ path /= this->Path;
+ // filesystem::path::operator/= use preferred_separator ('\' on Windows)
+ // so converts back to '/'
+ return path.generic_string();
+ }
+ return *this;
+}
+
+bool cmCMakePath::IsPrefix(const cmCMakePath& path) const
+{
+ auto prefix_it = this->Path.begin();
+ auto prefix_end = this->Path.end();
+ auto path_it = path.Path.begin();
+ auto path_end = path.Path.end();
+
+ while (prefix_it != prefix_end && path_it != path_end &&
+ *prefix_it == *path_it) {
+ ++prefix_it;
+ ++path_it;
+ }
+ return prefix_it == prefix_end;
+}
+
+std::string cmCMakePath::FormatPath(std::string path, format fmt)
+{
+#if defined(_WIN32)
+ if (fmt == auto_format || fmt == native_format) {
+ auto prefix = path.substr(0, 4);
+ for (auto& c : prefix) {
+ if (c == '\\') {
+ c = '/';
+ }
+ }
+ // remove Windows long filename marker
+ if (prefix == "//?/"_s) {
+ path.erase(0, 4);
+ }
+ if (cmHasPrefix(path, "UNC/"_s) || cmHasPrefix(path, "UNC\\"_s)) {
+ path.erase(0, 2);
+ path[0] = '/';
+ }
+ }
+#else
+ static_cast<void>(fmt);
+#endif
+ return path;
+}
+
+void cmCMakePath::GetNativePath(std::string& path) const
+{
+ cm::filesystem::path tmp(this->Path);
+ tmp.make_preferred();
+
+ path = tmp.string();
+}
+void cmCMakePath::GetNativePath(std::wstring& path) const
+{
+ cm::filesystem::path tmp(this->Path);
+ tmp.make_preferred();
+
+ path = tmp.wstring();
+
+#if defined(_WIN32)
+ // Windows long filename
+ static std::wstring UNC(L"\\\\?\\UNC");
+ static std::wstring PREFIX(L"\\\\?\\");
+
+ if (this->IsAbsolute() && path.length() > _MAX_PATH - 12) {
+ if (this->HasRootName() && path[0] == L'\\') {
+ path = UNC + path.substr(1);
+ } else {
+ path = PREFIX + path;
+ }
+ }
+#endif
+}
diff --git a/Source/cmCMakePath.h b/Source/cmCMakePath.h
new file mode 100644
index 0000000..15aa30c
--- /dev/null
+++ b/Source/cmCMakePath.h
@@ -0,0 +1,571 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#pragma once
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include <cstddef>
+#include <string>
+#include <utility>
+
+#include <cm/filesystem>
+#include <cm/string_view>
+#include <cm/type_traits>
+#include <cmext/string_view>
+
+namespace detail {
+#if defined(__SUNPRO_CC) && defined(__sparc)
+// Oracle DeveloperStudio C++ compiler on Solaris/Sparc fails to compile
+// the full 'is_pathable' and 'is_move_pathable' checks. We use it only to
+// improve error messages via 'enable_if' when calling methods with incorrect
+// types. Just pretend all types are allowed so we can at least compile valid
+// code.
+template <typename T>
+struct is_pathable : std::true_type
+{
+};
+
+template <typename T>
+struct is_move_pathable : std::true_type
+{
+};
+
+#else
+template <typename T, typename = void>
+struct is_pathable : std::false_type
+{
+};
+
+template <>
+struct is_pathable<cm::filesystem::path> : std::true_type
+{
+};
+template <>
+struct is_pathable<std::string> : std::true_type
+{
+};
+template <>
+struct is_pathable<cm::string_view> : std::true_type
+{
+};
+template <>
+struct is_pathable<cm::static_string_view> : std::true_type
+{
+};
+template <typename T>
+struct is_pathable<
+ T,
+ cm::enable_if_t<std::is_same<char*, typename std::decay<T>::type>::value,
+ void>>
+ : cm::bool_constant<std::is_same<char*, typename std::decay<T>::type>::value>
+{
+};
+
+template <typename T>
+struct is_move_pathable : std::false_type
+{
+};
+
+template <>
+struct is_move_pathable<cm::filesystem::path> : std::true_type
+{
+};
+template <>
+struct is_move_pathable<std::string> : std::true_type
+{
+};
+#endif
+}
+
+class cmCMakePath
+{
+private:
+ template <typename Source>
+ using enable_if_move_pathable =
+ cm::enable_if_t<detail::is_move_pathable<Source>::value, cmCMakePath&>;
+
+ template <typename Source>
+ using enable_if_pathable =
+ cm::enable_if_t<detail::is_pathable<Source>::value, cmCMakePath&>;
+
+public:
+ using value_type = cm::filesystem::path::value_type;
+ using string_type = cm::filesystem::path::string_type;
+
+ enum format : unsigned char
+ {
+ auto_format =
+ static_cast<unsigned char>(cm::filesystem::path::format::auto_format),
+ native_format =
+ static_cast<unsigned char>(cm::filesystem::path::format::native_format),
+ generic_format =
+ static_cast<unsigned char>(cm::filesystem::path::format::generic_format)
+ };
+
+ class iterator;
+ using const_iterator = iterator;
+
+ cmCMakePath() noexcept = default;
+
+ cmCMakePath(const cmCMakePath&) = default;
+
+ cmCMakePath(cmCMakePath&& path) noexcept
+ : Path(std::forward<cm::filesystem::path>(path.Path))
+ {
+ }
+
+ cmCMakePath(cm::filesystem::path path) noexcept
+ : Path(std::move(path))
+ {
+ }
+ cmCMakePath(cm::string_view source, format fmt = generic_format) noexcept
+ : Path(FormatPath(source, fmt))
+ {
+ }
+ template <typename Source, typename = enable_if_move_pathable<Source>>
+ cmCMakePath(Source source, format fmt = generic_format)
+ : Path(FormatPath(std::move(source), fmt))
+ {
+ }
+
+ template <typename Source, typename = enable_if_move_pathable<Source>>
+ cmCMakePath& Assign(Source&& source)
+ {
+ this->Path = std::forward<Source>(source);
+ return *this;
+ }
+ template <typename Source, typename = enable_if_pathable<Source>>
+ cmCMakePath& Assign(const Source& source)
+ {
+ this->Path = source;
+ return *this;
+ }
+
+ cmCMakePath& operator=(const cmCMakePath& path)
+ {
+ if (this != &path) {
+ this->Path = path.Path;
+ }
+ return *this;
+ }
+ cmCMakePath& operator=(cmCMakePath&& path) noexcept
+ {
+ if (this != &path) {
+ this->Path = std::move(path.Path);
+ }
+ return *this;
+ }
+ template <typename Source, typename = enable_if_move_pathable<Source>>
+ cmCMakePath& operator=(Source&& source)
+ {
+ this->Assign(std::forward<Source>(source));
+ return *this;
+ }
+ template <typename Source, typename = enable_if_pathable<Source>>
+ cmCMakePath& operator=(const Source& source)
+ {
+ this->Assign(source);
+ return *this;
+ }
+
+ // Concatenation
+ cmCMakePath& Append(const cmCMakePath& path)
+ {
+ return this->Append(path.Path);
+ }
+ cmCMakePath& Append(const cm::filesystem::path& path)
+ {
+ this->Path /= path;
+ // filesystem::path::append use preferred_separator ('\' on Windows)
+ // so convert back to '/'
+ this->Path = this->Path.generic_string();
+ return *this;
+ }
+
+ template <typename Source, typename = enable_if_pathable<Source>>
+ cmCMakePath& Append(const Source& source)
+ {
+ return this->Append(cm::filesystem::path(source));
+ }
+
+ cmCMakePath& operator/=(const cmCMakePath& path)
+ {
+ return this->Append(path);
+ }
+ template <typename Source, typename = enable_if_pathable<Source>>
+ cmCMakePath& operator/=(const Source& source)
+ {
+ return this->Append(source);
+ }
+
+ cmCMakePath& Concat(const cmCMakePath& path)
+ {
+ this->Path += path.Path;
+ return *this;
+ }
+ cmCMakePath& Concat(cm::static_string_view source)
+ {
+ this->Path.concat(std::string(source));
+ return *this;
+ }
+ template <typename Source, typename = enable_if_pathable<Source>>
+ cmCMakePath& Concat(const Source& source)
+ {
+ this->Path.concat(source);
+ return *this;
+ }
+
+ cmCMakePath& operator+=(const cmCMakePath& path)
+ {
+ return this->Concat(path);
+ }
+ template <typename Source, typename = enable_if_pathable<Source>>
+ cmCMakePath& operator+=(const Source& source)
+ {
+ return this->Concat(source);
+ }
+
+ // Manipulation
+ void Clear() noexcept { this->Path.clear(); }
+
+ cmCMakePath& RemoveFileName()
+ {
+ this->Path.remove_filename();
+ return *this;
+ }
+
+ cmCMakePath& ReplaceFileName(const cmCMakePath& filename)
+ {
+ if (this->Path.has_filename()) {
+ this->Path.replace_filename(filename.Path);
+ }
+ return *this;
+ }
+ template <typename Source, typename = enable_if_pathable<Source>>
+ cmCMakePath& ReplaceFileName(const Source& filename)
+ {
+ if (this->Path.has_filename()) {
+ this->Path.replace_filename(filename);
+ }
+ return *this;
+ }
+
+ cmCMakePath& ReplaceExtension(const cmCMakePath& extension = cmCMakePath())
+ {
+ this->Path.replace_extension(extension.Path);
+ return *this;
+ }
+ template <typename Source, typename = enable_if_pathable<Source>>
+ cmCMakePath& ReplaceExtension(const Source& extension)
+ {
+ this->Path.replace_extension(extension);
+ return *this;
+ }
+
+ cmCMakePath& ReplaceWideExtension(
+ const cmCMakePath& extension = cmCMakePath())
+ {
+ return this->ReplaceWideExtension(
+ static_cast<cm::string_view>(extension.Path.string()));
+ }
+ template <typename Source, typename = enable_if_pathable<Source>>
+ cmCMakePath& ReplaceWideExtension(const Source& extension)
+ {
+ return this->ReplaceWideExtension(cm::string_view(extension));
+ }
+ cmCMakePath& ReplaceWideExtension(cm::string_view extension);
+
+ cmCMakePath& RemoveExtension()
+ {
+ if (this->Path.has_extension()) {
+ this->ReplaceExtension(cm::string_view(""));
+ }
+ return *this;
+ }
+
+ cmCMakePath& RemoveWideExtension()
+ {
+ if (this->Path.has_extension()) {
+ this->ReplaceWideExtension(cm::string_view(""));
+ }
+ return *this;
+ }
+
+ void swap(cmCMakePath& other) noexcept { this->Path.swap(other.Path); }
+
+ // Observers
+ std::string String() const { return this->Path.string(); }
+ std::wstring WString() const { return this->Path.wstring(); }
+
+ string_type Native() const
+ {
+ string_type path;
+ this->GetNativePath(path);
+
+ return path;
+ }
+ std::string NativeString() const
+ {
+ std::string path;
+ this->GetNativePath(path);
+
+ return path;
+ }
+ std::wstring NativeWString() const
+ {
+ std::wstring path;
+ this->GetNativePath(path);
+
+ return path;
+ }
+ std::string GenericString() const { return this->Path.generic_string(); }
+ std::wstring GenericWString() const { return this->Path.generic_wstring(); }
+
+ // Decomposition
+ cmCMakePath GetRootName() const { return this->Path.root_name(); }
+ cmCMakePath GetRootDirectory() const { return this->Path.root_directory(); }
+ cmCMakePath GetRootPath() const { return this->Path.root_path(); }
+ cmCMakePath GetFileName() const { return this->Path.filename(); }
+ cmCMakePath GetExtension() const { return this->Path.extension(); }
+ cmCMakePath GetWideExtension() const;
+ cmCMakePath GetStem() const { return this->Path.stem(); }
+ cmCMakePath GetNarrowStem() const;
+
+ cmCMakePath GetRelativePath() const { return this->Path.relative_path(); }
+ cmCMakePath GetParentPath() const { return this->Path.parent_path(); }
+
+ // Generation
+ cmCMakePath Normal() const
+ {
+ auto path = this->Path.lexically_normal();
+ // filesystem::path:lexically_normal use preferred_separator ('\') on
+ // Windows) so convert back to '/'
+ return path.generic_string();
+ }
+
+ cmCMakePath Relative(const cmCMakePath& base) const
+ {
+ return this->Relative(base.Path);
+ }
+ cmCMakePath Relative(const cm::filesystem::path& base) const
+ {
+ auto path = this->Path.lexically_relative(base);
+ // filesystem::path:lexically_relative use preferred_separator ('\') on
+ // Windows) so convert back to '/'
+ return path.generic_string();
+ }
+ template <typename Source, typename = enable_if_pathable<Source>>
+ cmCMakePath Relative(const Source& base) const
+ {
+ return this->Relative(cm::filesystem::path(base));
+ }
+
+ cmCMakePath Proximate(const cmCMakePath& base) const
+ {
+ return this->Proximate(base.Path);
+ }
+ cmCMakePath Proximate(const cm::filesystem::path& base) const
+ {
+ auto path = this->Path.lexically_proximate(base);
+ // filesystem::path::lexically_proximate use preferred_separator ('\') on
+ // Windows) so convert back to '/'
+ return path.generic_string();
+ }
+ template <typename Source, typename = enable_if_pathable<Source>>
+ cmCMakePath Proximate(const Source& base) const
+ {
+ return this->Proximate(cm::filesystem::path(base));
+ }
+
+ cmCMakePath Absolute(const cmCMakePath& base) const
+ {
+ return this->Absolute(base.Path);
+ }
+ template <typename Source, typename = enable_if_pathable<Source>>
+ cmCMakePath Absolute(const Source& base) const
+ {
+ return this->Absolute(cm::filesystem::path(base));
+ }
+ cmCMakePath Absolute(const cm::filesystem::path& base) const;
+
+ // Comparison
+ int Compare(const cmCMakePath& path) const noexcept
+ {
+ return this->Path.compare(path.Path);
+ }
+
+ // Query
+ bool IsEmpty() const noexcept { return this->Path.empty(); }
+
+ bool HasRootPath() const { return this->Path.has_root_path(); }
+ bool HasRootName() const { return this->Path.has_root_name(); }
+ bool HasRootDirectory() const { return this->Path.has_root_directory(); }
+ bool HasRelativePath() const { return this->Path.has_relative_path(); }
+ bool HasParentPath() const { return this->Path.has_parent_path(); }
+ bool HasFileName() const { return this->Path.has_filename(); }
+ bool HasStem() const { return this->Path.has_stem(); }
+ bool HasExtension() const { return this->Path.has_extension(); }
+
+ bool IsAbsolute() const { return this->Path.is_absolute(); }
+ bool IsRelative() const { return this->Path.is_relative(); }
+ bool IsPrefix(const cmCMakePath& path) const;
+
+ // Iterators
+ // =========
+ inline iterator begin() const;
+ inline iterator end() const;
+
+ // Non-members
+ // ===========
+ friend inline bool operator==(const cmCMakePath& lhs,
+ const cmCMakePath& rhs) noexcept
+ {
+ return lhs.Compare(rhs) == 0;
+ }
+ friend inline bool operator!=(const cmCMakePath& lhs,
+ const cmCMakePath& rhs) noexcept
+ {
+ return lhs.Compare(rhs) != 0;
+ }
+
+ friend inline cmCMakePath operator/(const cmCMakePath& lhs,
+ const cmCMakePath& rhs)
+ {
+ cmCMakePath result(lhs);
+ result /= rhs;
+
+ return result;
+ }
+
+private:
+ friend std::size_t hash_value(const cmCMakePath& path) noexcept;
+
+ static std::string FormatPath(std::string path, format fmt = generic_format);
+ static std::string FormatPath(cm::string_view path,
+ format fmt = generic_format)
+ {
+ return FormatPath(std::string(path), fmt);
+ }
+
+ void GetNativePath(std::string& path) const;
+ void GetNativePath(std::wstring& path) const;
+
+ cm::filesystem::path Path;
+};
+
+class cmCMakePath::iterator
+{
+public:
+ using iterator_category = cm::filesystem::path::iterator::iterator_category;
+
+ using value_type = cmCMakePath;
+ using difference_type = cm::filesystem::path::iterator::difference_type;
+ using pointer = const cmCMakePath*;
+ using reference = const cmCMakePath&;
+
+ iterator() = default;
+
+ iterator(const iterator& other)
+ : Iterator(other.Iterator)
+ , Path(other.Path)
+ , PathElement(*this->Iterator)
+ {
+ }
+
+ ~iterator() = default;
+
+ iterator& operator=(const iterator& other)
+ {
+ if (this != &other) {
+ this->Iterator = other.Iterator;
+ this->Path = other.Path;
+ this->PathElement = *this->Iterator;
+ }
+
+ return *this;
+ }
+
+ reference operator*() const { return this->PathElement; }
+
+ pointer operator->() const { return &this->PathElement; }
+
+ iterator& operator++()
+ {
+ ++this->Iterator;
+ this->PathElement = *this->Iterator;
+
+ return *this;
+ }
+
+ iterator operator++(int)
+ {
+ iterator it(*this);
+ this->operator++();
+ return it;
+ }
+
+ iterator& operator--()
+ {
+ --this->Iterator;
+ this->PathElement = *this->Iterator;
+
+ return *this;
+ }
+
+ iterator operator--(int)
+ {
+ iterator it(*this);
+ this->operator--();
+ return it;
+ }
+
+private:
+ friend class cmCMakePath;
+ friend bool operator==(const iterator&, const iterator&);
+
+ iterator(const cmCMakePath* path, const cm::filesystem::path::iterator& it)
+ : Iterator(it)
+ , Path(path)
+ , PathElement(*this->Iterator)
+ {
+ }
+
+ cm::filesystem::path::iterator Iterator;
+ const cmCMakePath* Path = nullptr;
+ cmCMakePath PathElement;
+};
+
+inline cmCMakePath::iterator cmCMakePath::begin() const
+{
+ return iterator(this, this->Path.begin());
+}
+inline cmCMakePath::iterator cmCMakePath::end() const
+{
+ return iterator(this, this->Path.end());
+}
+
+// Non-member functions
+// ====================
+inline bool operator==(const cmCMakePath::iterator& lhs,
+ const cmCMakePath::iterator& rhs)
+{
+ return lhs.Path == rhs.Path && lhs.Path != nullptr &&
+ lhs.Iterator == rhs.Iterator;
+}
+
+inline bool operator!=(const cmCMakePath::iterator& lhs,
+ const cmCMakePath::iterator& rhs)
+{
+ return !(lhs == rhs);
+}
+
+inline void swap(cmCMakePath& lhs, cmCMakePath& rhs) noexcept
+{
+ lhs.swap(rhs);
+}
+
+inline std::size_t hash_value(const cmCMakePath& path) noexcept
+{
+ return cm::filesystem::hash_value(path.Path);
+}
diff --git a/Source/cmCMakePathCommand.cxx b/Source/cmCMakePathCommand.cxx
new file mode 100644
index 0000000..720f582
--- /dev/null
+++ b/Source/cmCMakePathCommand.cxx
@@ -0,0 +1,1019 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmCMakePathCommand.h"
+
+#include <algorithm>
+#include <functional>
+#include <iomanip>
+#include <map>
+#include <sstream>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include <cm/string_view>
+#include <cmext/string_view>
+
+#include "cmArgumentParser.h"
+#include "cmCMakePath.h"
+#include "cmExecutionStatus.h"
+#include "cmMakefile.h"
+#include "cmRange.h"
+#include "cmStringAlgorithms.h"
+#include "cmSubcommandTable.h"
+#include "cmSystemTools.h"
+
+namespace {
+// Helper classes for argument parsing
+template <typename Result>
+class CMakePathArgumentParser : public cmArgumentParser<Result>
+{
+public:
+ CMakePathArgumentParser()
+ : cmArgumentParser<Result>()
+ {
+ }
+
+ template <typename T>
+ CMakePathArgumentParser& Bind(cm::static_string_view name, T Result::*member)
+ {
+ cmArgumentParser<Result>::Bind(name, member);
+ return *this;
+ }
+
+ template <int Advance = 2>
+ Result Parse(std::vector<std::string> const& args,
+ std::vector<std::string>* keywordsMissingValue = nullptr,
+ std::vector<std::string>* parsedKeywords = nullptr) const
+ {
+ this->Inputs.clear();
+
+ return cmArgumentParser<Result>::Parse(cmMakeRange(args).advance(Advance),
+ &this->Inputs, keywordsMissingValue,
+ parsedKeywords);
+ }
+
+ const std::vector<std::string>& GetInputs() const { return Inputs; }
+
+protected:
+ mutable std::vector<std::string> Inputs;
+};
+
+// OUTPUT_VARIABLE is expected
+template <typename Result>
+class ArgumentParserWithOutputVariable : public CMakePathArgumentParser<Result>
+{
+public:
+ ArgumentParserWithOutputVariable()
+ : CMakePathArgumentParser<Result>()
+ {
+ this->Bind("OUTPUT_VARIABLE"_s, &Result::Output);
+ }
+
+ template <typename T>
+ ArgumentParserWithOutputVariable& Bind(cm::static_string_view name,
+ T Result::*member)
+ {
+ cmArgumentParser<Result>::Bind(name, member);
+ return *this;
+ }
+
+ template <int Advance = 2>
+ Result Parse(std::vector<std::string> const& args) const
+ {
+ this->KeywordsMissingValue.clear();
+ this->ParsedKeywords.clear();
+
+ return CMakePathArgumentParser<Result>::template Parse<Advance>(
+ args, &this->KeywordsMissingValue, &this->ParsedKeywords);
+ }
+
+ const std::vector<std::string>& GetKeywordsMissingValue() const
+ {
+ return this->KeywordsMissingValue;
+ }
+ const std::vector<std::string>& GetParsedKeywords() const
+ {
+ return this->ParsedKeywords;
+ }
+
+ bool checkOutputVariable(const Result& arguments,
+ cmExecutionStatus& status) const
+ {
+ if (std::find(this->GetKeywordsMissingValue().begin(),
+ this->GetKeywordsMissingValue().end(),
+ "OUTPUT_VARIABLE"_s) !=
+ this->GetKeywordsMissingValue().end()) {
+ status.SetError("OUTPUT_VARIABLE requires an argument.");
+ return false;
+ }
+
+ if (std::find(this->GetParsedKeywords().begin(),
+ this->GetParsedKeywords().end(),
+ "OUTPUT_VARIABLE"_s) != this->GetParsedKeywords().end() &&
+ arguments.Output.empty()) {
+ status.SetError("Invalid name for output variable.");
+ return false;
+ }
+
+ return true;
+ }
+
+private:
+ mutable std::vector<std::string> KeywordsMissingValue;
+ mutable std::vector<std::string> ParsedKeywords;
+};
+
+struct OutputVariable
+{
+ std::string Output;
+};
+// Usable when OUTPUT_VARIABLE is the only option
+class OutputVariableParser
+ : public ArgumentParserWithOutputVariable<OutputVariable>
+{
+};
+
+struct NormalizeOption
+{
+ bool Normalize = false;
+};
+// Usable when NORMALIZE is the only option
+class NormalizeParser : public CMakePathArgumentParser<NormalizeOption>
+{
+public:
+ NormalizeParser() { this->Bind("NORMALIZE"_s, &NormalizeOption::Normalize); }
+};
+
+// retrieve value of input path from specified variable
+bool getInputPath(const std::string& arg, cmExecutionStatus& status,
+ std::string& path)
+{
+ auto def = status.GetMakefile().GetDefinition(arg);
+ if (def == nullptr) {
+ status.SetError("undefined variable for input path.");
+ return false;
+ }
+
+ path = *def;
+ return true;
+}
+
+bool HandleGetCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ static std::map<cm::string_view,
+ std::function<cmCMakePath(const cmCMakePath&, bool)>> const
+ actions{ { "ROOT_NAME"_s,
+ [](const cmCMakePath& path, bool) -> cmCMakePath {
+ return path.GetRootName();
+ } },
+ { "ROOT_DIRECTORY"_s,
+ [](const cmCMakePath& path, bool) -> cmCMakePath {
+ return path.GetRootDirectory();
+ } },
+ { "ROOT_PATH"_s,
+ [](const cmCMakePath& path, bool) -> cmCMakePath {
+ return path.GetRootPath();
+ } },
+ { "FILENAME"_s,
+ [](const cmCMakePath& path, bool) -> cmCMakePath {
+ return path.GetFileName();
+ } },
+ { "EXTENSION"_s,
+ [](const cmCMakePath& path, bool last_only) -> cmCMakePath {
+ if (last_only) {
+ return path.GetExtension();
+ }
+ return path.GetWideExtension();
+ } },
+ { "STEM"_s,
+ [](const cmCMakePath& path, bool last_only) -> cmCMakePath {
+ if (last_only) {
+ return path.GetStem();
+ }
+ return path.GetNarrowStem();
+ } },
+ { "RELATIVE_PATH"_s,
+ [](const cmCMakePath& path, bool) -> cmCMakePath {
+ return path.GetRelativePath();
+ } },
+ { "PARENT_PATH"_s,
+ [](const cmCMakePath& path, bool) -> cmCMakePath {
+ return path.GetParentPath();
+ } } };
+
+ if (args.size() < 4) {
+ status.SetError("GET must be called with at least three arguments.");
+ return false;
+ }
+
+ const auto& action = args[2];
+
+ if (actions.find(action) == actions.end()) {
+ status.SetError(
+ cmStrCat("GET called with an unknown action: ", action, "."));
+ return false;
+ }
+
+ struct Arguments
+ {
+ bool LastOnly = false;
+ };
+
+ CMakePathArgumentParser<Arguments> parser;
+ if ((action == "EXTENSION"_s || action == "STEM"_s)) {
+ parser.Bind("LAST_ONLY"_s, &Arguments::LastOnly);
+ }
+
+ Arguments const arguments = parser.Parse<3>(args);
+
+ if (parser.GetInputs().size() != 1) {
+ status.SetError("GET called with unexpected arguments.");
+ return false;
+ }
+ if (parser.GetInputs().front().empty()) {
+ status.SetError("Invalid name for output variable.");
+ return false;
+ }
+
+ std::string path;
+ if (!getInputPath(args[1], status, path)) {
+ return false;
+ }
+
+ auto result = actions.at(action)(path, arguments.LastOnly);
+
+ status.GetMakefile().AddDefinition(parser.GetInputs().front(),
+ result.String());
+
+ return true;
+}
+
+bool HandleAppendCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ static OutputVariableParser const parser{};
+
+ const auto arguments = parser.Parse(args);
+
+ if (!parser.checkOutputVariable(arguments, status)) {
+ return false;
+ }
+
+ cmCMakePath path(status.GetMakefile().GetSafeDefinition(args[1]));
+ for (const auto& input : parser.GetInputs()) {
+ path /= input;
+ }
+
+ status.GetMakefile().AddDefinition(
+ arguments.Output.empty() ? args[1] : arguments.Output, path.String());
+
+ return true;
+}
+
+bool HandleConcatCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ static OutputVariableParser const parser{};
+
+ const auto arguments = parser.Parse(args);
+
+ if (!parser.checkOutputVariable(arguments, status)) {
+ return false;
+ }
+
+ std::string inputPath;
+ if (!getInputPath(args[1], status, inputPath)) {
+ return false;
+ }
+
+ cmCMakePath path(inputPath);
+ for (const auto& input : parser.GetInputs()) {
+ path += input;
+ }
+
+ status.GetMakefile().AddDefinition(
+ arguments.Output.empty() ? args[1] : arguments.Output, path.String());
+
+ return true;
+}
+
+bool HandleRemoveFilenameCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ static OutputVariableParser const parser{};
+
+ const auto arguments = parser.Parse(args);
+
+ if (!parser.checkOutputVariable(arguments, status)) {
+ return false;
+ }
+
+ if (!parser.GetInputs().empty()) {
+ status.SetError("REMOVE_FILENAME called with unexpected arguments.");
+ return false;
+ }
+
+ std::string inputPath;
+ if (!getInputPath(args[1], status, inputPath)) {
+ return false;
+ }
+
+ cmCMakePath path(inputPath);
+ path.RemoveFileName();
+
+ status.GetMakefile().AddDefinition(
+ arguments.Output.empty() ? args[1] : arguments.Output, path.String());
+
+ return true;
+}
+
+bool HandleReplaceFilenameCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ static OutputVariableParser const parser{};
+
+ const auto arguments = parser.Parse(args);
+
+ if (!parser.checkOutputVariable(arguments, status)) {
+ return false;
+ }
+
+ if (parser.GetInputs().size() > 1) {
+ status.SetError("REPLACE_FILENAME called with unexpected arguments.");
+ return false;
+ }
+
+ std::string inputPath;
+ if (!getInputPath(args[1], status, inputPath)) {
+ return false;
+ }
+
+ cmCMakePath path(inputPath);
+ path.ReplaceFileName(
+ parser.GetInputs().empty() ? "" : parser.GetInputs().front());
+
+ status.GetMakefile().AddDefinition(
+ arguments.Output.empty() ? args[1] : arguments.Output, path.String());
+
+ return true;
+}
+
+bool HandleRemoveExtensionCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ struct Arguments
+ {
+ std::string Output;
+ bool LastOnly = false;
+ };
+
+ static auto const parser =
+ ArgumentParserWithOutputVariable<Arguments>{}.Bind("LAST_ONLY"_s,
+ &Arguments::LastOnly);
+
+ Arguments const arguments = parser.Parse(args);
+
+ if (!parser.checkOutputVariable(arguments, status)) {
+ return false;
+ }
+
+ if (!parser.GetInputs().empty()) {
+ status.SetError("REMOVE_EXTENSION called with unexpected arguments.");
+ return false;
+ }
+
+ std::string inputPath;
+ if (!getInputPath(args[1], status, inputPath)) {
+ return false;
+ }
+
+ cmCMakePath path(inputPath);
+
+ if (arguments.LastOnly) {
+ path.RemoveExtension();
+ } else {
+ path.RemoveWideExtension();
+ }
+
+ status.GetMakefile().AddDefinition(
+ arguments.Output.empty() ? args[1] : arguments.Output, path.String());
+
+ return true;
+}
+
+bool HandleReplaceExtensionCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ struct Arguments
+ {
+ std::string Output;
+ bool LastOnly = false;
+ };
+
+ static auto const parser =
+ ArgumentParserWithOutputVariable<Arguments>{}.Bind("LAST_ONLY"_s,
+ &Arguments::LastOnly);
+
+ Arguments const arguments = parser.Parse(args);
+
+ if (!parser.checkOutputVariable(arguments, status)) {
+ return false;
+ }
+
+ if (parser.GetInputs().size() > 1) {
+ status.SetError("REPLACE_EXTENSION called with unexpected arguments.");
+ return false;
+ }
+
+ std::string inputPath;
+ if (!getInputPath(args[1], status, inputPath)) {
+ return false;
+ }
+
+ cmCMakePath path(inputPath);
+ cmCMakePath extension(
+ parser.GetInputs().empty() ? "" : parser.GetInputs().front());
+
+ if (arguments.LastOnly) {
+ path.ReplaceExtension(extension);
+ } else {
+ path.ReplaceWideExtension(extension);
+ }
+
+ status.GetMakefile().AddDefinition(
+ arguments.Output.empty() ? args[1] : arguments.Output, path.String());
+
+ return true;
+}
+
+bool HandleNormalPathCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ static OutputVariableParser const parser{};
+
+ const auto arguments = parser.Parse(args);
+
+ if (!parser.checkOutputVariable(arguments, status)) {
+ return false;
+ }
+
+ if (!parser.GetInputs().empty()) {
+ status.SetError("NORMAL_PATH called with unexpected arguments.");
+ return false;
+ }
+
+ std::string inputPath;
+ if (!getInputPath(args[1], status, inputPath)) {
+ return false;
+ }
+
+ auto path = cmCMakePath(inputPath).Normal();
+
+ status.GetMakefile().AddDefinition(
+ arguments.Output.empty() ? args[1] : arguments.Output, path.String());
+
+ return true;
+}
+
+bool HandleTransformPathCommand(
+ std::vector<std::string> const& args, cmExecutionStatus& status,
+ const std::function<cmCMakePath(const cmCMakePath&,
+ const std::string& base)>& transform,
+ bool normalizeOption = false)
+{
+ struct Arguments
+ {
+ std::string Output;
+ std::string BaseDirectory;
+ bool Normalize = false;
+ };
+
+ auto parser = ArgumentParserWithOutputVariable<Arguments>{}.Bind(
+ "BASE_DIRECTORY"_s, &Arguments::BaseDirectory);
+ if (normalizeOption) {
+ parser.Bind("NORMALIZE"_s, &Arguments::Normalize);
+ }
+
+ Arguments arguments = parser.Parse(args);
+
+ if (!parser.checkOutputVariable(arguments, status)) {
+ return false;
+ }
+
+ if (!parser.GetInputs().empty()) {
+ status.SetError(cmStrCat(args[0], " called with unexpected arguments."));
+ return false;
+ }
+
+ if (std::find(parser.GetKeywordsMissingValue().begin(),
+ parser.GetKeywordsMissingValue().end(), "BASE_DIRECTORY"_s) !=
+ parser.GetKeywordsMissingValue().end()) {
+ status.SetError("BASE_DIRECTORY requires an argument.");
+ return false;
+ }
+
+ if (std::find(parser.GetParsedKeywords().begin(),
+ parser.GetParsedKeywords().end(),
+ "BASE_DIRECTORY"_s) == parser.GetParsedKeywords().end()) {
+ arguments.BaseDirectory = status.GetMakefile().GetCurrentSourceDirectory();
+ }
+
+ std::string inputPath;
+ if (!getInputPath(args[1], status, inputPath)) {
+ return false;
+ }
+
+ auto path = transform(cmCMakePath(inputPath), arguments.BaseDirectory);
+ if (arguments.Normalize) {
+ path = path.Normal();
+ }
+
+ status.GetMakefile().AddDefinition(
+ arguments.Output.empty() ? args[1] : arguments.Output, path.String());
+
+ return true;
+}
+
+bool HandleRelativePathCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ return HandleTransformPathCommand(
+ args, status,
+ [](const cmCMakePath& path, const std::string& base) -> cmCMakePath {
+ return path.Relative(base);
+ });
+}
+
+bool HandleProximatePathCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ return HandleTransformPathCommand(
+ args, status,
+ [](const cmCMakePath& path, const std::string& base) -> cmCMakePath {
+ return path.Proximate(base);
+ });
+}
+
+bool HandleAbsolutePathCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ return HandleTransformPathCommand(
+ args, status,
+ [](const cmCMakePath& path, const std::string& base) -> cmCMakePath {
+ return path.Absolute(base);
+ },
+ true);
+}
+
+bool HandleCMakePathCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ if (args.size() < 3 || args.size() > 4) {
+ status.SetError("CMAKE_PATH must be called with two or three arguments.");
+ return false;
+ }
+
+ static NormalizeParser const parser;
+
+ const auto arguments = parser.Parse(args);
+
+ if (parser.GetInputs().size() != 1) {
+ status.SetError("CMAKE_PATH called with unexpected arguments.");
+ return false;
+ }
+
+ if (args[1].empty()) {
+ status.SetError("Invalid name for output variable.");
+ return false;
+ }
+
+ auto path =
+ cmCMakePath(parser.GetInputs().front(), cmCMakePath::native_format);
+
+ if (arguments.Normalize) {
+ path = path.Normal();
+ }
+
+ status.GetMakefile().AddDefinition(args[1], path.GenericString());
+
+ return true;
+}
+
+bool HandleNativePathCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ if (args.size() < 3 || args.size() > 4) {
+ status.SetError("NATIVE_PATH must be called with two or three arguments.");
+ return false;
+ }
+
+ static NormalizeParser const parser;
+
+ const auto arguments = parser.Parse(args);
+
+ if (parser.GetInputs().size() != 1) {
+ status.SetError("NATIVE_PATH called with unexpected arguments.");
+ return false;
+ }
+ if (parser.GetInputs().front().empty()) {
+ status.SetError("Invalid name for output variable.");
+ return false;
+ }
+
+ std::string inputPath;
+ if (!getInputPath(args[1], status, inputPath)) {
+ return false;
+ }
+
+ cmCMakePath path(inputPath);
+ if (arguments.Normalize) {
+ path = path.Normal();
+ }
+
+ status.GetMakefile().AddDefinition(parser.GetInputs().front(),
+ path.NativeString());
+
+ return true;
+}
+
+bool HandleConvertCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ const auto pathSep = ";"_s;
+#else
+ const auto pathSep = ":"_s;
+#endif
+ const auto cmakePath = "TO_CMAKE_PATH_LIST"_s;
+ const auto nativePath = "TO_NATIVE_PATH_LIST"_s;
+
+ if (args.size() < 4 || args.size() > 5) {
+ status.SetError("CONVERT must be called with three or four arguments.");
+ return false;
+ }
+
+ const auto& action = args[2];
+
+ if (action != cmakePath && action != nativePath) {
+ status.SetError(
+ cmStrCat("CONVERT called with an unknown action: ", action, "."));
+ return false;
+ }
+
+ if (args[3].empty()) {
+ status.SetError("Invalid name for output variable.");
+ return false;
+ }
+
+ static NormalizeParser const parser;
+
+ const auto arguments = parser.Parse<4>(args);
+
+ if (!parser.GetInputs().empty()) {
+ status.SetError("CONVERT called with unexpected arguments.");
+ return false;
+ }
+
+ std::vector<std::string> paths;
+
+ if (action == cmakePath) {
+ paths = cmSystemTools::SplitString(args[1], pathSep.front());
+ } else {
+ cmExpandList(args[1], paths);
+ }
+
+ for (auto& path : paths) {
+ auto p = cmCMakePath(path,
+ action == cmakePath ? cmCMakePath::native_format
+ : cmCMakePath::generic_format);
+ if (arguments.Normalize) {
+ p = p.Normal();
+ }
+ if (action == cmakePath) {
+ path = p.GenericString();
+ } else {
+ path = p.NativeString();
+ }
+ }
+
+ auto value = cmJoin(paths, action == cmakePath ? ";"_s : pathSep);
+ status.GetMakefile().AddDefinition(args[3], value);
+
+ return true;
+}
+
+bool HandleCompareCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ if (args.size() != 5) {
+ status.SetError("COMPARE must be called with four arguments.");
+ return false;
+ }
+
+ static std::map<cm::string_view,
+ std::function<bool(const cmCMakePath&,
+ const cmCMakePath&)>> const operators{
+ { "EQUAL"_s,
+ [](const cmCMakePath& path1, const cmCMakePath& path2) -> bool {
+ return path1 == path2;
+ } },
+ { "NOT_EQUAL"_s,
+ [](const cmCMakePath& path1, const cmCMakePath& path2) -> bool {
+ return path1 != path2;
+ } }
+ };
+
+ const auto op = operators.find(args[2]);
+ if (op == operators.end()) {
+ status.SetError(cmStrCat(
+ "COMPARE called with an unknown comparison operator: ", args[2], "."));
+ return false;
+ }
+
+ if (args[4].empty()) {
+ status.SetError("Invalid name for output variable.");
+ return false;
+ }
+
+ std::string inputPath;
+ if (!getInputPath(args[1], status, inputPath)) {
+ return false;
+ }
+
+ cmCMakePath path1(inputPath);
+ cmCMakePath path2(args[3]);
+ auto result = op->second(path1, path2);
+
+ status.GetMakefile().AddDefinitionBool(args[4], result);
+
+ return true;
+}
+
+bool HandleHasItemCommand(
+ std::vector<std::string> const& args, cmExecutionStatus& status,
+ const std::function<bool(const cmCMakePath&)>& has_item)
+{
+ if (args.size() != 3) {
+ status.SetError(
+ cmStrCat(args.front(), " must be called with two arguments."));
+ return false;
+ }
+
+ std::string inputPath;
+ if (!getInputPath(args[1], status, inputPath)) {
+ return false;
+ }
+
+ if (args[2].empty()) {
+ status.SetError("Invalid name for output variable.");
+ return false;
+ }
+
+ cmCMakePath path(inputPath);
+ auto result = has_item(path);
+
+ status.GetMakefile().AddDefinitionBool(args[2], result);
+
+ return true;
+}
+
+bool HandleHasRootNameCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ return HandleHasItemCommand(
+ args, status,
+ [](const cmCMakePath& path) -> bool { return path.HasRootName(); });
+}
+
+bool HandleHasRootDirectoryCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ return HandleHasItemCommand(
+ args, status,
+ [](const cmCMakePath& path) -> bool { return path.HasRootDirectory(); });
+}
+
+bool HandleHasRootPathCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ return HandleHasItemCommand(
+ args, status,
+ [](const cmCMakePath& path) -> bool { return path.HasRootPath(); });
+}
+
+bool HandleHasFilenameCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ return HandleHasItemCommand(
+ args, status,
+ [](const cmCMakePath& path) -> bool { return path.HasFileName(); });
+}
+
+bool HandleHasExtensionCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ return HandleHasItemCommand(
+ args, status,
+ [](const cmCMakePath& path) -> bool { return path.HasExtension(); });
+}
+
+bool HandleHasStemCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ return HandleHasItemCommand(
+ args, status,
+ [](const cmCMakePath& path) -> bool { return path.HasStem(); });
+}
+
+bool HandleHasRelativePathCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ return HandleHasItemCommand(
+ args, status,
+ [](const cmCMakePath& path) -> bool { return path.HasRelativePath(); });
+}
+
+bool HandleHasParentPathCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ return HandleHasItemCommand(
+ args, status,
+ [](const cmCMakePath& path) -> bool { return path.HasParentPath(); });
+}
+
+bool HandleIsAbsoluteCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ if (args.size() != 3) {
+ status.SetError("IS_ABSOLUTE must be called with two arguments.");
+ return false;
+ }
+
+ std::string inputPath;
+ if (!getInputPath(args[1], status, inputPath)) {
+ return false;
+ }
+
+ if (args[2].empty()) {
+ status.SetError("Invalid name for output variable.");
+ return false;
+ }
+
+ bool isAbsolute = cmCMakePath(inputPath).IsAbsolute();
+
+ status.GetMakefile().AddDefinitionBool(args[2], isAbsolute);
+
+ return true;
+}
+
+bool HandleIsRelativeCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ if (args.size() != 3) {
+ status.SetError("IS_RELATIVE must be called with two arguments.");
+ return false;
+ }
+
+ std::string inputPath;
+ if (!getInputPath(args[1], status, inputPath)) {
+ return false;
+ }
+
+ if (args[2].empty()) {
+ status.SetError("Invalid name for output variable.");
+ return false;
+ }
+
+ bool isRelative = cmCMakePath(inputPath).IsRelative();
+
+ status.GetMakefile().AddDefinitionBool(args[2], isRelative);
+
+ return true;
+}
+
+bool HandleIsPrefixCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ if (args.size() < 4 || args.size() > 5) {
+ status.SetError("IS_PREFIX must be called with three or four arguments.");
+ return false;
+ }
+
+ static NormalizeParser const parser;
+
+ const auto arguments = parser.Parse(args);
+
+ if (parser.GetInputs().size() != 2) {
+ status.SetError("IS_PREFIX called with unexpected arguments.");
+ return false;
+ }
+
+ std::string inputPath;
+ if (!getInputPath(args[1], status, inputPath)) {
+ return false;
+ }
+
+ const auto& input = parser.GetInputs().front();
+ const auto& output = parser.GetInputs().back();
+
+ if (output.empty()) {
+ status.SetError("Invalid name for output variable.");
+ return false;
+ }
+
+ bool isPrefix;
+ if (arguments.Normalize) {
+ isPrefix =
+ cmCMakePath(inputPath).Normal().IsPrefix(cmCMakePath(input).Normal());
+ } else {
+ isPrefix = cmCMakePath(inputPath).IsPrefix(input);
+ }
+
+ status.GetMakefile().AddDefinitionBool(output, isPrefix);
+
+ return true;
+}
+
+bool HandleHashCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ if (args.size() < 3 || args.size() > 4) {
+ status.SetError("HASH must be called with two or three arguments.");
+ return false;
+ }
+
+ static NormalizeParser const parser;
+
+ const auto arguments = parser.Parse(args);
+
+ if (parser.GetInputs().size() != 1) {
+ status.SetError("HASH called with unexpected arguments.");
+ return false;
+ }
+
+ std::string inputPath;
+ if (!getInputPath(args[1], status, inputPath)) {
+ return false;
+ }
+
+ const auto& output = parser.GetInputs().front();
+
+ if (output.empty()) {
+ status.SetError("Invalid name for output variable.");
+ return false;
+ }
+
+ auto hash = hash_value(arguments.Normalize ? cmCMakePath(inputPath).Normal()
+ : cmCMakePath(inputPath));
+
+ std::ostringstream out;
+ out << std::setbase(16) << hash;
+
+ status.GetMakefile().AddDefinition(output, out.str());
+
+ return true;
+}
+} // anonymous namespace
+
+bool cmCMakePathCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ if (args.size() < 2) {
+ status.SetError("must be called with at least two arguments.");
+ return false;
+ }
+
+ static cmSubcommandTable const subcommand{
+ { "GET"_s, HandleGetCommand },
+ { "APPEND"_s, HandleAppendCommand },
+ { "CONCAT"_s, HandleConcatCommand },
+ { "REMOVE_FILENAME"_s, HandleRemoveFilenameCommand },
+ { "REPLACE_FILENAME"_s, HandleReplaceFilenameCommand },
+ { "REMOVE_EXTENSION"_s, HandleRemoveExtensionCommand },
+ { "REPLACE_EXTENSION"_s, HandleReplaceExtensionCommand },
+ { "NORMAL_PATH"_s, HandleNormalPathCommand },
+ { "RELATIVE_PATH"_s, HandleRelativePathCommand },
+ { "PROXIMATE_PATH"_s, HandleProximatePathCommand },
+ { "ABSOLUTE_PATH"_s, HandleAbsolutePathCommand },
+ { "CMAKE_PATH"_s, HandleCMakePathCommand },
+ { "NATIVE_PATH"_s, HandleNativePathCommand },
+ { "CONVERT"_s, HandleConvertCommand },
+ { "COMPARE"_s, HandleCompareCommand },
+ { "HAS_ROOT_NAME"_s, HandleHasRootNameCommand },
+ { "HAS_ROOT_DIRECTORY"_s, HandleHasRootDirectoryCommand },
+ { "HAS_ROOT_PATH"_s, HandleHasRootPathCommand },
+ { "HAS_FILENAME"_s, HandleHasFilenameCommand },
+ { "HAS_EXTENSION"_s, HandleHasExtensionCommand },
+ { "HAS_STEM"_s, HandleHasStemCommand },
+ { "HAS_RELATIVE_PATH"_s, HandleHasRelativePathCommand },
+ { "HAS_PARENT_PATH"_s, HandleHasParentPathCommand },
+ { "IS_ABSOLUTE"_s, HandleIsAbsoluteCommand },
+ { "IS_RELATIVE"_s, HandleIsRelativeCommand },
+ { "IS_PREFIX"_s, HandleIsPrefixCommand },
+ { "HASH"_s, HandleHashCommand }
+ };
+
+ return subcommand(args[0], args, status);
+}
diff --git a/Source/cmCMakePathCommand.h b/Source/cmCMakePathCommand.h
new file mode 100644
index 0000000..49e9380
--- /dev/null
+++ b/Source/cmCMakePathCommand.h
@@ -0,0 +1,14 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#pragma once
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include <string>
+#include <vector>
+
+class cmExecutionStatus;
+
+bool cmCMakePathCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h
index ba9397d..7346b66 100644
--- a/Source/cmCMakePolicyCommand.h
+++ b/Source/cmCMakePolicyCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCMakePolicyCommand_h
-#define cmCMakePolicyCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -18,5 +17,3 @@ class cmExecutionStatus;
*/
bool cmCMakePolicyCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmCPackPropertiesGenerator.h b/Source/cmCPackPropertiesGenerator.h
index 8339238..63c469a 100644
--- a/Source/cmCPackPropertiesGenerator.h
+++ b/Source/cmCPackPropertiesGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCPackPropertiesGenerator_h
-#define cmCPackPropertiesGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -36,5 +35,3 @@ protected:
cmLocalGenerator* LG;
cmInstalledFile const& InstalledFile;
};
-
-#endif
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index 697d435..ee2960b 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -140,7 +140,7 @@ const char* CCONV cmGetCurrentOutputDirectory(void* arg)
const char* CCONV cmGetDefinition(void* arg, const char* def)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
- return mf->GetDefinition(def);
+ return cmToCStr(mf->GetDefinition(def));
}
int CCONV cmIsOn(void* arg, const char* name)
@@ -581,13 +581,13 @@ const char* CCONV cmSourceFileGetProperty(void* arg, const char* prop)
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
if (cmSourceFile* rsf = sf->RealSourceFile) {
cmProp p = rsf->GetProperty(prop);
- return p ? p->c_str() : nullptr;
+ return cmToCStr(p);
}
if (!strcmp(prop, "LOCATION")) {
return sf->FullPath.c_str();
}
cmProp retVal = sf->Properties.GetPropertyValue(prop);
- return retVal ? retVal->c_str() : nullptr;
+ return cmToCStr(retVal);
}
int CCONV cmSourceFileGetPropertyAsBool(void* arg, const char* prop)
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index f0ae8de..8cf5ae9 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -2620,14 +2620,14 @@ int cmCTest::ReadCustomConfigurationFileTree(const std::string& dir,
void cmCTest::PopulateCustomVector(cmMakefile* mf, const std::string& def,
std::vector<std::string>& vec)
{
- const char* dval = mf->GetDefinition(def);
+ cmProp dval = mf->GetDefinition(def);
if (!dval) {
return;
}
cmCTestLog(this, DEBUG, "PopulateCustomVector: " << def << std::endl);
vec.clear();
- cmExpandList(dval, vec);
+ cmExpandList(*dval, vec);
for (std::string const& it : vec) {
cmCTestLog(this, DEBUG, " -- " << it << std::endl);
@@ -2637,11 +2637,11 @@ void cmCTest::PopulateCustomVector(cmMakefile* mf, const std::string& def,
void cmCTest::PopulateCustomInteger(cmMakefile* mf, const std::string& def,
int& val)
{
- const char* dval = mf->GetDefinition(def);
+ cmProp dval = mf->GetDefinition(def);
if (!dval) {
return;
}
- val = atoi(dval);
+ val = atoi(dval->c_str());
}
std::string cmCTest::GetShortPathToFile(const std::string& cfname)
@@ -2971,7 +2971,7 @@ bool cmCTest::SetCTestConfigurationFromCMakeVariable(
cmMakefile* mf, const char* dconfig, const std::string& cmake_var,
bool suppress)
{
- cmProp ctvar = mf->GetDef(cmake_var);
+ cmProp ctvar = mf->GetDefinition(cmake_var);
if (!ctvar) {
return false;
}
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 1e0fb8c..e12f8b0 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCTest_h
-#define cmCTest_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -571,5 +570,3 @@ inline std::ostream& operator<<(std::ostream& os, const cmCTestLogWrite& c)
(ctSelf)->Log(cmCTest::logType, __FILE__, __LINE__, \
cmCTestLog_msg.str().c_str(), suppress); \
} while (false)
-
-#endif
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index f036258..20d49a8 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCacheManager_h
-#define cmCacheManager_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -210,5 +209,3 @@ private:
unsigned int CacheMajorVersion = 0;
unsigned int CacheMinorVersion = 0;
};
-
-#endif
diff --git a/Source/cmCallVisualStudioMacro.h b/Source/cmCallVisualStudioMacro.h
index 9b5b3a8..795b863 100644
--- a/Source/cmCallVisualStudioMacro.h
+++ b/Source/cmCallVisualStudioMacro.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCallVisualStudioMacro_h
-#define cmCallVisualStudioMacro_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -32,5 +31,3 @@ public:
protected:
private:
};
-
-#endif
diff --git a/Source/cmCheckCustomOutputs.h b/Source/cmCheckCustomOutputs.h
index 9f33d16..2752ed4 100644
--- a/Source/cmCheckCustomOutputs.h
+++ b/Source/cmCheckCustomOutputs.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCheckCustomOutputs_h
-#define cmCheckCustomOutputs_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -14,5 +13,3 @@ class cmExecutionStatus;
bool cmCheckCustomOutputs(const std::vector<std::string>& outputs,
cm::string_view keyword, cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index bcb178d..68c56d9 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCommand_h
-#define cmCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -96,5 +95,3 @@ public:
private:
std::unique_ptr<cmCommand> Command;
};
-
-#endif
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index 87eb91c..e3d014e 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -93,7 +93,7 @@ const char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
if (this->FileLine >= 0 && strcmp(var, "CMAKE_CURRENT_LIST_LINE") == 0) {
return this->AddString(std::to_string(this->FileLine));
}
- const char* value = this->Makefile->GetDefinition(var);
+ cmProp value = this->Makefile->GetDefinition(var);
if (!value) {
this->Makefile->MaybeWarnUninitialized(var, this->FileName);
if (!this->RemoveEmpty) {
@@ -101,9 +101,9 @@ const char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
}
}
if (this->EscapeQuotes && value) {
- return this->AddString(cmEscapeQuotes(value));
+ return this->AddString(cmEscapeQuotes(*value));
}
- return this->AddString(value ? value : "");
+ return this->AddString(cmToCStrSafe(value));
}
const char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var)
@@ -205,23 +205,24 @@ bool cmCommandArgumentParserHelper::HandleEscapeSymbol(
void cmCommandArgument_SetupEscapes(yyscan_t yyscanner, bool noEscapes);
-int cmCommandArgumentParserHelper::ParseString(const char* str, int verb)
+int cmCommandArgumentParserHelper::ParseString(std::string const& str,
+ int verb)
{
- if (!str) {
+ if (str.empty()) {
return 0;
}
+ this->InputSize = str.size();
this->Verbose = verb;
- this->InputBuffer = str;
- this->InputBufferPos = 0;
- this->CurrentLine = 0;
this->Result.clear();
yyscan_t yyscanner;
cmCommandArgument_yylex_init(&yyscanner);
+ auto scanBuf = cmCommandArgument_yy_scan_string(str.c_str(), yyscanner);
cmCommandArgument_yyset_extra(this, yyscanner);
cmCommandArgument_SetupEscapes(yyscanner, this->NoEscapeMode);
int res = cmCommandArgument_yyparse(yyscanner);
+ cmCommandArgument_yy_delete_buffer(scanBuf, yyscanner);
cmCommandArgument_yylex_destroy(yyscanner);
if (res != 0) {
return 0;
@@ -241,25 +242,14 @@ void cmCommandArgumentParserHelper::CleanupParser()
this->Variables.clear();
}
-int cmCommandArgumentParserHelper::LexInput(char* buf, int maxlen)
+void cmCommandArgumentParserHelper::Error(const char* str)
{
- if (maxlen < 1) {
- return 0;
+ auto pos = this->InputBufferPos;
+ auto const isEof = (this->InputSize < this->InputBufferPos);
+ if (!isEof) {
+ pos -= this->LastTokenLength;
}
- if (this->InputBufferPos < this->InputBuffer.size()) {
- buf[0] = this->InputBuffer[this->InputBufferPos++];
- if (buf[0] == '\n') {
- this->CurrentLine++;
- }
- return (1);
- }
- buf[0] = '\n';
- return (0);
-}
-void cmCommandArgumentParserHelper::Error(const char* str)
-{
- unsigned long pos = static_cast<unsigned long>(this->InputBufferPos);
std::ostringstream ostr;
ostr << str << " (" << pos << ")";
this->SetError(ostr.str());
@@ -286,3 +276,9 @@ void cmCommandArgumentParserHelper::SetError(std::string const& msg)
this->ErrorString = msg;
}
}
+
+void cmCommandArgumentParserHelper::UpdateInputPosition(int const tokenLength)
+{
+ this->InputBufferPos += tokenLength;
+ this->LastTokenLength = tokenLength;
+}
diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h
index b46edcb..f79ca2c 100644
--- a/Source/cmCommandArgumentParserHelper.h
+++ b/Source/cmCommandArgumentParserHelper.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCommandArgumentParserHelper_h
-#define cmCommandArgumentParserHelper_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -26,7 +25,7 @@ public:
cmCommandArgumentParserHelper& operator=(
cmCommandArgumentParserHelper const&) = delete;
- int ParseString(const char* str, int verb);
+ int ParseString(std::string const& str, int verb);
// For the lexer:
void AllocateParserType(cmCommandArgumentParserHelper::ParserType* pt,
@@ -34,7 +33,6 @@ public:
bool HandleEscapeSymbol(cmCommandArgumentParserHelper::ParserType* pt,
char symbol);
- int LexInput(char* buf, int maxlen);
void Error(const char* str);
// For yacc
@@ -47,6 +45,8 @@ public:
void SetMakefile(const cmMakefile* mf);
+ void UpdateInputPosition(int tokenLength);
+
std::string& GetResult() { return this->Result; }
void SetLineFile(long line, const char* file);
@@ -58,8 +58,9 @@ public:
const char* GetError() { return this->ErrorString.c_str(); }
private:
- std::string::size_type InputBufferPos;
- std::string InputBuffer;
+ std::string::size_type InputBufferPos{ 1 };
+ std::string::size_type LastTokenLength{};
+ std::string::size_type InputSize{};
std::vector<char> OutputBuffer;
void Print(const char* place, const char* str);
@@ -76,7 +77,6 @@ private:
std::string ErrorString;
const char* FileName;
long FileLine;
- int CurrentLine;
int Verbose;
bool EscapeQuotes;
bool NoEscapeMode;
@@ -89,5 +89,3 @@ private:
#define YY_EXTRA_TYPE cmCommandArgumentParserHelper*
#define YY_DECL \
int cmCommandArgument_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner)
-
-#endif
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index c94f128..37be542 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -17,6 +17,7 @@
#include "cmBreakCommand.h"
#include "cmBuildCommand.h"
#include "cmCMakeMinimumRequired.h"
+#include "cmCMakePathCommand.h"
#include "cmCMakePolicyCommand.h"
#include "cmCommand.h"
#include "cmConfigureFileCommand.h"
@@ -120,6 +121,7 @@ void GetScriptingCommands(cmState* state)
{
state->AddBuiltinCommand("break", cmBreakCommand);
state->AddBuiltinCommand("cmake_minimum_required", cmCMakeMinimumRequired);
+ state->AddBuiltinCommand("cmake_path", cmCMakePathCommand);
state->AddBuiltinCommand("cmake_policy", cmCMakePolicyCommand);
state->AddBuiltinCommand("configure_file", cmConfigureFileCommand);
state->AddBuiltinCommand("continue", cmContinueCommand);
diff --git a/Source/cmCommands.h b/Source/cmCommands.h
index 1f8fafb..5605430 100644
--- a/Source/cmCommands.h
+++ b/Source/cmCommands.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCommands_h
-#define cmCommands_h
+#pragma once
class cmState;
@@ -13,5 +12,3 @@ class cmState;
void GetScriptingCommands(cmState* state);
void GetProjectCommands(cmState* state);
void GetProjectCommandsInScriptMode(cmState* state);
-
-#endif
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 8aee27c..2b7c9f6 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -55,7 +55,7 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(
}
// TODO: Create a per-language flag variable.
- const char* defFileFlag =
+ cmProp defFileFlag =
this->Makefile->GetDefinition("CMAKE_LINK_DEF_FILE_FLAG");
if (!defFileFlag) {
return;
@@ -64,7 +64,7 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(
// Append the flag and value. Use ConvertToLinkReference to help
// vs6's "cl -link" pass it to the linker.
std::string flag =
- cmStrCat(defFileFlag,
+ cmStrCat(*defFileFlag,
this->LocalCommonGenerator->ConvertToOutputFormat(
linkLineComputer->ConvertToLinkReference(mdi->DefFile),
cmOutputConverter::SHELL));
@@ -270,7 +270,7 @@ void cmCommonTargetGenerator::AppendOSXVerFlag(std::string& flags,
{
// Lookup the flag to specify the version.
std::string fvar = cmStrCat("CMAKE_", lang, "_OSX_", name, "_VERSION_FLAG");
- const char* flag = this->Makefile->GetDefinition(fvar);
+ cmProp flag = this->Makefile->GetDefinition(fvar);
// Skip if no such flag.
if (!flag) {
@@ -288,7 +288,7 @@ void cmCommonTargetGenerator::AppendOSXVerFlag(std::string& flags,
if (major > 0 || minor > 0 || patch > 0) {
// Append the flag since a non-zero version is specified.
std::ostringstream vflag;
- vflag << flag << major << "." << minor << "." << patch;
+ vflag << *flag << major << "." << minor << "." << patch;
this->LocalCommonGenerator->AppendFlags(flags, vflag.str());
}
}
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index c3c3a3a..fba6b0a 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCommonTargetGenerator_h
-#define cmCommonTargetGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -75,5 +74,3 @@ private:
};
std::map<std::string, ByConfig> Configs;
};
-
-#endif
diff --git a/Source/cmComputeComponentGraph.h b/Source/cmComputeComponentGraph.h
index b873131..1d1d134 100644
--- a/Source/cmComputeComponentGraph.h
+++ b/Source/cmComputeComponentGraph.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmComputeComponentGraph_h
-#define cmComputeComponentGraph_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -78,5 +77,3 @@ private:
// Connected components.
};
-
-#endif
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 8ca2168..5341e8d 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -5,7 +5,6 @@
#include <algorithm>
#include <cassert>
#include <cstdio>
-#include <cstring>
#include <iterator>
#include <sstream>
#include <utility>
@@ -18,6 +17,7 @@
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmRange.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
@@ -315,9 +315,9 @@ int cmComputeLinkDepends::AddLinkEntry(cmLinkItem const& item)
} else {
// Look for an old-style <item>_LIB_DEPENDS variable.
std::string var = cmStrCat(entry.Item.Value, "_LIB_DEPENDS");
- if (const char* val = this->Makefile->GetDefinition(var)) {
+ if (cmProp val = this->Makefile->GetDefinition(var)) {
// The item dependencies are known. Follow them.
- BFSEntry qe = { index, val };
+ BFSEntry qe = { index, val->c_str() };
this->BFSQueue.push(qe);
} else if (!entry.IsFlag) {
// The item dependencies are not known. We need to infer them.
@@ -454,10 +454,10 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index,
// lower.
if (!haveLLT) {
std::string var = cmStrCat(d, "_LINK_TYPE");
- if (const char* val = this->Makefile->GetDefinition(var)) {
- if (strcmp(val, "debug") == 0) {
+ if (cmProp val = this->Makefile->GetDefinition(var)) {
+ if (*val == "debug") {
llt = DEBUG_LibraryType;
- } else if (strcmp(val, "optimized") == 0) {
+ } else if (*val == "optimized") {
llt = OPTIMIZED_LibraryType;
}
}
diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h
index e806dff..902500a 100644
--- a/Source/cmComputeLinkDepends.h
+++ b/Source/cmComputeLinkDepends.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmComputeLinkDepends_h
-#define cmComputeLinkDepends_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -160,5 +159,3 @@ private:
bool DebugMode;
bool OldLinkDirMode;
};
-
-#endif
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 43cceae..4a331fb 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -4,7 +4,6 @@
#include <algorithm>
#include <cctype>
-#include <cstring>
#include <sstream>
#include <utility>
@@ -284,27 +283,28 @@ cmComputeLinkInformation::cmComputeLinkInformation(
this->Target->GetType() == cmStateEnums::MODULE_LIBRARY) {
std::string loader_flag_var =
cmStrCat("CMAKE_SHARED_MODULE_LOADER_", this->LinkLanguage, "_FLAG");
- this->LoaderFlag = this->Makefile->GetDefinition(loader_flag_var);
+ this->LoaderFlag =
+ cmToCStr(this->Makefile->GetDefinition(loader_flag_var));
}
// Get options needed to link libraries.
- if (const char* flag = this->Makefile->GetDefinition(
+ if (cmProp flag = this->Makefile->GetDefinition(
"CMAKE_" + this->LinkLanguage + "_LINK_LIBRARY_FLAG")) {
- this->LibLinkFlag = flag;
+ this->LibLinkFlag = *flag;
} else {
this->LibLinkFlag =
this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FLAG");
}
- if (const char* flag = this->Makefile->GetDefinition(
+ if (cmProp flag = this->Makefile->GetDefinition(
"CMAKE_" + this->LinkLanguage + "_LINK_LIBRARY_FILE_FLAG")) {
- this->LibLinkFileFlag = flag;
+ this->LibLinkFileFlag = *flag;
} else {
this->LibLinkFileFlag =
this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FILE_FLAG");
}
- if (const char* suffix = this->Makefile->GetDefinition(
+ if (cmProp suffix = this->Makefile->GetDefinition(
"CMAKE_" + this->LinkLanguage + "_LINK_LIBRARY_SUFFIX")) {
- this->LibLinkSuffix = suffix;
+ this->LibLinkSuffix = *suffix;
} else {
this->LibLinkSuffix =
this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_SUFFIX");
@@ -593,9 +593,9 @@ void cmComputeLinkInformation::AddRuntimeLinkLibrary(std::string const& lang)
if (runtimeLibrary.empty()) {
return;
}
- if (const char* runtimeLinkOptions = this->Makefile->GetDefinition(
+ if (cmProp runtimeLinkOptions = this->Makefile->GetDefinition(
"CMAKE_" + lang + "_RUNTIME_LIBRARY_LINK_OPTIONS_" + runtimeLibrary)) {
- std::vector<std::string> libsVec = cmExpandedList(runtimeLinkOptions);
+ std::vector<std::string> libsVec = cmExpandedList(*runtimeLinkOptions);
for (std::string const& i : libsVec) {
if (!cm::contains(this->ImplicitLinkLibs, i)) {
this->AddItem(i, nullptr);
@@ -609,8 +609,8 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
// Add libraries for this language that are not implied by the
// linker language.
std::string libVar = cmStrCat("CMAKE_", lang, "_IMPLICIT_LINK_LIBRARIES");
- if (const char* libs = this->Makefile->GetDefinition(libVar)) {
- std::vector<std::string> libsVec = cmExpandedList(libs);
+ if (cmProp libs = this->Makefile->GetDefinition(libVar)) {
+ std::vector<std::string> libsVec = cmExpandedList(*libs);
for (std::string const& i : libsVec) {
if (!cm::contains(this->ImplicitLinkLibs, i)) {
this->AddItem(i, nullptr);
@@ -621,8 +621,8 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
// Add linker search paths for this language that are not
// implied by the linker language.
std::string dirVar = cmStrCat("CMAKE_", lang, "_IMPLICIT_LINK_DIRECTORIES");
- if (const char* dirs = this->Makefile->GetDefinition(dirVar)) {
- std::vector<std::string> dirsVec = cmExpandedList(dirs);
+ if (cmProp dirs = this->Makefile->GetDefinition(dirVar)) {
+ std::vector<std::string> dirsVec = cmExpandedList(*dirs);
this->OrderLinkerSearchPath->AddLanguageDirectories(dirsVec);
}
}
@@ -800,8 +800,8 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo()
this->LinkTypeEnabled = false;
// Lookup link type selection flags.
- const char* static_link_type_flag = nullptr;
- const char* shared_link_type_flag = nullptr;
+ cmProp static_link_type_flag = nullptr;
+ cmProp shared_link_type_flag = nullptr;
const char* target_type_str = nullptr;
switch (this->Target->GetType()) {
case cmStateEnums::EXECUTABLE:
@@ -834,8 +834,8 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo()
// known.
if (cmNonempty(static_link_type_flag) && cmNonempty(shared_link_type_flag)) {
this->LinkTypeEnabled = true;
- this->StaticLinkTypeFlag = static_link_type_flag;
- this->SharedLinkTypeFlag = shared_link_type_flag;
+ this->StaticLinkTypeFlag = *static_link_type_flag;
+ this->SharedLinkTypeFlag = *shared_link_type_flag;
}
// Lookup the starting link type from the target (linked statically?).
@@ -861,16 +861,15 @@ void cmComputeLinkInformation::ComputeItemParserInfo()
LinkShared);
this->AddLinkExtension(mf->GetSafeDefinition("CMAKE_LINK_LIBRARY_SUFFIX"),
LinkUnknown);
- if (const char* linkSuffixes =
- mf->GetDefinition("CMAKE_EXTRA_LINK_EXTENSIONS")) {
- std::vector<std::string> linkSuffixVec = cmExpandedList(linkSuffixes);
+ if (cmProp linkSuffixes = mf->GetDefinition("CMAKE_EXTRA_LINK_EXTENSIONS")) {
+ std::vector<std::string> linkSuffixVec = cmExpandedList(*linkSuffixes);
for (std::string const& i : linkSuffixVec) {
this->AddLinkExtension(i, LinkUnknown);
}
}
- if (const char* sharedSuffixes =
+ if (cmProp sharedSuffixes =
mf->GetDefinition("CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES")) {
- std::vector<std::string> sharedSuffixVec = cmExpandedList(sharedSuffixes);
+ std::vector<std::string> sharedSuffixVec = cmExpandedList(*sharedSuffixes);
for (std::string const& i : sharedSuffixVec) {
this->AddLinkExtension(i, LinkShared);
}
@@ -1553,10 +1552,10 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo()
// Append library architecture to all implicit platform directories
// and add them to the set
- if (const char* libraryArch =
+ if (cmProp libraryArch =
this->Makefile->GetDefinition("CMAKE_LIBRARY_ARCHITECTURE")) {
for (std::string const& i : implicitDirVec) {
- this->ImplicitLinkDirs.insert(i + "/" + libraryArch);
+ this->ImplicitLinkDirs.insert(i + "/" + *libraryArch);
}
}
@@ -1746,14 +1745,13 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
}
if (use_build_rpath || use_link_rpath) {
std::string rootPath;
- if (const char* sysrootLink =
+ if (cmProp sysrootLink =
this->Makefile->GetDefinition("CMAKE_SYSROOT_LINK")) {
- rootPath = sysrootLink;
+ rootPath = *sysrootLink;
} else {
rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
}
- const char* stagePath =
- this->Makefile->GetDefinition("CMAKE_STAGING_PREFIX");
+ cmProp stagePath = this->Makefile->GetDefinition("CMAKE_STAGING_PREFIX");
std::string const& installPrefix =
this->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
cmSystemTools::ConvertToUnixSlashes(rootPath);
@@ -1767,8 +1765,8 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
std::string d = ri;
if (!rootPath.empty() && cmHasPrefix(d, rootPath)) {
d.erase(0, rootPath.size());
- } else if (cmNonempty(stagePath) && cmHasPrefix(d, stagePath)) {
- d.erase(0, strlen(stagePath));
+ } else if (cmNonempty(stagePath) && cmHasPrefix(d, *stagePath)) {
+ d.erase(0, (*stagePath).size());
d = cmStrCat(installPrefix, '/', d);
cmSystemTools::ConvertToUnixSlashes(d);
} else if (use_relative_build_rpath) {
@@ -1798,8 +1796,8 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
std::string d = ri;
if (!rootPath.empty() && cmHasPrefix(d, rootPath)) {
d.erase(0, rootPath.size());
- } else if (cmNonempty(stagePath) && cmHasPrefix(d, stagePath)) {
- d.erase(0, strlen(stagePath));
+ } else if (cmNonempty(stagePath) && cmHasPrefix(d, *stagePath)) {
+ d.erase(0, (*stagePath).size());
d = cmStrCat(installPrefix, '/', d);
cmSystemTools::ConvertToUnixSlashes(d);
}
@@ -1821,7 +1819,7 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
"CMAKE_" + li + "_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH";
if (this->Makefile->IsOn(useVar)) {
std::string dirVar = "CMAKE_" + li + "_IMPLICIT_LINK_DIRECTORIES";
- if (cmProp dirs = this->Makefile->GetDef(dirVar)) {
+ if (cmProp dirs = this->Makefile->GetDefinition(dirVar)) {
cmCLI_ExpandListUnique(*dirs, runtimeDirs, emitted);
}
}
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index 544ff23..543b6d7 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmComputeLinkInformation_h
-#define cmComputeLinkInformation_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -209,5 +208,3 @@ private:
const cmGeneratorTarget* target);
void AddLibraryRuntimeInfo(std::string const& fullPath);
};
-
-#endif
diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h
index 277521d..3517844 100644
--- a/Source/cmComputeTargetDepends.h
+++ b/Source/cmComputeTargetDepends.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmComputeTargetDepends_h
-#define cmComputeTargetDepends_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -105,5 +104,3 @@ private:
bool IntraComponent(std::vector<int> const& cmap, int c, int i, int* head,
std::set<int>& emitted, std::set<int>& visited);
};
-
-#endif
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 7a3a3e8..7ada8d8 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -4,7 +4,6 @@
#include <cstdio>
#include <cstdlib>
-#include <cstring>
#include <functional>
#include <sstream>
#include <utility>
@@ -15,6 +14,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -134,7 +134,7 @@ bool cmConditionEvaluator::IsTrue(
}
//=========================================================================
-const char* cmConditionEvaluator::GetDefinitionIfUnquoted(
+cmProp cmConditionEvaluator::GetDefinitionIfUnquoted(
cmExpandedCommandArgument const& argument) const
{
if ((this->Policy54Status != cmPolicies::WARN &&
@@ -143,7 +143,7 @@ const char* cmConditionEvaluator::GetDefinitionIfUnquoted(
return nullptr;
}
- const char* def = this->Makefile.GetDefinition(argument.GetValue());
+ cmProp def = this->Makefile.GetDefinition(argument.GetValue());
if (def && argument.WasQuoted() &&
this->Policy54Status == cmPolicies::WARN) {
@@ -165,13 +165,13 @@ const char* cmConditionEvaluator::GetDefinitionIfUnquoted(
}
//=========================================================================
-const char* cmConditionEvaluator::GetVariableOrString(
+cmProp cmConditionEvaluator::GetVariableOrString(
const cmExpandedCommandArgument& argument) const
{
- const char* def = this->GetDefinitionIfUnquoted(argument);
+ cmProp def = this->GetDefinitionIfUnquoted(argument);
if (!def) {
- def = argument.c_str();
+ def = &argument.GetValue();
}
return def;
@@ -231,7 +231,7 @@ bool cmConditionEvaluator::GetBooleanValue(
// Check for numbers.
if (!arg.empty()) {
char* end;
- double d = strtod(arg.c_str(), &end);
+ double d = strtod(arg.GetValue().c_str(), &end);
if (*end == '\0') {
// The whole string is a number. Use C conversion to bool.
return static_cast<bool>(d);
@@ -239,7 +239,7 @@ bool cmConditionEvaluator::GetBooleanValue(
}
// Check definition.
- const char* def = this->GetDefinitionIfUnquoted(arg);
+ cmProp def = this->GetDefinitionIfUnquoted(arg);
return !cmIsOff(def);
}
@@ -256,13 +256,13 @@ bool cmConditionEvaluator::GetBooleanValueOld(
if (arg == "1") {
return true;
}
- const char* def = this->GetDefinitionIfUnquoted(arg);
+ cmProp def = this->GetDefinitionIfUnquoted(arg);
return !cmIsOff(def);
}
// Old GetVariableOrNumber behavior.
- const char* def = this->GetDefinitionIfUnquoted(arg);
- if (!def && atoi(arg.c_str())) {
- def = arg.c_str();
+ cmProp def = this->GetDefinitionIfUnquoted(arg);
+ if (!def && atoi(arg.GetValue().c_str())) {
+ def = &arg.GetValue();
}
return !cmIsOff(def);
}
@@ -434,36 +434,38 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
this->IncrementArguments(newArgs, argP1, argP2);
// does a file exist
if (this->IsKeyword(keyEXISTS, *arg) && argP1 != newArgs.end()) {
- this->HandlePredicate(cmSystemTools::FileExists(argP1->c_str()),
+ this->HandlePredicate(cmSystemTools::FileExists(argP1->GetValue()),
reducible, arg, newArgs, argP1, argP2);
}
// does a directory with this name exist
if (this->IsKeyword(keyIS_DIRECTORY, *arg) && argP1 != newArgs.end()) {
- this->HandlePredicate(cmSystemTools::FileIsDirectory(argP1->c_str()),
- reducible, arg, newArgs, argP1, argP2);
+ this->HandlePredicate(
+ cmSystemTools::FileIsDirectory(argP1->GetValue()), reducible, arg,
+ newArgs, argP1, argP2);
}
// does a symlink with this name exist
if (this->IsKeyword(keyIS_SYMLINK, *arg) && argP1 != newArgs.end()) {
- this->HandlePredicate(cmSystemTools::FileIsSymlink(argP1->c_str()),
+ this->HandlePredicate(cmSystemTools::FileIsSymlink(argP1->GetValue()),
reducible, arg, newArgs, argP1, argP2);
}
// is the given path an absolute path ?
if (this->IsKeyword(keyIS_ABSOLUTE, *arg) && argP1 != newArgs.end()) {
- this->HandlePredicate(cmSystemTools::FileIsFullPath(argP1->c_str()),
+ this->HandlePredicate(cmSystemTools::FileIsFullPath(argP1->GetValue()),
reducible, arg, newArgs, argP1, argP2);
}
// does a command exist
if (this->IsKeyword(keyCOMMAND, *arg) && argP1 != newArgs.end()) {
cmState::Command command =
- this->Makefile.GetState()->GetCommand(argP1->c_str());
+ this->Makefile.GetState()->GetCommand(argP1->GetValue());
this->HandlePredicate(command != nullptr, reducible, arg, newArgs,
argP1, argP2);
}
// does a policy exist
if (this->IsKeyword(keyPOLICY, *arg) && argP1 != newArgs.end()) {
cmPolicies::PolicyID pid;
- this->HandlePredicate(cmPolicies::GetPolicyID(argP1->c_str(), pid),
- reducible, arg, newArgs, argP1, argP2);
+ this->HandlePredicate(
+ cmPolicies::GetPolicyID(argP1->GetValue().c_str(), pid), reducible,
+ arg, newArgs, argP1, argP2);
}
// does a target exist
if (this->IsKeyword(keyTARGET, *arg) && argP1 != newArgs.end()) {
@@ -475,7 +477,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
if (this->Policy64Status != cmPolicies::OLD &&
this->Policy64Status != cmPolicies::WARN) {
if (this->IsKeyword(keyTEST, *arg) && argP1 != newArgs.end()) {
- const cmTest* haveTest = this->Makefile.GetTest(argP1->c_str());
+ const cmTest* haveTest = this->Makefile.GetTest(argP1->GetValue());
this->HandlePredicate(haveTest != nullptr, reducible, arg, newArgs,
argP1, argP2);
}
@@ -522,8 +524,8 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
{
int reducible;
std::string def_buf;
- const char* def;
- const char* def2;
+ cmProp def;
+ cmProp def2;
do {
reducible = 0;
auto arg = newArgs.begin();
@@ -534,15 +536,16 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
this->IncrementArguments(newArgs, argP1, argP2);
if (argP1 != newArgs.end() && argP2 != newArgs.end() &&
IsKeyword(keyMATCHES, *argP1)) {
- def = this->GetVariableOrString(*arg);
- if (def != arg->c_str() // yes, we compare the pointer value
- && cmHasLiteralPrefix(arg->GetValue(), "CMAKE_MATCH_")) {
+ def = this->GetDefinitionIfUnquoted(*arg);
+ if (!def) {
+ def = &arg->GetValue();
+ } else if (cmHasLiteralPrefix(arg->GetValue(), "CMAKE_MATCH_")) {
// The string to match is owned by our match result variables.
// Move it to our own buffer before clearing them.
- def_buf = def;
- def = def_buf.c_str();
+ def_buf = *def;
+ def = &def_buf;
}
- const char* rex = argP2->c_str();
+ const std::string& rex = argP2->GetValue();
this->Makefile.ClearMatches();
cmsys::RegularExpression regEntry;
if (!regEntry.compile(rex)) {
@@ -552,7 +555,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
status = MessageType::FATAL_ERROR;
return false;
}
- if (regEntry.find(def)) {
+ if (regEntry.find(*def)) {
this->Makefile.StoreMatches(regEntry);
*arg = cmExpandedCommandArgument("1", true);
} else {
@@ -584,7 +587,8 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
double lhs;
double rhs;
bool result;
- if (sscanf(def, "%lg", &lhs) != 1 || sscanf(def2, "%lg", &rhs) != 1) {
+ if (sscanf(def->c_str(), "%lg", &lhs) != 1 ||
+ sscanf(def2->c_str(), "%lg", &rhs) != 1) {
result = false;
} else if (*(argP1) == keyLESS) {
result = (lhs < rhs);
@@ -608,7 +612,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
this->IsKeyword(keySTREQUAL, *argP1))) {
def = this->GetVariableOrString(*arg);
def2 = this->GetVariableOrString(*argP2);
- int val = strcmp(def, def2);
+ int val = (*def).compare(*def2);
bool result;
if (*(argP1) == keySTRLESS) {
result = (val < 0);
@@ -645,7 +649,8 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
} else { // version_equal
op = cmSystemTools::OP_EQUAL;
}
- bool result = cmSystemTools::VersionCompare(op, def, def2);
+ bool result =
+ cmSystemTools::VersionCompare(op, def->c_str(), def2->c_str());
this->HandleBinaryOp(result, reducible, arg, newArgs, argP1, argP2);
}
@@ -670,9 +675,8 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
def2 = this->Makefile.GetDefinition(argP2->GetValue());
if (def2) {
- std::vector<std::string> list = cmExpandedList(def2, true);
-
- result = cm::contains(list, def);
+ std::vector<std::string> list = cmExpandedList(*def2, true);
+ result = cm::contains(list, *def);
}
this->HandleBinaryOp(result, reducible, arg, newArgs, argP1, argP2);
diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h
index 082534c..a4cedff 100644
--- a/Source/cmConditionEvaluator.h
+++ b/Source/cmConditionEvaluator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmConditionEvaluator_h
-#define cmConditionEvaluator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -13,6 +12,7 @@
#include "cmListFileCache.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
class cmMakefile;
@@ -32,11 +32,10 @@ public:
private:
// Filter the given variable definition based on policy CMP0054.
- const char* GetDefinitionIfUnquoted(
+ cmProp GetDefinitionIfUnquoted(
const cmExpandedCommandArgument& argument) const;
- const char* GetVariableOrString(
- const cmExpandedCommandArgument& argument) const;
+ cmProp GetVariableOrString(const cmExpandedCommandArgument& argument) const;
bool IsKeyword(std::string const& keyword,
cmExpandedCommandArgument& argument) const;
@@ -87,5 +86,3 @@ private:
cmPolicies::PolicyStatus Policy57Status;
cmPolicies::PolicyStatus Policy64Status;
};
-
-#endif
diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in
index 97e7856..ceb2a32 100644
--- a/Source/cmConfigure.cmake.h.in
+++ b/Source/cmConfigure.cmake.h.in
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmConfigure_h
-#define cmConfigure_h
+#pragma once
#include "cmsys/Configure.hxx" // IWYU pragma: export
@@ -28,5 +27,3 @@
#if defined(_WIN32) && !defined(NOMINMAX)
# define NOMINMAX
#endif
-
-#endif
diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h
index c7f95b8..009c145 100644
--- a/Source/cmConfigureFileCommand.h
+++ b/Source/cmConfigureFileCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmConfigureFileCommand_h
-#define cmConfigureFileCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,4 +11,3 @@ class cmExecutionStatus;
bool cmConfigureFileCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-#endif
diff --git a/Source/cmContinueCommand.h b/Source/cmContinueCommand.h
index ff903aa..29a219f 100644
--- a/Source/cmContinueCommand.h
+++ b/Source/cmContinueCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmContinueCommand_h
-#define cmContinueCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -17,5 +16,3 @@ class cmExecutionStatus;
*/
bool cmContinueCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 63c1484..77a6d4b 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -192,12 +192,15 @@ SETUP_LANGUAGE(objc_properties, OBJC);
// NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
SETUP_LANGUAGE(objcxx_properties, OBJCXX);
// NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
+SETUP_LANGUAGE(ispc_properties, ISPC);
+// NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
SETUP_LANGUAGE(swift_properties, Swift);
#undef SETUP_LANGUAGE
std::string const kCMAKE_CUDA_ARCHITECTURES = "CMAKE_CUDA_ARCHITECTURES";
std::string const kCMAKE_CUDA_RUNTIME_LIBRARY = "CMAKE_CUDA_RUNTIME_LIBRARY";
std::string const kCMAKE_ENABLE_EXPORTS = "CMAKE_ENABLE_EXPORTS";
+std::string const kCMAKE_ISPC_INSTRUCTION_SETS = "CMAKE_ISPC_INSTRUCTION_SETS";
std::string const kCMAKE_LINK_SEARCH_END_STATIC =
"CMAKE_LINK_SEARCH_END_STATIC";
std::string const kCMAKE_LINK_SEARCH_START_STATIC =
@@ -236,7 +239,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
this->SrcFileSignature = true;
cmStateEnums::TargetType targetType = cmStateEnums::EXECUTABLE;
- cmProp tt = this->Makefile->GetDef("CMAKE_TRY_COMPILE_TARGET_TYPE");
+ cmProp tt = this->Makefile->GetDefinition("CMAKE_TRY_COMPILE_TARGET_TYPE");
if (!isTryRun && cmNonempty(tt)) {
if (*tt == cmState::GetTargetTypeName(cmStateEnums::EXECUTABLE)) {
targetType = cmStateEnums::EXECUTABLE;
@@ -499,6 +502,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
}
}
+ // when the only language is ISPC we know that the output
+ // type must by a static library
+ if (testLangs.size() == 1 && testLangs.count("ISPC") == 1) {
+ targetType = cmStateEnums::STATIC_LIBRARY;
+ }
+
std::string const tcConfig =
this->Makefile->GetSafeDefinition("CMAKE_TRY_COMPILE_CONFIGURATION");
@@ -519,19 +528,19 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
return -1;
}
- const char* def = this->Makefile->GetDefinition("CMAKE_MODULE_PATH");
+ cmProp def = this->Makefile->GetDefinition("CMAKE_MODULE_PATH");
fprintf(fout, "cmake_minimum_required(VERSION %u.%u.%u.%u)\n",
cmVersion::GetMajorVersion(), cmVersion::GetMinorVersion(),
cmVersion::GetPatchVersion(), cmVersion::GetTweakVersion());
if (def) {
- fprintf(fout, "set(CMAKE_MODULE_PATH \"%s\")\n", def);
+ fprintf(fout, "set(CMAKE_MODULE_PATH \"%s\")\n", def->c_str());
}
/* Set MSVC runtime library policy to match our selection. */
- if (const char* msvcRuntimeLibraryDefault =
+ if (cmProp msvcRuntimeLibraryDefault =
this->Makefile->GetDefinition(kCMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT)) {
fprintf(fout, "cmake_policy(SET CMP0091 %s)\n",
- *msvcRuntimeLibraryDefault ? "NEW" : "OLD");
+ !msvcRuntimeLibraryDefault->empty() ? "NEW" : "OLD");
}
/* Set CUDA architectures policy to match outer project. */
@@ -547,14 +556,14 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
projectLangs += " " + li;
std::string rulesOverrideBase = "CMAKE_USER_MAKE_RULES_OVERRIDE";
std::string rulesOverrideLang = cmStrCat(rulesOverrideBase, "_", li);
- if (const char* rulesOverridePath =
+ if (cmProp rulesOverridePath =
this->Makefile->GetDefinition(rulesOverrideLang)) {
fprintf(fout, "set(%s \"%s\")\n", rulesOverrideLang.c_str(),
- rulesOverridePath);
- } else if (const char* rulesOverridePath2 =
+ rulesOverridePath->c_str());
+ } else if (cmProp rulesOverridePath2 =
this->Makefile->GetDefinition(rulesOverrideBase)) {
fprintf(fout, "set(%s \"%s\")\n", rulesOverrideBase.c_str(),
- rulesOverridePath2);
+ rulesOverridePath2->c_str());
}
}
fprintf(fout, "project(CMAKE_TRY_COMPILE%s)\n", projectLangs.c_str());
@@ -569,9 +578,9 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
fprintf(fout, "set(CMAKE_VERBOSE_MAKEFILE 1)\n");
for (std::string const& li : testLangs) {
std::string langFlags = "CMAKE_" + li + "_FLAGS";
- const char* flags = this->Makefile->GetDefinition(langFlags);
+ cmProp flags = this->Makefile->GetDefinition(langFlags);
fprintf(fout, "set(CMAKE_%s_FLAGS %s)\n", li.c_str(),
- cmOutputConverter::EscapeForCMake(flags ? flags : "").c_str());
+ cmOutputConverter::EscapeForCMake(cmToCStrSafe(flags)).c_str());
fprintf(fout,
"set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}"
" ${COMPILE_DEFINITIONS}\")\n",
@@ -608,10 +617,10 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
for (std::string const& li : testLangs) {
std::string const langFlagsCfg =
cmStrCat("CMAKE_", li, "_FLAGS_", cfg);
- const char* flagsCfg = this->Makefile->GetDefinition(langFlagsCfg);
- fprintf(fout, "set(%s %s)\n", langFlagsCfg.c_str(),
- cmOutputConverter::EscapeForCMake(flagsCfg ? flagsCfg : "")
- .c_str());
+ cmProp flagsCfg = this->Makefile->GetDefinition(langFlagsCfg);
+ fprintf(
+ fout, "set(%s %s)\n", langFlagsCfg.c_str(),
+ cmOutputConverter::EscapeForCMake(cmToCStrSafe(flagsCfg)).c_str());
}
} break;
}
@@ -641,12 +650,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
case cmPolicies::NEW:
// NEW behavior is to pass linker flags.
{
- const char* exeLinkFlags =
+ cmProp exeLinkFlags =
this->Makefile->GetDefinition("CMAKE_EXE_LINKER_FLAGS");
- fprintf(
- fout, "set(CMAKE_EXE_LINKER_FLAGS %s)\n",
- cmOutputConverter::EscapeForCMake(exeLinkFlags ? exeLinkFlags : "")
- .c_str());
+ fprintf(fout, "set(CMAKE_EXE_LINKER_FLAGS %s)\n",
+ cmOutputConverter::EscapeForCMake(cmToCStrSafe(exeLinkFlags))
+ .c_str());
}
break;
}
@@ -702,11 +710,14 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
vars.insert(
&objcxx_properties[lang_property_start],
&objcxx_properties[lang_property_start + lang_property_size]);
+ vars.insert(&ispc_properties[lang_property_start],
+ &ispc_properties[lang_property_start + lang_property_size]);
vars.insert(&swift_properties[lang_property_start],
&swift_properties[lang_property_start + lang_property_size]);
vars.insert(kCMAKE_CUDA_ARCHITECTURES);
vars.insert(kCMAKE_CUDA_RUNTIME_LIBRARY);
vars.insert(kCMAKE_ENABLE_EXPORTS);
+ vars.insert(kCMAKE_ISPC_INSTRUCTION_SETS);
vars.insert(kCMAKE_LINK_SEARCH_END_STATIC);
vars.insert(kCMAKE_LINK_SEARCH_START_STATIC);
vars.insert(kCMAKE_OSX_ARCHITECTURES);
@@ -720,9 +731,9 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
vars.insert(kCMAKE_WARN_DEPRECATED);
vars.emplace("CMAKE_MSVC_RUNTIME_LIBRARY"_s);
- if (const char* varListStr = this->Makefile->GetDefinition(
+ if (cmProp varListStr = this->Makefile->GetDefinition(
kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES)) {
- std::vector<std::string> varList = cmExpandedList(varListStr);
+ std::vector<std::string> varList = cmExpandedList(*varListStr);
vars.insert(varList.begin(), varList.end());
}
@@ -744,6 +755,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
vars.insert(
&objcxx_properties[pie_property_start],
&objcxx_properties[pie_property_start + pie_property_size]);
+ vars.insert(&ispc_properties[pie_property_start],
+ &ispc_properties[pie_property_start + pie_property_size]);
vars.insert(&swift_properties[pie_property_start],
&swift_properties[pie_property_start + pie_property_size]);
}
@@ -755,16 +768,16 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
cmLocalGenerator doesn't allow building for "the other"
architecture only via CMAKE_OSX_ARCHITECTURES.
*/
- if (const char* tcArchs = this->Makefile->GetDefinition(
+ if (cmProp tcArchs = this->Makefile->GetDefinition(
kCMAKE_TRY_COMPILE_OSX_ARCHITECTURES)) {
vars.erase(kCMAKE_OSX_ARCHITECTURES);
- std::string flag = "-DCMAKE_OSX_ARCHITECTURES=" + std::string(tcArchs);
+ std::string flag = "-DCMAKE_OSX_ARCHITECTURES=" + *tcArchs;
cmakeFlags.push_back(std::move(flag));
}
for (std::string const& var : vars) {
- if (const char* val = this->Makefile->GetDefinition(var)) {
- std::string flag = "-D" + var + "=" + val;
+ if (cmProp val = this->Makefile->GetDefinition(var)) {
+ std::string flag = "-D" + var + "=" + *val;
cmakeFlags.push_back(std::move(flag));
}
}
@@ -904,8 +917,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
if (this->Makefile->GetState()->UseGhsMultiIDE()) {
// Forward the GHS variables to the inner project cache.
for (std::string const& var : ghs_platform_vars) {
- if (const char* val = this->Makefile->GetDefinition(var)) {
- std::string flag = "-D" + var + "=" + "'" + val + "'";
+ if (cmProp val = this->Makefile->GetDefinition(var)) {
+ std::string flag = "-D" + var + "=" + "'" + *val + "'";
cmakeFlags.push_back(std::move(flag));
}
}
@@ -1042,18 +1055,18 @@ void cmCoreTryCompile::FindOutputFile(const std::string& targetName,
std::vector<std::string> searchDirs;
searchDirs.emplace_back();
- const char* config =
+ cmProp config =
this->Makefile->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION");
// if a config was specified try that first
if (cmNonempty(config)) {
- std::string tmp = cmStrCat('/', config);
+ std::string tmp = cmStrCat('/', *config);
searchDirs.push_back(std::move(tmp));
}
searchDirs.emplace_back("/Debug");
#if defined(__APPLE__)
std::string app = "/" + targetName + ".app";
if (cmNonempty(config)) {
- std::string tmp = cmStrCat('/', config, app);
+ std::string tmp = cmStrCat('/', *config, app);
searchDirs.push_back(std::move(tmp));
}
std::string tmp = "/Debug" + app;
diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h
index 916572a..594fd7f 100644
--- a/Source/cmCoreTryCompile.h
+++ b/Source/cmCoreTryCompile.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCoreTryCompile_h
-#define cmCoreTryCompile_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -48,5 +47,3 @@ protected:
std::string FindErrorMessage;
bool SrcFileSignature = false;
};
-
-#endif
diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h
index 19503f4..a7f11a6 100644
--- a/Source/cmCreateTestSourceList.h
+++ b/Source/cmCreateTestSourceList.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCreateTestSourceList_h
-#define cmCreateTestSourceList_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmCreateTestSourceList(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h
index f27bb5d..a2d45e7 100644
--- a/Source/cmCryptoHash.h
+++ b/Source/cmCryptoHash.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCryptoHash_h
-#define cmCryptoHash_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -85,5 +84,3 @@ private:
unsigned int Id;
struct rhash_context* CTX;
};
-
-#endif
diff --git a/Source/cmCurl.h b/Source/cmCurl.h
index 7bd036e..fb716f8 100644
--- a/Source/cmCurl.h
+++ b/Source/cmCurl.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCurl_h
-#define cmCurl_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@
std::string cmCurlSetCAInfo(::CURL* curl, const char* cafile = nullptr);
std::string cmCurlSetNETRCOption(::CURL* curl, const std::string& netrc_level,
const std::string& netrc_file);
-
-#endif
diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h
index aa572ad..2036e90 100644
--- a/Source/cmCustomCommand.h
+++ b/Source/cmCustomCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCustomCommand_h
-#define cmCustomCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -114,5 +113,3 @@ private:
bool CommandExpandLists = false;
bool StdPipesUTF8 = false;
};
-
-#endif
diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h
index 67ee9e0..412eba8 100644
--- a/Source/cmCustomCommandGenerator.h
+++ b/Source/cmCustomCommandGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCustomCommandGenerator_h
-#define cmCustomCommandGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -47,5 +46,3 @@ public:
std::vector<std::string> const& GetDepends() const;
bool HasOnlyEmptyCommandLines() const;
};
-
-#endif
diff --git a/Source/cmCustomCommandLines.h b/Source/cmCustomCommandLines.h
index ead5792..ee8d080 100644
--- a/Source/cmCustomCommandLines.h
+++ b/Source/cmCustomCommandLines.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCustomCommandLines_h
-#define cmCustomCommandLines_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -28,5 +27,3 @@ cmCustomCommandLine cmMakeCommandLine(
/** Return a command line vector with a single command line. */
cmCustomCommandLines cmMakeSingleCommandLine(
std::initializer_list<cm::string_view> ilist);
-
-#endif
diff --git a/Source/cmCustomCommandTypes.h b/Source/cmCustomCommandTypes.h
index d4bf1f9..5c900ce 100644
--- a/Source/cmCustomCommandTypes.h
+++ b/Source/cmCustomCommandTypes.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmCustomCommandTypes_h
-#define cmCustomCommandTypes_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -35,5 +34,3 @@ struct cmUtilityOutput
std::string Name;
std::string NameCMP0049;
};
-
-#endif
diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h
index 60dd76a..3c478b3 100644
--- a/Source/cmDefinePropertyCommand.h
+++ b/Source/cmDefinePropertyCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmDefinesPropertyCommand_h
-#define cmDefinesPropertyCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmDefinePropertyCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index d57750a..b650aa8 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmDefinitions_h
-#define cmDefinitions_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -67,5 +66,3 @@ private:
static Def const& GetInternal(const std::string& key, StackIter begin,
StackIter end, bool raise);
};
-
-#endif
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index d8aa730..d092f4f 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -11,6 +11,7 @@
#include "cmGeneratedFileStream.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -228,19 +229,19 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends,
void cmDepends::SetIncludePathFromLanguage(const std::string& lang)
{
// Look for the new per "TARGET_" variant first:
- const char* includePath = nullptr;
+ cmProp includePath = nullptr;
std::string includePathVar =
cmStrCat("CMAKE_", lang, "_TARGET_INCLUDE_PATH");
cmMakefile* mf = this->LocalGenerator->GetMakefile();
includePath = mf->GetDefinition(includePathVar);
if (includePath) {
- cmExpandList(includePath, this->IncludePath);
+ cmExpandList(*includePath, this->IncludePath);
} else {
// Fallback to the old directory level variable if no per-target var:
includePathVar = cmStrCat("CMAKE_", lang, "_INCLUDE_PATH");
includePath = mf->GetDefinition(includePathVar);
if (includePath) {
- cmExpandList(includePath, this->IncludePath);
+ cmExpandList(*includePath, this->IncludePath);
}
}
}
diff --git a/Source/cmDepends.h b/Source/cmDepends.h
index 8cf528f..0240da9 100644
--- a/Source/cmDepends.h
+++ b/Source/cmDepends.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmDepends_h
-#define cmDepends_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -112,5 +111,3 @@ protected:
void SetIncludePathFromLanguage(const std::string& lang);
};
-
-#endif
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index e05c964..e6aef92 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -9,6 +9,7 @@
#include "cmFileTime.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -38,13 +39,13 @@ cmDependsC::cmDependsC(cmLocalUnixMakefileGenerator3* lg,
std::string complainRegex = "^$";
{
std::string scanRegexVar = cmStrCat("CMAKE_", lang, "_INCLUDE_REGEX_SCAN");
- if (const char* sr = mf->GetDefinition(scanRegexVar)) {
- scanRegex = sr;
+ if (cmProp sr = mf->GetDefinition(scanRegexVar)) {
+ scanRegex = *sr;
}
std::string complainRegexVar =
cmStrCat("CMAKE_", lang, "_INCLUDE_REGEX_COMPLAIN");
- if (const char* cr = mf->GetDefinition(complainRegexVar)) {
- complainRegex = cr;
+ if (cmProp cr = mf->GetDefinition(complainRegexVar)) {
+ complainRegex = *cr;
}
}
diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h
index e01faa4..c79da1a 100644
--- a/Source/cmDependsC.h
+++ b/Source/cmDependsC.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmDependsC_h
-#define cmDependsC_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -93,5 +92,3 @@ protected:
void WriteCacheFile() const;
void ReadCacheFile();
};
-
-#endif
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index 54418df..a239418 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -15,6 +15,7 @@
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
#include "cmOutputConverter.h"
+#include "cmProperty.h"
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
#include "cmStringAlgorithms.h"
@@ -394,9 +395,9 @@ bool cmDependsFortran::WriteDependenciesReal(std::string const& obj,
makeDepends << "\t$(CMAKE_COMMAND) -E cmake_copy_f90_mod " << modFile
<< ' ' << stampFileForShell;
cmMakefile* mf = this->LocalGenerator->GetMakefile();
- const char* cid = mf->GetDefinition("CMAKE_Fortran_COMPILER_ID");
+ cmProp cid = mf->GetDefinition("CMAKE_Fortran_COMPILER_ID");
if (cmNonempty(cid)) {
- makeDepends << ' ' << cid;
+ makeDepends << ' ' << *cid;
}
makeDepends << '\n';
}
diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h
index 3e306dd..e377a2c 100644
--- a/Source/cmDependsFortran.h
+++ b/Source/cmDependsFortran.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFortran_h
-#define cmFortran_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -91,5 +90,3 @@ private:
std::string MaybeConvertToRelativePath(std::string const& base,
std::string const& path);
};
-
-#endif
diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h
index 2a90251..1db7ce1 100644
--- a/Source/cmDependsJava.h
+++ b/Source/cmDependsJava.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmDependsJava_h
-#define cmDependsJava_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -36,5 +35,3 @@ protected:
const std::string& internalDependsFileName,
DependencyMap& validDeps) override;
};
-
-#endif
diff --git a/Source/cmDependsJavaParserHelper.h b/Source/cmDependsJavaParserHelper.h
index c545ee2..869b7d4 100644
--- a/Source/cmDependsJavaParserHelper.h
+++ b/Source/cmDependsJavaParserHelper.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmDependsJavaParserHelper_h
-#define cmDependsJavaParserHelper_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -97,5 +96,3 @@ private:
#define YYSTYPE_IS_DECLARED
#define YY_EXTRA_TYPE cmDependsJavaParserHelper*
#define YY_DECL int cmDependsJava_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner)
-
-#endif
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index 3768e1a..313be32 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef _cmDocumentation_h
-#define _cmDocumentation_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -125,5 +124,3 @@ private:
static void WarnFormFromFilename(RequestedHelpItem& request, bool& result);
};
-
-#endif
diff --git a/Source/cmDocumentationEntry.h b/Source/cmDocumentationEntry.h
index afbca5e..89a2899 100644
--- a/Source/cmDocumentationEntry.h
+++ b/Source/cmDocumentationEntry.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmDocumentationEntry_h
-#define cmDocumentationEntry_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -33,5 +32,3 @@ struct cmDocumentationEntry
}
}
};
-
-#endif
diff --git a/Source/cmDocumentationFormatter.h b/Source/cmDocumentationFormatter.h
index 17b63da..cb3038a 100644
--- a/Source/cmDocumentationFormatter.h
+++ b/Source/cmDocumentationFormatter.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef _cmDocumentationFormatter_h
-#define _cmDocumentationFormatter_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -62,5 +61,3 @@ private:
int TextWidth = 77;
const char* TextIndent = "";
};
-
-#endif
diff --git a/Source/cmDocumentationSection.h b/Source/cmDocumentationSection.h
index 641263d..276e520 100644
--- a/Source/cmDocumentationSection.h
+++ b/Source/cmDocumentationSection.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef _cmDocumentationSection_h
-#define _cmDocumentationSection_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -67,5 +66,3 @@ private:
std::string Name;
std::vector<cmDocumentationEntry> Entries;
};
-
-#endif
diff --git a/Source/cmDynamicLoader.h b/Source/cmDynamicLoader.h
index 4b89388..53ea5cb 100644
--- a/Source/cmDynamicLoader.h
+++ b/Source/cmDynamicLoader.h
@@ -5,8 +5,7 @@
// cmDynamicLoader provides a portable interface to loading dynamic
// libraries into a process.
-#ifndef cmDynamicLoader_h
-#define cmDynamicLoader_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -29,5 +28,3 @@ protected:
cmDynamicLoader() = default;
~cmDynamicLoader() = default;
};
-
-#endif
diff --git a/Source/cmELF.h b/Source/cmELF.h
index 123bf9b..99eb4f4 100644
--- a/Source/cmELF.h
+++ b/Source/cmELF.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmELF_h
-#define cmELF_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -112,5 +111,3 @@ private:
std::unique_ptr<cmELFInternal> Internal;
std::string ErrorMessage;
};
-
-#endif
diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h
index 1f8c4ce..730ba65 100644
--- a/Source/cmEnableLanguageCommand.h
+++ b/Source/cmEnableLanguageCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmEnableLanguageCommand_h
-#define cmEnableLanguageCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmEnableLanguageCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmEnableTestingCommand.h b/Source/cmEnableTestingCommand.h
index e4593f2..1722511 100644
--- a/Source/cmEnableTestingCommand.h
+++ b/Source/cmEnableTestingCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmEnableTestingCommand_h
-#define cmEnableTestingCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -25,5 +24,3 @@ class cmExecutionStatus;
*/
bool cmEnableTestingCommand(std::vector<std::string> const&,
cmExecutionStatus&);
-
-#endif
diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h
index 7c751e1..111a56e 100644
--- a/Source/cmExecProgramCommand.h
+++ b/Source/cmExecProgramCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExecProgramCommand_h
-#define cmExecProgramCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -19,5 +18,3 @@ class cmExecutionStatus;
*/
bool cmExecProgramCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h
index 9c4b600..cc8cc38 100644
--- a/Source/cmExecuteProcessCommand.h
+++ b/Source/cmExecuteProcessCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExecuteProcessCommand_h
-#define cmExecuteProcessCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -18,5 +17,3 @@ class cmExecutionStatus;
*/
bool cmExecuteProcessCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h
index d2cc9b8..0feaedf 100644
--- a/Source/cmExecutionStatus.h
+++ b/Source/cmExecutionStatus.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExecutionStatus_h
-#define cmExecutionStatus_h
+#pragma once
#include <cmConfigure.h> // IWYU pragma: keep
@@ -48,5 +47,3 @@ private:
bool ContinueInvoked = false;
bool NestedError = false;
};
-
-#endif
diff --git a/Source/cmExpandedCommandArgument.cxx b/Source/cmExpandedCommandArgument.cxx
index 43f648b..1f14fc4 100644
--- a/Source/cmExpandedCommandArgument.cxx
+++ b/Source/cmExpandedCommandArgument.cxx
@@ -37,8 +37,3 @@ bool cmExpandedCommandArgument::empty() const
{
return this->Value.empty();
}
-
-const char* cmExpandedCommandArgument::c_str() const
-{
- return this->Value.c_str();
-}
diff --git a/Source/cmExpandedCommandArgument.h b/Source/cmExpandedCommandArgument.h
index 69d35de..1ff6ed1 100644
--- a/Source/cmExpandedCommandArgument.h
+++ b/Source/cmExpandedCommandArgument.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExpandedCommandArgument_h
-#define cmExpandedCommandArgument_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -29,11 +28,7 @@ public:
bool empty() const;
- const char* c_str() const;
-
private:
std::string Value;
bool Quoted = false;
};
-
-#endif
diff --git a/Source/cmExportBuildAndroidMKGenerator.h b/Source/cmExportBuildAndroidMKGenerator.h
index a9b6107..250564f 100644
--- a/Source/cmExportBuildAndroidMKGenerator.h
+++ b/Source/cmExportBuildAndroidMKGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExportBuildAndroidMKGenerator_h
-#define cmExportBuildAndroidMKGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -63,5 +62,3 @@ protected:
cmGeneratorTarget const* target, std::ostream& os,
const ImportPropertyMap& properties) override;
};
-
-#endif
diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h
index 66e8cbb..264494d 100644
--- a/Source/cmExportBuildFileGenerator.h
+++ b/Source/cmExportBuildFileGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExportBuildFileGenerator_h
-#define cmExportBuildFileGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -85,5 +84,3 @@ protected:
std::vector<cmGeneratorTarget*> Exports;
cmLocalGenerator* LG;
};
-
-#endif
diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h
index 9655628..3f87bcf 100644
--- a/Source/cmExportCommand.h
+++ b/Source/cmExportCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExportCommand_h
-#define cmExportCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmExportCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index e9d0da7..45eaed0 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExportFileGenerator_h
-#define cmExportFileGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -223,5 +222,3 @@ private:
virtual std::string InstallNameDir(cmGeneratorTarget* target,
const std::string& config) = 0;
};
-
-#endif
diff --git a/Source/cmExportInstallAndroidMKGenerator.h b/Source/cmExportInstallAndroidMKGenerator.h
index 8883ffa..40978e0 100644
--- a/Source/cmExportInstallAndroidMKGenerator.h
+++ b/Source/cmExportInstallAndroidMKGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExportInstallAndroidMKGenerator_h
-#define cmExportInstallAndroidMKGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -69,5 +68,3 @@ protected:
bool GenerateImportFileConfig(const std::string& config,
std::vector<std::string>&) override;
};
-
-#endif
diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h
index 5fa812c..2d8de9d 100644
--- a/Source/cmExportInstallFileGenerator.h
+++ b/Source/cmExportInstallFileGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExportInstallFileGenerator_h
-#define cmExportInstallFileGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -103,5 +102,3 @@ protected:
// The import file generated for each configuration.
std::map<std::string, std::string> ConfigImportFiles;
};
-
-#endif
diff --git a/Source/cmExportLibraryDependenciesCommand.h b/Source/cmExportLibraryDependenciesCommand.h
index 230c906..1834bfa 100644
--- a/Source/cmExportLibraryDependenciesCommand.h
+++ b/Source/cmExportLibraryDependenciesCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExportLibraryDependenciesCommand_h
-#define cmExportLibraryDependenciesCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmExportLibraryDependenciesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmExportSet.h b/Source/cmExportSet.h
index f0d921f..07deb11 100644
--- a/Source/cmExportSet.h
+++ b/Source/cmExportSet.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExportSet_h
-#define cmExportSet_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -61,5 +60,3 @@ public:
*/
cmExportSet& operator[](const std::string& name);
};
-
-#endif
diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h
index 7573427..6bf5781 100644
--- a/Source/cmExportTryCompileFileGenerator.h
+++ b/Source/cmExportTryCompileFileGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExportTryCompileFileGenerator_h
-#define cmExportTryCompileFileGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -58,5 +57,3 @@ private:
std::string Config;
std::vector<std::string> Languages;
};
-
-#endif
diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h
index 717acdc..54dd6a4 100644
--- a/Source/cmExprParserHelper.h
+++ b/Source/cmExprParserHelper.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExprParserHelper_h
-#define cmExprParserHelper_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -58,5 +57,3 @@ private:
#define YYSTYPE_IS_DECLARED
#define YY_EXTRA_TYPE cmExprParserHelper*
#define YY_DECL int cmExpr_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner)
-
-#endif
diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h
index 2b8d505..3ade67b 100644
--- a/Source/cmExternalMakefileProjectGenerator.h
+++ b/Source/cmExternalMakefileProjectGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExternalMakefileProjectGenerator_h
-#define cmExternalMakefileProjectGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -109,5 +108,3 @@ public:
return p;
}
};
-
-#endif
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index df68033..87b8f9b 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -16,6 +16,7 @@
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmStateTypes.h"
@@ -496,15 +497,15 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
if (target->GetType() == cmStateEnums::EXECUTABLE) {
// Determine the directory where the executable target is created, and
// set the working directory to this dir.
- const char* runtimeOutputDir =
+ cmProp runtimeOutputDir =
makefile->GetDefinition("CMAKE_RUNTIME_OUTPUT_DIRECTORY");
- if (runtimeOutputDir != nullptr) {
- workingDir = runtimeOutputDir;
+ if (runtimeOutputDir) {
+ workingDir = *runtimeOutputDir;
} else {
- const char* executableOutputDir =
+ cmProp executableOutputDir =
makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH");
- if (executableOutputDir != nullptr) {
- workingDir = executableOutputDir;
+ if (executableOutputDir) {
+ workingDir = *executableOutputDir;
}
}
}
diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h
index d9f92bd..cada5dd 100644
--- a/Source/cmExtraCodeBlocksGenerator.h
+++ b/Source/cmExtraCodeBlocksGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExtraCodeBlocksGenerator_h
-#define cmExtraCodeBlocksGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -51,5 +50,3 @@ private:
const cmLocalGenerator* lg, const std::string& compiler,
const std::string& makeFlags);
};
-
-#endif
diff --git a/Source/cmExtraCodeLiteGenerator.h b/Source/cmExtraCodeLiteGenerator.h
index 0ce90b0..2478585 100644
--- a/Source/cmExtraCodeLiteGenerator.h
+++ b/Source/cmExtraCodeLiteGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalCodeLiteGenerator_h
-#define cmGlobalCodeLiteGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -68,5 +67,3 @@ public:
void CreateNewProjectFile(const cmGeneratorTarget* lg,
const std::string& filename);
};
-
-#endif
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index b6c0a7a..ccfd727 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -189,9 +189,9 @@ void cmExtraEclipseCDT4Generator::CreateSettingsResourcePrefsFile()
}
fout << "eclipse.preferences.version=1\n";
- const char* encoding = mf->GetDefinition("CMAKE_ECLIPSE_RESOURCE_ENCODING");
+ cmProp encoding = mf->GetDefinition("CMAKE_ECLIPSE_RESOURCE_ENCODING");
if (encoding) {
- fout << "encoding/<project>=" << encoding << '\n';
+ fout << "encoding/<project>=" << *encoding << '\n';
}
}
@@ -793,11 +793,11 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
}
}
// add system defined c macros
- const char* cDefs =
+ cmProp cDefs =
mf->GetDefinition("CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS");
if (this->CEnabled && cDefs) {
// Expand the list.
- std::vector<std::string> defs = cmExpandedList(cDefs, true);
+ std::vector<std::string> defs = cmExpandedList(*cDefs, true);
// the list must contain only definition-value pairs:
if ((defs.size() % 2) == 0) {
@@ -825,11 +825,11 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
}
}
// add system defined c++ macros
- const char* cxxDefs =
+ cmProp cxxDefs =
mf->GetDefinition("CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS");
if (this->CXXEnabled && cxxDefs) {
// Expand the list.
- std::vector<std::string> defs = cmExpandedList(cxxDefs, true);
+ std::vector<std::string> defs = cmExpandedList(*cxxDefs, true);
// the list must contain only definition-value pairs:
if ((defs.size() % 2) == 0) {
diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h
index a7aa549..c4ed577 100644
--- a/Source/cmExtraEclipseCDT4Generator.h
+++ b/Source/cmExtraEclipseCDT4Generator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExtraEclipseCDT4Generator_h
-#define cmExtraEclipseCDT4Generator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -106,5 +105,3 @@ private:
bool CEnabled;
bool CXXEnabled;
};
-
-#endif
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index 01fac5a..54c3114 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -13,6 +13,7 @@
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmSourceFile.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
@@ -127,10 +128,10 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator& lg,
// only add the "edit_cache" target if it's not ccmake, because
// this will not work within the IDE
if (targetName == "edit_cache") {
- const char* editCommand =
+ cmProp editCommand =
localGen->GetMakefile()->GetDefinition("CMAKE_EDIT_COMMAND");
if (editCommand == nullptr ||
- strstr(editCommand, "ccmake") != nullptr) {
+ strstr(editCommand->c_str(), "ccmake") != nullptr) {
insertTarget = false;
}
}
diff --git a/Source/cmExtraKateGenerator.h b/Source/cmExtraKateGenerator.h
index 1fb81b4..c66ddbf 100644
--- a/Source/cmExtraKateGenerator.h
+++ b/Source/cmExtraKateGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExtraKateGenerator_h
-#define cmExtraKateGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -43,5 +42,3 @@ private:
std::string ProjectName;
bool UseNinja;
};
-
-#endif
diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h
index 078cfe7..671b65a 100644
--- a/Source/cmExtraSublimeTextGenerator.h
+++ b/Source/cmExtraSublimeTextGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmExtraSublimeTextGenerator_h
-#define cmExtraSublimeTextGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -75,5 +74,3 @@ private:
bool ExcludeBuildFolder;
std::string EnvSettings;
};
-
-#endif
diff --git a/Source/cmFLTKWrapUICommand.h b/Source/cmFLTKWrapUICommand.h
index bb56dbd..7c1fc52 100644
--- a/Source/cmFLTKWrapUICommand.h
+++ b/Source/cmFLTKWrapUICommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFLTKWrapUICommand_h
-#define cmFLTKWrapUICommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmFLTKWrapUICommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmFSPermissions.h b/Source/cmFSPermissions.h
index fef72e6..78f2240 100644
--- a/Source/cmFSPermissions.h
+++ b/Source/cmFSPermissions.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFSPermissions_h
-#define cmFSPermissions_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -41,5 +40,3 @@ static const mode_t mode_setgid = S_ISGID;
bool stringToModeT(std::string const& arg, mode_t& permissions);
} // ns
-
-#endif
diff --git a/Source/cmFileAPI.h b/Source/cmFileAPI.h
index ae07612..086a92a 100644
--- a/Source/cmFileAPI.h
+++ b/Source/cmFileAPI.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFileAPI_h
-#define cmFileAPI_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -205,5 +204,3 @@ private:
ClientRequest& r, std::vector<RequestVersion> const& versions);
Json::Value BuildInternalTest(Object const& object);
};
-
-#endif
diff --git a/Source/cmFileAPICMakeFiles.h b/Source/cmFileAPICMakeFiles.h
index 1ae1e4f..5b48ed3 100644
--- a/Source/cmFileAPICMakeFiles.h
+++ b/Source/cmFileAPICMakeFiles.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFileAPICMakeFiles_h
-#define cmFileAPICMakeFiles_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -11,5 +10,3 @@ class cmFileAPI;
extern Json::Value cmFileAPICMakeFilesDump(cmFileAPI& fileAPI,
unsigned long version);
-
-#endif
diff --git a/Source/cmFileAPICache.h b/Source/cmFileAPICache.h
index 2f30c76..bd9feeb 100644
--- a/Source/cmFileAPICache.h
+++ b/Source/cmFileAPICache.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFileAPICache_h
-#define cmFileAPICache_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -11,5 +10,3 @@ class cmFileAPI;
extern Json::Value cmFileAPICacheDump(cmFileAPI& fileAPI,
unsigned long version);
-
-#endif
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 55fb115..4a53c8a 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -852,12 +852,12 @@ void Target::ProcessLanguage(std::string const& lang)
{
CompileData& cd = this->CompileDataMap[lang];
cd.Language = lang;
- if (const char* sysrootCompile =
+ if (cmProp sysrootCompile =
this->GT->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE")) {
- cd.Sysroot = sysrootCompile;
- } else if (const char* sysroot =
+ cd.Sysroot = *sysrootCompile;
+ } else if (cmProp sysroot =
this->GT->Makefile->GetDefinition("CMAKE_SYSROOT")) {
- cd.Sysroot = sysroot;
+ cd.Sysroot = *sysroot;
}
cmLocalGenerator* lg = this->GT->GetLocalGenerator();
{
@@ -1404,12 +1404,12 @@ Json::Value Target::DumpLink()
link["commandFragments"] = std::move(commandFragments);
}
}
- if (const char* sysrootLink =
+ if (cmProp sysrootLink =
this->GT->Makefile->GetDefinition("CMAKE_SYSROOT_LINK")) {
- link["sysroot"] = this->DumpSysroot(sysrootLink);
- } else if (const char* sysroot =
+ link["sysroot"] = this->DumpSysroot(*sysrootLink);
+ } else if (cmProp sysroot =
this->GT->Makefile->GetDefinition("CMAKE_SYSROOT")) {
- link["sysroot"] = this->DumpSysroot(sysroot);
+ link["sysroot"] = this->DumpSysroot(*sysroot);
}
if (this->GT->IsIPOEnabled(lang, this->Config)) {
link["lto"] = true;
diff --git a/Source/cmFileAPICodemodel.h b/Source/cmFileAPICodemodel.h
index a6c6bdd..263f675 100644
--- a/Source/cmFileAPICodemodel.h
+++ b/Source/cmFileAPICodemodel.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFileAPICodemodel_h
-#define cmFileAPICodemodel_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -11,5 +10,3 @@ class cmFileAPI;
extern Json::Value cmFileAPICodemodelDump(cmFileAPI& fileAPI,
unsigned long version);
-
-#endif
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 550ad6e..84639a7 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -28,8 +28,10 @@
#include "cmAlgorithms.h"
#include "cmArgumentParser.h"
+#include "cmCMakePath.h"
#include "cmCryptoHash.h"
#include "cmExecutionStatus.h"
+#include "cmFSPermissions.h"
#include "cmFileCopier.h"
#include "cmFileInstaller.h"
#include "cmFileLockPool.h"
@@ -43,6 +45,7 @@
#include "cmMessageType.h"
#include "cmNewLineStyle.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
#include "cmRange.h"
#include "cmRuntimeDependencyArchive.h"
#include "cmState.h"
@@ -1232,6 +1235,50 @@ bool HandleInstallCommand(std::vector<std::string> const& args,
return installer.Run(args);
}
+bool HandleRealPathCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ if (args.size() < 3) {
+ status.SetError("REAL_PATH requires a path and an output variable");
+ return false;
+ }
+
+ struct Arguments
+ {
+ std::string BaseDirectory;
+ };
+ static auto const parser = cmArgumentParser<Arguments>{}.Bind(
+ "BASE_DIRECTORY"_s, &Arguments::BaseDirectory);
+
+ std::vector<std::string> unparsedArguments;
+ std::vector<std::string> keywordsMissingValue;
+ std::vector<std::string> parsedKeywords;
+ auto arguments =
+ parser.Parse(cmMakeRange(args).advance(3), &unparsedArguments,
+ &keywordsMissingValue, &parsedKeywords);
+
+ if (!unparsedArguments.empty()) {
+ status.SetError("REAL_PATH called with unexpected arguments");
+ return false;
+ }
+ if (!keywordsMissingValue.empty()) {
+ status.SetError("BASE_DIRECTORY requires a value");
+ return false;
+ }
+
+ if (parsedKeywords.empty()) {
+ arguments.BaseDirectory = status.GetMakefile().GetCurrentSourceDirectory();
+ }
+
+ cmCMakePath path(args[1]);
+ path = path.Absolute(arguments.BaseDirectory).Normal();
+ auto realPath = cmSystemTools::GetRealPath(path.GenericString());
+
+ status.GetMakefile().AddDefinition(args[2], realPath);
+
+ return true;
+}
+
bool HandleRelativePathCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
@@ -1567,7 +1614,7 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
std::string logVar;
std::string statusVar;
bool tls_verify = status.GetMakefile().IsOn("CMAKE_TLS_VERIFY");
- const char* cainfo = status.GetMakefile().GetDefinition("CMAKE_TLS_CAINFO");
+ cmProp cainfo = status.GetMakefile().GetDefinition("CMAKE_TLS_CAINFO");
std::string netrc_level =
status.GetMakefile().GetSafeDefinition("CMAKE_NETRC");
std::string netrc_file =
@@ -1622,7 +1669,7 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
} else if (*i == "TLS_CAINFO") {
++i;
if (i != args.end()) {
- cainfo = i->c_str();
+ cainfo = &(*i);
} else {
status.SetError("DOWNLOAD missing file value for TLS_CAINFO.");
return false;
@@ -1789,7 +1836,7 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
// check to see if a CAINFO file has been specified
// command arg comes first
- std::string const& cainfo_err = cmCurlSetCAInfo(curl, cainfo);
+ std::string const& cainfo_err = cmCurlSetCAInfo(curl, cmToCStr(cainfo));
if (!cainfo_err.empty()) {
status.SetError(cainfo_err);
return false;
@@ -1955,7 +2002,7 @@ bool HandleUploadCommand(std::vector<std::string> const& args,
std::string statusVar;
bool showProgress = false;
bool tls_verify = status.GetMakefile().IsOn("CMAKE_TLS_VERIFY");
- const char* cainfo = status.GetMakefile().GetDefinition("CMAKE_TLS_CAINFO");
+ cmProp cainfo = status.GetMakefile().GetDefinition("CMAKE_TLS_CAINFO");
std::string userpwd;
std::string netrc_level =
status.GetMakefile().GetSafeDefinition("CMAKE_NETRC");
@@ -2008,7 +2055,7 @@ bool HandleUploadCommand(std::vector<std::string> const& args,
} else if (*i == "TLS_CAINFO") {
++i;
if (i != args.end()) {
- cainfo = i->c_str();
+ cainfo = &(*i);
} else {
status.SetError("UPLOAD missing file value for TLS_CAINFO.");
return false;
@@ -2109,7 +2156,7 @@ bool HandleUploadCommand(std::vector<std::string> const& args,
// check to see if a CAINFO file has been specified
// command arg comes first
- std::string const& cainfo_err = cmCurlSetCAInfo(curl, cainfo);
+ std::string const& cainfo_err = cmCurlSetCAInfo(curl, cmToCStr(cainfo));
if (!cainfo_err.empty()) {
status.SetError(cainfo_err);
return false;
@@ -3160,6 +3207,163 @@ bool HandleArchiveExtractCommand(std::vector<std::string> const& args,
return true;
}
+bool ValidateAndConvertPermissions(const std::vector<std::string>& permissions,
+ mode_t& perms, cmExecutionStatus& status)
+{
+ for (const auto& i : permissions) {
+ if (!cmFSPermissions::stringToModeT(i, perms)) {
+ status.SetError(i + " is an invalid permission specifier");
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+ }
+ }
+ return true;
+}
+
+bool SetPermissions(const std::string& filename, const mode_t& perms,
+ cmExecutionStatus& status)
+{
+ if (!cmSystemTools::SetPermissions(filename, perms)) {
+ status.SetError("Failed to set permissions for " + filename);
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+ }
+ return true;
+}
+
+bool HandleChmodCommandImpl(std::vector<std::string> const& args, bool recurse,
+ cmExecutionStatus& status)
+{
+ mode_t perms = 0;
+ mode_t fperms = 0;
+ mode_t dperms = 0;
+ cmsys::Glob globber;
+
+ globber.SetRecurse(recurse);
+ globber.SetRecurseListDirs(recurse);
+
+ struct Arguments
+ {
+ std::vector<std::string> Permissions;
+ std::vector<std::string> FilePermissions;
+ std::vector<std::string> DirectoryPermissions;
+ };
+
+ static auto const parser =
+ cmArgumentParser<Arguments>{}
+ .Bind("PERMISSIONS"_s, &Arguments::Permissions)
+ .Bind("FILE_PERMISSIONS"_s, &Arguments::FilePermissions)
+ .Bind("DIRECTORY_PERMISSIONS"_s, &Arguments::DirectoryPermissions);
+
+ std::vector<std::string> pathEntries;
+ std::vector<std::string> keywordsMissingValues;
+ Arguments parsedArgs = parser.Parse(cmMakeRange(args).advance(1),
+ &pathEntries, &keywordsMissingValues);
+
+ // check validity of arguments
+ if (parsedArgs.Permissions.empty() && parsedArgs.FilePermissions.empty() &&
+ parsedArgs.DirectoryPermissions.empty()) // no permissions given
+ {
+ status.SetError("No permissions given");
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+ }
+
+ if (!parsedArgs.Permissions.empty() && !parsedArgs.FilePermissions.empty() &&
+ !parsedArgs.DirectoryPermissions.empty()) // all keywords are used
+ {
+ status.SetError("Remove either PERMISSIONS or FILE_PERMISSIONS or "
+ "DIRECTORY_PERMISSIONS from the invocation");
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+ }
+
+ if (!keywordsMissingValues.empty()) {
+ for (const auto& i : keywordsMissingValues) {
+ status.SetError(i + " is not given any arguments");
+ cmSystemTools::SetFatalErrorOccured();
+ }
+ return false;
+ }
+
+ // validate permissions
+ bool validatePermissions =
+ ValidateAndConvertPermissions(parsedArgs.Permissions, perms, status) &&
+ ValidateAndConvertPermissions(parsedArgs.FilePermissions, fperms,
+ status) &&
+ ValidateAndConvertPermissions(parsedArgs.DirectoryPermissions, dperms,
+ status);
+ if (!validatePermissions) {
+ return false;
+ }
+
+ std::vector<std::string> allPathEntries;
+
+ if (recurse) {
+ std::vector<std::string> tempPathEntries;
+ for (const auto& i : pathEntries) {
+ if (cmSystemTools::FileIsDirectory(i)) {
+ globber.FindFiles(i + "/*");
+ tempPathEntries = globber.GetFiles();
+ allPathEntries.insert(allPathEntries.end(), tempPathEntries.begin(),
+ tempPathEntries.end());
+ allPathEntries.emplace_back(i);
+ } else {
+ allPathEntries.emplace_back(i); // We validate path entries below
+ }
+ }
+ } else {
+ allPathEntries = std::move(pathEntries);
+ }
+
+ // chmod
+ for (const auto& i : allPathEntries) {
+ if (!(cmSystemTools::FileExists(i) || cmSystemTools::FileIsDirectory(i))) {
+ status.SetError(cmStrCat("does not exist:\n ", i));
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+ }
+
+ if (cmSystemTools::FileExists(i, true)) {
+ bool success = true;
+ const mode_t& filePermissions =
+ parsedArgs.FilePermissions.empty() ? perms : fperms;
+ if (filePermissions) {
+ success = SetPermissions(i, filePermissions, status);
+ }
+ if (!success) {
+ return false;
+ }
+ }
+
+ else if (cmSystemTools::FileIsDirectory(i)) {
+ bool success = true;
+ const mode_t& directoryPermissions =
+ parsedArgs.DirectoryPermissions.empty() ? perms : dperms;
+ if (directoryPermissions) {
+ success = SetPermissions(i, directoryPermissions, status);
+ }
+ if (!success) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+bool HandleChmodCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ return HandleChmodCommandImpl(args, false, status);
+}
+
+bool HandleChmodRecurseCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ return HandleChmodCommandImpl(args, true, status);
+}
+
} // namespace
bool cmFileCommand(std::vector<std::string> const& args,
@@ -3201,6 +3405,7 @@ bool cmFileCommand(std::vector<std::string> const& args,
{ "RPATH_CHECK"_s, HandleRPathCheckCommand },
{ "RPATH_REMOVE"_s, HandleRPathRemoveCommand },
{ "READ_ELF"_s, HandleReadElfCommand },
+ { "REAL_PATH"_s, HandleRealPathCommand },
{ "RELATIVE_PATH"_s, HandleRelativePathCommand },
{ "TO_CMAKE_PATH"_s, HandleCMakePathCommand },
{ "TO_NATIVE_PATH"_s, HandleNativePathCommand },
@@ -3216,6 +3421,8 @@ bool cmFileCommand(std::vector<std::string> const& args,
{ "CONFIGURE"_s, HandleConfigureCommand },
{ "ARCHIVE_CREATE"_s, HandleArchiveCreateCommand },
{ "ARCHIVE_EXTRACT"_s, HandleArchiveExtractCommand },
+ { "CHMOD"_s, HandleChmodCommand },
+ { "CHMOD_RECURSE"_s, HandleChmodRecurseCommand },
};
return subcommand(args[0], args, status);
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index 8c9b219..ec9ee47 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFileCommand_h
-#define cmFileCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmFileCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmFileCopier.cxx b/Source/cmFileCopier.cxx
index 5d44a06..48fc286 100644
--- a/Source/cmFileCopier.cxx
+++ b/Source/cmFileCopier.cxx
@@ -10,6 +10,7 @@
#include "cmFSPermissions.h"
#include "cmFileTimes.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -171,11 +172,11 @@ void cmFileCopier::DefaultDirectoryPermissions()
bool cmFileCopier::GetDefaultDirectoryPermissions(mode_t** mode)
{
// check if default dir creation permissions were set
- const char* default_dir_install_permissions = this->Makefile->GetDefinition(
+ cmProp default_dir_install_permissions = this->Makefile->GetDefinition(
"CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS");
if (cmNonempty(default_dir_install_permissions)) {
std::vector<std::string> items =
- cmExpandedList(default_dir_install_permissions);
+ cmExpandedList(*default_dir_install_permissions);
for (const auto& arg : items) {
if (!this->CheckPermissions(arg, **mode)) {
this->Status.SetError(
diff --git a/Source/cmFileCopier.h b/Source/cmFileCopier.h
index 612a57f..217d58d 100644
--- a/Source/cmFileCopier.h
+++ b/Source/cmFileCopier.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFileCopier_h
-#define cmFileCopier_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -120,5 +119,3 @@ protected:
bool GetDefaultDirectoryPermissions(mode_t** mode);
};
-
-#endif
diff --git a/Source/cmFileInstaller.h b/Source/cmFileInstaller.h
index 537cd53..3a905d3 100644
--- a/Source/cmFileInstaller.h
+++ b/Source/cmFileInstaller.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFileInstaller_h
-#define cmFileInstaller_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -50,5 +49,3 @@ protected:
bool GetTargetTypeFromString(const std::string& stype);
bool HandleInstallDestination();
};
-
-#endif
diff --git a/Source/cmFileLock.h b/Source/cmFileLock.h
index 5fe068e..2b125af 100644
--- a/Source/cmFileLock.h
+++ b/Source/cmFileLock.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFileLock_h
-#define cmFileLock_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -63,5 +62,3 @@ private:
std::string Filename;
};
-
-#endif // cmFileLock_h
diff --git a/Source/cmFileLockPool.h b/Source/cmFileLockPool.h
index d45c82c..f2f9f23 100644
--- a/Source/cmFileLockPool.h
+++ b/Source/cmFileLockPool.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFileLockPool_h
-#define cmFileLockPool_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -86,5 +85,3 @@ private:
List FileScopes;
ScopePool ProcessScope;
};
-
-#endif // cmFileLockPool_h
diff --git a/Source/cmFileLockResult.h b/Source/cmFileLockResult.h
index 81c1906..8a58d1f 100644
--- a/Source/cmFileLockResult.h
+++ b/Source/cmFileLockResult.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFileLockResult_h
-#define cmFileLockResult_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -73,5 +72,3 @@ private:
ErrorType Type;
Error ErrorValue;
};
-
-#endif // cmFileLockResult_h
diff --git a/Source/cmFilePathChecksum.h b/Source/cmFilePathChecksum.h
index b7d5cd2..a6f7bd3 100644
--- a/Source/cmFilePathChecksum.h
+++ b/Source/cmFilePathChecksum.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFilePathChecksum_h
-#define cmFilePathChecksum_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -60,5 +59,3 @@ private:
/// List of (directory name, seed name) pairs
std::array<std::pair<std::string, std::string>, 4> parentDirs;
};
-
-#endif
diff --git a/Source/cmFileTime.h b/Source/cmFileTime.h
index e9a8559..f496cdc 100644
--- a/Source/cmFileTime.h
+++ b/Source/cmFileTime.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFileTime_h
-#define cmFileTime_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -126,5 +125,3 @@ public:
private:
NSC NS = 0;
};
-
-#endif
diff --git a/Source/cmFileTimeCache.h b/Source/cmFileTimeCache.h
index 83b77b6..336136e 100644
--- a/Source/cmFileTimeCache.h
+++ b/Source/cmFileTimeCache.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFileTimeCache_h
-#define cmFileTimeCache_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -53,5 +52,3 @@ public:
private:
std::unordered_map<std::string, cmFileTime> Cache;
};
-
-#endif
diff --git a/Source/cmFileTimes.h b/Source/cmFileTimes.h
index 191d89e..f1916f7 100644
--- a/Source/cmFileTimes.h
+++ b/Source/cmFileTimes.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFileTimes_h
-#define cmFileTimes_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -36,5 +35,3 @@ private:
class Times;
std::unique_ptr<Times> times;
};
-
-#endif
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index 743ac75..bf52d75 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -294,11 +294,10 @@ void cmFindBase::FillUserGuessPath()
bool cmFindBase::CheckForVariableInCache()
{
- if (const char* cacheValue =
- this->Makefile->GetDefinition(this->VariableName)) {
+ if (cmProp cacheValue = this->Makefile->GetDefinition(this->VariableName)) {
cmState* state = this->Makefile->GetState();
cmProp cacheEntry = state->GetCacheEntryValue(this->VariableName);
- bool found = !cmIsNOTFOUND(cacheValue);
+ bool found = !cmIsNOTFOUND(*cacheValue);
bool cached = cacheEntry != nullptr;
if (found) {
// If the user specifies the entry on the command line without a
diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h
index 4cbf09e..57a40be 100644
--- a/Source/cmFindBase.h
+++ b/Source/cmFindBase.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFindBase_h
-#define cmFindBase_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -94,5 +93,3 @@ private:
std::vector<DebugLibState> FailedSearchLocations;
DebugLibState FoundSearchLocation;
};
-
-#endif
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 3401eff..dee91d7 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -11,6 +11,7 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmProperty.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -182,9 +183,9 @@ void cmFindCommon::SelectDefaultSearchModes()
};
for (auto& path : search_paths) {
- const char* def = this->Makefile->GetDefinition(path.second);
+ cmProp def = this->Makefile->GetDefinition(path.second);
if (def) {
- path.first = !cmIsOn(def);
+ path.first = !cmIsOn(*def);
}
}
}
@@ -202,12 +203,11 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
return;
}
- const char* sysroot = this->Makefile->GetDefinition("CMAKE_SYSROOT");
- const char* sysrootCompile =
+ cmProp sysroot = this->Makefile->GetDefinition("CMAKE_SYSROOT");
+ cmProp sysrootCompile =
this->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE");
- const char* sysrootLink =
- this->Makefile->GetDefinition("CMAKE_SYSROOT_LINK");
- const char* rootPath = this->Makefile->GetDefinition("CMAKE_FIND_ROOT_PATH");
+ cmProp sysrootLink = this->Makefile->GetDefinition("CMAKE_SYSROOT_LINK");
+ cmProp rootPath = this->Makefile->GetDefinition("CMAKE_FIND_ROOT_PATH");
const bool noSysroot = !cmNonempty(sysroot);
const bool noCompileSysroot = !cmNonempty(sysrootCompile);
const bool noLinkSysroot = !cmNonempty(sysrootLink);
@@ -219,23 +219,22 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
// Construct the list of path roots with no trailing slashes.
std::vector<std::string> roots;
if (rootPath) {
- cmExpandList(rootPath, roots);
+ cmExpandList(*rootPath, roots);
}
if (sysrootCompile) {
- roots.emplace_back(sysrootCompile);
+ roots.emplace_back(*sysrootCompile);
}
if (sysrootLink) {
- roots.emplace_back(sysrootLink);
+ roots.emplace_back(*sysrootLink);
}
if (sysroot) {
- roots.emplace_back(sysroot);
+ roots.emplace_back(*sysroot);
}
for (std::string& r : roots) {
cmSystemTools::ConvertToUnixSlashes(r);
}
- const char* stagePrefix =
- this->Makefile->GetDefinition("CMAKE_STAGING_PREFIX");
+ cmProp stagePrefix = this->Makefile->GetDefinition("CMAKE_STAGING_PREFIX");
// Copy the original set of unrooted paths.
std::vector<std::string> unrootedPaths = paths;
@@ -248,7 +247,7 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
// a user home directory or is empty.
std::string rootedDir;
if (cmSystemTools::IsSubDirectory(up, r) ||
- (stagePrefix && cmSystemTools::IsSubDirectory(up, stagePrefix))) {
+ (stagePrefix && cmSystemTools::IsSubDirectory(up, *stagePrefix))) {
rootedDir = up;
} else if (!up.empty() && up[0] != '~') {
// Start with the new root.
diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h
index 916f3bc..f84242e 100644
--- a/Source/cmFindCommon.h
+++ b/Source/cmFindCommon.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFindCommon_h
-#define cmFindCommon_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -143,5 +142,3 @@ protected:
cmMakefile* Makefile;
cmExecutionStatus& Status;
};
-
-#endif
diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h
index 7dc6e55..368a7c9 100644
--- a/Source/cmFindFileCommand.h
+++ b/Source/cmFindFileCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFindFileCommand_h
-#define cmFindFileCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -28,5 +27,3 @@ public:
bool cmFindFile(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 3242b6d..b87dfe3 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -13,6 +13,7 @@
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
@@ -50,9 +51,9 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
// add custom lib<qual> paths instead of using fixed lib32, lib64 or
// libx32
- if (const char* customLib = this->Makefile->GetDefinition(
+ if (cmProp customLib = this->Makefile->GetDefinition(
"CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX")) {
- this->AddArchitecturePaths(customLib);
+ this->AddArchitecturePaths(customLib->c_str());
}
// add special 32 bit paths if this is a 32 bit compile.
else if (this->Makefile->PlatformIs32Bit() &&
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index b2f71b3..f3874ff 100644
--- a/Source/cmFindLibraryCommand.h
+++ b/Source/cmFindLibraryCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFindLibraryCommand_h
-#define cmFindLibraryCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -44,5 +43,3 @@ private:
bool cmFindLibrary(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index ae06047..c462651 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -154,10 +154,10 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
}
// Lookup required version of CMake.
- if (const char* rv =
+ if (cmProp rv =
this->Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION")) {
unsigned int v[3] = { 0, 0, 0 };
- sscanf(rv, "%u.%u.%u", &v[0], &v[1], &v[2]);
+ sscanf(rv->c_str(), "%u.%u.%u", &v[0], &v[1], &v[2]);
this->RequiredCMakeVersion = CMake_VERSION_ENCODE(v[0], v[1], v[2]);
}
@@ -165,9 +165,9 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
this->DebugBuffer.clear();
// Lookup target architecture, if any.
- if (const char* arch =
+ if (cmProp arch =
this->Makefile->GetDefinition("CMAKE_LIBRARY_ARCHITECTURE")) {
- this->LibraryArchitecture = arch;
+ this->LibraryArchitecture = *arch;
}
// Lookup whether lib32 paths should be used.
@@ -194,9 +194,9 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
// Check if User Package Registry should be disabled
// The `CMAKE_FIND_USE_PACKAGE_REGISTRY` has
// priority over the deprecated CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY
- if (const char* def =
+ if (cmProp def =
this->Makefile->GetDefinition("CMAKE_FIND_USE_PACKAGE_REGISTRY")) {
- this->NoUserRegistry = !cmIsOn(def);
+ this->NoUserRegistry = !cmIsOn(*def);
} else if (this->Makefile->IsOn("CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY")) {
this->NoUserRegistry = true;
}
@@ -204,9 +204,9 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
// Check if System Package Registry should be disabled
// The `CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY` has
// priority over the deprecated CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY
- if (const char* def = this->Makefile->GetDefinition(
+ if (cmProp def = this->Makefile->GetDefinition(
"CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY")) {
- this->NoSystemRegistry = !cmIsOn(def);
+ this->NoSystemRegistry = !cmIsOn(*def);
} else if (this->Makefile->IsOn(
"CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY")) {
this->NoSystemRegistry = true;
@@ -218,20 +218,20 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
}
// Check if Sorting should be enabled
- if (const char* so =
+ if (cmProp so =
this->Makefile->GetDefinition("CMAKE_FIND_PACKAGE_SORT_ORDER")) {
- if (strcmp(so, "NAME") == 0) {
+ if (*so == "NAME") {
this->SortOrder = Name_order;
- } else if (strcmp(so, "NATURAL") == 0) {
+ } else if (*so == "NATURAL") {
this->SortOrder = Natural;
} else {
this->SortOrder = None;
}
}
- if (const char* sd =
+ if (cmProp sd =
this->Makefile->GetDefinition("CMAKE_FIND_PACKAGE_SORT_DIRECTION")) {
- this->SortDirection = strcmp(sd, "ASC") == 0 ? Asc : Dec;
+ this->SortDirection = (*sd == "ASC") ? Asc : Dec;
}
// Find what search path locations have been enabled/disable
@@ -675,9 +675,9 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components)
void cmFindPackageCommand::AddFindDefinition(const std::string& var,
const char* val)
{
- if (const char* old = this->Makefile->GetDefinition(var)) {
+ if (cmProp old = this->Makefile->GetDefinition(var)) {
this->OriginalDefs[var].exists = true;
- this->OriginalDefs[var].value = old;
+ this->OriginalDefs[var].value = *old;
} else {
this->OriginalDefs[var].exists = false;
}
@@ -759,14 +759,14 @@ bool cmFindPackageCommand::HandlePackageMode(
this->ConsideredConfigs.clear();
// Try to find the config file.
- const char* def = this->Makefile->GetDefinition(this->Variable);
+ cmProp def = this->Makefile->GetDefinition(this->Variable);
// Try to load the config file if the directory is known
bool fileFound = false;
if (this->UseConfigFiles) {
if (!cmIsOff(def)) {
// Get the directory from the variable value.
- std::string dir = def;
+ std::string dir = *def;
cmSystemTools::ConvertToUnixSlashes(dir);
// Treat relative paths with respect to the current source dir.
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index 7058a54..eacd1ce 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFindPackageCommand_h
-#define cmFindPackageCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -233,5 +232,3 @@ struct hash<cmFindPackageCommand::ConfigFileInfo>
bool cmFindPackage(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h
index 18bfb7d..b9fe673 100644
--- a/Source/cmFindPathCommand.h
+++ b/Source/cmFindPathCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFindPathCommand_h
-#define cmFindPathCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -38,5 +37,3 @@ private:
bool cmFindPath(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h
index 043b43c..161a680 100644
--- a/Source/cmFindProgramCommand.h
+++ b/Source/cmFindProgramCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFindProgramCommand_h
-#define cmFindProgramCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -38,5 +37,3 @@ private:
bool cmFindProgram(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index 3b82e0a..12fb55a 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -25,6 +25,7 @@
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmProperty.h"
#include "cmRange.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -113,8 +114,8 @@ bool cmForEachFunctionBlocker::ReplayItems(
// At end of for each execute recorded commands
// store the old value
std::string oldDef;
- if (auto d = mf.GetDefinition(this->Args.front())) {
- oldDef = d;
+ if (cmProp d = mf.GetDefinition(this->Args.front())) {
+ oldDef = *d;
}
auto restore = false;
@@ -186,8 +187,8 @@ bool cmForEachFunctionBlocker::ReplayZipLists(
// Store old values for iteration variables
std::map<std::string, std::string> oldDefs;
for (auto i = 0u; i < values.size(); ++i) {
- if (auto d = mf.GetDefinition(iterationVars[i])) {
- oldDefs.emplace(iterationVars[i], d);
+ if (cmProp d = mf.GetDefinition(iterationVars[i])) {
+ oldDefs.emplace(iterationVars[i], *d);
}
}
diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h
index 1feb965..6476fea 100644
--- a/Source/cmForEachCommand.h
+++ b/Source/cmForEachCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmForEachCommand_h
-#define cmForEachCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -13,4 +12,3 @@ class cmExecutionStatus;
/// Starts foreach() ... endforeach() block
bool cmForEachCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-#endif
diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h
index 6f97b42..1b14d17 100644
--- a/Source/cmFortranParser.h
+++ b/Source/cmFortranParser.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFortranParser_h
-#define cmFortranParser_h
+#pragma once
#if !defined(cmFortranLexer_cxx) && !defined(cmFortranParser_cxx)
# include "cmConfigure.h" // IWYU pragma: keep
@@ -181,5 +180,3 @@ struct cmFortranParser_s
cmFortranSourceInfo& Info;
};
#endif
-
-#endif
diff --git a/Source/cmFunctionBlocker.h b/Source/cmFunctionBlocker.h
index 59bb892..b4b493b 100644
--- a/Source/cmFunctionBlocker.h
+++ b/Source/cmFunctionBlocker.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFunctionBlocker_h
-#define cmFunctionBlocker_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -50,5 +49,3 @@ private:
std::vector<cmListFileFunction> Functions;
unsigned int ScopeDepth = 1;
};
-
-#endif
diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h
index d6b549c..07ff4f7 100644
--- a/Source/cmFunctionCommand.h
+++ b/Source/cmFunctionCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmFunctionCommand_h
-#define cmFunctionCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -13,5 +12,3 @@ class cmExecutionStatus;
/// Starts function() ... endfunction() block
bool cmFunctionCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmGccDepfileLexerHelper.h b/Source/cmGccDepfileLexerHelper.h
index e6b2fcf..07ca61d 100644
--- a/Source/cmGccDepfileLexerHelper.h
+++ b/Source/cmGccDepfileLexerHelper.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGccDepfileLexerHelper_h
-#define cmGccDepfileLexerHelper_h
+#pragma once
#include <utility>
@@ -36,5 +35,3 @@ private:
};
#define YY_EXTRA_TYPE cmGccDepfileLexerHelper*
-
-#endif
diff --git a/Source/cmGccDepfileReader.h b/Source/cmGccDepfileReader.h
index 9313010..395dd77 100644
--- a/Source/cmGccDepfileReader.h
+++ b/Source/cmGccDepfileReader.h
@@ -1,10 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGccDepfileReader_h
-#define cmGccDepfileReader_h
+#pragma once
#include "cmGccDepfileReaderTypes.h"
cmGccDepfileContent cmReadGccDepfile(const char* filePath);
-
-#endif
diff --git a/Source/cmGccDepfileReaderTypes.h b/Source/cmGccDepfileReaderTypes.h
index 8b15c73..246e355 100644
--- a/Source/cmGccDepfileReaderTypes.h
+++ b/Source/cmGccDepfileReaderTypes.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGccDepfileReaderTypes_h
-#define cmGccDepfileReaderTypes_h
+#pragma once
#include <string>
#include <vector>
@@ -13,5 +12,3 @@ struct cmGccStyleDependency
};
using cmGccDepfileContent = std::vector<cmGccStyleDependency>;
-
-#endif
diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h
index f6da86e..bb7e3bf 100644
--- a/Source/cmGeneratedFileStream.h
+++ b/Source/cmGeneratedFileStream.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGeneratedFileStream_h
-#define cmGeneratedFileStream_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -158,5 +157,3 @@ private:
// The original locale of the stream (performs no encoding conversion).
std::locale OriginalLocale;
};
-
-#endif
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 09d8b88..03be782 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGeneratorExpression_h
-#define cmGeneratorExpression_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -208,5 +207,3 @@ protected:
cmGeneratorTarget const* HeadTarget = nullptr;
std::string Language;
};
-
-#endif
diff --git a/Source/cmGeneratorExpressionContext.h b/Source/cmGeneratorExpressionContext.h
index bceff12..22e7463 100644
--- a/Source/cmGeneratorExpressionContext.h
+++ b/Source/cmGeneratorExpressionContext.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGeneratorExpressionContext_h
-#define cmGeneratorExpressionContext_h
+#pragma once
#include <map>
#include <set>
@@ -43,5 +42,3 @@ struct cmGeneratorExpressionContext
bool HadLinkLanguageSensitiveCondition;
bool EvaluateForBuildsystem;
};
-
-#endif
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index ac2314c..53225cd 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGeneratorExpressionDAGChecker_h
-#define cmGeneratorExpressionDAGChecker_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -100,5 +99,3 @@ private:
Result CheckResult;
bool TransitivePropertiesOnly;
};
-
-#endif
diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h
index caa8064..2cd35ae 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.h
+++ b/Source/cmGeneratorExpressionEvaluationFile.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGeneratorExpressionEvaluationFile_h
-#define cmGeneratorExpressionEvaluationFile_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -61,5 +60,3 @@ private:
const bool InputIsContent;
cmPolicies::PolicyStatus PolicyStatusCMP0070;
};
-
-#endif
diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h
index 10496fd..3e7737e 100644
--- a/Source/cmGeneratorExpressionEvaluator.h
+++ b/Source/cmGeneratorExpressionEvaluator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGeneratorExpressionEvaluator_h
-#define cmGeneratorExpressionEvaluator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -115,5 +114,3 @@ private:
const char* StartContent;
size_t ContentLength;
};
-
-#endif
diff --git a/Source/cmGeneratorExpressionLexer.h b/Source/cmGeneratorExpressionLexer.h
index 9e01948..a4321d1 100644
--- a/Source/cmGeneratorExpressionLexer.h
+++ b/Source/cmGeneratorExpressionLexer.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGeneratorExpressionLexer_h
-#define cmGeneratorExpressionLexer_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -49,5 +48,3 @@ private:
bool SawBeginExpression = false;
bool SawGeneratorExpression = false;
};
-
-#endif
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index fdc8f29..d3308e2 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -715,7 +715,8 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
static const CompilerIdNode cCompilerIdNode("C"), cxxCompilerIdNode("CXX"),
cudaCompilerIdNode("CUDA"), objcCompilerIdNode("OBJC"),
- objcxxCompilerIdNode("OBJCXX"), fortranCompilerIdNode("Fortran");
+ objcxxCompilerIdNode("OBJCXX"), fortranCompilerIdNode("Fortran"),
+ ispcCompilerIdNode("ISPC");
struct CompilerVersionNode : public cmGeneratorExpressionNode
{
@@ -780,7 +781,7 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode
static const CompilerVersionNode cCompilerVersionNode("C"),
cxxCompilerVersionNode("CXX"), cudaCompilerVersionNode("CUDA"),
objcCompilerVersionNode("OBJC"), objcxxCompilerVersionNode("OBJCXX"),
- fortranCompilerVersionNode("Fortran");
+ fortranCompilerVersionNode("Fortran"), ispcCompilerVersionNode("ISPC");
struct PlatformIdNode : public cmGeneratorExpressionNode
{
@@ -1740,7 +1741,7 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode
for (auto const& lit : testedFeatures) {
std::vector<std::string> const& langAvailable =
availableFeatures[lit.first];
- cmProp standardDefault = context->LG->GetMakefile()->GetDef(
+ cmProp standardDefault = context->LG->GetMakefile()->GetDefinition(
"CMAKE_" + lit.first + "_STANDARD_DEFAULT");
for (std::string const& it : lit.second) {
if (!cm::contains(langAvailable, it)) {
@@ -1901,6 +1902,70 @@ class ArtifactSonameTag;
class ArtifactBundleDirTag;
class ArtifactBundleContentDirTag;
+template <typename ArtifactT, typename ComponentT>
+struct TargetFilesystemArtifactDependency
+{
+ static void AddDependency(cmGeneratorTarget* target,
+ cmGeneratorExpressionContext* context)
+ {
+ context->DependTargets.insert(target);
+ context->AllTargets.insert(target);
+ }
+};
+
+struct TargetFilesystemArtifactDependencyCMP0112
+{
+ static void AddDependency(cmGeneratorTarget* target,
+ cmGeneratorExpressionContext* context)
+ {
+ context->AllTargets.insert(target);
+ cmLocalGenerator* lg = context->LG;
+ switch (target->GetPolicyStatusCMP0112()) {
+ case cmPolicies::WARN:
+ if (lg->GetMakefile()->PolicyOptionalWarningEnabled(
+ "CMAKE_POLICY_WARNING_CMP0112")) {
+ std::string err =
+ cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0112),
+ "\nDependency being added to target:\n \"",
+ target->GetName(), "\"\n");
+ lg->GetCMakeInstance()->IssueMessage(MessageType ::AUTHOR_WARNING,
+ err, context->Backtrace);
+ }
+ CM_FALLTHROUGH;
+ case cmPolicies::OLD:
+ context->DependTargets.insert(target);
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ break;
+ }
+ }
+};
+
+template <typename ArtifactT>
+struct TargetFilesystemArtifactDependency<ArtifactT, ArtifactNameTag>
+ : TargetFilesystemArtifactDependencyCMP0112
+{
+};
+template <typename ArtifactT>
+struct TargetFilesystemArtifactDependency<ArtifactT, ArtifactDirTag>
+ : TargetFilesystemArtifactDependencyCMP0112
+{
+};
+template <>
+struct TargetFilesystemArtifactDependency<ArtifactBundleDirTag,
+ ArtifactPathTag>
+ : TargetFilesystemArtifactDependencyCMP0112
+{
+};
+template <>
+struct TargetFilesystemArtifactDependency<ArtifactBundleContentDirTag,
+ ArtifactPathTag>
+ : TargetFilesystemArtifactDependencyCMP0112
+{
+};
+
template <typename ArtifactT>
struct TargetFilesystemArtifactResultCreator
{
@@ -2153,8 +2218,10 @@ struct TargetFilesystemArtifact : public TargetArtifactBase
if (!target) {
return std::string();
}
- context->DependTargets.insert(target);
- context->AllTargets.insert(target);
+ // Not a dependent target if we are querying for ArtifactDirTag,
+ // ArtifactNameTag, ArtifactBundleDirTag, and ArtifactBundleContentDirTag
+ TargetFilesystemArtifactDependency<ArtifactT, ComponentT>::AddDependency(
+ target, context);
std::string result =
TargetFilesystemArtifactResultCreator<ArtifactT>::Create(target, context,
diff --git a/Source/cmGeneratorExpressionNode.h b/Source/cmGeneratorExpressionNode.h
index 13e8484..f068b02 100644
--- a/Source/cmGeneratorExpressionNode.h
+++ b/Source/cmGeneratorExpressionNode.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGeneratorExpressionNode_h
-#define cmGeneratorExpressionNode_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -52,5 +51,3 @@ struct cmGeneratorExpressionNode
void reportError(cmGeneratorExpressionContext* context,
const std::string& expr, const std::string& result);
-
-#endif
diff --git a/Source/cmGeneratorExpressionParser.h b/Source/cmGeneratorExpressionParser.h
index 1ba1654..d49bf3e 100644
--- a/Source/cmGeneratorExpressionParser.h
+++ b/Source/cmGeneratorExpressionParser.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGeneratorExpressionParser_h
-#define cmGeneratorExpressionParser_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -30,5 +29,3 @@ private:
const std::vector<cmGeneratorExpressionToken> Tokens;
unsigned int NestingLevel;
};
-
-#endif
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index de981c1..c0f2495 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -625,13 +625,13 @@ const char* cmGeneratorTarget::GetFilePrefixInternal(
const char* prefixVar = this->Target->GetPrefixVariableInternal(artifact);
if (!language.empty() && prefixVar && *prefixVar) {
std::string langPrefix = prefixVar + std::string("_") + language;
- targetPrefix = this->Makefile->GetDef(langPrefix);
+ targetPrefix = this->Makefile->GetDefinition(langPrefix);
}
// if there is no prefix on the target nor specific language
// use the cmake definition.
if (!targetPrefix && prefixVar) {
- targetPrefix = this->Makefile->GetDef(prefixVar);
+ targetPrefix = this->Makefile->GetDefinition(prefixVar);
}
}
@@ -675,13 +675,13 @@ const char* cmGeneratorTarget::GetFileSuffixInternal(
const char* suffixVar = this->Target->GetSuffixVariableInternal(artifact);
if (!language.empty() && suffixVar && *suffixVar) {
std::string langSuffix = suffixVar + std::string("_") + language;
- targetSuffix = this->Makefile->GetDef(langSuffix);
+ targetSuffix = this->Makefile->GetDefinition(langSuffix);
}
// if there is no suffix on the target nor specific language
// use the cmake definition.
if (!targetSuffix && suffixVar) {
- targetSuffix = this->Makefile->GetDef(suffixVar);
+ targetSuffix = this->Makefile->GetDefinition(suffixVar);
}
}
@@ -1167,10 +1167,10 @@ const std::string& cmGeneratorTarget::GetLocationForBuild() const
// Now handle the deprecated build-time configuration location.
std::string const noConfig;
location = this->GetDirectory(noConfig);
- const char* cfgid = this->Makefile->GetDefinition("CMAKE_CFG_INTDIR");
- if (cfgid && strcmp(cfgid, ".") != 0) {
+ cmProp cfgid = this->Makefile->GetDefinition("CMAKE_CFG_INTDIR");
+ if (cfgid && (*cfgid != ".")) {
location += "/";
- location += cfgid;
+ location += *cfgid;
}
if (this->IsAppBundleOnApple()) {
@@ -1363,18 +1363,25 @@ std::string cmGeneratorTarget::EvaluateInterfaceProperty(
}
namespace {
-std::string AddSwiftInterfaceIncludeDirectories(
+
+enum class IncludeDirectoryFallBack
+{
+ BINARY,
+ OBJECT
+};
+
+std::string AddLangSpecificInterfaceIncludeDirectories(
const cmGeneratorTarget* root, const cmGeneratorTarget* target,
- const std::string& config, cmGeneratorExpressionDAGChecker* context)
+ const std::string& lang, const std::string& config,
+ const std::string& propertyName, IncludeDirectoryFallBack mode,
+ cmGeneratorExpressionDAGChecker* context)
{
cmGeneratorExpressionDAGChecker dag{ target->GetBacktrace(), target,
- "Swift_MODULE_DIRECTORY", nullptr,
- context };
+ propertyName, nullptr, context };
switch (dag.Check()) {
case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
- dag.ReportError(nullptr,
- "$<TARGET_PROPERTY:" + target->GetName() +
- ",Swift_MODULE_DIRECTORY>");
+ dag.ReportError(
+ nullptr, "$<TARGET_PROPERTY:" + target->GetName() + ",propertyName");
CM_FALLTHROUGH;
case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE:
// No error. We just skip cyclic references.
@@ -1390,13 +1397,16 @@ std::string AddSwiftInterfaceIncludeDirectories(
target->GetLinkInterfaceLibraries(config, root, true)) {
for (const cmLinkItem& library : interface->Libraries) {
if (const cmGeneratorTarget* dependency = library.Target) {
- if (cm::contains(dependency->GetAllConfigCompileLanguages(),
- "Swift")) {
- std::string value =
- dependency->GetSafeProperty("Swift_MODULE_DIRECTORY");
+ if (cm::contains(dependency->GetAllConfigCompileLanguages(), lang)) {
+ auto* lg = dependency->GetLocalGenerator();
+ std::string value = dependency->GetSafeProperty(propertyName);
if (value.empty()) {
- value =
- dependency->GetLocalGenerator()->GetCurrentBinaryDirectory();
+ if (mode == IncludeDirectoryFallBack::BINARY) {
+ value = lg->GetCurrentBinaryDirectory();
+ } else if (mode == IncludeDirectoryFallBack::OBJECT) {
+ value = cmStrCat(lg->GetCurrentBinaryDirectory(), '/',
+ lg->GetTargetDirectory(dependency));
+ }
}
if (!directories.empty()) {
@@ -1410,35 +1420,39 @@ std::string AddSwiftInterfaceIncludeDirectories(
return directories;
}
-void AddSwiftImplicitIncludeDirectories(
- const cmGeneratorTarget* target, const std::string& config,
- EvaluatedTargetPropertyEntries& entries)
+void AddLangSpecificImplicitIncludeDirectories(
+ const cmGeneratorTarget* target, const std::string& lang,
+ const std::string& config, const std::string& propertyName,
+ IncludeDirectoryFallBack mode, EvaluatedTargetPropertyEntries& entries)
{
if (const auto* libraries = target->GetLinkImplementationLibraries(config)) {
cmGeneratorExpressionDAGChecker dag{ target->GetBacktrace(), target,
- "Swift_MODULE_DIRECTORY", nullptr,
- nullptr };
+ propertyName, nullptr, nullptr };
for (const cmLinkImplItem& library : libraries->Libraries) {
if (const cmGeneratorTarget* dependency = library.Target) {
if (!dependency->IsInBuildSystem()) {
continue;
}
- if (cm::contains(dependency->GetAllConfigCompileLanguages(),
- "Swift")) {
+ if (cm::contains(dependency->GetAllConfigCompileLanguages(), lang)) {
+ auto* lg = dependency->GetLocalGenerator();
EvaluatedTargetPropertyEntry entry{ library, library.Backtrace };
- if (cmProp val = dependency->GetProperty("Swift_MODULE_DIRECTORY")) {
+ if (cmProp val = dependency->GetProperty(propertyName)) {
entry.Values.emplace_back(*val);
} else {
- entry.Values.emplace_back(
- dependency->GetLocalGenerator()->GetCurrentBinaryDirectory());
+ if (mode == IncludeDirectoryFallBack::BINARY) {
+ entry.Values.emplace_back(lg->GetCurrentBinaryDirectory());
+ } else if (mode == IncludeDirectoryFallBack::OBJECT) {
+ entry.Values.emplace_back(
+ dependency->GetObjectDirectory(config));
+ }
}
- cmExpandList(AddSwiftInterfaceIncludeDirectories(target, dependency,
- config, &dag),
- entry.Values);
-
+ cmExpandList(
+ AddLangSpecificInterfaceIncludeDirectories(
+ target, dependency, lang, config, propertyName, mode, &dag),
+ entry.Values);
entries.Entries.emplace_back(std::move(entry));
}
}
@@ -2051,13 +2065,13 @@ bool cmGeneratorTarget::IsChrpathUsed(const std::string& config) const
if (!ll.empty()) {
std::string sepVar =
cmStrCat("CMAKE_SHARED_LIBRARY_RUNTIME_", ll, "_FLAG_SEP");
- const char* sep = this->Makefile->GetDefinition(sepVar);
+ cmProp sep = this->Makefile->GetDefinition(sepVar);
if (cmNonempty(sep)) {
// TODO: Add ELF check to ABI detection and get rid of
// CMAKE_EXECUTABLE_FORMAT.
- if (const char* fmt =
+ if (cmProp fmt =
this->Makefile->GetDefinition("CMAKE_EXECUTABLE_FORMAT")) {
- return strcmp(fmt, "ELF") == 0;
+ return (*fmt == "ELF");
}
}
}
@@ -3288,6 +3302,27 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(std::string& flags) const
}
}
+void cmGeneratorTarget::AddISPCTargetFlags(std::string& flags) const
+{
+ const std::string& property = this->GetSafeProperty("ISPC_INSTRUCTION_SETS");
+
+ // If ISPC_TARGET is false we don't add any architectures.
+ if (cmIsOff(property)) {
+ return;
+ }
+
+ std::string const& compiler =
+ this->Makefile->GetSafeDefinition("CMAKE_ISPC_COMPILER_ID");
+
+ if (compiler == "Intel") {
+ std::vector<std::string> targets;
+ cmExpandList(property, targets);
+ if (!targets.empty()) {
+ flags += cmStrCat(" --target=", cmWrap("", targets, "", ","));
+ }
+ }
+}
+
void cmGeneratorTarget::AddCUDAToolkitFlags(std::string& flags) const
{
std::string const& compiler =
@@ -3482,7 +3517,28 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
this, config, lang, &dagChecker, this->IncludeDirectoriesEntries);
if (lang == "Swift") {
- AddSwiftImplicitIncludeDirectories(this, config, entries);
+ AddLangSpecificImplicitIncludeDirectories(
+ this, lang, config, "Swift_MODULE_DIRECTORY",
+ IncludeDirectoryFallBack::BINARY, entries);
+ }
+
+ if (this->CanCompileSources() && (lang != "Swift" && lang != "Fortran")) {
+
+ const std::string propertyName = "ISPC_HEADER_DIRECTORY";
+
+ // If this target has ISPC sources make sure to add the header
+ // directory to other compilation units
+ if (cm::contains(this->GetAllConfigCompileLanguages(), "ISPC")) {
+ if (cmProp val = this->GetProperty(propertyName)) {
+ includes.emplace_back(*val);
+ } else {
+ includes.emplace_back(this->GetObjectDirectory(config));
+ }
+ }
+
+ AddLangSpecificImplicitIncludeDirectories(
+ this, "ISPC", config, propertyName, IncludeDirectoryFallBack::OBJECT,
+ entries);
}
AddInterfaceEntries(this, config, "INTERFACE_INCLUDE_DIRECTORIES", lang,
@@ -3874,8 +3930,8 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
const std::string filename_tmp = cmStrCat(filename, ".tmp");
if (!pchReuseFrom) {
- auto pchPrologue = this->Makefile->GetDefinition("CMAKE_PCH_PROLOGUE");
- auto pchEpilogue = this->Makefile->GetDefinition("CMAKE_PCH_EPILOGUE");
+ cmProp pchPrologue = this->Makefile->GetDefinition("CMAKE_PCH_PROLOGUE");
+ cmProp pchEpilogue = this->Makefile->GetDefinition("CMAKE_PCH_EPILOGUE");
std::string firstHeaderOnDisk;
{
@@ -3884,7 +3940,7 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
this->GetGlobalGenerator()->GetMakefileEncoding());
file << "/* generated by CMake */\n\n";
if (pchPrologue) {
- file << pchPrologue << "\n";
+ file << *pchPrologue << "\n";
}
if (this->GetGlobalGenerator()->IsXcode()) {
file << "#ifndef CMAKE_SKIP_PRECOMPILE_HEADERS\n";
@@ -3914,7 +3970,7 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
file << "#endif // CMAKE_SKIP_PRECOMPILE_HEADERS\n";
}
if (pchEpilogue) {
- file << pchEpilogue << "\n";
+ file << *pchEpilogue << "\n";
}
}
@@ -4605,7 +4661,7 @@ bool cmGeneratorTarget::ComputeCompileFeatures(
this->LanguageStandardMap[key] = *standardToCopy;
generatorTargetLanguageStandard = &this->LanguageStandardMap[key];
} else {
- cmProp defaultStandard = this->Makefile->GetDef(
+ cmProp defaultStandard = this->Makefile->GetDefinition(
cmStrCat("CMAKE_", language.second, "_STANDARD_DEFAULT"));
if (defaultStandard != nullptr) {
this->LanguageStandardMap[key] = BTs<std::string>(*defaultStandard);
@@ -4750,12 +4806,11 @@ cmGeneratorTarget::Names cmGeneratorTarget::GetLibraryNames(
// The library's soname.
this->ComputeVersionedName(targetNames.SharedObject, prefix,
targetNames.Base, suffix, targetNames.Output,
- (soversion ? soversion->c_str() : nullptr));
+ cmToCStr(soversion));
// The library's real name on disk.
this->ComputeVersionedName(targetNames.Real, prefix, targetNames.Base,
- suffix, targetNames.Output,
- (version ? version->c_str() : nullptr));
+ suffix, targetNames.Output, cmToCStr(version));
}
// The import library name.
@@ -4791,10 +4846,7 @@ cmGeneratorTarget::Names cmGeneratorTarget::GetExecutableNames(
const char* version = nullptr;
#else
// Check for executable version properties.
- const char* version = nullptr;
- if (cmProp p = this->GetProperty("VERSION")) {
- version = p->c_str();
- }
+ const char* version = cmToCStr(this->GetProperty("VERSION"));
if (this->GetType() != cmStateEnums::EXECUTABLE ||
this->Makefile->IsOn("XCODE")) {
version = nullptr;
@@ -5046,6 +5098,11 @@ void cmGeneratorTarget::GetTargetObjectNames(
assert(!map_it->second.empty());
objects.push_back(map_it->second);
}
+
+ auto ispcObjects = this->GetGeneratedISPCObjects(config);
+ for (std::string const& output : ispcObjects) {
+ objects.push_back(cmSystemTools::GetFilenameName(output));
+ }
}
bool cmGeneratorTarget::StrictTargetComparison::operator()(
@@ -5511,7 +5568,7 @@ const char* getTypedProperty<const char*>(
cmProp value = tgt->GetProperty(prop);
if (genexInterpreter == nullptr) {
- return value ? value->c_str() : nullptr;
+ return cmToCStr(value);
}
return genexInterpreter->Evaluate(value ? *value : "", prop).c_str();
@@ -5525,7 +5582,7 @@ std::string getTypedProperty<std::string>(
cmProp value = tgt->GetProperty(prop);
if (genexInterpreter == nullptr) {
- return valueAsString(value ? value->c_str() : nullptr);
+ return valueAsString(cmToCStr(value));
}
return genexInterpreter->Evaluate(value ? *value : "", prop);
@@ -5927,7 +5984,7 @@ std::string cmGeneratorTarget::GetRuntimeLinkLibrary(
{
// This is activated by the presence of a default selection whether or
// not it is overridden by a property.
- cmProp runtimeLibraryDefault = this->Makefile->GetDef(
+ cmProp runtimeLibraryDefault = this->Makefile->GetDefinition(
cmStrCat("CMAKE_", lang, "_RUNTIME_LIBRARY_DEFAULT"));
if (!cmNonempty(runtimeLibraryDefault)) {
return std::string();
@@ -5967,7 +6024,7 @@ std::string cmGeneratorTarget::CreateFortranModuleDirectory(
target_mod_dir = default_mod_dir;
}
}
- const char* moddir_flag =
+ cmProp moddir_flag =
this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG");
if (!target_mod_dir.empty() && moddir_flag) {
// Compute the full path to the module directory.
@@ -5986,6 +6043,66 @@ std::string cmGeneratorTarget::CreateFortranModuleDirectory(
return mod_dir;
}
+void cmGeneratorTarget::AddISPCGeneratedHeader(std::string const& header,
+ std::string const& config)
+{
+ std::string config_upper;
+ if (!config.empty()) {
+ config_upper = cmSystemTools::UpperCase(config);
+ }
+ auto iter = this->ISPCGeneratedHeaders.find(config_upper);
+ if (iter == this->ISPCGeneratedHeaders.end()) {
+ std::vector<std::string> headers;
+ headers.emplace_back(header);
+ this->ISPCGeneratedHeaders.insert({ config_upper, headers });
+ } else {
+ iter->second.emplace_back(header);
+ }
+}
+
+std::vector<std::string> cmGeneratorTarget::GetGeneratedISPCHeaders(
+ std::string const& config) const
+{
+ std::string config_upper;
+ if (!config.empty()) {
+ config_upper = cmSystemTools::UpperCase(config);
+ }
+ auto iter = this->ISPCGeneratedHeaders.find(config_upper);
+ if (iter == this->ISPCGeneratedHeaders.end()) {
+ return std::vector<std::string>{};
+ }
+ return iter->second;
+}
+
+void cmGeneratorTarget::AddISPCGeneratedObject(std::vector<std::string>&& objs,
+ std::string const& config)
+{
+ std::string config_upper;
+ if (!config.empty()) {
+ config_upper = cmSystemTools::UpperCase(config);
+ }
+ auto iter = this->ISPCGeneratedObjects.find(config_upper);
+ if (iter == this->ISPCGeneratedObjects.end()) {
+ this->ISPCGeneratedObjects.insert({ config_upper, objs });
+ } else {
+ iter->second.insert(iter->second.end(), objs.begin(), objs.end());
+ }
+}
+
+std::vector<std::string> cmGeneratorTarget::GetGeneratedISPCObjects(
+ std::string const& config) const
+{
+ std::string config_upper;
+ if (!config.empty()) {
+ config_upper = cmSystemTools::UpperCase(config);
+ }
+ auto iter = this->ISPCGeneratedObjects.find(config_upper);
+ if (iter == this->ISPCGeneratedObjects.end()) {
+ return std::vector<std::string>{};
+ }
+ return iter->second;
+}
+
std::string cmGeneratorTarget::GetFrameworkVersion() const
{
assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY);
@@ -6365,21 +6482,16 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
// Look for a target property defining the target output directory
// based on the target type.
std::string targetTypeName = this->GetOutputTargetType(artifact);
- const char* propertyName = nullptr;
- std::string propertyNameStr = targetTypeName;
- if (!propertyNameStr.empty()) {
- propertyNameStr += "_OUTPUT_DIRECTORY";
- propertyName = propertyNameStr.c_str();
+ std::string propertyName;
+ if (!targetTypeName.empty()) {
+ propertyName = cmStrCat(targetTypeName, "_OUTPUT_DIRECTORY");
}
// Check for a per-configuration output directory target property.
std::string configUpper = cmSystemTools::UpperCase(conf);
- const char* configProp = nullptr;
- std::string configPropStr = targetTypeName;
- if (!configPropStr.empty()) {
- configPropStr += "_OUTPUT_DIRECTORY_";
- configPropStr += configUpper;
- configProp = configPropStr.c_str();
+ std::string configProp;
+ if (!targetTypeName.empty()) {
+ configProp = cmStrCat(targetTypeName, "_OUTPUT_DIRECTORY_", configUpper);
}
// Select an output directory.
@@ -6440,22 +6552,17 @@ bool cmGeneratorTarget::ComputePDBOutputDir(const std::string& kind,
{
// Look for a target property defining the target output directory
// based on the target type.
- const char* propertyName = nullptr;
- std::string propertyNameStr = kind;
- if (!propertyNameStr.empty()) {
- propertyNameStr += "_OUTPUT_DIRECTORY";
- propertyName = propertyNameStr.c_str();
+ std::string propertyName;
+ if (!kind.empty()) {
+ propertyName = cmStrCat(kind, "_OUTPUT_DIRECTORY");
}
std::string conf = config;
// Check for a per-configuration output directory target property.
std::string configUpper = cmSystemTools::UpperCase(conf);
- const char* configProp = nullptr;
- std::string configPropStr = kind;
- if (!configPropStr.empty()) {
- configPropStr += "_OUTPUT_DIRECTORY_";
- configPropStr += configUpper;
- configProp = configPropStr.c_str();
+ std::string configProp;
+ if (!kind.empty()) {
+ configProp = cmStrCat(kind, "_OUTPUT_DIRECTORY_", configUpper);
}
// Select an output directory.
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 544b27a..330d784 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGeneratorTarget_h
-#define cmGeneratorTarget_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -449,6 +448,8 @@ public:
void AddCUDAArchitectureFlags(std::string& flags) const;
void AddCUDAToolkitFlags(std::string& flags) const;
+ void AddISPCTargetFlags(std::string& flags) const;
+
std::string GetFeatureSpecificLinkRuleVariable(
std::string const& var, std::string const& lang,
std::string const& config) const;
@@ -816,6 +817,16 @@ public:
const std::string& GetSourcesProperty() const;
+ void AddISPCGeneratedHeader(std::string const& header,
+ std::string const& config);
+ std::vector<std::string> GetGeneratedISPCHeaders(
+ std::string const& config) const;
+
+ void AddISPCGeneratedObject(std::vector<std::string>&& objs,
+ std::string const& config);
+ std::vector<std::string> GetGeneratedISPCObjects(
+ std::string const& config) const;
+
private:
void AddSourceCommon(const std::string& src, bool before = false);
@@ -994,6 +1005,11 @@ private:
std::unordered_set<std::string> UnityBatchedSourceFiles;
+ std::unordered_map<std::string, std::vector<std::string>>
+ ISPCGeneratedHeaders;
+ std::unordered_map<std::string, std::vector<std::string>>
+ ISPCGeneratedObjects;
+
bool IsLinkLookupScope(std::string const& n,
cmLocalGenerator const*& lg) const;
@@ -1085,5 +1101,3 @@ public:
cmGeneratorTarget const* t2) const;
};
};
-
-#endif
diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h
index 7a6728c..3a2e702 100644
--- a/Source/cmGetCMakePropertyCommand.h
+++ b/Source/cmGetCMakePropertyCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGetCMakePropertyCommand_h
-#define cmGetCMakePropertyCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmGetCMakePropertyCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx
index fa4a40b..c2098c0 100644
--- a/Source/cmGetDirectoryPropertyCommand.cxx
+++ b/Source/cmGetDirectoryPropertyCommand.cxx
@@ -86,9 +86,7 @@ bool cmGetDirectoryPropertyCommand(std::vector<std::string> const& args,
break;
}
}
- if (cmProp p = dir->GetProperty(*i)) {
- prop = p->c_str();
- }
+ prop = cmToCStr(dir->GetProperty(*i));
}
StoreResult(status.GetMakefile(), variable, prop);
return true;
diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h
index f356ea5..4b0883c 100644
--- a/Source/cmGetDirectoryPropertyCommand.h
+++ b/Source/cmGetDirectoryPropertyCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGetDirectoryPropertyCommand_h
-#define cmGetDirectoryPropertyCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmGetDirectoryPropertyCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx
index 38bffbf..40e8a05 100644
--- a/Source/cmGetFilenameComponentCommand.cxx
+++ b/Source/cmGetFilenameComponentCommand.cxx
@@ -4,6 +4,7 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -21,8 +22,8 @@ bool cmGetFilenameComponentCommand(std::vector<std::string> const& args,
// Check and see if the value has been stored in the cache
// already, if so use that value
if (args.size() >= 4 && args.back() == "CACHE") {
- const char* cacheValue = status.GetMakefile().GetDefinition(args.front());
- if (cacheValue && !cmIsNOTFOUND(cacheValue)) {
+ cmProp cacheValue = status.GetMakefile().GetDefinition(args.front());
+ if (cacheValue && !cmIsNOTFOUND(*cacheValue)) {
return true;
}
}
diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h
index db5293b..4e1addf 100644
--- a/Source/cmGetFilenameComponentCommand.h
+++ b/Source/cmGetFilenameComponentCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGetFilenameComponentCommand_h
-#define cmGetFilenameComponentCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -18,5 +17,3 @@ class cmExecutionStatus;
*/
bool cmGetFilenameComponentCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmGetPipes.h b/Source/cmGetPipes.h
index 2a46b51..6b1b495 100644
--- a/Source/cmGetPipes.h
+++ b/Source/cmGetPipes.h
@@ -1,8 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGetPipes_h
-#define cmGetPipes_h
+#pragma once
int cmGetPipes(int* fds);
-
-#endif
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index cdfd8c8..3a5b39d 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -281,8 +281,7 @@ bool HandleGlobalMode(cmExecutionStatus& status, const std::string& name,
// Get the property.
cmake* cm = status.GetMakefile().GetCMakeInstance();
cmProp p = cm->GetState()->GetGlobalProperty(propertyName);
- return StoreResult(infoType, status.GetMakefile(), variable,
- p ? p->c_str() : nullptr);
+ return StoreResult(infoType, status.GetMakefile(), variable, cmToCStr(p));
}
bool HandleDirectoryMode(cmExecutionStatus& status, const std::string& name,
@@ -329,8 +328,7 @@ bool HandleDirectoryMode(cmExecutionStatus& status, const std::string& name,
// Get the property.
cmProp p = mf->GetProperty(propertyName);
- return StoreResult(infoType, status.GetMakefile(), variable,
- p ? p->c_str() : nullptr);
+ return StoreResult(infoType, status.GetMakefile(), variable, cmToCStr(p));
}
bool HandleTargetMode(cmExecutionStatus& status, const std::string& name,
@@ -430,8 +428,9 @@ bool HandleVariableMode(cmExecutionStatus& status, const std::string& name,
return false;
}
- return StoreResult(infoType, status.GetMakefile(), variable,
- status.GetMakefile().GetDefinition(propertyName));
+ return StoreResult(
+ infoType, status.GetMakefile(), variable,
+ cmToCStr(status.GetMakefile().GetDefinition(propertyName)));
}
bool HandleCacheMode(cmExecutionStatus& status, const std::string& name,
@@ -448,8 +447,7 @@ bool HandleCacheMode(cmExecutionStatus& status, const std::string& name,
value = status.GetMakefile().GetState()->GetCacheEntryProperty(
name, propertyName);
}
- StoreResult(infoType, status.GetMakefile(), variable,
- value ? value->c_str() : nullptr);
+ StoreResult(infoType, status.GetMakefile(), variable, cmToCStr(value));
return true;
}
diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h
index cc600f4..fac3202 100644
--- a/Source/cmGetPropertyCommand.h
+++ b/Source/cmGetPropertyCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGetPropertyCommand_h
-#define cmGetPropertyCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmGetPropertyCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h
index f0c319b..4f8eab2 100644
--- a/Source/cmGetSourceFilePropertyCommand.h
+++ b/Source/cmGetSourceFilePropertyCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGetSourceFilePropertyCommand_h
-#define cmGetSourceFilePropertyCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmGetSourceFilePropertyCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h
index c13078f..0fbd23d 100644
--- a/Source/cmGetTargetPropertyCommand.h
+++ b/Source/cmGetTargetPropertyCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGetTargetPropertyCommand_h
-#define cmGetTargetPropertyCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmGetTargetPropertyCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h
index 30beb8f..f1d6010 100644
--- a/Source/cmGetTestPropertyCommand.h
+++ b/Source/cmGetTestPropertyCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGetTestPropertyCommand_h
-#define cmGetTestPropertyCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmGetTestPropertyCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmGhsMultiGpj.h b/Source/cmGhsMultiGpj.h
index fbbef5d..1cae660 100644
--- a/Source/cmGhsMultiGpj.h
+++ b/Source/cmGhsMultiGpj.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGhsMultiGpj_h
-#define cmGhsMultiGpj_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -25,5 +24,3 @@ public:
static const char* GetGpjTag(Types gpjType);
};
-
-#endif // ! cmGhsMultiGpjType_h
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 1589c47..a8f8f57 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -43,9 +43,9 @@ cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target)
#endif
{
// Store the configuration name that is being used
- if (const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) {
+ if (cmProp config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) {
// Use the build type given by the user.
- this->ConfigName = config;
+ this->ConfigName = *config;
} else {
// No configuration type given.
this->ConfigName.clear();
diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h
index 5f26387..e9d7537 100644
--- a/Source/cmGhsMultiTargetGenerator.h
+++ b/Source/cmGhsMultiTargetGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGhsMultiTargetGenerator_h
-#define cmGhsMultiTargetGenerator_h
+#pragma once
#include <iosfwd>
#include <map>
@@ -82,5 +81,3 @@ private:
std::string ConfigName; /* CMAKE_BUILD_TYPE */
bool const CmdWindowsShell; /* custom commands run in cmd.exe or /bin/sh */
};
-
-#endif // ! cmGhsMultiTargetGenerator_h
diff --git a/Source/cmGlobVerificationManager.h b/Source/cmGlobVerificationManager.h
index 2e7e1ca..b618fb0 100644
--- a/Source/cmGlobVerificationManager.h
+++ b/Source/cmGlobVerificationManager.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobVerificationManager_h
-#define cmGlobVerificationManager_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -81,5 +80,3 @@ private:
// cmGlobVerificationManager should never be used directly.
friend class cmState; // allow access to add cache values
};
-
-#endif
diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h
index 3c97955..5a4e8c2 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.h
+++ b/Source/cmGlobalBorlandMakefileGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalBorlandMakefileGenerator_h
-#define cmGlobalBorlandMakefileGenerator_h
+#pragma once
#include <iosfwd>
#include <memory>
@@ -58,5 +57,3 @@ protected:
void PrintBuildCommandAdvice(std::ostream& os, int jobs) const override;
};
-
-#endif
diff --git a/Source/cmGlobalCommonGenerator.h b/Source/cmGlobalCommonGenerator.h
index f97b5f4..2aa9d27 100644
--- a/Source/cmGlobalCommonGenerator.h
+++ b/Source/cmGlobalCommonGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalCommonGenerator_h
-#define cmGlobalCommonGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -44,5 +43,3 @@ public:
bool IsExcludedFromAllInConfig(const DirectoryTarget::Target& t,
const std::string& config);
};
-
-#endif
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index a192ffd..8688b1b 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -780,27 +780,27 @@ void cmGlobalGenerator::EnableLanguage(
std::string compilerName = cmStrCat("CMAKE_", lang, "_COMPILER");
std::string compilerEnv = cmStrCat("CMAKE_", lang, "_COMPILER_ENV_VAR");
std::ostringstream noCompiler;
- const char* compilerFile = mf->GetDefinition(compilerName);
- if (!cmNonempty(compilerFile) || cmIsNOTFOUND(compilerFile)) {
+ cmProp compilerFile = mf->GetDefinition(compilerName);
+ if (!cmNonempty(compilerFile) || cmIsNOTFOUND(*compilerFile)) {
/* clang-format off */
noCompiler <<
"No " << compilerName << " could be found.\n"
;
/* clang-format on */
} else if ((lang != "RC") && (lang != "ASM_MASM")) {
- if (!cmSystemTools::FileIsFullPath(compilerFile)) {
+ if (!cmSystemTools::FileIsFullPath(*compilerFile)) {
/* clang-format off */
noCompiler <<
"The " << compilerName << ":\n"
- " " << compilerFile << "\n"
+ " " << *compilerFile << "\n"
"is not a full path and was not found in the PATH.\n"
;
/* clang-format on */
- } else if (!cmSystemTools::FileExists(compilerFile)) {
+ } else if (!cmSystemTools::FileExists(*compilerFile)) {
/* clang-format off */
noCompiler <<
"The " << compilerName << ":\n"
- " " << compilerFile << "\n"
+ " " << *compilerFile << "\n"
"is not a full path to an existing compiler tool.\n"
;
/* clang-format on */
@@ -817,7 +817,7 @@ void cmGlobalGenerator::EnableLanguage(
cmSystemTools::RemoveFile(compilerLangFile);
if (!this->CMakeInstance->GetIsInTryCompile()) {
this->PrintCompilerAdvice(noCompiler, lang,
- mf->GetDefinition(compilerEnv));
+ cmToCStr(mf->GetDefinition(compilerEnv)));
mf->IssueMessage(MessageType::FATAL_ERROR, noCompiler.str());
fatalError = true;
}
@@ -1095,17 +1095,16 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l,
return;
}
- std::string linkerPrefVar =
- std::string("CMAKE_") + std::string(l) + std::string("_LINKER_PREFERENCE");
- const char* linkerPref = mf->GetDefinition(linkerPrefVar);
+ std::string linkerPrefVar = "CMAKE_" + l + "_LINKER_PREFERENCE";
+ cmProp linkerPref = mf->GetDefinition(linkerPrefVar);
int preference = 0;
- if (linkerPref) {
- if (sscanf(linkerPref, "%d", &preference) != 1) {
+ if (cmNonempty(linkerPref)) {
+ if (sscanf(linkerPref->c_str(), "%d", &preference) != 1) {
// backward compatibility: before 2.6 LINKER_PREFERENCE
// was either "None" or "Preferred", and only the first character was
// tested. So if there is a custom language out there and it is
// "Preferred", set its preference high
- if (linkerPref[0] == 'P') {
+ if ((*linkerPref)[0] == 'P') {
preference = 100;
} else {
preference = 0;
@@ -1122,14 +1121,14 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l,
this->LanguageToLinkerPreference[l] = preference;
- std::string outputExtensionVar =
- std::string("CMAKE_") + std::string(l) + std::string("_OUTPUT_EXTENSION");
- const char* outputExtension = mf->GetDefinition(outputExtensionVar);
- if (outputExtension) {
+ std::string outputExtensionVar = "CMAKE_" + l + "_OUTPUT_EXTENSION";
+ if (cmProp p = mf->GetDefinition(outputExtensionVar)) {
+ std::string outputExtension = *p;
this->LanguageToOutputExtension[l] = outputExtension;
this->OutputExtensions[outputExtension] = outputExtension;
- if (outputExtension[0] == '.') {
- this->OutputExtensions[outputExtension + 1] = outputExtension + 1;
+ if (cmHasPrefix(outputExtension, ".")) {
+ outputExtension = outputExtension.substr(1);
+ this->OutputExtensions[outputExtension] = outputExtension;
}
}
@@ -1162,7 +1161,7 @@ void cmGlobalGenerator::FillExtensionToLanguageMap(const std::string& l,
const char* cmGlobalGenerator::GetGlobalSetting(std::string const& name) const
{
assert(!this->Makefiles.empty());
- return this->Makefiles[0]->GetDefinition(name);
+ return cmToCStr(this->Makefiles[0]->GetDefinition(name));
}
bool cmGlobalGenerator::GlobalSettingIsOn(std::string const& name) const
@@ -1472,6 +1471,7 @@ bool cmGlobalGenerator::Compute()
if (!this->ComputeTargetDepends()) {
return false;
}
+ this->ComputeTargetOrder();
if (this->CheckTargetsForType()) {
return false;
@@ -1582,6 +1582,50 @@ bool cmGlobalGenerator::ComputeTargetDepends()
return true;
}
+std::vector<cmGeneratorTarget*>
+cmGlobalGenerator::GetLocalGeneratorTargetsInOrder(cmLocalGenerator* lg) const
+{
+ std::vector<cmGeneratorTarget*> gts;
+ cm::append(gts, lg->GetGeneratorTargets());
+ std::sort(gts.begin(), gts.end(),
+ [this](cmGeneratorTarget const* l, cmGeneratorTarget const* r) {
+ return this->TargetOrderIndex.at(l) <
+ this->TargetOrderIndex.at(r);
+ });
+ return gts;
+}
+
+void cmGlobalGenerator::ComputeTargetOrder()
+{
+ size_t index = 0;
+ auto const& lgens = this->GetLocalGenerators();
+ for (auto const& lgen : lgens) {
+ const auto& targets = lgen->GetGeneratorTargets();
+ for (const auto& gt : targets) {
+ this->ComputeTargetOrder(gt.get(), index);
+ }
+ }
+ assert(index == this->TargetOrderIndex.size());
+}
+
+void cmGlobalGenerator::ComputeTargetOrder(cmGeneratorTarget const* gt,
+ size_t& index)
+{
+ std::map<cmGeneratorTarget const*, size_t>::value_type value(gt, 0);
+ auto insertion = this->TargetOrderIndex.insert(value);
+ if (!insertion.second) {
+ return;
+ }
+ auto entry = insertion.first;
+
+ auto& deps = this->GetTargetDirectDepends(gt);
+ for (auto& d : deps) {
+ this->ComputeTargetOrder(d, index);
+ }
+
+ entry->second = index++;
+}
+
bool cmGlobalGenerator::QtAutoGen()
{
#ifndef CMAKE_BOOTSTRAP
@@ -1601,6 +1645,7 @@ bool cmGlobalGenerator::AddAutomaticSources()
continue;
}
lg->AddUnityBuild(gt.get());
+ lg->AddISPCDependencies(gt.get());
// Targets that re-use a PCH are handled below.
if (!gt->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM")) {
lg->AddPchDependencies(gt.get());
@@ -1760,6 +1805,7 @@ void cmGlobalGenerator::ClearGeneratorMembers()
this->GeneratorTargetSearchIndex.clear();
this->MakefileSearchIndex.clear();
this->LocalGeneratorSearchIndex.clear();
+ this->TargetOrderIndex.clear();
this->ProjectMap.clear();
this->RuleHashes.clear();
this->DirectoryContentMap.clear();
@@ -2462,9 +2508,9 @@ void cmGlobalGenerator::AddGlobalTarget_Package(
if (this->GetPreinstallTargetName()) {
gti.Depends.emplace_back(this->GetPreinstallTargetName());
} else {
- const char* noPackageAll =
+ cmProp noPackageAll =
mf->GetDefinition("CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY");
- if (!noPackageAll || cmIsOff(noPackageAll)) {
+ if (cmIsOff(noPackageAll)) {
gti.Depends.emplace_back(this->GetAllTargetName());
}
}
@@ -2643,9 +2689,8 @@ void cmGlobalGenerator::AddGlobalTarget_Install(
if (this->GetPreinstallTargetName()) {
gti.Depends.emplace_back(this->GetPreinstallTargetName());
} else {
- const char* noall =
- mf->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY");
- if (!noall || cmIsOff(noall)) {
+ cmProp noall = mf->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY");
+ if (cmIsOff(noall)) {
gti.Depends.emplace_back(this->GetAllTargetName());
}
}
@@ -2665,7 +2710,7 @@ void cmGlobalGenerator::AddGlobalTarget_Install(
singleLine.push_back(cfgArg);
cfgArg = "-DEFFECTIVE_PLATFORM_NAME=$(EFFECTIVE_PLATFORM_NAME)";
} else {
- cfgArg += mf->GetDefinition("CMAKE_CFG_INTDIR");
+ cfgArg += cmToCStr(mf->GetDefinition("CMAKE_CFG_INTDIR"));
}
singleLine.push_back(cfgArg);
}
@@ -3073,7 +3118,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
cmProp targetLabels = target->GetProperty("LABELS");
cmProp directoryLabels =
target->Target->GetMakefile()->GetProperty("LABELS");
- const char* cmakeDirectoryLabels =
+ cmProp cmakeDirectoryLabels =
target->Target->GetMakefile()->GetDefinition("CMAKE_DIRECTORY_LABELS");
if (targetLabels || directoryLabels || cmakeDirectoryLabels) {
Json::Value lj_root(Json::objectValue);
@@ -3109,7 +3154,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
}
if (cmakeDirectoryLabels) {
- cmExpandList(cmakeDirectoryLabels, cmakeDirectoryLabelsList);
+ cmExpandList(*cmakeDirectoryLabels, cmakeDirectoryLabelsList);
}
if (!directoryLabelsList.empty() || !cmakeDirectoryLabelsList.empty()) {
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index c2c80c2..478028e 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -1,10 +1,10 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalGenerator_h
-#define cmGlobalGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
+#include <cstddef>
#include <iosfwd>
#include <map>
#include <memory>
@@ -265,6 +265,9 @@ public:
return this->LocalGenerators;
}
+ std::vector<cmGeneratorTarget*> GetLocalGeneratorTargetsInOrder(
+ cmLocalGenerator* lg) const;
+
cmMakefile* GetCurrentMakefile() const
{
return this->CurrentConfigureMakefile;
@@ -614,6 +617,10 @@ private:
// Its order is not deterministic.
LocalGeneratorMap LocalGeneratorSearchIndex;
+ void ComputeTargetOrder();
+ void ComputeTargetOrder(cmGeneratorTarget const* gt, size_t& index);
+ std::map<cmGeneratorTarget const*, size_t> TargetOrderIndex;
+
cmMakefile* TryCompileOuterMakefile;
// If you add a new map here, make sure it is copied
// in EnableLanguagesFromGenerator
@@ -717,5 +724,3 @@ protected:
bool InstallTargetEnabled;
bool ConfigureDoneCMP0026AndCMP0024;
};
-
-#endif
diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h
index 13cfe4d..3a7f806 100644
--- a/Source/cmGlobalGeneratorFactory.h
+++ b/Source/cmGlobalGeneratorFactory.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalGeneratorFactory_h
-#define cmGlobalGeneratorFactory_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -95,5 +94,3 @@ public:
std::string GetDefaultPlatformName() const override { return std::string(); }
};
-
-#endif
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 7c87131..cbaf0ab 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -100,13 +100,13 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
/* set the build tool to use */
std::string gbuild(tsp + ((tsp.back() == '/') ? "" : "/") +
DEFAULT_BUILD_PROGRAM);
- const char* prevTool = mf->GetDefinition("CMAKE_MAKE_PROGRAM");
+ cmProp prevTool = mf->GetDefinition("CMAKE_MAKE_PROGRAM");
/* check if the toolset changed from last generate */
- if (prevTool != nullptr && (gbuild != prevTool)) {
+ if (prevTool && (gbuild != *prevTool)) {
std::string message =
cmStrCat("toolset build tool: ", gbuild,
- "\nDoes not match the previously used build tool: ", prevTool,
+ "\nDoes not match the previously used build tool: ", *prevTool,
"\nEither remove the CMakeCache.txt file and CMakeFiles "
"directory or choose a different binary directory.");
cmSystemTools::Error(message);
@@ -187,7 +187,8 @@ void cmGlobalGhsMultiGenerator::EnableLanguage(
mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files
- const char* tgtPlatform = mf->GetDefinition("GHS_TARGET_PLATFORM");
+ const char* tgtPlatform =
+ cmToCStrSafe(mf->GetDefinition("GHS_TARGET_PLATFORM"));
if (!tgtPlatform) {
cmSystemTools::Message("Green Hills MULTI: GHS_TARGET_PLATFORM not "
"specified; defaulting to \"integrity\"");
@@ -216,10 +217,10 @@ bool cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile* /*mf*/)
void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd,
const std::string& ts)
{
- const char* ghsRoot = mf->GetDefinition("GHS_TOOLSET_ROOT");
+ cmProp ghsRoot = mf->GetDefinition("GHS_TOOLSET_ROOT");
if (cmNonempty(ghsRoot)) {
- tsd = ghsRoot;
+ tsd = *ghsRoot;
} else {
tsd = DEFAULT_TOOLSET_ROOT;
}
diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h
index 12ca8b6..7753b31 100644
--- a/Source/cmGlobalGhsMultiGenerator.h
+++ b/Source/cmGlobalGhsMultiGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGhsMultiGenerator_h
-#define cmGhsMultiGenerator_h
+#pragma once
#include <iosfwd>
#include <memory>
@@ -158,5 +157,3 @@ public:
using TargetDependSet = cmGlobalGenerator::TargetDependSet;
OrderedTargetDependSet(TargetDependSet const&, std::string const& first);
};
-
-#endif
diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h
index 9f1ec8b..2d58f91 100644
--- a/Source/cmGlobalJOMMakefileGenerator.h
+++ b/Source/cmGlobalJOMMakefileGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalJOMMakefileGenerator_h
-#define cmGlobalJOMMakefileGenerator_h
+#pragma once
#include <iosfwd>
#include <memory>
@@ -53,5 +52,3 @@ private:
void PrintCompilerAdvice(std::ostream& os, std::string const& lang,
const char* envVar) const override;
};
-
-#endif
diff --git a/Source/cmGlobalMSYSMakefileGenerator.h b/Source/cmGlobalMSYSMakefileGenerator.h
index b2de4ff..1a47b4f 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.h
+++ b/Source/cmGlobalMSYSMakefileGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalMSYSMakefileGenerator_h
-#define cmGlobalMSYSMakefileGenerator_h
+#pragma once
#include <memory>
@@ -42,5 +41,3 @@ public:
private:
std::string FindMinGW(std::string const& makeloc);
};
-
-#endif
diff --git a/Source/cmGlobalMinGWMakefileGenerator.h b/Source/cmGlobalMinGWMakefileGenerator.h
index a9f92a1..ffc9ebe 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.h
+++ b/Source/cmGlobalMinGWMakefileGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalMinGWMakefileGenerator_h
-#define cmGlobalMinGWMakefileGenerator_h
+#pragma once
#include <memory>
@@ -38,5 +37,3 @@ public:
virtual void EnableLanguage(std::vector<std::string> const& languages,
cmMakefile*, bool optional);
};
-
-#endif
diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h
index fdf6006..abe64ff 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.h
+++ b/Source/cmGlobalNMakeMakefileGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalNMakeMakefileGenerator_h
-#define cmGlobalNMakeMakefileGenerator_h
+#pragma once
#include <iosfwd>
#include <memory>
@@ -59,5 +58,3 @@ private:
void PrintCompilerAdvice(std::ostream& os, std::string const& lang,
const char* envVar) const override;
};
-
-#endif
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index f0fa1f4..006925d 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -32,6 +32,7 @@
#include "cmMessageType.h"
#include "cmNinjaLinkLineComputer.h"
#include "cmOutputConverter.h"
+#include "cmProperty.h"
#include "cmRange.h"
#include "cmState.h"
#include "cmStateDirectory.h"
@@ -614,8 +615,8 @@ bool cmGlobalNinjaGenerator::FindMakeProgram(cmMakefile* mf)
if (!this->cmGlobalGenerator::FindMakeProgram(mf)) {
return false;
}
- if (const char* ninjaCommand = mf->GetDefinition("CMAKE_MAKE_PROGRAM")) {
- this->NinjaCommand = ninjaCommand;
+ if (cmProp ninjaCommand = mf->GetDefinition("CMAKE_MAKE_PROGRAM")) {
+ this->NinjaCommand = *ninjaCommand;
std::vector<std::string> command;
command.push_back(this->NinjaCommand);
command.emplace_back("--version");
@@ -680,6 +681,9 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures()
this->NinjaSupportsRestatTool = !cmSystemTools::VersionCompare(
cmSystemTools::OP_LESS, this->NinjaVersion.c_str(),
RequiredNinjaVersionForRestatTool().c_str());
+ this->NinjaSupportsMultipleOutputs = !cmSystemTools::VersionCompare(
+ cmSystemTools::OP_LESS, this->NinjaVersion.c_str(),
+ RequiredNinjaVersionForMultipleOutputs().c_str());
}
bool cmGlobalNinjaGenerator::CheckLanguages(
@@ -688,6 +692,9 @@ bool cmGlobalNinjaGenerator::CheckLanguages(
if (cm::contains(languages, "Fortran")) {
return this->CheckFortran(mf);
}
+ if (cm::contains(languages, "ISPC")) {
+ return this->CheckISPC(mf);
+ }
if (cm::contains(languages, "Swift")) {
const std::string architectures =
mf->GetSafeDefinition("CMAKE_OSX_ARCHITECTURES");
@@ -721,6 +728,25 @@ bool cmGlobalNinjaGenerator::CheckFortran(cmMakefile* mf) const
return false;
}
+bool cmGlobalNinjaGenerator::CheckISPC(cmMakefile* mf) const
+{
+ if (this->NinjaSupportsMultipleOutputs) {
+ return true;
+ }
+
+ std::ostringstream e;
+ /* clang-format off */
+ e <<
+ "The Ninja generator does not support ISPC using Ninja version\n"
+ " " << this->NinjaVersion << "\n"
+ "due to lack of required features. Ninja 1.10 or higher is required."
+ ;
+ /* clang-format on */
+ mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+}
+
void cmGlobalNinjaGenerator::EnableLanguage(
std::vector<std::string> const& langs, cmMakefile* mf, bool optional)
{
@@ -1127,6 +1153,27 @@ void cmGlobalNinjaGenerator::AppendTargetDepends(
}
} else {
cmNinjaDeps outs;
+
+ auto computeISPCOuputs = [](cmGlobalNinjaGenerator* gg,
+ cmGeneratorTarget const* depTarget,
+ cmNinjaDeps& outputDeps,
+ const std::string& targetConfig) {
+ if (depTarget->CanCompileSources()) {
+ auto headers = depTarget->GetGeneratedISPCHeaders(targetConfig);
+ if (!headers.empty()) {
+ std::transform(headers.begin(), headers.end(), headers.begin(),
+ gg->MapToNinjaPath());
+ outputDeps.insert(outputDeps.end(), headers.begin(), headers.end());
+ }
+ auto objs = depTarget->GetGeneratedISPCObjects(targetConfig);
+ if (!objs.empty()) {
+ std::transform(objs.begin(), objs.end(), objs.begin(),
+ gg->MapToNinjaPath());
+ outputDeps.insert(outputDeps.end(), objs.begin(), objs.end());
+ }
+ }
+ };
+
for (cmTargetDepend const& targetDep :
this->GetTargetDirectDepends(target)) {
if (!targetDep->IsInBuildSystem()) {
@@ -1134,8 +1181,10 @@ void cmGlobalNinjaGenerator::AppendTargetDepends(
}
if (targetDep.IsCross()) {
this->AppendTargetOutputs(targetDep, outs, fileConfig, depends);
+ computeISPCOuputs(this, targetDep, outs, fileConfig);
} else {
this->AppendTargetOutputs(targetDep, outs, config, depends);
+ computeISPCOuputs(this, targetDep, outs, config);
}
}
std::sort(outs.begin(), outs.end());
@@ -1172,7 +1221,8 @@ void cmGlobalNinjaGenerator::AppendTargetDependsClosure(
for (auto const& dep_target : this->GetTargetDirectDepends(target)) {
if (!dep_target->IsInBuildSystem() ||
- (this->EnableCrossConfigBuild() && !dep_target.IsCross())) {
+ (target->GetType() != cmStateEnums::UTILITY &&
+ this->EnableCrossConfigBuild() && !dep_target.IsCross())) {
continue;
}
@@ -1868,6 +1918,7 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
byproducts.push_back(
this->BuildAlias(GetByproductsForCleanTargetName(), config));
}
+ byproducts.emplace_back(GetByproductsForCleanTargetName());
build.Variables["TARGETS"] = cmJoin(byproducts, " ");
for (auto const& fileConfig : configs) {
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 10f5cf6..884a711 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalNinjaGenerator_h
-#define cmGlobalNinjaGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -370,6 +369,10 @@ public:
return "1.10";
}
static std::string RequiredNinjaVersionForCleanDeadTool() { return "1.10"; }
+ static std::string RequiredNinjaVersionForMultipleOutputs()
+ {
+ return "1.10";
+ }
bool SupportsConsolePool() const;
bool SupportsImplicitOuts() const;
bool SupportsManifestRestat() const;
@@ -447,6 +450,7 @@ private:
bool CheckLanguages(std::vector<std::string> const& languages,
cmMakefile* mf) const override;
bool CheckFortran(cmMakefile* mf) const;
+ bool CheckISPC(cmMakefile* mf) const;
void CloseCompileCommandsStream();
@@ -533,6 +537,7 @@ private:
bool NinjaSupportsRestatTool = false;
bool NinjaSupportsUnconditionalRecompactTool = false;
bool NinjaSupportsCleanDeadTool = false;
+ bool NinjaSupportsMultipleOutputs = false;
private:
void InitOutputPathPrefix();
@@ -663,5 +668,3 @@ private:
std::unique_ptr<cmGeneratedFileStream> CommonFileStream;
std::unique_ptr<cmGeneratedFileStream> DefaultFileStream;
};
-
-#endif // ! cmGlobalNinjaGenerator_h
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index 1caa4b7..77d0827 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalUnixMakefileGenerator3_h
-#define cmGlobalUnixMakefileGenerator3_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -259,5 +258,3 @@ private:
DirectoryTargetsMap;
void InitializeProgressMarks() override;
};
-
-#endif
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 0c53537..65ea33f 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalVisualStudio10Generator_h
-#define cmGlobalVisualStudio10Generator_h
+#pragma once
#include <memory>
#include <set>
@@ -244,4 +243,3 @@ private:
// We do not use the reload macros for VS >= 10.
std::string GetUserMacrosDirectory() override { return ""; }
};
-#endif
diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h
index 5f1ff73..6e409cf 100644
--- a/Source/cmGlobalVisualStudio11Generator.h
+++ b/Source/cmGlobalVisualStudio11Generator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalVisualStudio11Generator_h
-#define cmGlobalVisualStudio11Generator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -53,4 +52,3 @@ private:
class Factory;
friend class Factory;
};
-#endif
diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h
index bdd40ff..c220d40 100644
--- a/Source/cmGlobalVisualStudio12Generator.h
+++ b/Source/cmGlobalVisualStudio12Generator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalVisualStudio12Generator_h
-#define cmGlobalVisualStudio12Generator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -48,4 +47,3 @@ private:
class Factory;
friend class Factory;
};
-#endif
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index aa1b7ad..a12b7e1 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -239,8 +239,8 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKMaxVersion(
{
// if the given value is set, it can either be OFF/FALSE or a valid SDK
// string
- if (std::string const* value =
- mf->GetDef("CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM")) {
+ if (cmProp value = mf->GetDefinition(
+ "CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM")) {
// If the value is some off/false value, then there is NO maximum set.
if (cmIsOff(value)) {
diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h
index 2b9a649..1ccd4c7 100644
--- a/Source/cmGlobalVisualStudio14Generator.h
+++ b/Source/cmGlobalVisualStudio14Generator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalVisualStudio14Generator_h
-#define cmGlobalVisualStudio14Generator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -60,4 +59,3 @@ private:
class Factory;
friend class Factory;
};
-#endif
diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h
index 7eadaf3..7d38199 100644
--- a/Source/cmGlobalVisualStudio71Generator.h
+++ b/Source/cmGlobalVisualStudio71Generator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalVisualStudio71Generator_h
-#define cmGlobalVisualStudio71Generator_h
+#pragma once
#include "cmGlobalVisualStudio7Generator.h"
@@ -42,4 +41,3 @@ protected:
std::string ProjectConfigurationSectionName;
};
-#endif
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index f8b438a..84cfaeb 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -381,8 +381,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
std::string location = *expath;
cmProp p = target->GetProperty("VS_PROJECT_TYPE");
- this->WriteExternalProject(fout, project, location,
- p ? p->c_str() : nullptr,
+ this->WriteExternalProject(fout, project, location, cmToCStr(p),
target->GetUtilities());
written = true;
} else {
@@ -676,11 +675,11 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
"CMAKE_VS_INCLUDE_" + t + "_TO_DEFAULT_BUILD";
// inspect CMAKE_VS_INCLUDE_<t>_TO_DEFAULT_BUILD properties
for (std::string const& i : configs) {
- const char* propertyValue =
+ cmProp propertyValue =
target->Target->GetMakefile()->GetDefinition(propertyName);
if (propertyValue &&
cmIsOn(cmGeneratorExpression::Evaluate(
- propertyValue, target->GetLocalGenerator(), i))) {
+ *propertyValue, target->GetLocalGenerator(), i))) {
activeConfigs.insert(i);
}
}
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 6cc1cf8..148762e 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalVisualStudio7Generator_h
-#define cmGlobalVisualStudio7Generator_h
+#pragma once
#include <memory>
@@ -174,5 +173,3 @@ private:
};
#define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"
-
-#endif
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index 6ce67d3..96e3553 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalVisualStudio8Generator_h
-#define cmGlobalVisualStudio8Generator_h
+#pragma once
#include "cmGlobalVisualStudio71Generator.h"
@@ -78,4 +77,3 @@ protected:
std::string Name;
std::string WindowsCEVersion;
};
-#endif
diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h
index 53318a6..6f4d159 100644
--- a/Source/cmGlobalVisualStudio9Generator.h
+++ b/Source/cmGlobalVisualStudio9Generator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalVisualStudio9Generator_h
-#define cmGlobalVisualStudio9Generator_h
+#pragma once
#include <memory>
@@ -38,4 +37,3 @@ private:
class Factory;
friend class Factory;
};
-#endif
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 29a5c2c..3c46408 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalVisualStudioGenerator_h
-#define cmGlobalVisualStudioGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -224,5 +223,3 @@ public:
OrderedTargetDependSet(TargetDependSet const&, std::string const& first);
OrderedTargetDependSet(TargetSet const&, std::string const& first);
};
-
-#endif
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h
index 289c35c..af09cbd 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.h
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalVisualStudioVersionedGenerator_h
-#define cmGlobalVisualStudioVersionedGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -69,4 +68,3 @@ private:
friend class Factory16;
mutable cmVSSetupAPIHelper vsSetupAPIHelper;
};
-#endif
diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h
index c47127f..da39d3f 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.h
+++ b/Source/cmGlobalWatcomWMakeGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalWatcomWMakeGenerator_h
-#define cmGlobalWatcomWMakeGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -64,5 +63,3 @@ protected:
void PrintBuildCommandAdvice(std::ostream& os, int jobs) const override;
};
-
-#endif
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 793f6f7..2f27128 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -424,37 +424,6 @@ void cmGlobalXCodeGenerator::AddExtraIDETargets()
}
}
-void cmGlobalXCodeGenerator::ComputeTargetOrder()
-{
- size_t index = 0;
- auto const& lgens = this->GetLocalGenerators();
- for (auto const& lgen : lgens) {
- const auto& targets = lgen->GetGeneratorTargets();
- for (const auto& gt : targets) {
- this->ComputeTargetOrder(gt.get(), index);
- }
- }
- assert(index == this->TargetOrderIndex.size());
-}
-
-void cmGlobalXCodeGenerator::ComputeTargetOrder(cmGeneratorTarget const* gt,
- size_t& index)
-{
- std::map<cmGeneratorTarget const*, size_t>::value_type value(gt, 0);
- auto insertion = this->TargetOrderIndex.insert(value);
- if (!insertion.second) {
- return;
- }
- auto entry = insertion.first;
-
- auto& deps = this->GetTargetDirectDepends(gt);
- for (auto& d : deps) {
- this->ComputeTargetOrder(d, index);
- }
-
- entry->second = index++;
-}
-
void cmGlobalXCodeGenerator::Generate()
{
this->cmGlobalGenerator::Generate();
@@ -462,8 +431,6 @@ void cmGlobalXCodeGenerator::Generate()
return;
}
- this->ComputeTargetOrder();
-
for (auto keyVal : this->ProjectMap) {
cmLocalGenerator* root = keyVal.second[0];
@@ -678,6 +645,8 @@ void cmGlobalXCodeGenerator::ClearXCodeObjects()
this->TargetGroup.clear();
this->FileRefs.clear();
this->ExternalLibRefs.clear();
+ this->FileRefToBuildFileMap.clear();
+ this->CommandsVisited.clear();
}
void cmGlobalXCodeGenerator::addObject(std::unique_ptr<cmXCodeObject> obj)
@@ -751,16 +720,23 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeBuildFileFromPath(
const std::string& lang, cmSourceFile* sf)
{
// Using a map and the full path guarantees that we will always get the same
- // fileRef object for any given full path.
- //
+ // fileRef object for any given full path. Same goes for the buildFile
+ // object.
cmXCodeObject* fileRef =
this->CreateXCodeFileReferenceFromPath(fullpath, target, lang, sf);
-
- cmXCodeObject* buildFile = this->CreateObject(cmXCodeObject::PBXBuildFile);
- buildFile->SetComment(fileRef->GetComment());
- buildFile->AddAttribute("fileRef", this->CreateObjectReference(fileRef));
-
- return buildFile;
+ if (fileRef) {
+ auto it = this->FileRefToBuildFileMap.find(fileRef);
+ if (it == this->FileRefToBuildFileMap.end()) {
+ cmXCodeObject* buildFile =
+ this->CreateObject(cmXCodeObject::PBXBuildFile);
+ buildFile->SetComment(fileRef->GetComment());
+ buildFile->AddAttribute("fileRef", this->CreateObjectReference(fileRef));
+ this->FileRefToBuildFileMap[fileRef] = buildFile;
+ return buildFile;
+ }
+ return it->second;
+ }
+ return nullptr;
}
class XCodeGeneratorExpressionInterpreter
@@ -918,7 +894,9 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
settings->AddAttributeIfNotEmpty("ATTRIBUTES", attrs);
- buildFile->AddAttributeIfNotEmpty("settings", settings);
+ if (buildFile) {
+ buildFile->AddAttributeIfNotEmpty("settings", settings);
+ }
return buildFile;
}
@@ -935,16 +913,21 @@ void cmGlobalXCodeGenerator::AddXCodeProjBuildRule(
}
}
-bool IsLibraryExtension(const std::string& fileExt)
+namespace {
+
+bool IsLinkPhaseLibraryExtension(const std::string& fileExt)
{
+ // Empty file extension is a special case for paths to framework's
+ // internal binary which could be MyFw.framework/Versions/*/MyFw
return (fileExt == ".framework" || fileExt == ".a" || fileExt == ".o" ||
- fileExt == ".dylib" || fileExt == ".tbd");
+ fileExt == ".dylib" || fileExt == ".tbd" || fileExt.empty());
}
bool IsLibraryType(const std::string& fileType)
{
return (fileType == "wrapper.framework" || fileType == "archive.ar" ||
fileType == "compiled.mach-o.objfile" ||
fileType == "compiled.mach-o.dylib" ||
+ fileType == "compiled.mach-o.executable" ||
fileType == "sourcecode.text-based-dylib-definition");
}
@@ -1020,6 +1003,12 @@ std::string GetSourcecodeValueFromFileExtension(
} else if (ext == "dylib") {
keepLastKnownFileType = true;
sourcecode = "compiled.mach-o.dylib";
+ } else if (ext == "framework") {
+ keepLastKnownFileType = true;
+ sourcecode = "wrapper.framework";
+ } else if (ext == "xcassets") {
+ keepLastKnownFileType = true;
+ sourcecode = "folder.assetcatalog";
}
// else
// {
@@ -1032,6 +1021,47 @@ std::string GetSourcecodeValueFromFileExtension(
return sourcecode;
}
+// If the file has no extension it's either a raw executable or might
+// be a direct reference to a binary within a framework (bad practice!).
+// This is where we change the path to point to the framework directory.
+// .tbd files also can be located in SDK frameworks (they are
+// placeholders for actual libraries shipped with the OS)
+std::string GetLibraryOrFrameworkPath(const std::string& path)
+{
+ auto ext = cmSystemTools::GetFilenameLastExtension(path);
+ if (ext.empty() || ext == ".tbd") {
+ auto name = cmSystemTools::GetFilenameWithoutExtension(path);
+ // Check for iOS framework structure:
+ // FwName.framework/FwName (and also on macOS where FwName lib is a
+ // symlink)
+ auto parentDir = cmSystemTools::GetParentDirectory(path);
+ auto parentName = cmSystemTools::GetFilenameWithoutExtension(parentDir);
+ ext = cmSystemTools::GetFilenameLastExtension(parentDir);
+ if (ext == ".framework" && name == parentName) {
+ return parentDir;
+ }
+ // Check for macOS framework structure:
+ // FwName.framework/Versions/*/FwName
+ std::vector<std::string> components;
+ cmSystemTools::SplitPath(path, components);
+ if (components.size() > 3 &&
+ components[components.size() - 3] == "Versions") {
+ ext = cmSystemTools::GetFilenameLastExtension(
+ components[components.size() - 4]);
+ parentName = cmSystemTools::GetFilenameWithoutExtension(
+ components[components.size() - 4]);
+ if (ext == ".framework" && name == parentName) {
+ components.erase(components.begin() + components.size() - 3,
+ components.end());
+ return cmSystemTools::JoinPath(components);
+ }
+ }
+ }
+ return path;
+}
+
+} // anonymous
+
cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
const std::string& fullpath, cmGeneratorTarget* target,
const std::string& lang, cmSourceFile* sf)
@@ -1054,17 +1084,10 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
ext = ext.substr(1);
}
if (fileType.empty()) {
- // If file has no extension it's either a raw executable or might
- // be a direct reference to binary within a framework (bad practice!)
- // so this is where we change the path to the point to framework
- // directory.
- if (ext.empty()) {
- auto parentDir = cmSystemTools::GetParentDirectory(path);
- auto parentExt = cmSystemTools::GetFilenameLastExtension(parentDir);
- if (parentExt == ".framework") {
- path = parentDir;
- ext = parentExt.substr(1);
- }
+ path = GetLibraryOrFrameworkPath(path);
+ ext = cmSystemTools::GetFilenameLastExtension(path);
+ if (!ext.empty()) {
+ ext = ext.substr(1);
}
// If fullpath references a directory, then we need to specify
// lastKnownFileType as folder in order for Xcode to be able to
@@ -1074,8 +1097,17 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
fileType = GetDirectoryValueFromFileExtension(ext);
useLastKnownFileType = true;
} else {
- fileType = GetSourcecodeValueFromFileExtension(
- ext, lang, useLastKnownFileType, this->EnabledLangs);
+ if (ext.empty() && !sf) {
+ // Special case for executable or library without extension
+ // that is not a source file. We can't tell which without reading
+ // its Mach-O header, but the file might not exist yet, so we
+ // have to pick one here.
+ useLastKnownFileType = true;
+ fileType = "compiled.mach-o.executable";
+ } else {
+ fileType = GetSourcecodeValueFromFileExtension(
+ ext, lang, useLastKnownFileType, this->EnabledLangs);
+ }
}
}
@@ -1106,7 +1138,11 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
group = this->FrameworkGroup;
this->GroupMap[key] = group;
}
- cmXCodeObject* children = group->GetObject("children");
+ if (!group) {
+ cmSystemTools::Error("Could not find a PBX group for " + key);
+ return nullptr;
+ }
+ cmXCodeObject* children = group->GetAttribute("children");
if (!children->HasObject(fileRef)) {
children->AddObject(fileRef);
}
@@ -1174,12 +1210,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
cmLocalGenerator* gen, std::vector<cmXCodeObject*>& targets)
{
this->SetCurrentLocalGenerator(gen);
- std::vector<cmGeneratorTarget*> gts;
- cm::append(gts, this->CurrentLocalGenerator->GetGeneratorTargets());
- std::sort(gts.begin(), gts.end(),
- [this](cmGeneratorTarget const* l, cmGeneratorTarget const* r) {
- return this->TargetOrderIndex[l] < this->TargetOrderIndex[r];
- });
+ std::vector<cmGeneratorTarget*> gts =
+ this->GetLocalGeneratorTargetsInOrder(gen);
for (auto gtgt : gts) {
if (!this->CreateXCodeTarget(gtgt, targets)) {
return false;
@@ -1203,6 +1235,16 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget(
return true;
}
+ auto& gtgt_visited = this->CommandsVisited[gtgt];
+ auto& deps = this->GetTargetDirectDepends(gtgt);
+ for (auto& d : deps) {
+ // Take the union of visited source files of custom commands so far.
+ // ComputeTargetOrder ensures our dependencies already visited their
+ // custom commands and updated CommandsVisited.
+ auto& dep_visited = this->CommandsVisited[d];
+ gtgt_visited.insert(dep_visited.begin(), dep_visited.end());
+ }
+
if (gtgt->GetType() == cmStateEnums::UTILITY ||
gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
gtgt->GetType() == cmStateEnums::GLOBAL_TARGET) {
@@ -1243,10 +1285,11 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget(
for (auto sourceFile : commonSourceFiles) {
cmXCodeObject* xsf = this->CreateXCodeSourceFile(
this->CurrentLocalGenerator, sourceFile, gtgt);
- cmXCodeObject* fr = xsf->GetObject("fileRef");
- cmXCodeObject* filetype = fr->GetObject()->GetObject("explicitFileType");
+ cmXCodeObject* fr = xsf->GetAttribute("fileRef");
+ cmXCodeObject* filetype =
+ fr->GetObject()->GetAttribute("explicitFileType");
if (!filetype) {
- filetype = fr->GetObject()->GetObject("lastKnownFileType");
+ filetype = fr->GetObject()->GetAttribute("lastKnownFileType");
}
cmGeneratorTarget::SourceFileFlags tsFlags =
@@ -1559,8 +1602,9 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(
}
// add all the sources
std::vector<cmCustomCommand> commands;
+ auto& visited = this->CommandsVisited[gtgt];
for (auto sourceFile : classes) {
- if (sourceFile->GetCustomCommand()) {
+ if (sourceFile->GetCustomCommand() && visited.insert(sourceFile).second) {
commands.push_back(*sourceFile->GetCustomCommand());
}
}
@@ -1770,6 +1814,15 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
for (auto const& command : commands) {
cmCustomCommandGenerator ccg(command, configName,
this->CurrentLocalGenerator);
+ std::vector<std::string> realDepends;
+ realDepends.reserve(ccg.GetDepends().size());
+ for (auto const& d : ccg.GetDepends()) {
+ std::string dep;
+ if (this->CurrentLocalGenerator->GetRealDependency(d, configName, dep)) {
+ realDepends.emplace_back(std::move(dep));
+ }
+ }
+
if (ccg.GetNumberOfCommands() > 0) {
makefileStream << "\n";
const std::vector<std::string>& outputs = ccg.GetOutputs();
@@ -1785,12 +1838,8 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
// There are no outputs. Use the generated force rule name.
makefileStream << tname[&ccg.GetCC()] << ": ";
}
- for (auto const& d : ccg.GetDepends()) {
- std::string dep;
- if (this->CurrentLocalGenerator->GetRealDependency(d, configName,
- dep)) {
- makefileStream << "\\\n" << this->ConvertToRelativeForMake(dep);
- }
+ for (auto const& dep : realDepends) {
+ makefileStream << "\\\n" << this->ConvertToRelativeForMake(dep);
}
makefileStream << "\n";
@@ -1819,6 +1868,17 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
ccg.AppendArguments(c, cmd);
makefileStream << "\t" << cmd << "\n";
}
+
+ // Symbolic inputs are not expected to exist, so add dummy rules.
+ for (auto const& dep : realDepends) {
+ if (cmSourceFile* dsf =
+ target->GetLocalGenerator()->GetMakefile()->GetSource(
+ dep, cmSourceFileLocationKind::Known)) {
+ if (dsf->GetPropertyAsBool("SYMBOLIC")) {
+ makefileStream << this->ConvertToRelativeForMake(dep) << ":\n";
+ }
+ }
+ }
}
}
}
@@ -2321,7 +2381,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
if (stdlib.size() > 8) {
const auto cxxLibrary = stdlib.substr(8);
if (language == "CXX" ||
- !buildSettings->GetObject("CLANG_CXX_LIBRARY")) {
+ !buildSettings->GetAttribute("CLANG_CXX_LIBRARY")) {
buildSettings->AddAttribute("CLANG_CXX_LIBRARY",
this->CreateString(cxxLibrary));
}
@@ -2343,7 +2403,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::string flags = cflags[language] + " " + defFlags;
if (language == "CXX" || language == "OBJCXX") {
if (language == "CXX" ||
- !buildSettings->GetObject("OTHER_CPLUSPLUSFLAGS")) {
+ !buildSettings->GetAttribute("OTHER_CPLUSPLUSFLAGS")) {
buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS",
this->CreateString(flags));
}
@@ -2351,7 +2411,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
buildSettings->AddAttribute("IFORT_OTHER_FLAGS",
this->CreateString(flags));
} else if (language == "C" || language == "OBJC") {
- if (language == "C" || !buildSettings->GetObject("OTHER_CFLAGS")) {
+ if (language == "C" || !buildSettings->GetAttribute("OTHER_CFLAGS")) {
buildSettings->AddAttribute("OTHER_CFLAGS", this->CreateString(flags));
}
} else if (language == "Swift") {
@@ -2771,7 +2831,7 @@ void cmGlobalXCodeGenerator::AddDependTarget(cmXCodeObject* target,
targetdep->AddAttribute("targetProxy",
this->CreateObjectReference(container));
- cmXCodeObject* depends = target->GetObject("dependencies");
+ cmXCodeObject* depends = target->GetAttribute("dependencies");
if (!depends) {
cmSystemTools::Error(
"target does not have dependencies attribute error..");
@@ -2783,33 +2843,60 @@ void cmGlobalXCodeGenerator::AddDependTarget(cmXCodeObject* target,
void cmGlobalXCodeGenerator::AppendOrAddBuildSetting(cmXCodeObject* settings,
const char* attribute,
- const char* value)
+ cmXCodeObject* value)
{
if (settings) {
- cmXCodeObject* attr = settings->GetObject(attribute);
+ cmXCodeObject* attr = settings->GetAttribute(attribute);
if (!attr) {
- settings->AddAttribute(attribute, this->CreateString(value));
+ settings->AddAttribute(attribute, value);
} else {
- std::string oldValue = cmStrCat(attr->GetString(), ' ', value);
- attr->SetString(oldValue);
+ if (value->GetType() != cmXCodeObject::OBJECT_LIST &&
+ value->GetType() != cmXCodeObject::STRING) {
+ cmSystemTools::Error("Unsupported value type for appending: " +
+ std::string(attribute));
+ return;
+ }
+ if (attr->GetType() == cmXCodeObject::OBJECT_LIST) {
+ if (value->GetType() == cmXCodeObject::OBJECT_LIST) {
+ for (auto* obj : value->GetObjectList()) {
+ attr->AddObject(obj);
+ }
+ } else {
+ attr->AddObject(value);
+ }
+ } else if (attr->GetType() == cmXCodeObject::STRING) {
+ if (value->GetType() == cmXCodeObject::OBJECT_LIST) {
+ // Add old value as a list item to new object list
+ // and replace the attribute with the new list
+ value->PrependObject(attr);
+ settings->AddAttribute(attribute, value);
+ } else {
+ std::string newValue =
+ cmStrCat(attr->GetString(), ' ', value->GetString());
+ attr->SetString(newValue);
+ }
+ } else {
+ cmSystemTools::Error("Unsupported attribute type for appending: " +
+ std::string(attribute));
+ }
}
}
}
void cmGlobalXCodeGenerator::AppendBuildSettingAttribute(
- cmXCodeObject* target, const char* attribute, const char* value,
+ cmXCodeObject* target, const char* attribute, cmXCodeObject* value,
const std::string& configName)
{
// There are multiple configurations. Add the setting to the
// buildSettings of the configuration name given.
cmXCodeObject* configurationList =
- target->GetObject("buildConfigurationList")->GetObject();
+ target->GetAttribute("buildConfigurationList")->GetObject();
cmXCodeObject* buildConfigs =
- configurationList->GetObject("buildConfigurations");
+ configurationList->GetAttribute("buildConfigurations");
for (auto obj : buildConfigs->GetObjectList()) {
if (configName.empty() ||
- obj->GetObject("name")->GetString() == configName) {
- cmXCodeObject* settings = obj->GetObject("buildSettings");
+ obj->GetAttribute("name")->GetString() == configName) {
+ cmXCodeObject* settings = obj->GetAttribute("buildSettings");
this->AppendOrAddBuildSetting(settings, attribute, value);
}
}
@@ -2835,9 +2922,9 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
// Separate libraries into ones that can be linked using "Link Binary With
// Libraries" build phase and the ones that can't. Only targets that build
- // Apple bundles (.app, .framework, .bundle) can use this feature and only
- // targets that represent actual libraries (static or dynamic, local or
- // imported) not objects and not executables will be used. These are
+ // Apple bundles (.app, .framework, .bundle), executables and dylibs can use
+ // this feature and only targets that represent actual libraries (object,
+ // static, dynamic or bundle, excluding executables) will be used. These are
// limitations imposed by CMake use-cases - otherwise a lot of things break.
// The rest will be linked using linker flags (OTHER_LDFLAGS setting in Xcode
// project).
@@ -2860,55 +2947,92 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
std::pair<std::string, cmComputeLinkInformation::Item const*>;
std::map<std::string, std::vector<ConfigItemPair>> targetItemMap;
std::map<std::string, std::vector<std::string>> targetProductNameMap;
+ bool useLinkPhase = false;
+ bool forceLinkPhase = false;
+ cmProp prop =
+ target->GetTarget()->GetProperty("XCODE_LINK_BUILD_PHASE_MODE");
+ if (prop) {
+ if (*prop == "BUILT_ONLY") {
+ useLinkPhase = true;
+ } else if (*prop == "KNOWN_LOCATION") {
+ useLinkPhase = true;
+ forceLinkPhase = true;
+ } else if (*prop != "NONE") {
+ cmSystemTools::Error("Invalid value for XCODE_LINK_BUILD_PHASE_MODE: " +
+ *prop);
+ return;
+ }
+ }
for (auto const& configName : this->CurrentConfigurationTypes) {
cmComputeLinkInformation* cli = gt->GetLinkInformation(configName);
if (!cli) {
continue;
}
for (auto const& libItem : cli->GetItems()) {
- if (gt->IsBundleOnApple() &&
+ // We want to put only static libraries, dynamic libraries, frameworks
+ // and bundles that are built from targets that are not imported in "Link
+ // Binary With Libraries" build phase. Except if the target property
+ // XCODE_LINK_BUILD_PHASE_MODE is KNOWN_LOCATION then all imported and
+ // non-target libraries will be added as well.
+ if (useLinkPhase &&
(gt->GetType() == cmStateEnums::EXECUTABLE ||
gt->GetType() == cmStateEnums::SHARED_LIBRARY ||
- gt->GetType() == cmStateEnums::MODULE_LIBRARY ||
- gt->GetType() == cmStateEnums::UNKNOWN_LIBRARY) &&
+ gt->GetType() == cmStateEnums::MODULE_LIBRARY) &&
((libItem.Target &&
+ (!libItem.Target->IsImported() || forceLinkPhase) &&
(libItem.Target->GetType() == cmStateEnums::STATIC_LIBRARY ||
libItem.Target->GetType() == cmStateEnums::SHARED_LIBRARY ||
- libItem.Target->GetType() == cmStateEnums::MODULE_LIBRARY)) ||
- (!libItem.Target && libItem.IsPath))) {
- // Add unique configuration name to target-config map for later
- // checks
+ libItem.Target->GetType() == cmStateEnums::MODULE_LIBRARY ||
+ libItem.Target->GetType() == cmStateEnums::UNKNOWN_LIBRARY)) ||
+ (!libItem.Target && libItem.IsPath && forceLinkPhase))) {
std::string libName;
+ bool canUseLinkPhase = true;
if (libItem.Target) {
+ if (libItem.Target->GetType() == cmStateEnums::UNKNOWN_LIBRARY) {
+ canUseLinkPhase = canUseLinkPhase && forceLinkPhase;
+ } else {
+ // If a library target uses custom build output directory Xcode
+ // won't pick it up so we have to resort back to linker flags, but
+ // that's OK as long as the custom output dir is absolute path.
+ for (auto const& libConfigName : this->CurrentConfigurationTypes) {
+ canUseLinkPhase = canUseLinkPhase &&
+ libItem.Target->UsesDefaultOutputDir(
+ libConfigName, cmStateEnums::RuntimeBinaryArtifact);
+ }
+ }
libName = libItem.Target->GetName();
} else {
libName = cmSystemTools::GetFilenameName(libItem.Value.Value);
+ // We don't want all the possible files here, just standard libraries
const auto libExt = cmSystemTools::GetFilenameExtension(libName);
- if (!IsLibraryExtension(libExt)) {
- // Add this library item to a regular linker flag list
- addToLinkerArguments(configName, &libItem);
- continue;
+ if (!IsLinkPhaseLibraryExtension(libExt)) {
+ canUseLinkPhase = false;
}
}
- auto& configVector = targetConfigMap[libName];
- if (std::find(configVector.begin(), configVector.end(), configName) ==
- configVector.end()) {
- configVector.push_back(configName);
- }
- // Add a pair of config and item to target-item map
- auto& itemVector = targetItemMap[libName];
- itemVector.emplace_back(ConfigItemPair(configName, &libItem));
- // Add product file-name to a lib-product map
- auto productName = cmSystemTools::GetFilenameName(libItem.Value.Value);
- auto& productVector = targetProductNameMap[libName];
- if (std::find(productVector.begin(), productVector.end(),
- productName) == productVector.end()) {
- productVector.push_back(productName);
+ if (canUseLinkPhase) {
+ // Add unique configuration name to target-config map for later
+ // checks
+ auto& configVector = targetConfigMap[libName];
+ if (std::find(configVector.begin(), configVector.end(),
+ configName) == configVector.end()) {
+ configVector.push_back(configName);
+ }
+ // Add a pair of config and item to target-item map
+ auto& itemVector = targetItemMap[libName];
+ itemVector.emplace_back(ConfigItemPair(configName, &libItem));
+ // Add product file-name to a lib-product map
+ auto productName =
+ cmSystemTools::GetFilenameName(libItem.Value.Value);
+ auto& productVector = targetProductNameMap[libName];
+ if (std::find(productVector.begin(), productVector.end(),
+ productName) == productVector.end()) {
+ productVector.push_back(productName);
+ }
+ continue;
}
- } else {
- // Add this library item to a regular linker flag list
- addToLinkerArguments(configName, &libItem);
}
+ // Add this library item to a regular linker flag list
+ addToLinkerArguments(configName, &libItem);
}
}
@@ -2938,18 +3062,28 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
// in this build phase so we don't have to do this for each configuration
// separately.
std::vector<std::string> linkSearchPaths;
+ std::vector<std::string> frameworkSearchPaths;
for (auto const& libItem : linkPhaseTargetVector) {
// Add target output directory as a library search path
std::string linkDir;
if (libItem->Target) {
- linkDir = cmSystemTools::GetParentDirectory(
- libItem->Target->GetLocationForBuild());
+ linkDir = libItem->Target->GetLocationForBuild();
} else {
- linkDir = cmSystemTools::GetParentDirectory(libItem->Value.Value);
+ linkDir = libItem->Value.Value;
}
- if (std::find(linkSearchPaths.begin(), linkSearchPaths.end(), linkDir) ==
- linkSearchPaths.end()) {
- linkSearchPaths.push_back(linkDir);
+ linkDir = GetLibraryOrFrameworkPath(linkDir);
+ bool isFramework = cmSystemTools::IsPathToFramework(linkDir);
+ linkDir = cmSystemTools::GetParentDirectory(linkDir);
+ if (isFramework) {
+ if (std::find(frameworkSearchPaths.begin(), frameworkSearchPaths.end(),
+ linkDir) == frameworkSearchPaths.end()) {
+ frameworkSearchPaths.push_back(linkDir);
+ }
+ } else {
+ if (std::find(linkSearchPaths.begin(), linkSearchPaths.end(), linkDir) ==
+ linkSearchPaths.end()) {
+ linkSearchPaths.push_back(linkDir);
+ }
}
// Add target dependency
if (libItem->Target && !libItem->Target->IsImported()) {
@@ -2967,6 +3101,13 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
if (it == this->ExternalLibRefs.end()) {
buildFile = CreateXCodeBuildFileFromPath(libItem->Value.Value, gt,
"", nullptr);
+ if (!buildFile) {
+ // Add this library item back to a regular linker flag list
+ for (const auto& conf : configItemMap) {
+ addToLinkerArguments(conf.first, libItem);
+ }
+ continue;
+ }
this->ExternalLibRefs.emplace(libItem->Value.Value, buildFile);
} else {
buildFile = it->second;
@@ -2981,7 +3122,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
} else {
// Add the target output file as a build reference for other targets
// to link against
- auto* fileRefObject = libTarget->GetObject("productReference");
+ auto* fileRefObject = libTarget->GetAttribute("productReference");
if (!fileRefObject) {
// Add this library item back to a regular linker flag list
for (const auto& conf : configItemMap) {
@@ -2999,20 +3140,23 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
}
}
// Add this reference to current target
- auto* buildPhases = target->GetObject("buildPhases");
+ auto* buildPhases = target->GetAttribute("buildPhases");
if (!buildPhases) {
+ cmSystemTools::Error("Missing buildPhase of target");
continue;
}
auto* frameworkBuildPhase =
buildPhases->GetObject(cmXCodeObject::PBXFrameworksBuildPhase);
if (!frameworkBuildPhase) {
+ cmSystemTools::Error("Missing PBXFrameworksBuildPhase of buildPhase");
continue;
}
- auto* buildFiles = frameworkBuildPhase->GetObject("files");
+ auto* buildFiles = frameworkBuildPhase->GetAttribute("files");
if (!buildFiles) {
+ cmSystemTools::Error("Missing files of PBXFrameworksBuildPhase");
continue;
}
- if (!buildFiles->HasObject(buildFile)) {
+ if (buildFile && !buildFiles->HasObject(buildFile)) {
buildFiles->AddObject(buildFile);
}
}
@@ -3021,20 +3165,18 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
for (auto const& configName : this->CurrentConfigurationTypes) {
{
// Add object library contents as link flags.
- std::string linkObjs;
- const char* sep = "";
+ BuildObjectListOrString libSearchPaths(this, true);
std::vector<cmSourceFile const*> objs;
gt->GetExternalObjects(objs, configName);
for (auto sourceFile : objs) {
if (sourceFile->GetObjectLibrary().empty()) {
continue;
}
- linkObjs += sep;
- sep = " ";
- linkObjs += this->XCodeEscapePath(sourceFile->GetFullPath());
+ libSearchPaths.Add(this->XCodeEscapePath(sourceFile->GetFullPath()));
}
this->AppendBuildSettingAttribute(
- target, this->GetTargetLinkFlagsVar(gt), linkObjs.c_str(), configName);
+ target, this->GetTargetLinkFlagsVar(gt), libSearchPaths.CreateList(),
+ configName);
}
// Skip link information for object libraries.
@@ -3056,49 +3198,70 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
// add the library search paths
{
+ BuildObjectListOrString libSearchPaths(this, true);
std::string linkDirs;
for (auto const& libDir : cli->GetDirectories()) {
if (!libDir.empty() && libDir != "/usr/lib") {
- // Now add the same one but append
- // $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) to it:
- linkDirs += " ";
- linkDirs += this->XCodeEscapePath(
- libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)");
- linkDirs += " ";
- linkDirs += this->XCodeEscapePath(libDir);
+ libSearchPaths.Add(this->XCodeEscapePath(
+ libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"));
+ libSearchPaths.Add(this->XCodeEscapePath(libDir));
}
}
// Add previously collected paths where to look for libraries
// that were added to "Link Binary With Libraries"
- for (auto& linkDir : linkSearchPaths) {
- linkDirs += " ";
- linkDirs += this->XCodeEscapePath(linkDir);
+ for (auto& libDir : linkSearchPaths) {
+ libSearchPaths.Add(this->XCodeEscapePath(libDir));
}
this->AppendBuildSettingAttribute(target, "LIBRARY_SEARCH_PATHS",
- linkDirs.c_str(), configName);
+ libSearchPaths.CreateList(),
+ configName);
+ }
+
+ // add framework search paths
+ {
+ BuildObjectListOrString fwSearchPaths(this, true);
+ // Add previously collected paths where to look for frameworks
+ // that were added to "Link Binary With Libraries"
+ for (auto& fwDir : frameworkSearchPaths) {
+ fwSearchPaths.Add(this->XCodeEscapePath(fwDir));
+ }
+ this->AppendBuildSettingAttribute(target, "FRAMEWORK_SEARCH_PATHS",
+ fwSearchPaths.CreateList(),
+ configName);
}
// now add the left-over link libraries
{
- std::string linkLibs;
- const char* sep = "";
+ BuildObjectListOrString libPaths(this, true);
for (auto const& libItem : configItemMap[configName]) {
auto const& libName = *libItem;
- linkLibs += sep;
- sep = " ";
if (libName.IsPath) {
- linkLibs += this->XCodeEscapePath(libName.Value.Value);
+ libPaths.Add(this->XCodeEscapePath(libName.Value.Value));
+ const auto libPath = GetLibraryOrFrameworkPath(libName.Value.Value);
+ if ((!libName.Target || libName.Target->IsImported()) &&
+ IsLinkPhaseLibraryExtension(libPath)) {
+ // Create file reference for embedding
+ auto it = this->ExternalLibRefs.find(libName.Value.Value);
+ if (it == this->ExternalLibRefs.end()) {
+ auto* buildFile = this->CreateXCodeBuildFileFromPath(
+ libName.Value.Value, gt, "", nullptr);
+ if (buildFile) {
+ this->ExternalLibRefs.emplace(libName.Value.Value, buildFile);
+ }
+ }
+ }
} else if (!libName.Target ||
libName.Target->GetType() !=
cmStateEnums::INTERFACE_LIBRARY) {
- linkLibs += libName.Value.Value;
+ libPaths.Add(libName.Value.Value);
}
if (libName.Target && !libName.Target->IsImported()) {
target->AddDependTarget(configName, libName.Target->GetName());
}
}
- this->AppendBuildSettingAttribute(
- target, this->GetTargetLinkFlagsVar(gt), linkLibs.c_str(), configName);
+ this->AppendBuildSettingAttribute(target,
+ this->GetTargetLinkFlagsVar(gt),
+ libPaths.CreateList(), configName);
}
}
}
@@ -3166,7 +3329,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreatePBXGroup(cmXCodeObject* parent,
{
cmXCodeObject* parentChildren = nullptr;
if (parent) {
- parentChildren = parent->GetObject("children");
+ parentChildren = parent->GetAttribute("children");
}
cmXCodeObject* group = this->CreateObject(cmXCodeObject::PBXGroup);
cmXCodeObject* groupChildren =
@@ -3367,12 +3530,11 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
this->CreateString(defaultConfigName));
cmXCodeObject* buildSettings =
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
- const char* sysroot =
- this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT");
- const char* deploymentTarget =
+ cmProp sysroot = this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT");
+ cmProp deploymentTarget =
this->CurrentMakefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET");
if (sysroot) {
- buildSettings->AddAttribute("SDKROOT", this->CreateString(sysroot));
+ buildSettings->AddAttribute("SDKROOT", this->CreateString(*sysroot));
}
// recompute this as it may have been changed since enable language
this->ComputeArchitectures(this->CurrentMakefile);
@@ -3383,7 +3545,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
// When targeting macOS, use only the host architecture.
if (this->SystemName == "Darwin"_s &&
(!cmNonempty(sysroot) ||
- cmSystemTools::LowerCase(sysroot).find("macos") !=
+ cmSystemTools::LowerCase(*sysroot).find("macos") !=
std::string::npos)) {
buildSettings->AddAttribute("ARCHS",
this->CreateString("$(NATIVE_ARCH_ACTUAL)"));
@@ -3394,7 +3556,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
}
if (cmNonempty(deploymentTarget)) {
buildSettings->AddAttribute(GetDeploymentPlatform(root->GetMakefile()),
- this->CreateString(deploymentTarget));
+ this->CreateString(*deploymentTarget));
}
if (!this->GeneratorToolset.empty()) {
buildSettings->AddAttribute("GCC_VERSION",
@@ -3402,9 +3564,9 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
}
if (this->GetLanguageEnabled("Swift")) {
std::string swiftVersion;
- if (const char* vers = this->CurrentMakefile->GetDefinition(
+ if (cmProp vers = this->CurrentMakefile->GetDefinition(
"CMAKE_Swift_LANGUAGE_VERSION")) {
- swiftVersion = vers;
+ swiftVersion = *vers;
} else if (this->XcodeVersion >= 102) {
swiftVersion = "4.0";
} else if (this->XcodeVersion >= 83) {
@@ -3465,7 +3627,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
cmXCodeObject* allTargets = this->CreateObject(cmXCodeObject::OBJECT_LIST);
for (auto t : targets) {
allTargets->AddObject(t);
- cmXCodeObject* productRef = t->GetObject("productReference");
+ cmXCodeObject* productRef = t->GetAttribute("productReference");
if (productRef) {
productGroupChildren->AddObject(productRef->GetObject());
}
@@ -3487,7 +3649,7 @@ std::string cmGlobalXCodeGenerator::GetObjectsDirectory(
void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf)
{
this->Architectures.clear();
- const char* sysroot = mf->GetDefinition("CMAKE_OSX_SYSROOT");
+ cmProp sysroot = mf->GetDefinition("CMAKE_OSX_SYSROOT");
if (sysroot) {
mf->GetDefExpandList("CMAKE_OSX_ARCHITECTURES", this->Architectures);
}
@@ -3496,8 +3658,8 @@ void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf)
// With no ARCHS we use ONLY_ACTIVE_ARCH and possibly a
// platform-specific default ARCHS placeholder value.
// Look up the arch that Xcode chooses in this case.
- if (const char* arch = mf->GetDefinition("CMAKE_XCODE_ARCHS")) {
- this->ObjectDirArchDefault = arch;
+ if (cmProp arch = mf->GetDefinition("CMAKE_XCODE_ARCHS")) {
+ this->ObjectDirArchDefault = *arch;
// We expect only one arch but choose the first just in case.
std::string::size_type pos = this->ObjectDirArchDefault.find(';');
if (pos != std::string::npos) {
@@ -3863,9 +4025,9 @@ std::string cmGlobalXCodeGenerator::LookupFlags(
{
if (!varNameLang.empty()) {
std::string varName = cmStrCat(varNamePrefix, varNameLang, varNameSuffix);
- if (const char* varValue = this->CurrentMakefile->GetDefinition(varName)) {
- if (*varValue) {
- return varValue;
+ if (cmProp varValue = this->CurrentMakefile->GetDefinition(varName)) {
+ if (!varValue->empty()) {
+ return *varValue;
}
}
}
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 7018de7..c7524e8 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGlobalXCodeGenerator_h
-#define cmGlobalXCodeGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -116,8 +115,6 @@ public:
protected:
void AddExtraIDETargets() override;
- void ComputeTargetOrder();
- void ComputeTargetOrder(cmGeneratorTarget const* gt, size_t& index);
void Generate() override;
private:
@@ -168,9 +165,9 @@ private:
std::string AddConfigurations(cmXCodeObject* target,
cmGeneratorTarget* gtgt);
void AppendOrAddBuildSetting(cmXCodeObject* settings, const char* attr,
- const char* value);
+ cmXCodeObject* value);
void AppendBuildSettingAttribute(cmXCodeObject* target, const char* attr,
- const char* value,
+ cmXCodeObject* value,
const std::string& configName);
cmXCodeObject* CreateUtilityTarget(cmGeneratorTarget* gtgt);
void AddDependAndLinkInformation(cmXCodeObject* target);
@@ -304,8 +301,7 @@ private:
std::string ObjectDirArch;
std::string SystemName;
std::string GeneratorToolset;
- std::map<cmGeneratorTarget const*, size_t> TargetOrderIndex;
std::vector<std::string> EnabledLangs;
+ std::map<cmGeneratorTarget const*, std::set<cmSourceFile const*>>
+ CommandsVisited;
};
-
-#endif
diff --git a/Source/cmGraphAdjacencyList.h b/Source/cmGraphAdjacencyList.h
index 4e1f128..fe9fbe2 100644
--- a/Source/cmGraphAdjacencyList.h
+++ b/Source/cmGraphAdjacencyList.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmGraphAdjacencyList_h
-#define cmGraphAdjacencyList_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -48,5 +47,3 @@ struct cmGraphNodeList : public std::vector<int>
struct cmGraphAdjacencyList : public std::vector<cmGraphEdgeList>
{
};
-
-#endif
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 8a7728e..cf4ba93 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -17,6 +17,7 @@
#include "cmLinkItem.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStateSnapshot.h"
#include "cmStringAlgorithms.h"
@@ -229,9 +230,9 @@ void cmGraphVizWriter::ReadSettings(
#define __set_if_set(var, cmakeDefinition) \
do { \
- const char* value = mf.GetDefinition(cmakeDefinition); \
+ cmProp value = mf.GetDefinition(cmakeDefinition); \
if (value) { \
- (var) = value; \
+ (var) = *value; \
} \
} while (false)
@@ -241,9 +242,9 @@ void cmGraphVizWriter::ReadSettings(
#define __set_bool_if_set(var, cmakeDefinition) \
do { \
- const char* value = mf.GetDefinition(cmakeDefinition); \
+ cmProp value = mf.GetDefinition(cmakeDefinition); \
if (value) { \
- (var) = cmIsOn(value); \
+ (var) = cmIsOn(*value); \
} \
} while (false)
diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h
index d1300ac..0912fc8 100644
--- a/Source/cmGraphVizWriter.h
+++ b/Source/cmGraphVizWriter.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef CMGRAPHVIZWRITER_H
-#define CMGRAPHVIZWRITER_H
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -136,5 +135,3 @@ private:
bool GeneratePerTarget;
bool GenerateDependers;
};
-
-#endif
diff --git a/Source/cmHexFileConverter.h b/Source/cmHexFileConverter.h
index 26f9ea8..35a91ed 100644
--- a/Source/cmHexFileConverter.h
+++ b/Source/cmHexFileConverter.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmHexFileConverter_h
-#define cmHexFileConverter_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -25,5 +24,3 @@ public:
static bool TryConvert(const std::string& inFileName,
const std::string& outFileName);
};
-
-#endif
diff --git a/Source/cmIDEFlagTable.h b/Source/cmIDEFlagTable.h
index ff93432..5901771 100644
--- a/Source/cmIDEFlagTable.h
+++ b/Source/cmIDEFlagTable.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmIDEFlagTable_h
-#define cmIDEFlagTable_h
+#pragma once
#include <string>
@@ -37,5 +36,3 @@ struct cmIDEFlagTable
UserValueRequired = UserValue | UserRequired
};
};
-
-#endif
diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h
index f949ae3..fbe9c37 100644
--- a/Source/cmIDEOptions.h
+++ b/Source/cmIDEOptions.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmIDEOptions_h
-#define cmIDEOptions_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -112,5 +111,3 @@ protected:
std::string const& new_value);
virtual void StoreUnknownFlag(std::string const& flag) = 0;
};
-
-#endif
diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h
index 820ffa4..f056587 100644
--- a/Source/cmIfCommand.h
+++ b/Source/cmIfCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmIfCommand_h
-#define cmIfCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -13,5 +12,3 @@ struct cmListFileArgument;
/// Starts an if block
bool cmIfCommand(std::vector<cmListFileArgument> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h
index b0dd779..af26163 100644
--- a/Source/cmIncludeCommand.h
+++ b/Source/cmIncludeCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmIncludeCommand_h
-#define cmIncludeCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -18,5 +17,3 @@ class cmExecutionStatus;
*/
bool cmIncludeCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h
index 66caff7..d830dbf 100644
--- a/Source/cmIncludeDirectoryCommand.h
+++ b/Source/cmIncludeDirectoryCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmIncludeDirectoryCommand_h
-#define cmIncludeDirectoryCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmIncludeDirectoryCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h
index 1013c44..fd77407 100644
--- a/Source/cmIncludeExternalMSProjectCommand.h
+++ b/Source/cmIncludeExternalMSProjectCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmIncludeExternalMSProjectCommand_h
-#define cmIncludeExternalMSProjectCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmIncludeExternalMSProjectCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmIncludeGuardCommand.cxx b/Source/cmIncludeGuardCommand.cxx
index ccb4496..aefd098 100644
--- a/Source/cmIncludeGuardCommand.cxx
+++ b/Source/cmIncludeGuardCommand.cxx
@@ -75,7 +75,7 @@ bool cmIncludeGuardCommand(std::vector<std::string> const& args,
}
std::string includeGuardVar = GetIncludeGuardVariableName(
- status.GetMakefile().GetDefinition("CMAKE_CURRENT_LIST_FILE"));
+ *status.GetMakefile().GetDefinition("CMAKE_CURRENT_LIST_FILE"));
cmMakefile* const mf = &status.GetMakefile();
diff --git a/Source/cmIncludeGuardCommand.h b/Source/cmIncludeGuardCommand.h
index b86b760..c4de3d4 100644
--- a/Source/cmIncludeGuardCommand.h
+++ b/Source/cmIncludeGuardCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmIncludeGuardCommand_h
-#define cmIncludeGuardCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -18,5 +17,3 @@ class cmExecutionStatus;
*/
bool cmIncludeGuardCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h
index ca152b0..a402f97 100644
--- a/Source/cmIncludeRegularExpressionCommand.h
+++ b/Source/cmIncludeRegularExpressionCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmIncludeRegularExpressionCommand_h
-#define cmIncludeRegularExpressionCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmIncludeRegularExpressionCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h
index 32f00ce..f0ba44e 100644
--- a/Source/cmInstallCommand.h
+++ b/Source/cmInstallCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmInstallCommand_h
-#define cmInstallCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmInstallCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h
index 5d2ee0a..f318a1a 100644
--- a/Source/cmInstallCommandArguments.h
+++ b/Source/cmInstallCommandArguments.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmInstallCommandArguments_h
-#define cmInstallCommandArguments_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -72,5 +71,3 @@ public:
private:
std::vector<std::string> IncludeDirs;
};
-
-#endif
diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h
index bec89df..af310f3 100644
--- a/Source/cmInstallDirectoryGenerator.h
+++ b/Source/cmInstallDirectoryGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmInstallDirectoryGenerator_h
-#define cmInstallDirectoryGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -48,5 +47,3 @@ protected:
std::string const LiteralArguments;
bool const Optional;
};
-
-#endif
diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h
index 43dd00d..dd8624b 100644
--- a/Source/cmInstallExportGenerator.h
+++ b/Source/cmInstallExportGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmInstallExportGenerator_h
-#define cmInstallExportGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -68,5 +67,3 @@ protected:
std::string MainImportFile;
std::unique_ptr<cmExportInstallFileGenerator> EFGen;
};
-
-#endif
diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h
index f4ebbde..219bb97 100644
--- a/Source/cmInstallFilesCommand.h
+++ b/Source/cmInstallFilesCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmInstallFilesCommand_h
-#define cmInstallFilesCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmInstallFilesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h
index 8266603..b5a1ef4 100644
--- a/Source/cmInstallFilesGenerator.h
+++ b/Source/cmInstallFilesGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmInstallFilesGenerator_h
-#define cmInstallFilesGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -48,5 +47,3 @@ protected:
bool const Programs;
bool const Optional;
};
-
-#endif
diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h
index d786d24..ee55ee9 100644
--- a/Source/cmInstallGenerator.h
+++ b/Source/cmInstallGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmInstallGenerator_h
-#define cmInstallGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -74,5 +73,3 @@ protected:
MessageLevel const Message;
bool const ExcludeFromAll;
};
-
-#endif
diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h
index c567f3b..e3c3e81 100644
--- a/Source/cmInstallProgramsCommand.h
+++ b/Source/cmInstallProgramsCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmInstallProgramsCommand_h
-#define cmInstallProgramsCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmInstallProgramsCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h
index 0a9c4ba..338d866 100644
--- a/Source/cmInstallScriptGenerator.h
+++ b/Source/cmInstallScriptGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmInstallScriptGenerator_h
-#define cmInstallScriptGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -38,5 +37,3 @@ protected:
cmLocalGenerator* LocalGenerator;
bool AllowGenex;
};
-
-#endif
diff --git a/Source/cmInstallSubdirectoryGenerator.h b/Source/cmInstallSubdirectoryGenerator.h
index f9cd0f1..3e46d6b 100644
--- a/Source/cmInstallSubdirectoryGenerator.h
+++ b/Source/cmInstallSubdirectoryGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmInstallSubdirectoryGenerator_h
-#define cmInstallSubdirectoryGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -37,5 +36,3 @@ protected:
std::string const BinaryDirectory;
cmLocalGenerator* LocalGenerator;
};
-
-#endif
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 178d5df..b3da202 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -820,7 +820,7 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os, Indent indent,
os << indent << "if(CMAKE_INSTALL_DO_STRIP)\n";
os << indent << " execute_process(COMMAND \""
- << this->Target->Target->GetMakefile()->GetDefinition("CMAKE_STRIP")
+ << this->Target->Target->GetMakefile()->GetSafeDefinition("CMAKE_STRIP")
<< "\" " << stripArgs << "\"" << toDestDirPath << "\")\n";
os << indent << "endif()\n";
}
@@ -858,9 +858,9 @@ void cmInstallTargetGenerator::AddUniversalInstallRule(
return;
}
- const char* xcodeVersion = mf->GetDefinition("XCODE_VERSION");
+ cmProp xcodeVersion = mf->GetDefinition("XCODE_VERSION");
if (!xcodeVersion ||
- cmSystemTools::VersionCompareGreater("6", xcodeVersion)) {
+ cmSystemTools::VersionCompareGreater("6", *xcodeVersion)) {
return;
}
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index e21001f..a53a75a 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/Source/cmInstallTargetGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmInstallTargetGenerator_h
-#define cmInstallTargetGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -114,5 +113,3 @@ protected:
bool const Optional;
cmListFileBacktrace const Backtrace;
};
-
-#endif
diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h
index 0c5850c..716e7ce 100644
--- a/Source/cmInstallTargetsCommand.h
+++ b/Source/cmInstallTargetsCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmInstallTargetsCommand_h
-#define cmInstallTargetsCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmInstallTargetsCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmInstallType.h b/Source/cmInstallType.h
index e2602cb..33fa7a9 100644
--- a/Source/cmInstallType.h
+++ b/Source/cmInstallType.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmInstallType_h
-#define cmInstallType_h
+#pragma once
/**
* Enumerate types known to file(INSTALL).
@@ -16,5 +15,3 @@ enum cmInstallType
cmInstallType_PROGRAMS,
cmInstallType_DIRECTORY
};
-
-#endif
diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h
index 07f7081..82474f5 100644
--- a/Source/cmInstalledFile.h
+++ b/Source/cmInstalledFile.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmInstalledFile_h
-#define cmInstalledFile_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -76,5 +75,3 @@ private:
CompiledGeneratorExpressionPtrType NameExpression;
PropertyMapType Properties;
};
-
-#endif
diff --git a/Source/cmJSONHelpers.h b/Source/cmJSONHelpers.h
new file mode 100644
index 0000000..2da2a03
--- /dev/null
+++ b/Source/cmJSONHelpers.h
@@ -0,0 +1,304 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#pragma once
+
+#include <algorithm>
+#include <cstddef>
+#include <functional>
+#include <map>
+#include <string>
+#include <vector>
+
+#include <cm/optional>
+#include <cm/string_view>
+
+#include <cm3p/json/value.h>
+
+template <typename T, typename E>
+using cmJSONHelper = std::function<E(T& out, const Json::Value* value)>;
+
+template <typename T, typename E>
+class cmJSONObjectHelper
+{
+public:
+ cmJSONObjectHelper(E&& success, E&& fail, bool allowExtra = true);
+
+ template <typename U, typename M, typename F>
+ cmJSONObjectHelper& Bind(const cm::string_view& name, M U::*member, F func,
+ bool required = true);
+ template <typename M, typename F>
+ cmJSONObjectHelper& Bind(const cm::string_view& name, std::nullptr_t, F func,
+ bool required = true);
+
+ E operator()(T& out, const Json::Value* value) const;
+
+private:
+ // Not a true cmJSONHelper, it just happens to match the signature
+ using MemberFunction = std::function<E(T& out, const Json::Value* value)>;
+ struct Member
+ {
+ cm::string_view Name;
+ MemberFunction Function;
+ bool Required;
+ };
+ std::vector<Member> Members;
+ bool AnyRequired = false;
+ E Success;
+ E Fail;
+ bool AllowExtra;
+
+ cmJSONObjectHelper& BindPrivate(const cm::string_view& name,
+ MemberFunction&& func, bool required);
+};
+
+template <typename T, typename E>
+cmJSONObjectHelper<T, E>::cmJSONObjectHelper(E&& success, E&& fail,
+ bool allowExtra)
+ : Success(std::move(success))
+ , Fail(std::move(fail))
+ , AllowExtra(allowExtra)
+{
+}
+
+template <typename T, typename E>
+template <typename U, typename M, typename F>
+cmJSONObjectHelper<T, E>& cmJSONObjectHelper<T, E>::Bind(
+ const cm::string_view& name, M U::*member, F func, bool required)
+{
+ return this->BindPrivate(
+ name,
+ [func, member](T& out, const Json::Value* value) -> E {
+ return func(out.*member, value);
+ },
+ required);
+}
+
+template <typename T, typename E>
+template <typename M, typename F>
+cmJSONObjectHelper<T, E>& cmJSONObjectHelper<T, E>::Bind(
+ const cm::string_view& name, std::nullptr_t, F func, bool required)
+{
+ return this->BindPrivate(name,
+ [func](T& /*out*/, const Json::Value* value) -> E {
+ M dummy;
+ return func(dummy, value);
+ },
+ required);
+}
+
+template <typename T, typename E>
+cmJSONObjectHelper<T, E>& cmJSONObjectHelper<T, E>::BindPrivate(
+ const cm::string_view& name, MemberFunction&& func, bool required)
+{
+ Member m;
+ m.Name = name;
+ m.Function = std::move(func);
+ m.Required = required;
+ this->Members.push_back(std::move(m));
+ if (required) {
+ this->AnyRequired = true;
+ }
+ return *this;
+}
+
+template <typename T, typename E>
+E cmJSONObjectHelper<T, E>::operator()(T& out, const Json::Value* value) const
+{
+ if (!value && this->AnyRequired) {
+ return this->Fail;
+ }
+ if (value && !value->isObject()) {
+ return this->Fail;
+ }
+ Json::Value::Members extraFields;
+ if (value) {
+ extraFields = value->getMemberNames();
+ }
+
+ for (auto const& m : this->Members) {
+ std::string name(m.Name.data(), m.Name.size());
+ if (value && value->isMember(name)) {
+ E result = m.Function(out, &(*value)[name]);
+ if (result != this->Success) {
+ return result;
+ }
+ extraFields.erase(
+ std::find(extraFields.begin(), extraFields.end(), name));
+ } else if (!m.Required) {
+ E result = m.Function(out, nullptr);
+ if (result != this->Success) {
+ return result;
+ }
+ } else {
+ return this->Fail;
+ }
+ }
+
+ return this->AllowExtra || extraFields.empty() ? this->Success : this->Fail;
+}
+
+template <typename E>
+cmJSONHelper<std::string, E> cmJSONStringHelper(E success, E fail,
+ const std::string& defval = "")
+{
+ return
+ [success, fail, defval](std::string& out, const Json::Value* value) -> E {
+ if (!value) {
+ out = defval;
+ return success;
+ }
+ if (!value->isString()) {
+ return fail;
+ }
+ out = value->asString();
+ return success;
+ };
+}
+
+template <typename E>
+cmJSONHelper<int, E> cmJSONIntHelper(E success, E fail, int defval = 0)
+{
+ return [success, fail, defval](int& out, const Json::Value* value) -> E {
+ if (!value) {
+ out = defval;
+ return success;
+ }
+ if (!value->isInt()) {
+ return fail;
+ }
+ out = value->asInt();
+ return success;
+ };
+}
+
+template <typename E>
+cmJSONHelper<unsigned int, E> cmJSONUIntHelper(E success, E fail,
+ unsigned int defval = 0)
+{
+ return
+ [success, fail, defval](unsigned int& out, const Json::Value* value) -> E {
+ if (!value) {
+ out = defval;
+ return success;
+ }
+ if (!value->isUInt()) {
+ return fail;
+ }
+ out = value->asUInt();
+ return success;
+ };
+}
+
+template <typename E>
+cmJSONHelper<bool, E> cmJSONBoolHelper(E success, E fail, bool defval = false)
+{
+ return [success, fail, defval](bool& out, const Json::Value* value) -> E {
+ if (!value) {
+ out = defval;
+ return success;
+ }
+ if (!value->isBool()) {
+ return fail;
+ }
+ out = value->asBool();
+ return success;
+ };
+}
+
+template <typename T, typename E, typename F, typename Filter>
+cmJSONHelper<std::vector<T>, E> cmJSONVectorFilterHelper(E success, E fail,
+ F func, Filter filter)
+{
+ return [success, fail, func, filter](std::vector<T>& out,
+ const Json::Value* value) -> E {
+ if (!value) {
+ out.clear();
+ return success;
+ }
+ if (!value->isArray()) {
+ return fail;
+ }
+ out.clear();
+ for (auto const& item : *value) {
+ T t;
+ E result = func(t, &item);
+ if (result != success) {
+ return result;
+ }
+ if (!filter(t)) {
+ continue;
+ }
+ out.push_back(t);
+ }
+ return success;
+ };
+}
+
+template <typename T, typename E, typename F>
+cmJSONHelper<std::vector<T>, E> cmJSONVectorHelper(E success, E fail, F func)
+{
+ return cmJSONVectorFilterHelper<T, E, F>(success, fail, func,
+ [](const T&) { return true; });
+}
+
+template <typename T, typename E, typename F, typename Filter>
+cmJSONHelper<std::map<std::string, T>, E> cmJSONMapFilterHelper(E success,
+ E fail, F func,
+ Filter filter)
+{
+ return [success, fail, func, filter](std::map<std::string, T>& out,
+ const Json::Value* value) -> E {
+ if (!value) {
+ out.clear();
+ return success;
+ }
+ if (!value->isObject()) {
+ return fail;
+ }
+ out.clear();
+ for (auto const& key : value->getMemberNames()) {
+ if (!filter(key)) {
+ continue;
+ }
+ T t;
+ E result = func(t, &(*value)[key]);
+ if (result != success) {
+ return result;
+ }
+ out[key] = std::move(t);
+ }
+ return success;
+ };
+}
+
+template <typename T, typename E, typename F>
+cmJSONHelper<std::map<std::string, T>, E> cmJSONMapHelper(E success, E fail,
+ F func)
+{
+ return cmJSONMapFilterHelper<T, E, F>(
+ success, fail, func, [](const std::string&) { return true; });
+}
+
+template <typename T, typename E, typename F>
+cmJSONHelper<cm::optional<T>, E> cmJSONOptionalHelper(E success, F func)
+{
+ return [success, func](cm::optional<T>& out, const Json::Value* value) -> E {
+ if (!value) {
+ out.reset();
+ return success;
+ }
+ out.emplace();
+ return func(*out, value);
+ };
+}
+
+template <typename T, typename E, typename F>
+cmJSONHelper<T, E> cmJSONRequiredHelper(E fail, F func)
+{
+ return [fail, func](T& out, const Json::Value* value) -> E {
+ if (!value) {
+ return fail;
+ }
+ return func(out, value);
+ };
+}
diff --git a/Source/cmJsonObjects.cxx b/Source/cmJsonObjects.cxx
index 3a2e3be..3a7ae0c 100644
--- a/Source/cmJsonObjects.cxx
+++ b/Source/cmJsonObjects.cxx
@@ -631,8 +631,8 @@ static Json::Value DumpProjectList(const cmake* cm, std::string const& config)
// Project structure information:
const cmMakefile* mf = lg->GetMakefile();
- auto minVersion = mf->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
- pObj[kMINIMUM_CMAKE_VERSION] = minVersion ? minVersion : "";
+ auto minVersion = mf->GetSafeDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
+ pObj[kMINIMUM_CMAKE_VERSION] = minVersion;
pObj[kSOURCE_DIRECTORY_KEY] = mf->GetCurrentSourceDirectory();
pObj[kBUILD_DIRECTORY_KEY] = mf->GetCurrentBinaryDirectory();
pObj[kTARGETS_KEY] = DumpTargetsList(projectIt.second, config);
diff --git a/Source/cmJsonObjects.h b/Source/cmJsonObjects.h
index 2fd4b26..80a4834 100644
--- a/Source/cmJsonObjects.h
+++ b/Source/cmJsonObjects.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmJsonObjects_h
-#define cmJsonObjects_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -23,5 +22,3 @@ extern void cmGetCMakeInputs(const cmGlobalGenerator* gg,
extern Json::Value cmDumpCodeModel(const cmake* cm);
extern Json::Value cmDumpCTestInfo(const cmake* cm);
extern Json::Value cmDumpCMakeInputs(const cmake* cm);
-
-#endif
diff --git a/Source/cmLDConfigLDConfigTool.h b/Source/cmLDConfigLDConfigTool.h
index 34bf6c6..eeb86dd 100644
--- a/Source/cmLDConfigLDConfigTool.h
+++ b/Source/cmLDConfigLDConfigTool.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLDConfigLDConfigTool_h
-#define cmLDConfigLDConfigTool_h
+#pragma once
#include <string>
#include <vector>
@@ -18,5 +17,3 @@ public:
bool GetLDConfigPaths(std::vector<std::string>& paths) override;
};
-
-#endif
diff --git a/Source/cmLDConfigTool.h b/Source/cmLDConfigTool.h
index c816562..3116f80 100644
--- a/Source/cmLDConfigTool.h
+++ b/Source/cmLDConfigTool.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLDConfigTool_h
-#define cmLDConfigTool_h
+#pragma once
#include <string>
#include <vector>
@@ -20,5 +19,3 @@ public:
protected:
cmRuntimeDependencyArchive* Archive;
};
-
-#endif
diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h
index a7caa5c..2a3499d 100644
--- a/Source/cmLinkDirectoriesCommand.h
+++ b/Source/cmLinkDirectoriesCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLinkDirectoriesCommand_h
-#define cmLinkDirectoriesCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmLinkDirectoriesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h
index 3d92935..5a90e7e 100644
--- a/Source/cmLinkItem.h
+++ b/Source/cmLinkItem.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLinkItem_h
-#define cmLinkItem_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -140,5 +139,3 @@ inline cmTargetLinkLibraryType CMP0003_ComputeLinkType(
// The current configuration is not a debug configuration.
return OPTIMIZED_LibraryType;
}
-
-#endif
diff --git a/Source/cmLinkItemGraphVisitor.h b/Source/cmLinkItemGraphVisitor.h
index 21dc659..0d6676a 100644
--- a/Source/cmLinkItemGraphVisitor.h
+++ b/Source/cmLinkItemGraphVisitor.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLinkItemGraphVisitor_h
-#define cmLinkItemGraphVisitor_h
+#pragma once
#include <map>
#include <set>
@@ -71,5 +70,3 @@ private:
std::string const& config,
DependencyMap& dependencies);
};
-
-#endif
diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h
index 3412251..27c410f 100644
--- a/Source/cmLinkLibrariesCommand.h
+++ b/Source/cmLinkLibrariesCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLinkLibrariesCommand_h
-#define cmLinkLibrariesCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmLinkLibrariesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h
index df42468..a1dafc4 100644
--- a/Source/cmLinkLineComputer.h
+++ b/Source/cmLinkLineComputer.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLinkLineComputer_h
-#define cmLinkLineComputer_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -73,5 +72,3 @@ protected:
bool UseNinjaMulti;
bool Relink;
};
-
-#endif
diff --git a/Source/cmLinkLineDeviceComputer.h b/Source/cmLinkLineDeviceComputer.h
index a9b01cd..dee625b 100644
--- a/Source/cmLinkLineDeviceComputer.h
+++ b/Source/cmLinkLineDeviceComputer.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLinkLineDeviceComputer_h
-#define cmLinkLineDeviceComputer_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -42,5 +41,3 @@ public:
bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg,
const std::string& config);
-
-#endif
diff --git a/Source/cmLinkedTree.h b/Source/cmLinkedTree.h
index c7453ea..d70176d 100644
--- a/Source/cmLinkedTree.h
+++ b/Source/cmLinkedTree.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLinkedTree_h
-#define cmLinkedTree_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -188,5 +187,3 @@ private:
std::vector<T> Data;
std::vector<PositionType> UpPositions;
};
-
-#endif
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index edec613..a2c14bd 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -27,6 +27,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
#include "cmRange.h"
#include "cmStringAlgorithms.h"
#include "cmStringReplaceHelper.h"
@@ -44,11 +45,11 @@ bool GetListString(std::string& listString, const std::string& var,
const cmMakefile& makefile)
{
// get the old value
- const char* cacheValue = makefile.GetDefinition(var);
+ cmProp cacheValue = makefile.GetDefinition(var);
if (!cacheValue) {
return false;
}
- listString = cacheValue;
+ listString = *cacheValue;
return true;
}
diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h
index 274d9fd..6efab16 100644
--- a/Source/cmListCommand.h
+++ b/Source/cmListCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmListCommand_h
-#define cmListCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -16,5 +15,3 @@ class cmExecutionStatus;
*/
bool cmListCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index 0b4414d..c9556ab 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmListFileCache_h
-#define cmListFileCache_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -215,5 +214,3 @@ struct cmListFile
std::vector<cmListFileFunction> Functions;
};
-
-#endif
diff --git a/Source/cmListFileLexer.h b/Source/cmListFileLexer.h
index ec6b3cd..3c89f63 100644
--- a/Source/cmListFileLexer.h
+++ b/Source/cmListFileLexer.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmListFileLexer_h
-#define cmListFileLexer_h
+#pragma once
#ifdef __cplusplus
extern "C" {
@@ -67,5 +66,3 @@ void cmListFileLexer_Delete(cmListFileLexer*);
#ifdef __cplusplus
} /* extern "C" */
#endif
-
-#endif
diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h
index 7cee663..5f5b705 100644
--- a/Source/cmLoadCacheCommand.h
+++ b/Source/cmLoadCacheCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLoadCacheCommand_h
-#define cmLoadCacheCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmLoadCacheCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h
index f5fd754..d30ba16 100644
--- a/Source/cmLoadCommandCommand.h
+++ b/Source/cmLoadCommandCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLoadCommandCommand_h
-#define cmLoadCommandCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmLoadCommandCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx
index 44db842..5daaeff 100644
--- a/Source/cmLocalCommonGenerator.cxx
+++ b/Source/cmLocalCommonGenerator.cxx
@@ -8,6 +8,7 @@
#include "cmGeneratorTarget.h"
#include "cmMakefile.h"
#include "cmOutputConverter.h"
+#include "cmProperty.h"
#include "cmStringAlgorithms.h"
class cmGlobalGenerator;
@@ -62,13 +63,13 @@ std::string cmLocalCommonGenerator::GetTargetFortranFlags(
// If there is a separate module path flag then duplicate the
// include path with it. This compiler does not search the include
// path for modules.
- if (const char* modpath_flag =
+ if (cmProp modpath_flag =
this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) {
std::vector<std::string> includes;
this->GetIncludeDirectories(includes, target, "C", config);
for (std::string const& id : includes) {
std::string flg =
- cmStrCat(modpath_flag,
+ cmStrCat(*modpath_flag,
this->ConvertToOutputFormat(id, cmOutputConverter::SHELL));
this->AppendFlags(flags, flg);
}
diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h
index 378ca63..f1eaf61 100644
--- a/Source/cmLocalCommonGenerator.h
+++ b/Source/cmLocalCommonGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLocalCommonGenerator_h
-#define cmLocalCommonGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -47,5 +46,3 @@ protected:
friend class cmCommonTargetGenerator;
};
-
-#endif
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 40010fc..47931b0 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -116,22 +116,22 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile)
std::vector<std::string> enabledLanguages =
this->GetState()->GetEnabledLanguages();
- if (const char* sysrootCompile =
+ if (cmProp sysrootCompile =
this->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE")) {
- this->CompilerSysroot = sysrootCompile;
+ this->CompilerSysroot = *sysrootCompile;
} else {
this->CompilerSysroot = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
}
- if (const char* sysrootLink =
+ if (cmProp sysrootLink =
this->Makefile->GetDefinition("CMAKE_SYSROOT_LINK")) {
- this->LinkerSysroot = sysrootLink;
+ this->LinkerSysroot = *sysrootLink;
} else {
this->LinkerSysroot = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
}
if (cmProp appleArchSysroots =
- this->Makefile->GetDef("CMAKE_APPLE_ARCH_SYSROOTS")) {
+ this->Makefile->GetDefinition("CMAKE_APPLE_ARCH_SYSROOTS")) {
std::string const& appleArchs =
this->Makefile->GetSafeDefinition("CMAKE_OSX_ARCHITECTURES");
std::vector<std::string> archs;
@@ -220,10 +220,10 @@ void cmLocalGenerator::ComputeObjectMaxPath()
#else
this->ObjectPathMax = 1000;
#endif
- const char* plen = this->Makefile->GetDefinition("CMAKE_OBJECT_PATH_MAX");
+ cmProp plen = this->Makefile->GetDefinition("CMAKE_OBJECT_PATH_MAX");
if (cmNonempty(plen)) {
unsigned int pmax;
- if (sscanf(plen, "%u", &pmax) == 1) {
+ if (sscanf(plen->c_str(), "%u", &pmax) == 1) {
if (pmax >= 128) {
this->ObjectPathMax = pmax;
} else {
@@ -235,7 +235,7 @@ void cmLocalGenerator::ComputeObjectMaxPath()
}
} else {
std::ostringstream w;
- w << "CMAKE_OBJECT_PATH_MAX is set to \"" << plen
+ w << "CMAKE_OBJECT_PATH_MAX is set to \"" << *plen
<< "\", which fails to parse as a positive integer. "
<< "The value will be ignored.";
this->IssueMessage(MessageType::AUTHOR_WARNING, w.str());
@@ -358,7 +358,7 @@ void cmLocalGenerator::GenerateTestFiles()
}
// Add directory labels property
- const char* directoryLabels =
+ cmProp directoryLabels =
this->Makefile->GetDefinition("CMAKE_DIRECTORY_LABELS");
cmProp labels = this->Makefile->GetProperty("LABELS");
@@ -371,7 +371,7 @@ void cmLocalGenerator::GenerateTestFiles()
fout << ";";
}
if (directoryLabels) {
- fout << cmOutputConverter::EscapeForCMake(directoryLabels);
+ fout << cmOutputConverter::EscapeForCMake(*directoryLabels);
}
fout << ")\n";
}
@@ -425,7 +425,8 @@ void cmLocalGenerator::ProcessEvaluationFiles(
void cmLocalGenerator::GenerateInstallRules()
{
// Compute the install prefix.
- const char* prefix = this->Makefile->GetDefinition("CMAKE_INSTALL_PREFIX");
+ const char* prefix =
+ cmToCStr(this->Makefile->GetDefinition("CMAKE_INSTALL_PREFIX"));
#if defined(_WIN32) && !defined(__CYGWIN__)
std::string prefix_win32;
@@ -433,10 +434,10 @@ void cmLocalGenerator::GenerateInstallRules()
if (!cmSystemTools::GetEnv("SystemDrive", prefix_win32)) {
prefix_win32 = "C:";
}
- const char* project_name = this->Makefile->GetDefinition("PROJECT_NAME");
+ cmProp project_name = this->Makefile->GetDefinition("PROJECT_NAME");
if (cmNonempty(project_name)) {
prefix_win32 += "/Program Files/";
- prefix_win32 += project_name;
+ prefix_win32 += *project_name;
} else {
prefix_win32 += "/InstalledCMakeProject";
}
@@ -457,9 +458,9 @@ void cmLocalGenerator::GenerateInstallRules()
prefix = "/usr/local";
}
#endif
- if (const char* stagingPrefix =
+ if (cmProp stagingPrefix =
this->Makefile->GetDefinition("CMAKE_STAGING_PREFIX")) {
- prefix = stagingPrefix;
+ prefix = stagingPrefix->c_str();
}
// Compute the set of configurations.
@@ -539,40 +540,40 @@ void cmLocalGenerator::GenerateInstallRules()
/* clang-format on */
// Copy user-specified install options to the install code.
- if (const char* so_no_exe =
+ if (cmProp so_no_exe =
this->Makefile->GetDefinition("CMAKE_INSTALL_SO_NO_EXE")) {
/* clang-format off */
fout <<
"# Install shared libraries without execute permission?\n"
"if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n"
- " set(CMAKE_INSTALL_SO_NO_EXE \"" << so_no_exe << "\")\n"
+ " set(CMAKE_INSTALL_SO_NO_EXE \"" << *so_no_exe << "\")\n"
"endif()\n"
"\n";
/* clang-format on */
}
// Copy cmake cross compile state to install code.
- if (const char* crosscompiling =
+ if (cmProp crosscompiling =
this->Makefile->GetDefinition("CMAKE_CROSSCOMPILING")) {
/* clang-format off */
fout <<
"# Is this installation the result of a crosscompile?\n"
"if(NOT DEFINED CMAKE_CROSSCOMPILING)\n"
- " set(CMAKE_CROSSCOMPILING \"" << crosscompiling << "\")\n"
+ " set(CMAKE_CROSSCOMPILING \"" << *crosscompiling << "\")\n"
"endif()\n"
"\n";
/* clang-format on */
}
// Write default directory permissions.
- if (const char* defaultDirPermissions = this->Makefile->GetDefinition(
+ if (cmProp defaultDirPermissions = this->Makefile->GetDefinition(
"CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS")) {
/* clang-format off */
fout <<
"# Set default install directory permissions.\n"
"if(NOT DEFINED CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS)\n"
" set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS \""
- << defaultDirPermissions << "\")\n"
+ << *defaultDirPermissions << "\")\n"
"endif()\n"
"\n";
/* clang-format on */
@@ -581,14 +582,14 @@ void cmLocalGenerator::GenerateInstallRules()
// Write out CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM so that
// installed code that uses `file(GET_RUNTIME_DEPENDENCIES)`
// has same platform variable as when running cmake
- if (const char* platform = this->Makefile->GetDefinition(
+ if (cmProp platform = this->Makefile->GetDefinition(
"CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM")) {
/* clang-format off */
fout <<
"# Set default install directory permissions.\n"
"if(NOT DEFINED CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM)\n"
" set(CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM \""
- << platform << "\")\n"
+ << *platform << "\")\n"
"endif()\n"
"\n";
/* clang-format on */
@@ -597,14 +598,14 @@ void cmLocalGenerator::GenerateInstallRules()
// Write out CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL so that
// installed code that uses `file(GET_RUNTIME_DEPENDENCIES)`
// has same tool selected as when running cmake
- if (const char* command =
+ if (cmProp command =
this->Makefile->GetDefinition("CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL")) {
/* clang-format off */
fout <<
"# Set default install directory permissions.\n"
"if(NOT DEFINED CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL)\n"
" set(CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL \""
- << command << "\")\n"
+ << *command << "\")\n"
"endif()\n"
"\n";
/* clang-format on */
@@ -613,14 +614,14 @@ void cmLocalGenerator::GenerateInstallRules()
// Write out CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND so that
// installed code that uses `file(GET_RUNTIME_DEPENDENCIES)`
// has same path to the tool as when running cmake
- if (const char* command = this->Makefile->GetDefinition(
+ if (cmProp command = this->Makefile->GetDefinition(
"CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND")) {
/* clang-format off */
fout <<
"# Set default install directory permissions.\n"
"if(NOT DEFINED CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND)\n"
" set(CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND \""
- << command << "\")\n"
+ << *command << "\")\n"
"endif()\n"
"\n";
/* clang-format on */
@@ -631,13 +632,13 @@ void cmLocalGenerator::GenerateInstallRules()
// CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND has consistent
// logic to fallback to CMAKE_OBJDUMP when `objdump` is
// not on the path
- if (const char* command = this->Makefile->GetDefinition("CMAKE_OBJDUMP")) {
+ if (cmProp command = this->Makefile->GetDefinition("CMAKE_OBJDUMP")) {
/* clang-format off */
fout <<
"# Set default install directory permissions.\n"
"if(NOT DEFINED CMAKE_OBJDUMP)\n"
" set(CMAKE_OBJDUMP \""
- << command << "\")\n"
+ << *command << "\")\n"
"endif()\n"
"\n";
/* clang-format on */
@@ -858,8 +859,8 @@ std::string cmLocalGenerator::GetIncludeFlags(
std::string const& includeFlag =
this->Makefile->GetSafeDefinition(cmStrCat("CMAKE_INCLUDE_FLAG_", lang));
- const char* sep =
- this->Makefile->GetDefinition(cmStrCat("CMAKE_INCLUDE_FLAG_SEP_", lang));
+ const char* sep = cmToCStr(
+ this->Makefile->GetDefinition(cmStrCat("CMAKE_INCLUDE_FLAG_SEP_", lang)));
bool quotePaths = false;
if (this->Makefile->GetDefinition("CMAKE_QUOTE_INCLUDE_PATHS")) {
quotePaths = true;
@@ -876,15 +877,15 @@ std::string cmLocalGenerator::GetIncludeFlags(
// Support special system include flag if it is available and the
// normal flag is repeated for each directory.
- const char* sysIncludeFlag = nullptr;
+ cmProp sysIncludeFlag = nullptr;
if (repeatFlag) {
sysIncludeFlag = this->Makefile->GetDefinition(
cmStrCat("CMAKE_INCLUDE_SYSTEM_FLAG_", lang));
}
- const char* fwSearchFlag = this->Makefile->GetDefinition(
+ cmProp fwSearchFlag = this->Makefile->GetDefinition(
cmStrCat("CMAKE_", lang, "_FRAMEWORK_SEARCH_FLAG"));
- const char* sysFwSearchFlag = this->Makefile->GetDefinition(
+ cmProp sysFwSearchFlag = this->Makefile->GetDefinition(
cmStrCat("CMAKE_", lang, "_SYSTEM_FRAMEWORK_SEARCH_FLAG"));
bool flagUsed = false;
@@ -900,9 +901,9 @@ std::string cmLocalGenerator::GetIncludeFlags(
if (emitted.insert(frameworkDir).second) {
if (sysFwSearchFlag && target &&
target->IsSystemIncludeDirectory(i, config, lang)) {
- includeFlags << sysFwSearchFlag;
+ includeFlags << *sysFwSearchFlag;
} else {
- includeFlags << fwSearchFlag;
+ includeFlags << *fwSearchFlag;
}
includeFlags << this->ConvertToOutputFormat(frameworkDir, shellFormat)
<< " ";
@@ -913,7 +914,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
if (!flagUsed || repeatFlag) {
if (sysIncludeFlag && target &&
target->IsSystemIncludeDirectory(i, config, lang)) {
- includeFlags << sysIncludeFlag;
+ includeFlags << *sysIncludeFlag;
} else {
includeFlags << includeFlag;
}
@@ -953,9 +954,9 @@ void cmLocalGenerator::AddCompileOptions(std::vector<BT<std::string>>& flags,
const std::string& lang,
const std::string& config)
{
- std::string langFlagRegexVar = std::string("CMAKE_") + lang + "_FLAG_REGEX";
+ std::string langFlagRegexVar = cmStrCat("CMAKE_", lang, "_FLAG_REGEX");
- if (const char* langFlagRegexStr =
+ if (cmProp langFlagRegexStr =
this->Makefile->GetDefinition(langFlagRegexVar)) {
// Filter flags acceptable to this language.
if (cmProp targetFlags = target->GetProperty("COMPILE_FLAGS")) {
@@ -964,7 +965,7 @@ void cmLocalGenerator::AddCompileOptions(std::vector<BT<std::string>>& flags,
// Re-escape these flags since COMPILE_FLAGS were already parsed
// as a command line above.
std::string compileOpts;
- this->AppendCompileOptions(compileOpts, opts, langFlagRegexStr);
+ this->AppendCompileOptions(compileOpts, opts, langFlagRegexStr->c_str());
if (!compileOpts.empty()) {
flags.emplace_back(std::move(compileOpts));
}
@@ -972,7 +973,8 @@ void cmLocalGenerator::AddCompileOptions(std::vector<BT<std::string>>& flags,
std::vector<BT<std::string>> targetCompileOpts =
target->GetCompileOptions(config, lang);
// COMPILE_OPTIONS are escaped.
- this->AppendCompileOptions(flags, targetCompileOpts, langFlagRegexStr);
+ this->AppendCompileOptions(flags, targetCompileOpts,
+ langFlagRegexStr->c_str());
} else {
// Use all flags.
if (cmProp targetFlags = target->GetProperty("COMPILE_FLAGS")) {
@@ -1022,7 +1024,7 @@ void cmLocalGenerator::AddCompileOptions(std::vector<BT<std::string>>& flags,
// Add compile flag for the MSVC compiler only.
cmMakefile* mf = this->GetMakefile();
- if (const char* jmc =
+ if (cmProp jmc =
mf->GetDefinition("CMAKE_" + lang + "_COMPILE_OPTIONS_JMC")) {
// Handle Just My Code debugging flags, /JMC.
@@ -1036,7 +1038,7 @@ void cmLocalGenerator::AddCompileOptions(std::vector<BT<std::string>>& flags,
std::string isJMCEnabled =
cmGeneratorExpression::Evaluate(*jmcExprGen, this, config);
if (cmIsOn(isJMCEnabled)) {
- std::vector<std::string> optVec = cmExpandedList(jmc);
+ std::vector<std::string> optVec = cmExpandedList(*jmc);
std::string jmcFlags;
this->AppendCompileOptions(jmcFlags, optVec);
if (!jmcFlags.empty()) {
@@ -1652,7 +1654,7 @@ static std::string GetFrameworkFlags(const std::string& lang,
}
std::string fwSearchFlagVar = "CMAKE_" + lang + "_FRAMEWORK_SEARCH_FLAG";
- const char* fwSearchFlag = mf->GetDefinition(fwSearchFlagVar);
+ cmProp fwSearchFlag = mf->GetDefinition(fwSearchFlagVar);
if (!cmNonempty(fwSearchFlag)) {
return std::string();
}
@@ -1679,7 +1681,7 @@ static std::string GetFrameworkFlags(const std::string& lang,
std::vector<std::string> const& frameworks = cli->GetFrameworkPaths();
for (std::string const& framework : frameworks) {
if (emitted.insert(framework).second) {
- flags += fwSearchFlag;
+ flags += *fwSearchFlag;
flags +=
lg->ConvertToOutputFormat(framework, cmOutputConverter::SHELL);
flags += " ";
@@ -1761,18 +1763,18 @@ void cmLocalGenerator::OutputLinkLibraries(
std::string linkLanguage = cli.GetLinkLanguage();
std::string libPathFlag;
- if (const char* value = this->Makefile->GetDefinition(
+ if (cmProp value = this->Makefile->GetDefinition(
"CMAKE_" + cli.GetLinkLanguage() + "_LIBRARY_PATH_FLAG")) {
- libPathFlag = value;
+ libPathFlag = *value;
} else {
libPathFlag =
this->Makefile->GetRequiredDefinition("CMAKE_LIBRARY_PATH_FLAG");
}
std::string libPathTerminator;
- if (const char* value = this->Makefile->GetDefinition(
+ if (cmProp value = this->Makefile->GetDefinition(
"CMAKE_" + cli.GetLinkLanguage() + "_LIBRARY_PATH_TERMINATOR")) {
- libPathTerminator = value;
+ libPathTerminator = *value;
} else {
libPathTerminator =
this->Makefile->GetRequiredDefinition("CMAKE_LIBRARY_PATH_TERMINATOR");
@@ -1886,16 +1888,15 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
}
}
- const char* sysroot = this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT");
- if (sysroot && sysroot[0] == '/' && !sysroot[1]) {
+ cmProp sysroot = this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT");
+ if (sysroot && *sysroot == "/") {
sysroot = nullptr;
}
- std::string sysrootFlagVar =
- std::string("CMAKE_") + lang + "_SYSROOT_FLAG";
- const char* sysrootFlag = this->Makefile->GetDefinition(sysrootFlagVar);
+ std::string sysrootFlagVar = "CMAKE_" + lang + "_SYSROOT_FLAG";
+ cmProp sysrootFlag = this->Makefile->GetDefinition(sysrootFlagVar);
if (cmNonempty(sysrootFlag)) {
if (!this->AppleArchSysroots.empty() &&
- !this->AllAppleArchSysrootsAreTheSame(archs, sysroot)) {
+ !this->AllAppleArchSysrootsAreTheSame(archs, cmToCStr(sysroot))) {
for (std::string const& arch : archs) {
std::string const& archSysroot = this->AppleArchSysroots[arch];
if (cmIsOff(archSysroot)) {
@@ -1904,28 +1905,28 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
if (filterArch.empty() || filterArch == arch) {
flags += " -Xarch_" + arch + " ";
// Combine sysroot flag and path to work with -Xarch
- std::string arch_sysroot = sysrootFlag + archSysroot;
+ std::string arch_sysroot = *sysrootFlag + archSysroot;
flags += this->ConvertToOutputFormat(arch_sysroot, SHELL);
}
}
- } else if (sysroot && *sysroot) {
+ } else if (cmNonempty(sysroot)) {
flags += " ";
- flags += sysrootFlag;
+ flags += *sysrootFlag;
flags += " ";
- flags += this->ConvertToOutputFormat(sysroot, SHELL);
+ flags += this->ConvertToOutputFormat(*sysroot, SHELL);
}
}
- const char* deploymentTarget =
+ cmProp deploymentTarget =
this->Makefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET");
std::string deploymentTargetFlagVar =
- std::string("CMAKE_") + lang + "_OSX_DEPLOYMENT_TARGET_FLAG";
- const char* deploymentTargetFlag =
+ "CMAKE_" + lang + "_OSX_DEPLOYMENT_TARGET_FLAG";
+ cmProp deploymentTargetFlag =
this->Makefile->GetDefinition(deploymentTargetFlagVar);
if (cmNonempty(deploymentTargetFlag) && cmNonempty(deploymentTarget)) {
flags += " ";
- flags += deploymentTargetFlag;
- flags += deploymentTarget;
+ flags += *deploymentTargetFlag;
+ flags += *deploymentTarget;
}
}
}
@@ -1944,10 +1945,10 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
if (lang == "Swift") {
if (cmProp v = target->GetProperty("Swift_LANGUAGE_VERSION")) {
- if (cmSystemTools::VersionCompare(
- cmSystemTools::OP_GREATER_EQUAL,
- this->Makefile->GetDefinition("CMAKE_Swift_COMPILER_VERSION"),
- "4.2")) {
+ if (cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER_EQUAL,
+ cmToCStr(this->Makefile->GetDefinition(
+ "CMAKE_Swift_COMPILER_VERSION")),
+ "4.2")) {
this->AppendFlags(flags, "-swift-version " + *v);
}
}
@@ -1965,10 +1966,12 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
"See CMake issue #20726.");
}
}
+ } else if (lang == "ISPC") {
+ target->AddISPCTargetFlags(flags);
}
// Add VFS Overlay for Clang compiliers
if (compiler == "Clang") {
- if (const char* vfsOverlay =
+ if (cmProp vfsOverlay =
this->Makefile->GetDefinition("CMAKE_CLANG_VFS_OVERLAY")) {
std::string const& compilerSimulateId =
this->Makefile->GetSafeDefinition(
@@ -1977,17 +1980,17 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
this->AppendCompileOptions(
flags,
std::vector<std::string>{ "-Xclang", "-ivfsoverlay", "-Xclang",
- vfsOverlay });
+ *vfsOverlay });
} else {
this->AppendCompileOptions(
- flags, std::vector<std::string>{ "-ivfsoverlay", vfsOverlay });
+ flags, std::vector<std::string>{ "-ivfsoverlay", *vfsOverlay });
}
}
}
// Add MSVC runtime library flags. This is activated by the presence
// of a default selection whether or not it is overridden by a property.
cmProp msvcRuntimeLibraryDefault =
- this->Makefile->GetDef("CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT");
+ this->Makefile->GetDefinition("CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT");
if (cmNonempty(msvcRuntimeLibraryDefault)) {
cmProp msvcRuntimeLibraryValue =
target->GetProperty("MSVC_RUNTIME_LIBRARY");
@@ -1997,11 +2000,10 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
std::string const msvcRuntimeLibrary = cmGeneratorExpression::Evaluate(
*msvcRuntimeLibraryValue, this, config, target);
if (!msvcRuntimeLibrary.empty()) {
- if (const char* msvcRuntimeLibraryOptions =
- this->Makefile->GetDefinition(
- "CMAKE_" + lang + "_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_" +
- msvcRuntimeLibrary)) {
- this->AppendCompileOptions(flags, msvcRuntimeLibraryOptions);
+ if (cmProp msvcRuntimeLibraryOptions = this->Makefile->GetDefinition(
+ "CMAKE_" + lang + "_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_" +
+ msvcRuntimeLibrary)) {
+ this->AppendCompileOptions(flags, *msvcRuntimeLibraryOptions);
} else if ((this->Makefile->GetSafeDefinition(
"CMAKE_" + lang + "_COMPILER_ID") == "MSVC" ||
this->Makefile->GetSafeDefinition(
@@ -2178,9 +2180,9 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
std::string const& optionFlagDef =
standardResolver.GetCompileOptionDef(target, lang, config);
if (!optionFlagDef.empty()) {
- auto opt = target->Target->GetMakefile()->GetDefinition(optionFlagDef);
+ cmProp opt = target->Target->GetMakefile()->GetDefinition(optionFlagDef);
if (opt) {
- std::vector<std::string> optVec = cmExpandedList(opt);
+ std::vector<std::string> optVec = cmExpandedList(*opt);
for (std::string const& i : optVec) {
this->AppendFlagEscape(flags, i);
}
@@ -2195,7 +2197,7 @@ static void AddVisibilityCompileOption(std::string& flags,
std::string* warnCMP0063)
{
std::string compileOption = "CMAKE_" + lang + "_COMPILE_OPTIONS_VISIBILITY";
- const char* opt = lg->GetMakefile()->GetDefinition(compileOption);
+ cmProp opt = lg->GetMakefile()->GetDefinition(compileOption);
if (!opt) {
return;
}
@@ -2219,7 +2221,7 @@ static void AddVisibilityCompileOption(std::string& flags,
cmSystemTools::Error(e.str());
return;
}
- std::string option = opt + *prop;
+ std::string option = *opt + *prop;
lg->AppendFlags(flags, option);
}
@@ -2231,7 +2233,7 @@ static void AddInlineVisibilityCompileOption(std::string& flags,
{
std::string compileOption =
cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN");
- const char* opt = lg->GetMakefile()->GetDefinition(compileOption);
+ cmProp opt = lg->GetMakefile()->GetDefinition(compileOption);
if (!opt) {
return;
}
@@ -2244,7 +2246,7 @@ static void AddInlineVisibilityCompileOption(std::string& flags,
*warnCMP0063 += " VISIBILITY_INLINES_HIDDEN\n";
return;
}
- lg->AppendFlags(flags, opt);
+ lg->AppendFlags(flags, *opt);
}
void cmLocalGenerator::AddVisibilityPresetFlags(
@@ -2426,6 +2428,54 @@ void cmLocalGenerator::AppendFlagEscape(std::string& flags,
this->EscapeForShell(rawFlag, false, false, false, this->IsNinjaMulti()));
}
+void cmLocalGenerator::AddISPCDependencies(cmGeneratorTarget* target)
+{
+ std::vector<std::string> enabledLanguages =
+ this->GetState()->GetEnabledLanguages();
+ if (std::find(enabledLanguages.begin(), enabledLanguages.end(), "ISPC") ==
+ enabledLanguages.end()) {
+ return;
+ }
+
+ std::vector<std::string> ispcSuffixes =
+ detail::ComputeISPCObjectSuffixes(target);
+ const bool extra_objects = (ispcSuffixes.size() > 1);
+
+ std::vector<std::string> configsList =
+ this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
+ for (std::string const& config : configsList) {
+
+ std::string perConfigDir = target->GetObjectDirectory(config);
+ if (cmProp prop = target->GetProperty("ISPC_HEADER_DIRECTORY")) {
+ perConfigDir = cmSystemTools::CollapseFullPath(
+ cmStrCat(this->GetBinaryDirectory(), '/', *prop));
+ }
+
+ std::vector<cmSourceFile*> sources;
+ target->GetSourceFiles(sources, config);
+
+ // build up the list of ispc headers and extra objects that this target is
+ // generating
+ for (cmSourceFile const* sf : sources) {
+ // Generate this object file's rule file.
+ const std::string& lang = sf->GetLanguage();
+ if (lang == "ISPC") {
+ std::string const& objectName = target->GetObjectName(sf);
+ std::string ispcSource =
+ cmSystemTools::GetFilenameWithoutLastExtension(objectName);
+
+ auto headerPath = cmStrCat(perConfigDir, '/', ispcSource, ".h");
+ target->AddISPCGeneratedHeader(headerPath, config);
+ if (extra_objects) {
+ std::vector<std::string> objs = detail::ComputeISPCExtraObjects(
+ objectName, perConfigDir, ispcSuffixes);
+ target->AddISPCGeneratedObject(std::move(objs), config);
+ }
+ }
+ }
+ }
+}
+
void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
{
std::vector<std::string> configsList =
@@ -2524,17 +2574,29 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_", lang, "_FLAGS_", configUpper));
+ bool editAndContinueDebugInfo =
+ langFlags.find("/ZI") != std::string::npos ||
+ langFlags.find("-ZI") != std::string::npos;
+
+ bool enableDebuggingInformation =
+ langFlags.find("/Zi") != std::string::npos ||
+ langFlags.find("-Zi") != std::string::npos;
+
// MSVC 2008 is producing both .pdb and .idb files with /Zi.
- if ((langFlags.find("/ZI") != std::string::npos ||
- langFlags.find("-ZI") != std::string::npos) ||
- (cmSystemTools::VersionCompare(cmSystemTools::OP_LESS,
- compilerVersion.c_str(),
- "16.0") &&
- compilerId == "MSVC")) {
+ bool msvc2008OrLess =
+ cmSystemTools::VersionCompare(
+ cmSystemTools::OP_LESS, compilerVersion.c_str(), "16.0") &&
+ compilerId == "MSVC";
+ // but not when used via toolset -Tv90
+ if (this->Makefile->GetSafeDefinition(
+ "CMAKE_VS_PLATFORM_TOOLSET") == "v90") {
+ msvc2008OrLess = false;
+ }
+
+ if (editAndContinueDebugInfo || msvc2008OrLess) {
CopyPchCompilePdb(config, target, *ReuseFrom, reuseTarget,
{ ".pdb", ".idb" });
- } else if ((langFlags.find("/Zi") != std::string::npos ||
- langFlags.find("-Zi") != std::string::npos)) {
+ } else if (enableDebuggingInformation) {
CopyPchCompilePdb(config, target, *ReuseFrom, reuseTarget,
{ ".pdb" });
}
@@ -2885,12 +2947,12 @@ void cmLocalGenerator::AppendIPOLinkerFlags(std::string& flags,
}
const std::string name = "CMAKE_" + lang + "_LINK_OPTIONS_IPO";
- const char* rawFlagsList = this->Makefile->GetDefinition(name);
+ cmProp rawFlagsList = this->Makefile->GetDefinition(name);
if (rawFlagsList == nullptr) {
return;
}
- std::vector<std::string> flagsList = cmExpandedList(rawFlagsList);
+ std::vector<std::string> flagsList = cmExpandedList(*rawFlagsList);
for (std::string const& o : flagsList) {
this->AppendFlagEscape(flags, o);
}
@@ -3076,10 +3138,10 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
// Lookup the define flag for the current language.
std::string dflag = "-D";
if (!lang.empty()) {
- const char* df =
+ cmProp df =
this->Makefile->GetDefinition(cmStrCat("CMAKE_", lang, "_DEFINE_FLAG"));
if (cmNonempty(df)) {
- dflag = df;
+ dflag = *df;
}
}
const char* itemSeparator = definesString.empty() ? "" : " ";
@@ -3123,10 +3185,10 @@ void cmLocalGenerator::AppendFeatureOptions(std::string& flags,
const std::string& lang,
const char* feature)
{
- const char* optionList = this->Makefile->GetDefinition(
+ cmProp optionList = this->Makefile->GetDefinition(
cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_", feature));
if (optionList != nullptr) {
- std::vector<std::string> options = cmExpandedList(optionList);
+ std::vector<std::string> options = cmExpandedList(*optionList);
for (std::string const& o : options) {
this->AppendFlagEscape(flags, o);
}
@@ -3581,9 +3643,9 @@ KWIML_INT_uint64_t cmLocalGenerator::GetBackwardsCompatibility()
unsigned int major = 0;
unsigned int minor = 0;
unsigned int patch = 0;
- if (const char* value =
+ if (cmProp value =
this->Makefile->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY")) {
- switch (sscanf(value, "%u.%u.%u", &major, &minor, &patch)) {
+ switch (sscanf(value->c_str(), "%u.%u.%u", &major, &minor, &patch)) {
case 2:
patch = 0;
break;
@@ -3996,4 +4058,44 @@ void AddUtilityCommand(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
target->AddSource(force.NameCMP0049);
}
}
+
+std::vector<std::string> ComputeISPCObjectSuffixes(cmGeneratorTarget* target)
+{
+ const std::string& targetProperty =
+ target->GetSafeProperty("ISPC_INSTRUCTION_SETS");
+ std::vector<std::string> ispcTargets;
+
+ if (!cmIsOff(targetProperty)) {
+ cmExpandList(targetProperty, ispcTargets);
+ for (auto& ispcTarget : ispcTargets) {
+ // transform targets into the suffixes
+ auto pos = ispcTarget.find('-');
+ auto target_suffix = ispcTarget.substr(0, pos);
+ if (target_suffix ==
+ "avx1") { // when targetting avx1 ISPC uses the 'avx' output string
+ target_suffix = "avx";
+ }
+ ispcTarget = target_suffix;
+ }
+ }
+ return ispcTargets;
+}
+
+std::vector<std::string> ComputeISPCExtraObjects(
+ std::string const& objectName, std::string const& buildDirectory,
+ std::vector<std::string> const& ispcSuffixes)
+{
+ std::vector<std::string> computedObjects;
+ computedObjects.reserve(ispcSuffixes.size());
+
+ auto extension = cmSystemTools::GetFilenameLastExtension(objectName);
+ auto objNameNoExt =
+ cmSystemTools::GetFilenameWithoutLastExtension(objectName);
+ for (const auto& ispcTarget : ispcSuffixes) {
+ computedObjects.emplace_back(
+ cmStrCat(buildDirectory, "/", objNameNoExt, "_", ispcTarget, extension));
+ }
+
+ return computedObjects;
+}
}
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 0c51a65..fad6136 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLocalGenerator_h
-#define cmLocalGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -133,6 +132,7 @@ public:
const std::vector<BT<std::string>>& newFlags) const;
virtual void AppendFlagEscape(std::string& flags,
const std::string& rawFlag) const;
+ void AddISPCDependencies(cmGeneratorTarget* target);
void AddPchDependencies(cmGeneratorTarget* target);
void AddUnityBuild(cmGeneratorTarget* target);
void AppendIPOLinkerFlags(std::string& flags, cmGeneratorTarget* target,
@@ -594,6 +594,9 @@ void AddUtilityCommand(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
bool escapeOldStyle, const char* comment,
bool uses_terminal, bool command_expand_lists,
const std::string& job_pool, bool stdPipesUTF8);
-}
-#endif
+std::vector<std::string> ComputeISPCObjectSuffixes(cmGeneratorTarget* target);
+std::vector<std::string> ComputeISPCExtraObjects(
+ std::string const& objectName, std::string const& buildDirectory,
+ std::vector<std::string> const& ispcSuffixes);
+}
diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx
index a23ad57..b223813 100644
--- a/Source/cmLocalGhsMultiGenerator.cxx
+++ b/Source/cmLocalGhsMultiGenerator.cxx
@@ -2,10 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmLocalGhsMultiGenerator.h"
-#include <algorithm>
#include <utility>
-
-#include <cmext/algorithm>
+#include <vector>
#include "cmGeneratorTarget.h"
#include "cmGhsMultiTargetGenerator.h"
@@ -29,34 +27,16 @@ std::string cmLocalGhsMultiGenerator::GetTargetDirectory(
return dir;
}
-void cmLocalGhsMultiGenerator::GenerateTargetsDepthFirst(
- cmGeneratorTarget* target, std::vector<cmGeneratorTarget*>& remaining)
-{
- if (!target->IsInBuildSystem()) {
- return;
- }
- // Find this target in the list of remaining targets.
- auto it = std::find(remaining.begin(), remaining.end(), target);
- if (it == remaining.end()) {
- // This target was already handled.
- return;
- }
- // Remove this target from the list of remaining targets because
- // we are handling it now.
- *it = nullptr;
-
- cmGhsMultiTargetGenerator tg(target);
- tg.Generate();
-}
-
void cmLocalGhsMultiGenerator::Generate()
{
- std::vector<cmGeneratorTarget*> remaining;
- cm::append(remaining, this->GetGeneratorTargets());
- for (auto& t : remaining) {
- if (t) {
- this->GenerateTargetsDepthFirst(t, remaining);
+ for (cmGeneratorTarget* gt :
+ this->GlobalGenerator->GetLocalGeneratorTargetsInOrder(this)) {
+ if (!gt->IsInBuildSystem()) {
+ continue;
}
+
+ cmGhsMultiTargetGenerator tg(gt);
+ tg.Generate();
}
}
diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h
index 2250e57..be32a94 100644
--- a/Source/cmLocalGhsMultiGenerator.h
+++ b/Source/cmLocalGhsMultiGenerator.h
@@ -1,11 +1,9 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLocalGhsMultiGenerator_h
-#define cmLocalGhsMultiGenerator_h
+#pragma once
#include <map>
#include <string>
-#include <vector>
#include "cmLocalGenerator.h"
@@ -38,10 +36,4 @@ public:
void ComputeObjectFilenames(
std::map<cmSourceFile const*, std::string>& mapping,
cmGeneratorTarget const* gt = nullptr) override;
-
-private:
- void GenerateTargetsDepthFirst(cmGeneratorTarget* target,
- std::vector<cmGeneratorTarget*>& remaining);
};
-
-#endif
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index eb841d9..ad782ee 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -312,7 +312,7 @@ void cmLocalNinjaGenerator::WritePools(std::ostream& os)
cmProp jobpools =
this->GetCMakeInstance()->GetState()->GetGlobalProperty("JOB_POOLS");
if (!jobpools) {
- jobpools = this->GetMakefile()->GetDef("CMAKE_JOB_POOLS");
+ jobpools = this->GetMakefile()->GetDefinition("CMAKE_JOB_POOLS");
}
if (jobpools) {
cmGlobalNinjaGenerator::WriteComment(
@@ -363,7 +363,7 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os)
{
cmGlobalNinjaGenerator::WriteDivider(os);
os << "# Write statements declared in CMakeLists.txt:\n"
- << "# " << this->Makefile->GetDefinition("CMAKE_CURRENT_LIST_FILE")
+ << "# " << this->Makefile->GetSafeDefinition("CMAKE_CURRENT_LIST_FILE")
<< '\n';
if (this->IsRootMakefile()) {
os << "# Which is the root file.\n";
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index 73c0cde..e81402c 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLocalNinjaGenerator_h
-#define cmLocalNinjaGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -121,5 +120,3 @@ private:
CustomCommandTargetMap CustomCommandTargets;
std::vector<cmCustomCommand const*> CustomCommands;
};
-
-#endif // ! cmLocalNinjaGenerator_h
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 8acd1e3..c877cf8 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -38,6 +38,7 @@
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
+#include "cmTargetDepend.h"
#include "cmVersion.h"
#include "cmake.h"
@@ -100,12 +101,22 @@ void cmLocalUnixMakefileGenerator3::Generate()
// Generate the rule files for each target.
cmGlobalUnixMakefileGenerator3* gg =
static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
- for (const auto& target : this->GetGeneratorTargets()) {
- if (!target->IsInBuildSystem()) {
+ for (cmGeneratorTarget* gt :
+ this->GlobalGenerator->GetLocalGeneratorTargetsInOrder(this)) {
+ if (!gt->IsInBuildSystem()) {
continue;
}
+
+ auto& gtVisited = this->GetCommandsVisited(gt);
+ auto& deps = this->GlobalGenerator->GetTargetDirectDepends(gt);
+ for (auto& d : deps) {
+ // Take the union of visited source files of custom commands
+ auto depVisited = this->GetCommandsVisited(d);
+ gtVisited.insert(depVisited.begin(), depVisited.end());
+ }
+
std::unique_ptr<cmMakefileTargetGenerator> tg(
- cmMakefileTargetGenerator::New(target.get()));
+ cmMakefileTargetGenerator::New(gt));
if (tg) {
tg->WriteRuleFiles();
gg->RecordTargetProgress(tg.get());
@@ -235,7 +246,8 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
for (LocalObjectEntry const& entry : localObjectFile.second) {
if (entry.Language == "C" || entry.Language == "CXX" ||
- entry.Language == "CUDA" || entry.Language == "Fortran") {
+ entry.Language == "CUDA" || entry.Language == "Fortran" ||
+ entry.Language == "ISPC") {
// Right now, C, C++, Fortran and CUDA have both a preprocessor and the
// ability to generate assembly code
lang_has_preprocessor = true;
@@ -518,9 +530,9 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
// Mark the rule as symbolic if requested.
if (symbolic) {
- if (const char* sym =
+ if (cmProp sym =
this->Makefile->GetDefinition("CMAKE_MAKE_SYMBOLIC_RULE")) {
- os << tgt << space << ": " << sym << "\n";
+ os << tgt << space << ": " << *sym << "\n";
}
}
@@ -832,9 +844,8 @@ void cmLocalUnixMakefileGenerator3::AppendRuleDepend(
{
// Add a dependency on the rule file itself unless an option to skip
// it is specifically enabled by the user or project.
- const char* nodep =
- this->Makefile->GetDefinition("CMAKE_SKIP_RULE_DEPENDENCY");
- if (!nodep || cmIsOff(nodep)) {
+ cmProp nodep = this->Makefile->GetDefinition("CMAKE_SKIP_RULE_DEPENDENCY");
+ if (cmIsOff(nodep)) {
depends.emplace_back(ruleFileName);
}
}
@@ -1394,22 +1405,22 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
// Lookup useful directory information.
if (haveDirectoryInfo) {
// Test whether we need to force Unix paths.
- if (const char* force = mf->GetDefinition("CMAKE_FORCE_UNIX_PATHS")) {
+ if (cmProp force = mf->GetDefinition("CMAKE_FORCE_UNIX_PATHS")) {
if (!cmIsOff(force)) {
cmSystemTools::SetForceUnixPaths(true);
}
}
// Setup relative path top directories.
- if (const char* relativePathTopSource =
+ if (cmProp relativePathTopSource =
mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_SOURCE")) {
this->StateSnapshot.GetDirectory().SetRelativePathTopSource(
- relativePathTopSource);
+ relativePathTopSource->c_str());
}
- if (const char* relativePathTopBinary =
+ if (cmProp relativePathTopBinary =
mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_BINARY")) {
this->StateSnapshot.GetDirectory().SetRelativePathTopBinary(
- relativePathTopBinary);
+ relativePathTopBinary->c_str());
}
} else {
cmSystemTools::Error("Directory Information file not found");
@@ -1444,7 +1455,8 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
// Create the scanner for this language
std::unique_ptr<cmDepends> scanner;
if (lang == "C" || lang == "CXX" || lang == "RC" || lang == "ASM" ||
- lang == "OBJC" || lang == "OBJCXX" || lang == "CUDA") {
+ lang == "OBJC" || lang == "OBJCXX" || lang == "CUDA" ||
+ lang == "ISPC") {
// TODO: Handle RC (resource files) dependencies correctly.
scanner = cm::make_unique<cmDependsC>(this, targetDir, lang, &validDeps);
}
@@ -1476,13 +1488,13 @@ void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose)
cmMakefile* mf = this->Makefile;
// Get the string listing the multiple output pairs.
- const char* pairs_string = mf->GetDefinition("CMAKE_MULTIPLE_OUTPUT_PAIRS");
+ cmProp pairs_string = mf->GetDefinition("CMAKE_MULTIPLE_OUTPUT_PAIRS");
if (!pairs_string) {
return;
}
// Convert the string to a list and preserve empty entries.
- std::vector<std::string> pairs = cmExpandedList(pairs_string, true);
+ std::vector<std::string> pairs = cmExpandedList(*pairs_string, true);
for (auto i = pairs.begin(); i != pairs.end() && (i + 1) != pairs.end();) {
const std::string& depender = *i++;
const std::string& dependee = *i++;
@@ -1648,9 +1660,9 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
recursiveTarget = cmStrCat(this->GetCurrentBinaryDirectory(), "/preinstall");
commands.clear();
depends.clear();
- const char* noall =
+ cmProp noall =
this->Makefile->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY");
- if (!noall || cmIsOff(noall)) {
+ if (cmIsOff(noall)) {
// Drive the build before installing.
depends.emplace_back("all");
} else if (regenerate) {
@@ -1698,11 +1710,11 @@ void cmLocalUnixMakefileGenerator3::ClearDependencies(cmMakefile* mf,
bool verbose)
{
// Get the list of target files to check
- const char* infoDef = mf->GetDefinition("CMAKE_DEPEND_INFO_FILES");
+ cmProp infoDef = mf->GetDefinition("CMAKE_DEPEND_INFO_FILES");
if (!infoDef) {
return;
}
- std::vector<std::string> files = cmExpandedList(infoDef);
+ std::vector<std::string> files = cmExpandedList(*infoDef);
// Each depend information file corresponds to a target. Clear the
// dependencies for that target.
@@ -1806,10 +1818,10 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
// Tell the dependency scanner what compiler is used.
std::string cidVar =
cmStrCat("CMAKE_", implicitLang.first, "_COMPILER_ID");
- const char* cid = this->Makefile->GetDefinition(cidVar);
+ cmProp cid = this->Makefile->GetDefinition(cidVar);
if (cmNonempty(cid)) {
cmakefileStream << "set(CMAKE_" << implicitLang.first
- << "_COMPILER_ID \"" << cid << "\")\n";
+ << "_COMPILER_ID \"" << *cid << "\")\n";
}
if (implicitLang.first == "Fortran") {
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 2b07952..8286d67 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLocalUnixMakefileGenerator3_h
-#define cmLocalUnixMakefileGenerator3_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -20,6 +19,7 @@ class cmCustomCommandGenerator;
class cmGeneratorTarget;
class cmGlobalGenerator;
class cmMakefile;
+class cmSourceFile;
/** \class cmLocalUnixMakefileGenerator3
* \brief Write a LocalUnix makefiles.
@@ -295,6 +295,13 @@ private:
bool ColorMakefile;
bool SkipPreprocessedSourceRules;
bool SkipAssemblySourceRules;
-};
-#endif
+ std::set<cmSourceFile const*>& GetCommandsVisited(
+ cmGeneratorTarget const* target)
+ {
+ return this->CommandsVisited[target];
+ };
+
+ std::map<cmGeneratorTarget const*, std::set<cmSourceFile const*>>
+ CommandsVisited;
+};
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 6c7d6c6..3ed49a0 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -66,33 +66,11 @@ cmLocalVisualStudio10Generator::~cmLocalVisualStudio10Generator()
{
}
-void cmLocalVisualStudio10Generator::GenerateTargetsDepthFirst(
- cmGeneratorTarget* target, std::vector<cmGeneratorTarget*>& remaining)
+void cmLocalVisualStudio10Generator::GenerateTarget(cmGeneratorTarget* target)
{
- if (!target->IsInBuildSystem()) {
- return;
- }
- // Find this target in the list of remaining targets.
- auto it = std::find(remaining.begin(), remaining.end(), target);
- if (it == remaining.end()) {
- // This target was already handled.
- return;
- }
- // Remove this target from the list of remaining targets because
- // we are handling it now.
- *it = nullptr;
- auto& deps = this->GlobalGenerator->GetTargetDirectDepends(target);
- for (auto& d : deps) {
- // FIXME: Revise CreateSingleVCProj so we do not have to drop `const` here.
- auto dependee = const_cast<cmGeneratorTarget*>(&*d);
- GenerateTargetsDepthFirst(dependee, remaining);
- // Take the union of visited source files of custom commands
- auto visited = GetSourcesVisited(dependee);
- GetSourcesVisited(target).insert(visited.begin(), visited.end());
- }
if (static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
->TargetIsFortranOnly(target)) {
- this->CreateSingleVCProj(target->GetName(), target);
+ this->cmLocalVisualStudio7Generator::GenerateTarget(target);
} else {
cmVisualStudio10TargetGenerator tg(
target,
@@ -102,18 +80,6 @@ void cmLocalVisualStudio10Generator::GenerateTargetsDepthFirst(
}
}
-void cmLocalVisualStudio10Generator::Generate()
-{
- std::vector<cmGeneratorTarget*> remaining;
- cm::append(remaining, this->GetGeneratorTargets());
- for (auto& t : remaining) {
- if (t) {
- this->GenerateTargetsDepthFirst(t, remaining);
- }
- }
- this->WriteStampFiles();
-}
-
void cmLocalVisualStudio10Generator::ReadAndStoreExternalGUID(
const std::string& name, const char* path)
{
diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h
index 5c6400e..45ee082 100644
--- a/Source/cmLocalVisualStudio10Generator.h
+++ b/Source/cmLocalVisualStudio10Generator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLocalVisualStudio10Generator_h
-#define cmLocalVisualStudio10Generator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -26,26 +25,13 @@ public:
virtual ~cmLocalVisualStudio10Generator();
- /**
- * Generate the makefile for this directory.
- */
- void Generate() override;
void ReadAndStoreExternalGUID(const std::string& name,
const char* path) override;
- std::set<cmSourceFile const*>& GetSourcesVisited(cmGeneratorTarget* target)
- {
- return SourcesVisited[target];
- };
-
protected:
const char* ReportErrorLabel() const override;
bool CustomCommandUseLocal() const override { return true; }
private:
- void GenerateTargetsDepthFirst(cmGeneratorTarget* target,
- std::vector<cmGeneratorTarget*>& remaining);
-
- std::map<cmGeneratorTarget*, std::set<cmSourceFile const*>> SourcesVisited;
+ void GenerateTarget(cmGeneratorTarget* target) override;
};
-#endif
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index ee7f74c..7795654 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -80,7 +80,24 @@ void cmLocalVisualStudio7Generator::AddHelperCommands()
void cmLocalVisualStudio7Generator::Generate()
{
- this->WriteProjectFiles();
+ // Create the project file for each target.
+ for (cmGeneratorTarget* gt :
+ this->GlobalGenerator->GetLocalGeneratorTargetsInOrder(this)) {
+ if (!gt->IsInBuildSystem() || gt->GetProperty("EXTERNAL_MSPROJECT")) {
+ continue;
+ }
+
+ auto& gtVisited = this->GetSourcesVisited(gt);
+ auto& deps = this->GlobalGenerator->GetTargetDirectDepends(gt);
+ for (auto& d : deps) {
+ // Take the union of visited source files of custom commands
+ auto depVisited = this->GetSourcesVisited(d);
+ gtVisited.insert(depVisited.begin(), depVisited.end());
+ }
+
+ this->GenerateTarget(gt);
+ }
+
this->WriteStampFiles();
}
@@ -111,35 +128,6 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
}
}
-// TODO
-// for CommandLine= need to repleace quotes with &quot
-// write out configurations
-void cmLocalVisualStudio7Generator::WriteProjectFiles()
-{
- // If not an in source build, then create the output directory
- if (this->GetCurrentBinaryDirectory() != this->GetSourceDirectory()) {
- if (!cmSystemTools::MakeDirectory(this->GetCurrentBinaryDirectory())) {
- cmSystemTools::Error("Error creating directory " +
- this->GetCurrentBinaryDirectory());
- }
- }
-
- // Get the set of targets in this directory.
- const auto& tgts = this->GetGeneratorTargets();
-
- // Create the project file for each target.
- for (const auto& l : tgts) {
- if (!l->IsInBuildSystem()) {
- continue;
- }
- // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
- // so don't build a projectfile for it
- if (!l->GetProperty("EXTERNAL_MSPROJECT")) {
- this->CreateSingleVCProj(l->GetName(), l.get());
- }
- }
-}
-
void cmLocalVisualStudio7Generator::WriteStampFiles()
{
// Touch a timestamp file used to determine when the project file is
@@ -178,9 +166,9 @@ void cmLocalVisualStudio7Generator::WriteStampFiles()
}
}
-void cmLocalVisualStudio7Generator::CreateSingleVCProj(
- const std::string& lname, cmGeneratorTarget* target)
+void cmLocalVisualStudio7Generator::GenerateTarget(cmGeneratorTarget* target)
{
+ std::string const& lname = target->GetName();
cmGlobalVisualStudioGenerator* gg =
static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator);
this->FortranProject = gg->TargetIsFortranOnly(target);
@@ -593,8 +581,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
std::ostream& fout, const std::string& configName,
const std::string& libName, cmGeneratorTarget* target)
{
- const char* mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG");
- if (!mfcFlag) {
+ std::string mfcFlag;
+ if (cmProp p = this->Makefile->GetDefinition("CMAKE_MFC_FLAG")) {
+ mfcFlag = *p;
+ } else {
mfcFlag = "0";
}
cmGlobalVisualStudio7Generator* gg =
@@ -1087,9 +1077,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
}
}
std::string stackVar = cmStrCat("CMAKE_", linkLanguage, "_STACK_SIZE");
- const char* stackVal = this->Makefile->GetDefinition(stackVar);
+ cmProp stackVal = this->Makefile->GetDefinition(stackVar);
if (stackVal) {
- fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\"\n";
+ fout << "\t\t\t\tStackReserveSize=\"" << *stackVal << "\"\n";
}
temp = cmStrCat(
target->GetDirectory(configName, cmStateEnums::ImportLibraryArtifact),
@@ -1176,9 +1166,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
<< "\"\n";
}
std::string stackVar = cmStrCat("CMAKE_", linkLanguage, "_STACK_SIZE");
- const char* stackVal = this->Makefile->GetDefinition(stackVar);
+ cmProp stackVal = this->Makefile->GetDefinition(stackVar);
if (stackVal) {
- fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\"";
+ fout << "\t\t\t\tStackReserveSize=\"" << *stackVal << "\"";
}
temp = cmStrCat(
target->GetDirectory(configName, cmStateEnums::ImportLibraryArtifact),
@@ -1634,6 +1624,8 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
this->WriteVCProjBeginGroup(fout, name.c_str(), "");
}
+ auto& sourcesVisited = this->GetSourcesVisited(target);
+
// Loop through each source in the source group.
for (const cmSourceFile* sf : sourceFiles) {
std::string source = sf->GetFullPath();
@@ -1657,7 +1649,10 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
// build it, then it will.
fout << "\t\t\t\tRelativePath=\"" << d << "\">\n";
if (cmCustomCommand const* command = sf->GetCustomCommand()) {
- this->WriteCustomRule(fout, configs, source.c_str(), *command, fcinfo);
+ if (sourcesVisited.insert(sf).second) {
+ this->WriteCustomRule(fout, configs, source.c_str(), *command,
+ fcinfo);
+ }
} else if (!fcinfo.FileConfigMap.empty()) {
const char* aCompilerTool = "VCCLCompilerTool";
std::string ppLang = "CXX";
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index 8b9b8ad..6e06c09 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLocalVisualStudio7Generator_h
-#define cmLocalVisualStudio7Generator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -84,8 +83,14 @@ public:
virtual void ReadAndStoreExternalGUID(const std::string& name,
const char* path);
+ std::set<cmSourceFile const*>& GetSourcesVisited(
+ cmGeneratorTarget const* target)
+ {
+ return this->SourcesVisited[target];
+ };
+
protected:
- void CreateSingleVCProj(const std::string& lname, cmGeneratorTarget* tgt);
+ virtual void GenerateTarget(cmGeneratorTarget* target);
private:
using Options = cmVS7GeneratorOptions;
@@ -93,7 +98,6 @@ private:
std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
const std::string& configName);
void FixGlobalTargets();
- void WriteProjectFiles();
void WriteVCProjHeader(std::ostream& fout, const std::string& libName,
cmGeneratorTarget* tgt,
std::vector<cmSourceGroup>& sgs);
@@ -150,6 +154,7 @@ private:
bool FortranProject;
bool WindowsCEProject;
std::unique_ptr<cmLocalVisualStudio7GeneratorInternals> Internal;
-};
-#endif
+ std::map<cmGeneratorTarget const*, std::set<cmSourceFile const*>>
+ SourcesVisited;
+};
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index ebd4f96..6d6ed9f 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -172,13 +172,12 @@ std::string cmLocalVisualStudioGenerator::ConstructScript(
// for visual studio IDE add extra stuff to the PATH
// if CMAKE_MSVCIDE_RUN_PATH is set.
if (this->Makefile->GetDefinition("MSVC_IDE")) {
- const char* extraPath =
- this->Makefile->GetDefinition("CMAKE_MSVCIDE_RUN_PATH");
+ cmProp extraPath = this->Makefile->GetDefinition("CMAKE_MSVCIDE_RUN_PATH");
if (extraPath) {
script += newline;
newline = newline_text;
script += "set PATH=";
- script += extraPath;
+ script += *extraPath;
script += ";%PATH%";
}
}
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index 585eb3c..91fb6b0 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLocalVisualStudioGenerator_h
-#define cmLocalVisualStudioGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -56,5 +55,3 @@ protected:
std::unique_ptr<cmCustomCommand> MaybeCreateImplibDir(
cmGeneratorTarget* target, const std::string& config, bool isFortran);
};
-
-#endif
diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h
index 42de20b..dd038b4 100644
--- a/Source/cmLocalXCodeGenerator.h
+++ b/Source/cmLocalXCodeGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLocalXCodeGenerator_h
-#define cmLocalXCodeGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -40,5 +39,3 @@ public:
private:
};
-
-#endif
diff --git a/Source/cmLocale.h b/Source/cmLocale.h
index c44a42d..f7636ac 100644
--- a/Source/cmLocale.h
+++ b/Source/cmLocale.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmLocale_h
-#define cmLocale_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -25,5 +24,3 @@ public:
private:
std::string OldLocale;
};
-
-#endif
diff --git a/Source/cmMSVC60LinkLineComputer.h b/Source/cmMSVC60LinkLineComputer.h
index d767914..0a303ab 100644
--- a/Source/cmMSVC60LinkLineComputer.h
+++ b/Source/cmMSVC60LinkLineComputer.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmMSVC60LinkLineComputer_h
-#define cmMSVC60LinkLineComputer_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -25,5 +24,3 @@ public:
std::string ConvertToLinkReference(std::string const& input) const override;
};
-
-#endif
diff --git a/Source/cmMachO.h b/Source/cmMachO.h
index 0c44b55..be92c95 100644
--- a/Source/cmMachO.h
+++ b/Source/cmMachO.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmMachO_h
-#define cmMachO_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -43,5 +42,3 @@ private:
bool Valid() const;
std::unique_ptr<cmMachOInternal> Internal;
};
-
-#endif
diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h
index 25091ea..b65a887 100644
--- a/Source/cmMacroCommand.h
+++ b/Source/cmMacroCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmMacroCommand_h
-#define cmMacroCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -13,5 +12,3 @@ class cmExecutionStatus;
/// Starts macro() ... endmacro() block
bool cmMacroCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h
index 2474383..340bca8 100644
--- a/Source/cmMakeDirectoryCommand.h
+++ b/Source/cmMakeDirectoryCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmMakeDirectoryCommand_h
-#define cmMakeDirectoryCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -21,5 +20,3 @@ class cmExecutionStatus;
*/
bool cmMakeDirectoryCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index d9d4ae8..d77c4af 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -194,7 +194,7 @@ void cmMakefile::MaybeWarnCMP0074(std::string const& pkg)
{
// Warn if a <pkg>_ROOT variable we may use is set.
std::string const varName = pkg + "_ROOT";
- const char* var = this->GetDefinition(varName);
+ cmProp var = this->GetDefinition(varName);
std::string env;
cmSystemTools::GetEnv(varName, env);
@@ -205,7 +205,7 @@ void cmMakefile::MaybeWarnCMP0074(std::string const& pkg)
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0074) << "\n";
if (haveVar) {
w << "CMake variable " << varName << " is set to:\n"
- << " " << var << "\n";
+ << " " << *var << "\n";
}
if (haveEnv) {
w << "Environment variable " << varName << " is set to:\n"
@@ -441,9 +441,9 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
// Check for maximum recursion depth.
int depth = CMake_DEFAULT_RECURSION_LIMIT;
- const char* depthStr = this->GetDefinition("CMAKE_MAXIMUM_RECURSION_DEPTH");
+ cmProp depthStr = this->GetDefinition("CMAKE_MAXIMUM_RECURSION_DEPTH");
if (depthStr) {
- std::istringstream s(depthStr);
+ std::istringstream s(*depthStr);
int d;
if (s >> d) {
depth = d;
@@ -627,8 +627,8 @@ void cmMakefile::IncludeScope::EnforceCMP0011()
bool cmMakefile::ReadDependentFile(const std::string& filename,
bool noPolicyScope)
{
- if (const char* def = this->GetDefinition("CMAKE_CURRENT_LIST_FILE")) {
- this->AddDefinition("CMAKE_PARENT_LIST_FILE", def);
+ if (cmProp def = this->GetDefinition("CMAKE_CURRENT_LIST_FILE")) {
+ this->AddDefinition("CMAKE_PARENT_LIST_FILE", *def);
}
std::string filenametoread = cmSystemTools::CollapseFullPath(
filename, this->GetCurrentSourceDirectory());
@@ -891,9 +891,10 @@ void cmMakefile::DoGenerate(cmLocalGenerator& lg)
void cmMakefile::Generate(cmLocalGenerator& lg)
{
this->DoGenerate(lg);
- const char* oldValue = this->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
+ cmProp oldValue = this->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
if (oldValue &&
- cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, oldValue, "2.4")) {
+ cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, oldValue->c_str(),
+ "2.4")) {
this->GetCMakeInstance()->IssueMessage(
MessageType::FATAL_ERROR,
"You have set CMAKE_BACKWARDS_COMPATIBILITY to a CMake version less "
@@ -1429,31 +1430,31 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
{
const char* prop = "IMPLICIT_DEPENDS_INCLUDE_TRANSFORM";
cmProp p = parent->GetProperty(prop);
- this->SetProperty(prop, p ? p->c_str() : nullptr);
+ this->SetProperty(prop, cmToCStr(p));
}
// compile definitions property and per-config versions
cmPolicies::PolicyStatus polSt = this->GetPolicyStatus(cmPolicies::CMP0043);
if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) {
cmProp p = parent->GetProperty("COMPILE_DEFINITIONS");
- this->SetProperty("COMPILE_DEFINITIONS", p ? p->c_str() : nullptr);
+ this->SetProperty("COMPILE_DEFINITIONS", cmToCStr(p));
std::vector<std::string> configs =
this->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
for (std::string const& config : configs) {
std::string defPropName =
cmStrCat("COMPILE_DEFINITIONS_", cmSystemTools::UpperCase(config));
cmProp prop = parent->GetProperty(defPropName);
- this->SetProperty(defPropName, prop ? prop->c_str() : nullptr);
+ this->SetProperty(defPropName, cmToCStr(prop));
}
}
// labels
cmProp p = parent->GetProperty("LABELS");
- this->SetProperty("LABELS", p ? p->c_str() : nullptr);
+ this->SetProperty("LABELS", cmToCStr(p));
// link libraries
p = parent->GetProperty("LINK_LIBRARIES");
- this->SetProperty("LINK_LIBRARIES", p ? p->c_str() : nullptr);
+ this->SetProperty("LINK_LIBRARIES", cmToCStr(p));
// the initial project name
this->StateSnapshot.SetProjectName(parent->StateSnapshot.GetProjectName());
@@ -2378,8 +2379,10 @@ cmSourceGroup* cmMakefile::GetOrCreateSourceGroup(
cmSourceGroup* cmMakefile::GetOrCreateSourceGroup(const std::string& name)
{
- const char* delimiters = this->GetDefinition("SOURCE_GROUP_DELIMITER");
- if (delimiters == nullptr) {
+ std::string delimiters;
+ if (cmProp p = this->GetDefinition("SOURCE_GROUP_DELIMITER")) {
+ delimiters = *p;
+ } else {
delimiters = "/\\";
}
return this->GetOrCreateSourceGroup(cmTokenize(name, delimiters));
@@ -2523,21 +2526,21 @@ void cmMakefile::ExpandVariablesCMP0019()
bool cmMakefile::IsOn(const std::string& name) const
{
- return cmIsOn(this->GetDef(name));
+ return cmIsOn(this->GetDefinition(name));
}
bool cmMakefile::IsSet(const std::string& name) const
{
- const char* value = this->GetDefinition(name);
+ cmProp value = this->GetDefinition(name);
if (!value) {
return false;
}
- if (!*value) {
+ if (value->empty()) {
return false;
}
- if (cmIsNOTFOUND(value)) {
+ if (cmIsNOTFOUND(*value)) {
return false;
}
@@ -2546,31 +2549,29 @@ bool cmMakefile::IsSet(const std::string& name) const
bool cmMakefile::PlatformIs32Bit() const
{
- if (const char* plat_abi =
- this->GetDefinition("CMAKE_INTERNAL_PLATFORM_ABI")) {
- if (strcmp(plat_abi, "ELF X32") == 0) {
+ if (cmProp plat_abi = this->GetDefinition("CMAKE_INTERNAL_PLATFORM_ABI")) {
+ if (*plat_abi == "ELF X32") {
return false;
}
}
- if (const char* sizeof_dptr = this->GetDefinition("CMAKE_SIZEOF_VOID_P")) {
- return atoi(sizeof_dptr) == 4;
+ if (cmProp sizeof_dptr = this->GetDefinition("CMAKE_SIZEOF_VOID_P")) {
+ return atoi(sizeof_dptr->c_str()) == 4;
}
return false;
}
bool cmMakefile::PlatformIs64Bit() const
{
- if (const char* sizeof_dptr = this->GetDefinition("CMAKE_SIZEOF_VOID_P")) {
- return atoi(sizeof_dptr) == 8;
+ if (cmProp sizeof_dptr = this->GetDefinition("CMAKE_SIZEOF_VOID_P")) {
+ return atoi(sizeof_dptr->c_str()) == 8;
}
return false;
}
bool cmMakefile::PlatformIsx32() const
{
- if (const char* plat_abi =
- this->GetDefinition("CMAKE_INTERNAL_PLATFORM_ABI")) {
- if (strcmp(plat_abi, "ELF X32") == 0) {
+ if (cmProp plat_abi = this->GetDefinition("CMAKE_INTERNAL_PLATFORM_ABI")) {
+ if (*plat_abi == "ELF X32") {
return true;
}
}
@@ -2619,7 +2620,7 @@ const char* cmMakefile::GetSONameFlag(const std::string& language) const
name += language;
}
name += "_FLAG";
- return GetDefinition(name);
+ return cmToCStr(GetDefinition(name));
}
bool cmMakefile::CanIWriteThisFile(std::string const& fileName) const
@@ -2642,7 +2643,7 @@ const std::string& cmMakefile::GetRequiredDefinition(
const std::string& name) const
{
static std::string const empty;
- const std::string* def = GetDef(name);
+ const std::string* def = GetDefinition(name);
if (!def) {
cmSystemTools::Error("Error required internal CMake variable not "
"set, cmake may not be built correctly.\n"
@@ -2670,7 +2671,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
return def != nullptr;
}
-const std::string* cmMakefile::GetDef(const std::string& name) const
+cmProp cmMakefile::GetDefinition(const std::string& name) const
{
cmProp def = this->StateSnapshot.GetDefinition(name);
if (!def) {
@@ -2683,7 +2684,7 @@ const std::string* cmMakefile::GetDef(const std::string& name) const
vv->VariableAccessed(name,
def ? cmVariableWatch::VARIABLE_READ_ACCESS
: cmVariableWatch::UNKNOWN_VARIABLE_READ_ACCESS,
- (def ? def->c_str() : nullptr), this);
+ cmToCStr(def), this);
if (watch_function_executed) {
// A callback was executed and may have caused re-allocation of the
@@ -2699,19 +2700,10 @@ const std::string* cmMakefile::GetDef(const std::string& name) const
return def;
}
-const char* cmMakefile::GetDefinition(const std::string& name) const
-{
- const std::string* def = GetDef(name);
- if (!def) {
- return nullptr;
- }
- return def->c_str();
-}
-
const std::string& cmMakefile::GetSafeDefinition(const std::string& name) const
{
static std::string const empty;
- const std::string* def = GetDef(name);
+ const std::string* def = GetDefinition(name);
if (!def) {
return empty;
}
@@ -2722,7 +2714,7 @@ bool cmMakefile::GetDefExpandList(const std::string& name,
std::vector<std::string>& out,
bool emptyArgs) const
{
- cmProp def = this->GetDef(name);
+ cmProp def = this->GetDefinition(name);
if (!def) {
return false;
}
@@ -2875,12 +2867,12 @@ MessageType cmMakefile::ExpandVariablesInStringOld(
// Lookup the definition of VAR.
std::string var(first + 1, last - first - 2);
- if (const char* val = this->GetDefinition(var)) {
+ if (cmProp val = this->GetDefinition(var)) {
// Store the value in the output escaping as requested.
if (escapeQuotes) {
- source.append(cmEscapeQuotes(val));
+ source.append(cmEscapeQuotes(*val));
} else {
- source.append(val);
+ source.append(*val);
}
}
@@ -2906,7 +2898,7 @@ MessageType cmMakefile::ExpandVariablesInStringOld(
parser.SetNoEscapeMode(noEscapes);
parser.SetReplaceAtSyntax(replaceAt);
parser.SetRemoveEmpty(removeEmpty);
- int res = parser.ParseString(source.c_str(), 0);
+ int res = parser.ParseString(source, 0);
const char* emsg = parser.GetError();
MessageType mtype = MessageType::LOG;
if (res && !emsg[0]) {
@@ -3026,7 +3018,7 @@ MessageType cmMakefile::ExpandVariablesInStringNew(
if (filename && lookup == lineVar) {
varresult = std::to_string(line);
} else {
- value = this->GetDef(lookup);
+ value = this->GetDefinition(lookup);
}
break;
case ENVIRONMENT:
@@ -3158,7 +3150,7 @@ MessageType cmMakefile::ExpandVariablesInStringNew(
if (filename && variable == lineVar) {
varresult = std::to_string(line);
} else {
- const std::string* def = this->GetDef(variable);
+ const std::string* def = this->GetDefinition(variable);
if (def) {
varresult = *def;
} else if (!this->SuppressSideEffects) {
@@ -3355,7 +3347,7 @@ bool cmMakefile::IsLoopBlock() const
return !this->LoopBlockCounter.empty() && this->LoopBlockCounter.top() > 0;
}
-std::string cmMakefile::GetExecutionFilePath() const
+std::string const& cmMakefile::GetExecutionFilePath() const
{
assert(this->StateSnapshot.IsValid());
return this->StateSnapshot.GetExecutionListFile();
@@ -3365,8 +3357,8 @@ bool cmMakefile::ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
std::vector<std::string>& outArgs,
const char* filename) const
{
- std::string efp = this->GetExecutionFilePath();
if (!filename) {
+ auto const& efp = this->GetExecutionFilePath();
filename = efp.c_str();
}
std::string value;
@@ -3397,8 +3389,8 @@ bool cmMakefile::ExpandArguments(
std::vector<cmListFileArgument> const& inArgs,
std::vector<cmExpandedCommandArgument>& outArgs, const char* filename) const
{
- std::string efp = this->GetExecutionFilePath();
if (!filename) {
+ auto const& efp = this->GetExecutionFilePath();
filename = efp.c_str();
}
std::string value;
@@ -3676,19 +3668,18 @@ int cmMakefile::TryCompile(const std::string& srcdir,
cm.SetGeneratorToolset(this->GetSafeDefinition("CMAKE_GENERATOR_TOOLSET"));
cm.LoadCache();
if (!cm.GetGlobalGenerator()->IsMultiConfig()) {
- if (const char* config =
+ if (cmProp config =
this->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION")) {
// Tell the single-configuration generator which one to use.
// Add this before the user-provided CMake arguments in case
// one of the arguments is -DCMAKE_BUILD_TYPE=...
- cm.AddCacheEntry("CMAKE_BUILD_TYPE", config, "Build configuration",
- cmStateEnums::STRING);
+ cm.AddCacheEntry("CMAKE_BUILD_TYPE", config->c_str(),
+ "Build configuration", cmStateEnums::STRING);
}
}
- const char* recursionDepth =
- this->GetDefinition("CMAKE_MAXIMUM_RECURSION_DEPTH");
+ cmProp recursionDepth = this->GetDefinition("CMAKE_MAXIMUM_RECURSION_DEPTH");
if (recursionDepth) {
- cm.AddCacheEntry("CMAKE_MAXIMUM_RECURSION_DEPTH", recursionDepth,
+ cm.AddCacheEntry("CMAKE_MAXIMUM_RECURSION_DEPTH", recursionDepth->c_str(),
"Maximum recursion depth", cmStateEnums::STRING);
}
// if cmake args were provided then pass them in
@@ -3821,9 +3812,9 @@ std::string cmMakefile::GetModulesFile(const std::string& filename,
std::string moduleInCMakeModulePath;
// Always search in CMAKE_MODULE_PATH:
- const char* cmakeModulePath = this->GetDefinition("CMAKE_MODULE_PATH");
+ cmProp cmakeModulePath = this->GetDefinition("CMAKE_MODULE_PATH");
if (cmakeModulePath) {
- std::vector<std::string> modulePath = cmExpandedList(cmakeModulePath);
+ std::vector<std::string> modulePath = cmExpandedList(*cmakeModulePath);
// Look through the possible module directories.
for (std::string itempl : modulePath) {
@@ -3862,14 +3853,14 @@ std::string cmMakefile::GetModulesFile(const std::string& filename,
}
if (!moduleInCMakeModulePath.empty() && !moduleInCMakeRoot.empty()) {
- const char* currentFile = this->GetDefinition("CMAKE_CURRENT_LIST_FILE");
+ cmProp currentFile = this->GetDefinition("CMAKE_CURRENT_LIST_FILE");
std::string mods = cmSystemTools::GetCMakeRoot() + "/Modules/";
- if (currentFile && cmSystemTools::IsSubDirectory(currentFile, mods)) {
+ if (currentFile && cmSystemTools::IsSubDirectory(*currentFile, mods)) {
switch (this->GetPolicyStatus(cmPolicies::CMP0017)) {
case cmPolicies::WARN: {
std::ostringstream e;
/* clang-format off */
- e << "File " << currentFile << " includes "
+ e << "File " << *currentFile << " includes "
<< moduleInCMakeModulePath
<< " (found via CMAKE_MODULE_PATH) which shadows "
<< moduleInCMakeRoot << ". This may cause errors later on .\n"
@@ -3919,7 +3910,7 @@ void cmMakefile::ConfigureString(const std::string& input, std::string& output,
// Replace #cmakedefine instances.
if (this->cmDefineRegex.find(line)) {
- const char* def = this->GetDefinition(this->cmDefineRegex.match(2));
+ cmProp def = this->GetDefinition(this->cmDefineRegex.match(2));
if (!cmIsOff(def)) {
const std::string indentation = this->cmDefineRegex.match(1);
cmSystemTools::ReplaceString(line, "#" + indentation + "cmakedefine",
@@ -3932,7 +3923,7 @@ void cmMakefile::ConfigureString(const std::string& input, std::string& output,
}
} else if (this->cmDefine01Regex.find(line)) {
const std::string indentation = this->cmDefine01Regex.match(1);
- const char* def = this->GetDefinition(this->cmDefine01Regex.match(2));
+ cmProp def = this->GetDefinition(this->cmDefine01Regex.match(2));
cmSystemTools::ReplaceString(line, "#" + indentation + "cmakedefine01",
"#" + indentation + "define");
output += line;
@@ -4457,11 +4448,11 @@ static std::string const nMatchesVariable = "CMAKE_MATCH_COUNT";
void cmMakefile::ClearMatches()
{
- const char* nMatchesStr = this->GetDefinition(nMatchesVariable);
+ cmProp nMatchesStr = this->GetDefinition(nMatchesVariable);
if (!nMatchesStr) {
return;
}
- int nMatches = atoi(nMatchesStr);
+ int nMatches = atoi(nMatchesStr->c_str());
for (int i = 0; i <= nMatches; i++) {
std::string const& var = matchVariables[i];
std::string const& s = this->GetSafeDefinition(var);
@@ -4510,7 +4501,7 @@ cmPolicies::PolicyStatus cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id,
bool cmMakefile::PolicyOptionalWarningEnabled(std::string const& var)
{
// Check for an explicit CMAKE_POLICY_WARNING_CMP<NNNN> setting.
- if (const char* val = this->GetDefinition(var)) {
+ if (cmProp val = this->GetDefinition(var)) {
return cmIsOn(val);
}
// Enable optional policy warnings with --debug-output, --trace,
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 69894b1..0a6e6e2 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmMakefile_h
-#define cmMakefile_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -515,8 +514,7 @@ public:
* If the variable is not found in this makefile instance, the
* cache is then queried.
*/
- const char* GetDefinition(const std::string&) const;
- const std::string* GetDef(const std::string&) const;
+ cmProp GetDefinition(const std::string&) const;
const std::string& GetSafeDefinition(const std::string&) const;
const std::string& GetRequiredDefinition(const std::string& name) const;
bool IsDefinitionSet(const std::string&) const;
@@ -944,7 +942,7 @@ public:
const char* GetDefineFlagsCMP0059() const;
- std::string GetExecutionFilePath() const;
+ std::string const& GetExecutionFilePath() const;
void EnforceDirectoryLevelRules() const;
@@ -1158,5 +1156,3 @@ private:
bool IsSourceFileTryCompile;
mutable bool SuppressSideEffects;
};
-
-#endif
diff --git a/Source/cmMakefileExecutableTargetGenerator.h b/Source/cmMakefileExecutableTargetGenerator.h
index b9bbe86..782692a 100644
--- a/Source/cmMakefileExecutableTargetGenerator.h
+++ b/Source/cmMakefileExecutableTargetGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmMakefileExecutableTargetGenerator_h
-#define cmMakefileExecutableTargetGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -28,5 +27,3 @@ protected:
private:
std::string DeviceLinkObject;
};
-
-#endif
diff --git a/Source/cmMakefileLibraryTargetGenerator.h b/Source/cmMakefileLibraryTargetGenerator.h
index ca22b09..6a38e18 100644
--- a/Source/cmMakefileLibraryTargetGenerator.h
+++ b/Source/cmMakefileLibraryTargetGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmMakefileLibraryTargetGenerator_h
-#define cmMakefileLibraryTargetGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -39,5 +38,3 @@ protected:
private:
std::string DeviceLinkObject;
};
-
-#endif
diff --git a/Source/cmMakefileProfilingData.h b/Source/cmMakefileProfilingData.h
index 1babd97..a3f128b 100644
--- a/Source/cmMakefileProfilingData.h
+++ b/Source/cmMakefileProfilingData.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmMakefileProfilingData_h
-#define cmMakefileProfilingData_h
+#pragma once
#include <memory>
#include <string>
@@ -26,4 +25,3 @@ private:
cmsys::ofstream ProfileStream;
std::unique_ptr<Json::StreamWriter> JsonWriter;
};
-#endif
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index fae1d76..e1fe0e5 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -26,10 +26,12 @@
#include "cmMakefileLibraryTargetGenerator.h"
#include "cmMakefileUtilityTargetGenerator.h"
#include "cmOutputConverter.h"
+#include "cmPolicies.h"
#include "cmProperty.h"
#include "cmRange.h"
#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
+#include "cmSourceFileLocationKind.h"
#include "cmState.h"
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
@@ -51,6 +53,17 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
if (cmProp ruleStatus = cm->GetState()->GetGlobalProperty("RULE_MESSAGES")) {
this->NoRuleMessages = cmIsOff(*ruleStatus);
}
+ switch (this->GeneratorTarget->GetPolicyStatusCMP0113()) {
+ case cmPolicies::WARN:
+ case cmPolicies::OLD:
+ this->CMP0113New = false;
+ break;
+ case cmPolicies::NEW:
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ this->CMP0113New = true;
+ break;
+ }
MacOSXContentGenerator = cm::make_unique<MacOSXContentGeneratorType>(this);
}
@@ -197,6 +210,17 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
}
}
+ std::string currentBinDir =
+ this->LocalGenerator->GetCurrentBinaryDirectory();
+
+ // Look for ISPC extra object files generated by this target
+ auto ispcAdditionalObjs =
+ this->GeneratorTarget->GetGeneratedISPCObjects(this->GetConfigName());
+ for (std::string const& ispcObj : ispcAdditionalObjs) {
+ this->CleanFiles.insert(this->LocalGenerator->MaybeConvertToRelativePath(
+ currentBinDir, ispcObj));
+ }
+
// add custom commands to the clean rules?
bool clean = cmIsOff(this->Makefile->GetProperty("CLEAN_NO_CUSTOM"));
@@ -205,9 +229,13 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
std::vector<cmSourceFile const*> customCommands;
this->GeneratorTarget->GetCustomCommands(customCommands,
this->GetConfigName());
- std::string currentBinDir =
- this->LocalGenerator->GetCurrentBinaryDirectory();
for (cmSourceFile const* sf : customCommands) {
+ if (this->CMP0113New &&
+ !this->LocalGenerator->GetCommandsVisited(this->GeneratorTarget)
+ .insert(sf)
+ .second) {
+ continue;
+ }
cmCustomCommandGenerator ccg(*sf->GetCustomCommand(),
this->GetConfigName(), this->LocalGenerator);
this->GenerateCustomRuleFile(ccg);
@@ -257,17 +285,18 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
this->GeneratorTarget->GetExtraSources(extraSources, this->GetConfigName());
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
extraSources, this->MacOSXContentGenerator.get(), this->GetConfigName());
- const char* pchExtension =
- this->Makefile->GetDefinition("CMAKE_PCH_EXTENSION");
+ cmProp pchExtension = this->Makefile->GetDefinition("CMAKE_PCH_EXTENSION");
std::vector<cmSourceFile const*> externalObjects;
this->GeneratorTarget->GetExternalObjects(externalObjects,
this->GetConfigName());
for (cmSourceFile const* sf : externalObjects) {
auto const& objectFileName = sf->GetFullPath();
- if (!cmSystemTools::StringEndsWith(objectFileName, pchExtension)) {
+ if (!cmSystemTools::StringEndsWith(objectFileName,
+ cmToCStr(pchExtension))) {
this->ExternalObjects.push_back(objectFileName);
}
}
+
std::vector<cmSourceFile const*> objectSources;
this->GeneratorTarget->GetObjectSources(objectSources,
this->GetConfigName());
@@ -525,6 +554,14 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
}
}
+ if (lang != "ISPC") {
+ auto const& headers =
+ this->GeneratorTarget->GetGeneratedISPCHeaders(config);
+ if (!headers.empty()) {
+ depends.insert(depends.end(), headers.begin(), headers.end());
+ }
+ }
+
std::string relativeObj =
cmStrCat(this->LocalGenerator->GetHomeRelativeOutputPath(), obj);
// Write the build rule.
@@ -552,6 +589,23 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
this->AppendFortranPreprocessFlags(flags, source);
}
+ std::string ispcHeaderRelative;
+ std::string ispcHeaderForShell;
+ if (lang == "ISPC") {
+ std::string ispcSource =
+ cmSystemTools::GetFilenameWithoutLastExtension(objectName);
+
+ std::string directory = this->GeneratorTarget->GetObjectDirectory(config);
+ if (cmProp prop =
+ this->GeneratorTarget->GetProperty("ISPC_HEADER_DIRECTORY")) {
+ directory =
+ cmStrCat(this->LocalGenerator->GetBinaryDirectory(), '/', *prop);
+ }
+ ispcHeaderRelative = cmStrCat(directory, '/', ispcSource, ".h");
+ ispcHeaderForShell = this->LocalGenerator->ConvertToOutputFormat(
+ ispcHeaderRelative, cmOutputConverter::SHELL);
+ }
+
// Add flags from source file properties.
const std::string COMPILE_FLAGS("COMPILE_FLAGS");
if (cmProp cflags = source.GetProperty(COMPILE_FLAGS)) {
@@ -717,6 +771,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
cmOutputConverter::SHELL);
vars.ObjectFileDir = objectFileDir.c_str();
vars.Flags = flags.c_str();
+ vars.ISPCHeader = ispcHeaderForShell.c_str();
std::string definesString = cmStrCat("$(", lang, "_DEFINES)");
@@ -735,7 +790,8 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
// ability to export compile commands
bool lang_has_preprocessor =
((lang == "C") || (lang == "CXX") || (lang == "OBJC") ||
- (lang == "OBJCXX") || (lang == "Fortran") || (lang == "CUDA"));
+ (lang == "OBJCXX") || (lang == "Fortran") || (lang == "CUDA") ||
+ lang == "ISPC");
bool const lang_has_assembly = lang_has_preprocessor;
bool const lang_can_export_cmds = lang_has_preprocessor;
@@ -786,13 +842,13 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
langIncludes.size(),
this->GetIncludes(lang, this->GetConfigName()));
- const char* eliminate[] = {
+ cmProp eliminate[] = {
this->Makefile->GetDefinition("CMAKE_START_TEMP_FILE"),
this->Makefile->GetDefinition("CMAKE_END_TEMP_FILE")
};
- for (const char* el : eliminate) {
+ for (cmProp el : eliminate) {
if (el) {
- cmSystemTools::ReplaceString(compileCommand, el, "");
+ cmSystemTools::ReplaceString(compileCommand, *el, "");
}
}
@@ -804,7 +860,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
std::string compilerLauncher;
if (!compileCommands.empty() &&
(lang == "C" || lang == "CXX" || lang == "Fortran" || lang == "CUDA" ||
- lang == "OBJC" || lang == "OBJCXX")) {
+ lang == "ISPC" || lang == "OBJC" || lang == "OBJCXX")) {
std::string const clauncher_prop = lang + "_COMPILER_LAUNCHER";
cmProp clauncher = this->GeneratorTarget->GetProperty(clauncher_prop);
if (cmNonempty(clauncher)) {
@@ -838,9 +894,12 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
}
if (cmNonempty(tidy)) {
run_iwyu += " --tidy=";
- const char* driverMode = this->Makefile->GetDefinition(
- "CMAKE_" + lang + "_CLANG_TIDY_DRIVER_MODE");
- if (!cmNonempty(driverMode)) {
+ cmProp p = this->Makefile->GetDefinition("CMAKE_" + lang +
+ "_CLANG_TIDY_DRIVER_MODE");
+ std::string driverMode;
+ if (cmNonempty(p)) {
+ driverMode = *p;
+ } else {
driverMode = lang == "C" ? "gcc" : "g++";
}
run_iwyu += this->LocalGenerator->EscapeForShell(
@@ -910,9 +969,16 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
if (!evaluated_outputs.empty()) {
// Register these as extra files to clean.
cmExpandList(evaluated_outputs, outputs);
- this->CleanFiles.insert(outputs.begin() + 1, outputs.end());
}
}
+ if (!ispcHeaderRelative
+ .empty()) { // can't move ispcHeader as vars is using it
+ outputs.emplace_back(ispcHeaderRelative);
+ }
+
+ if (outputs.size() > 1) {
+ this->CleanFiles.insert(outputs.begin() + 1, outputs.end());
+ }
// Write the rule.
this->WriteMakeRule(*this->BuildFileStream, nullptr, outputs, depends,
@@ -942,10 +1008,10 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
std::string preprocessRuleVar =
cmStrCat("CMAKE_", lang, "_CREATE_PREPROCESSED_SOURCE");
- if (const char* preprocessRule =
+ if (cmProp preprocessRule =
this->Makefile->GetDefinition(preprocessRuleVar)) {
std::vector<std::string> preprocessCommands =
- cmExpandedList(preprocessRule);
+ cmExpandedList(*preprocessRule);
std::string shellObjI = this->LocalGenerator->ConvertToOutputFormat(
objI, cmOutputConverter::SHELL);
@@ -987,10 +1053,10 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
std::string assemblyRuleVar =
cmStrCat("CMAKE_", lang, "_CREATE_ASSEMBLY_SOURCE");
- if (const char* assemblyRule =
+ if (cmProp assemblyRule =
this->Makefile->GetDefinition(assemblyRuleVar)) {
std::vector<std::string> assemblyCommands =
- cmExpandedList(assemblyRule);
+ cmExpandedList(*assemblyRule);
std::string shellObjS = this->LocalGenerator->ConvertToOutputFormat(
objS, cmOutputConverter::SHELL);
@@ -1243,16 +1309,7 @@ void cmMakefileTargetGenerator::DriveCustomCommands(
std::vector<std::string>& depends)
{
// Depend on all custom command outputs.
- std::vector<cmSourceFile*> sources;
- this->GeneratorTarget->GetSourceFiles(
- sources, this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
- for (cmSourceFile* source : sources) {
- if (cmCustomCommand* cc = source->GetCustomCommand()) {
- cmCustomCommandGenerator ccg(*cc, this->GetConfigName(),
- this->LocalGenerator);
- cm::append(depends, ccg.GetOutputs());
- }
- }
+ cm::append(depends, this->CustomCommandOutputs);
}
void cmMakefileTargetGenerator::WriteObjectDependRules(
@@ -1299,6 +1356,22 @@ void cmMakefileTargetGenerator::GenerateCustomRuleFile(
bool symbolic = this->WriteMakeRule(*this->BuildFileStream, nullptr, outputs,
depends, commands);
+ // Symbolic inputs are not expected to exist, so add dummy rules.
+ if (this->CMP0113New && !depends.empty()) {
+ std::vector<std::string> no_depends;
+ std::vector<std::string> no_commands;
+ for (std::string const& dep : depends) {
+ if (cmSourceFile* dsf =
+ this->Makefile->GetSource(dep, cmSourceFileLocationKind::Known)) {
+ if (dsf->GetPropertyAsBool("SYMBOLIC")) {
+ this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, nullptr,
+ dep, no_depends, no_commands,
+ true);
+ }
+ }
+ }
+ }
+
// If the rule has changed make sure the output is rebuilt.
if (!symbolic) {
this->GlobalGenerator->AddRuleHash(ccg.GetOutputs(), content.str());
@@ -1313,6 +1386,8 @@ void cmMakefileTargetGenerator::GenerateCustomRuleFile(
this->LocalGenerator->AddImplicitDepends(this->GeneratorTarget, idi.first,
objFullPath, srcFullPath);
}
+
+ this->CustomCommandOutputs.insert(outputs.begin(), outputs.end());
}
void cmMakefileTargetGenerator::MakeEchoProgress(
@@ -1337,17 +1412,17 @@ void cmMakefileTargetGenerator::WriteObjectsVariable(
<< this->GeneratorTarget->GetName() << "\n"
<< variableName << " =";
std::string object;
- const char* lineContinue =
- this->Makefile->GetDefinition("CMAKE_MAKE_LINE_CONTINUE");
- if (!lineContinue) {
+ std::string lineContinue;
+ if (cmProp p = this->Makefile->GetDefinition("CMAKE_MAKE_LINE_CONTINUE")) {
+ lineContinue = *p;
+ } else {
lineContinue = "\\";
}
- const char* pchExtension =
- this->Makefile->GetDefinition("CMAKE_PCH_EXTENSION");
+ cmProp pchExtension = this->Makefile->GetDefinition("CMAKE_PCH_EXTENSION");
for (std::string const& obj : this->Objects) {
- if (cmSystemTools::StringEndsWith(obj, pchExtension)) {
+ if (cmSystemTools::StringEndsWith(obj, cmToCStr(pchExtension))) {
continue;
}
*this->BuildFileStream << " " << lineContinue << "\n";
@@ -1442,14 +1517,13 @@ private:
void cmMakefileTargetGenerator::WriteObjectsStrings(
std::vector<std::string>& objStrings, std::string::size_type limit)
{
- const char* pchExtension =
- this->Makefile->GetDefinition("CMAKE_PCH_EXTENSION");
+ cmProp pchExtension = this->Makefile->GetDefinition("CMAKE_PCH_EXTENSION");
cmMakefileTargetGeneratorObjectStrings helper(
objStrings, this->LocalGenerator,
this->LocalGenerator->GetStateSnapshot().GetDirectory(), limit);
for (std::string const& obj : this->Objects) {
- if (cmSystemTools::StringEndsWith(obj, pchExtension)) {
+ if (cmSystemTools::StringEndsWith(obj, cmToCStr(pchExtension))) {
continue;
}
helper.Feed(obj);
@@ -1457,6 +1531,11 @@ void cmMakefileTargetGenerator::WriteObjectsStrings(
for (std::string const& obj : this->ExternalObjects) {
helper.Feed(obj);
}
+ auto ispcAdditionalObjs =
+ this->GeneratorTarget->GetGeneratedISPCObjects(this->GetConfigName());
+ for (std::string const& obj : ispcAdditionalObjs) {
+ helper.Feed(obj);
+ }
helper.Done();
}
@@ -1572,8 +1651,8 @@ std::string cmMakefileTargetGenerator::GetLinkRule(
cmStrCat("CMAKE_",
this->GeneratorTarget->GetLinkerLanguage(this->GetConfigName()),
"_GNUtoMS_RULE");
- if (const char* rule = this->Makefile->GetDefinition(ruleVar)) {
- linkRule += rule;
+ if (cmProp rule = this->Makefile->GetDefinition(ruleVar)) {
+ linkRule += *rule;
}
}
return linkRule;
@@ -1622,8 +1701,8 @@ bool cmMakefileTargetGenerator::CheckUseResponseFileForObjects(
// Check for an explicit setting one way or the other.
std::string const responseVar =
"CMAKE_" + l + "_USE_RESPONSE_FILE_FOR_OBJECTS";
- if (const char* val = this->Makefile->GetDefinition(responseVar)) {
- if (*val) {
+ if (cmProp val = this->Makefile->GetDefinition(responseVar)) {
+ if (!val->empty()) {
return cmIsOn(val);
}
}
@@ -1661,8 +1740,8 @@ bool cmMakefileTargetGenerator::CheckUseResponseFileForLibraries(
// Check for an explicit setting one way or the other.
std::string const responseVar =
"CMAKE_" + l + "_USE_RESPONSE_FILE_FOR_LIBRARIES";
- if (const char* val = this->Makefile->GetDefinition(responseVar)) {
- if (*val) {
+ if (cmProp val = this->Makefile->GetDefinition(responseVar)) {
+ if (!val->empty()) {
return cmIsOn(val);
}
}
@@ -1723,8 +1802,10 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
cmStrCat("CMAKE_",
this->GeneratorTarget->GetLinkerLanguage(this->GetConfigName()),
"_RESPONSE_FILE_LINK_FLAG");
- const char* responseFlag = this->Makefile->GetDefinition(responseFlagVar);
- if (!responseFlag) {
+ std::string responseFlag;
+ if (cmProp p = this->Makefile->GetDefinition(responseFlagVar)) {
+ responseFlag = *p;
+ } else {
responseFlag = "@";
}
@@ -1761,8 +1842,10 @@ void cmMakefileTargetGenerator::CreateObjectLists(
cmStrCat("CMAKE_",
this->GeneratorTarget->GetLinkerLanguage(this->GetConfigName()),
"_RESPONSE_FILE_LINK_FLAG");
- const char* responseFlag = this->Makefile->GetDefinition(responseFlagVar);
- if (!responseFlag) {
+ std::string responseFlag;
+ if (cmProp p = this->Makefile->GetDefinition(responseFlagVar)) {
+ responseFlag = *p;
+ } else {
responseFlag = "@";
}
@@ -1857,11 +1940,11 @@ void cmMakefileTargetGenerator::GenDefFile(
this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), objlist_file),
cmOutputConverter::SHELL);
- const char* nm_executable = this->Makefile->GetDefinition("CMAKE_NM");
+ cmProp nm_executable = this->Makefile->GetDefinition("CMAKE_NM");
if (cmNonempty(nm_executable)) {
cmd += " --nm=";
cmd += this->LocalCommonGenerator->ConvertToOutputFormat(
- nm_executable, cmOutputConverter::SHELL);
+ *nm_executable, cmOutputConverter::SHELL);
}
real_link_commands.insert(real_link_commands.begin(), cmd);
// create a list of obj files for the -E __create_def to read
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index f38f862..1740d54 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmMakefileTargetGenerator_h
-#define cmMakefileTargetGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -197,6 +196,8 @@ protected:
unsigned long NumberOfProgressActions;
bool NoRuleMessages;
+ bool CMP0113New = false;
+
// the path to the directory the build file is in
std::string TargetBuildDirectory;
std::string TargetBuildDirectoryFull;
@@ -229,6 +230,9 @@ protected:
// Set of extra output files to be driven by the build.
std::set<std::string> ExtraFiles;
+ // Set of custom command output files to be driven by the build.
+ std::set<std::string> CustomCommandOutputs;
+
using MultipleOutputPairsType = std::map<std::string, std::string>;
MultipleOutputPairsType MultipleOutputPairs;
bool WriteMakeRule(std::ostream& os, const char* comment,
@@ -245,5 +249,3 @@ protected:
std::unique_ptr<cmOSXBundleGenerator> OSXBundleGenerator;
std::unique_ptr<MacOSXContentGeneratorType> MacOSXContentGenerator;
};
-
-#endif
diff --git a/Source/cmMakefileUtilityTargetGenerator.h b/Source/cmMakefileUtilityTargetGenerator.h
index be243a7..d2b4ba5 100644
--- a/Source/cmMakefileUtilityTargetGenerator.h
+++ b/Source/cmMakefileUtilityTargetGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmMakefileUtilityTargetGenerator_h
-#define cmMakefileUtilityTargetGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -21,5 +20,3 @@ public:
protected:
};
-
-#endif
diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h
index de7bf08..e420e64 100644
--- a/Source/cmMarkAsAdvancedCommand.h
+++ b/Source/cmMarkAsAdvancedCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmMarkAsAdvancedCommand_h
-#define cmMarkAsAdvancedCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -17,5 +16,3 @@ class cmExecutionStatus;
*/
bool cmMarkAsAdvancedCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h
index ac1957c..e6b347b 100644
--- a/Source/cmMathCommand.h
+++ b/Source/cmMathCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmMathCommand_h
-#define cmMathCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -13,5 +12,3 @@ class cmExecutionStatus;
/// Mathematical expressions: math(EXPR ...) command.
bool cmMathCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h
index 7d544c4..c37098c 100644
--- a/Source/cmMessageCommand.h
+++ b/Source/cmMessageCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmMessageCommand_h
-#define cmMessageCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -16,5 +15,3 @@ class cmExecutionStatus;
*/
bool cmMessageCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmMessageType.h b/Source/cmMessageType.h
index b57b86b..44de429 100644
--- a/Source/cmMessageType.h
+++ b/Source/cmMessageType.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmMessageType_h
-#define cmMessageType_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -17,5 +16,3 @@ enum class MessageType
DEPRECATION_ERROR,
DEPRECATION_WARNING
};
-
-#endif
diff --git a/Source/cmMessenger.h b/Source/cmMessenger.h
index 8c09782..b6f5712 100644
--- a/Source/cmMessenger.h
+++ b/Source/cmMessenger.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmMessenger_h
-#define cmMessenger_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -57,5 +56,3 @@ private:
bool DevWarningsAsErrors = false;
bool DeprecatedWarningsAsErrors = false;
};
-
-#endif
diff --git a/Source/cmNewLineStyle.h b/Source/cmNewLineStyle.h
index ab9002e..a2b985b 100644
--- a/Source/cmNewLineStyle.h
+++ b/Source/cmNewLineStyle.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmNewLineStyle_h
-#define cmNewLineStyle_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -35,5 +34,3 @@ public:
private:
Style NewLineStyle = Invalid;
};
-
-#endif
diff --git a/Source/cmNinjaLinkLineComputer.h b/Source/cmNinjaLinkLineComputer.h
index b2b2e84..5d22f3e 100644
--- a/Source/cmNinjaLinkLineComputer.h
+++ b/Source/cmNinjaLinkLineComputer.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmNinjaLinkLineComputer_h
-#define cmNinjaLinkLineComputer_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -29,5 +28,3 @@ public:
private:
cmGlobalNinjaGenerator const* GG;
};
-
-#endif
diff --git a/Source/cmNinjaLinkLineDeviceComputer.h b/Source/cmNinjaLinkLineDeviceComputer.h
index 84ced5b..457f036 100644
--- a/Source/cmNinjaLinkLineDeviceComputer.h
+++ b/Source/cmNinjaLinkLineDeviceComputer.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmNinjaLinkLineDeviceComputer_h
-#define cmNinjaLinkLineDeviceComputer_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -30,5 +29,3 @@ public:
private:
cmGlobalNinjaGenerator const* GG;
};
-
-#endif
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index bde5ee7..210b36e 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -307,10 +307,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile,
// build response file name
std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_LINK_FLAG";
- const char* flag = GetMakefile()->GetDefinition(cmakeLinkVar);
+ cmProp flag = GetMakefile()->GetDefinition(cmakeLinkVar);
if (flag) {
- responseFlag = flag;
+ responseFlag = *flag;
} else {
responseFlag = "@";
}
@@ -478,15 +478,15 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd(
// CMAKE_<lang>_CREATE_STATIC_LIBRARY_IPO define instead.
std::string linkCmdVar = this->GetGeneratorTarget()->GetCreateRuleVariable(
this->TargetLinkLanguage(config), config);
- const char* linkCmd = mf->GetDefinition(linkCmdVar);
+ cmProp linkCmd = mf->GetDefinition(linkCmdVar);
if (linkCmd) {
- std::string linkCmdStr = linkCmd;
+ std::string linkCmdStr = *linkCmd;
if (this->GetGeneratorTarget()->HasImplibGNUtoMS(config)) {
std::string ruleVar =
cmStrCat("CMAKE_", this->GeneratorTarget->GetLinkerLanguage(config),
"_GNUtoMS_RULE");
- if (const char* rule = this->Makefile->GetDefinition(ruleVar)) {
- linkCmdStr += rule;
+ if (cmProp rule = this->Makefile->GetDefinition(ruleVar)) {
+ linkCmdStr += *rule;
}
}
cmExpandList(linkCmdStr, linkCmds);
@@ -911,11 +911,16 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
linkBuild.ExplicitDeps.push_back(
this->ConvertToNinjaPath(this->GetSourceFilePath(source)));
}
-
linkBuild.Outputs.push_back(vars["SWIFT_MODULE"]);
} else {
linkBuild.ExplicitDeps = this->GetObjects(config);
}
+
+ std::vector<std::string> extraISPCObjects =
+ this->GetGeneratorTarget()->GetGeneratedISPCObjects(config);
+ std::transform(extraISPCObjects.begin(), extraISPCObjects.end(),
+ std::back_inserter(linkBuild.ExplicitDeps), MapToNinjaPath());
+
linkBuild.ImplicitDeps =
this->ComputeLinkDeps(this->TargetLinkLanguage(config), config);
@@ -1027,8 +1032,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
gt->GetFullNameComponents(prefix, base, suffix, config);
std::string dbg_suffix = ".dbg";
// TODO: Where to document?
- if (auto d = mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX")) {
- dbg_suffix = d;
+ if (cmProp d = mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX")) {
+ dbg_suffix = *d;
}
vars["TARGET_PDB"] = base + suffix + dbg_suffix;
}
@@ -1091,11 +1096,11 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
cmd += this->GetLocalGenerator()->ConvertToOutputFormat(
obj_list_file, cmOutputConverter::SHELL);
- const char* nm_executable = GetMakefile()->GetDefinition("CMAKE_NM");
+ cmProp nm_executable = GetMakefile()->GetDefinition("CMAKE_NM");
if (cmNonempty(nm_executable)) {
cmd += " --nm=";
cmd += this->LocalCommonGenerator->ConvertToOutputFormat(
- nm_executable, cmOutputConverter::SHELL);
+ *nm_executable, cmOutputConverter::SHELL);
}
preLinkCmdLines.push_back(std::move(cmd));
@@ -1144,7 +1149,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
// build response file name
std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_LINK_FLAG";
- const char* flag = GetMakefile()->GetDefinition(cmakeLinkVar);
+ cmProp flag = GetMakefile()->GetDefinition(cmakeLinkVar);
bool const lang_supports_response =
!(this->TargetLinkLanguage(config) == "RC" ||
diff --git a/Source/cmNinjaNormalTargetGenerator.h b/Source/cmNinjaNormalTargetGenerator.h
index 9de99b9..25e40d0 100644
--- a/Source/cmNinjaNormalTargetGenerator.h
+++ b/Source/cmNinjaNormalTargetGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmNinjaNormalTargetGenerator_h
-#define cmNinjaNormalTargetGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -46,5 +45,3 @@ private:
std::string TargetLinkLanguage(const std::string& config) const;
std::string DeviceLinkObject;
};
-
-#endif // ! cmNinjaNormalTargetGenerator_h
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 57f526e..accdcf1 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -631,6 +631,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
vars.TargetCompilePDB = "$TARGET_COMPILE_PDB";
vars.ObjectDir = "$OBJECT_DIR";
vars.ObjectFileDir = "$OBJECT_FILE_DIR";
+ vars.ISPCHeader = "$ISPC_HEADER_FILE";
cmMakefile* mf = this->GetMakefile();
@@ -761,9 +762,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
if (!mf->GetIsSourceFileTryCompile()) {
rule.DepType = "gcc";
rule.DepFile = "$DEP_FILE";
- auto d = mf->GetDefinition("CMAKE_C_COMPILER");
+ cmProp d = mf->GetDefinition("CMAKE_C_COMPILER");
const std::string cl =
- d ? d : mf->GetSafeDefinition("CMAKE_CXX_COMPILER");
+ d ? *d : mf->GetSafeDefinition("CMAKE_CXX_COMPILER");
cldeps = cmStrCat('"', cmSystemTools::GetCMClDepsCommand(), "\" ", lang,
' ', vars.Source, " $DEP_FILE $out \"",
mf->GetSafeDefinition("CMAKE_CL_SHOWINCLUDES_PREFIX"),
@@ -777,8 +778,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
if (!depfileFlags.empty()) {
cmSystemTools::ReplaceString(depfileFlags, "<DEPFILE>", "$DEP_FILE");
cmSystemTools::ReplaceString(depfileFlags, "<OBJECT>", "$out");
- cmSystemTools::ReplaceString(depfileFlags, "<CMAKE_C_COMPILER>",
- mf->GetDefinition("CMAKE_C_COMPILER"));
+ cmSystemTools::ReplaceString(
+ depfileFlags, "<CMAKE_C_COMPILER>",
+ cmToCStr(mf->GetDefinition("CMAKE_C_COMPILER")));
flags += cmStrCat(' ', depfileFlags);
}
}
@@ -811,7 +813,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
std::string compilerLauncher;
if (!compileCmds.empty() &&
(lang == "C" || lang == "CXX" || lang == "Fortran" || lang == "CUDA" ||
- lang == "OBJC" || lang == "OBJCXX")) {
+ lang == "ISPC" || lang == "OBJC" || lang == "OBJCXX")) {
std::string const clauncher_prop = cmStrCat(lang, "_COMPILER_LAUNCHER");
cmProp clauncher = this->GeneratorTarget->GetProperty(clauncher_prop);
if (cmNonempty(clauncher)) {
@@ -846,9 +848,12 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
}
if (cmNonempty(tidy)) {
run_iwyu += " --tidy=";
- const char* driverMode = this->Makefile->GetDefinition(
+ cmProp p = this->Makefile->GetDefinition(
cmStrCat("CMAKE_", lang, "_CLANG_TIDY_DRIVER_MODE"));
- if (!cmNonempty(driverMode)) {
+ std::string driverMode;
+ if (cmNonempty(p)) {
+ driverMode = *p;
+ } else {
driverMode = lang == "C" ? "gcc" : "g++";
}
run_iwyu += this->GetLocalGenerator()->EscapeForShell(
@@ -941,15 +946,15 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements(
config);
}
if (firstForConfig) {
- const char* pchExtension =
- GetMakefile()->GetDefinition("CMAKE_PCH_EXTENSION");
+ cmProp pchExtension = GetMakefile()->GetDefinition("CMAKE_PCH_EXTENSION");
std::vector<cmSourceFile const*> externalObjects;
this->GeneratorTarget->GetExternalObjects(externalObjects, config);
for (cmSourceFile const* sf : externalObjects) {
auto objectFileName = this->GetGlobalGenerator()->ExpandCFGIntDir(
this->GetSourceFilePath(sf), config);
- if (!cmSystemTools::StringEndsWith(objectFileName, pchExtension)) {
+ if (!cmSystemTools::StringEndsWith(objectFileName,
+ cmToCStr(pchExtension))) {
this->Configs[config].Objects.push_back(objectFileName);
}
}
@@ -1158,7 +1163,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
// build response file name
std::string cmakeLinkVar = cmStrCat(cmakeVarLang, "_RESPONSE_FILE_FLAG");
- const char* flag = GetMakefile()->GetDefinition(cmakeLinkVar);
+ cmProp flag = GetMakefile()->GetDefinition(cmakeLinkVar);
bool const lang_supports_response =
!(language == "RC" || (language == "CUDA" && !flag));
@@ -1199,9 +1204,10 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
objBuild.Outputs.push_back(objectFileName);
if (firstForConfig) {
- const char* pchExtension =
+ cmProp pchExtension =
this->GetMakefile()->GetDefinition("CMAKE_PCH_EXTENSION");
- if (!cmSystemTools::StringEndsWith(objectFileName, pchExtension)) {
+ if (!cmSystemTools::StringEndsWith(objectFileName,
+ cmToCStr(pchExtension))) {
// Add this object to the list of object files.
this->Configs[config].Objects.push_back(objectFileName);
}
@@ -1369,6 +1375,55 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
objBuild.RspFile = cmStrCat(objectFileName, ".rsp");
+ if (language == "ISPC") {
+ std::string const& objectName =
+ this->GeneratorTarget->GetObjectName(source);
+ std::string ispcSource =
+ cmSystemTools::GetFilenameWithoutLastExtension(objectName);
+
+ std::string ispcDirectory = objectFileDir;
+ if (cmProp prop =
+ this->GeneratorTarget->GetProperty("ISPC_HEADER_DIRECTORY")) {
+ ispcDirectory = *prop;
+ }
+ ispcDirectory =
+ cmStrCat(this->LocalGenerator->GetBinaryDirectory(), '/', ispcDirectory);
+
+ std::string ispcHeader = cmStrCat(ispcDirectory, '/', ispcSource, ".h");
+ ispcHeader = this->ConvertToNinjaPath(ispcHeader);
+
+ // Make sure ninja knows what command generates the header
+ objBuild.ImplicitOuts.push_back(ispcHeader);
+
+ // Make sure ninja knows how to clean the generated header
+ this->GetGlobalGenerator()->AddAdditionalCleanFile(ispcHeader, config);
+
+ auto ispcSuffixes =
+ detail::ComputeISPCObjectSuffixes(this->GeneratorTarget);
+ if (ispcSuffixes.size() > 1) {
+ auto ispcSideEfffectObjects = detail::ComputeISPCExtraObjects(
+ objectName, ispcDirectory, ispcSuffixes);
+
+ for (auto sideEffect : ispcSideEfffectObjects) {
+ sideEffect = this->ConvertToNinjaPath(sideEffect);
+ objBuild.ImplicitOuts.emplace_back(sideEffect);
+ this->GetGlobalGenerator()->AddAdditionalCleanFile(sideEffect, config);
+ }
+ }
+
+ vars["ISPC_HEADER_FILE"] =
+ this->GetLocalGenerator()->ConvertToOutputFormat(
+ ispcHeader, cmOutputConverter::SHELL);
+ } else {
+ auto headers = this->GeneratorTarget->GetGeneratedISPCHeaders(config);
+ if (!headers.empty()) {
+ std::transform(headers.begin(), headers.end(), headers.begin(),
+ MapToNinjaPath());
+ objBuild.OrderOnlyDeps.insert(objBuild.OrderOnlyDeps.end(),
+ headers.begin(), headers.end());
+ }
+ }
+
if (language == "Swift") {
this->EmitSwiftDependencyInfo(source, config);
} else {
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 8d4372e..9d9ce60 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmNinjaTargetGenerator_h
-#define cmNinjaTargetGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -219,5 +218,3 @@ private:
std::map<std::string, ByConfig> Configs;
};
-
-#endif // ! cmNinjaTargetGenerator_h
diff --git a/Source/cmNinjaTypes.h b/Source/cmNinjaTypes.h
index bd0e83f..320f41b 100644
--- a/Source/cmNinjaTypes.h
+++ b/Source/cmNinjaTypes.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmNinjaTypes_h
-#define cmNinjaTypes_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -60,5 +59,3 @@ public:
cmNinjaVars Variables;
std::string RspFile;
};
-
-#endif // ! cmNinjaTypes_h
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx
index 9508bb9..ad1d5f1 100644
--- a/Source/cmNinjaUtilityTargetGenerator.cxx
+++ b/Source/cmNinjaUtilityTargetGenerator.cxx
@@ -100,6 +100,8 @@ void cmNinjaUtilityTargetGenerator::Generate(const std::string& config)
if (genTarget->Target->GetType() != cmStateEnums::GLOBAL_TARGET) {
lg->AppendTargetOutputs(genTarget, gg->GetByproductsForCleanTarget(),
config);
+ std::copy(util_outputs.begin(), util_outputs.end(),
+ std::back_inserter(gg->GetByproductsForCleanTarget()));
}
lg->AppendTargetDepends(genTarget, deps, config, config,
DependOnTargetArtifact);
diff --git a/Source/cmNinjaUtilityTargetGenerator.h b/Source/cmNinjaUtilityTargetGenerator.h
index ca3f0a4..24b47f8 100644
--- a/Source/cmNinjaUtilityTargetGenerator.h
+++ b/Source/cmNinjaUtilityTargetGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmNinjaUtilityTargetGenerator_h
-#define cmNinjaUtilityTargetGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -19,5 +18,3 @@ public:
void Generate(const std::string& config) override;
};
-
-#endif // ! cmNinjaUtilityTargetGenerator_h
diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h
index 5bf1d98..4c33fcc 100644
--- a/Source/cmOSXBundleGenerator.h
+++ b/Source/cmOSXBundleGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmOSXBundleGenerator_h
-#define cmOSXBundleGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -69,5 +68,3 @@ private:
cmLocalGenerator* LocalGenerator;
std::set<std::string>* MacContentFolders;
};
-
-#endif
diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h
index cbd1cb8..912e0ee 100644
--- a/Source/cmOptionCommand.h
+++ b/Source/cmOptionCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmOptionCommand_h
-#define cmOptionCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -17,4 +16,3 @@ class cmExecutionStatus;
*/
bool cmOptionCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-#endif
diff --git a/Source/cmOrderDirectories.h b/Source/cmOrderDirectories.h
index 8ce53e0..7788ea8 100644
--- a/Source/cmOrderDirectories.h
+++ b/Source/cmOrderDirectories.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmOrderDirectories_h
-#define cmOrderDirectories_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -95,5 +94,3 @@ private:
friend class cmOrderDirectoriesConstraint;
friend class cmOrderDirectoriesConstraintLibrary;
};
-
-#endif
diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h
index a8b4528..655bc87 100644
--- a/Source/cmOutputConverter.h
+++ b/Source/cmOutputConverter.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmOutputConverter_h
-#define cmOutputConverter_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -117,5 +116,3 @@ private:
bool LinkScriptShell;
};
-
-#endif
diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h
index 4c11894..9daba8f 100644
--- a/Source/cmOutputRequiredFilesCommand.h
+++ b/Source/cmOutputRequiredFilesCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmOutputRequiredFilesCommand_h
-#define cmOutputRequiredFilesCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmOutputRequiredFilesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx
index d712edb..2465069 100644
--- a/Source/cmParseArgumentsCommand.cxx
+++ b/Source/cmParseArgumentsCommand.cxx
@@ -13,6 +13,7 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmProperty.h"
#include "cmRange.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -195,7 +196,7 @@ bool cmParseArgumentsCommand(std::vector<std::string> const& args,
for (unsigned long i = argvStart; i < count; ++i) {
std::ostringstream argName;
argName << "ARGV" << i;
- const char* arg = status.GetMakefile().GetDefinition(argName.str());
+ cmProp arg = status.GetMakefile().GetDefinition(argName.str());
if (!arg) {
status.GetMakefile().IssueMessage(MessageType::FATAL_ERROR,
"PARSE_ARGV called with " +
@@ -203,7 +204,7 @@ bool cmParseArgumentsCommand(std::vector<std::string> const& args,
cmSystemTools::SetFatalErrorOccured();
return true;
}
- list.emplace_back(arg);
+ list.emplace_back(*arg);
}
}
diff --git a/Source/cmParseArgumentsCommand.h b/Source/cmParseArgumentsCommand.h
index b2e436d..008977b 100644
--- a/Source/cmParseArgumentsCommand.h
+++ b/Source/cmParseArgumentsCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmParseArgumentsCommand_h
-#define cmParseArgumentsCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmParseArgumentsCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmPathLabel.h b/Source/cmPathLabel.h
index 55dffab..d19d2be 100644
--- a/Source/cmPathLabel.h
+++ b/Source/cmPathLabel.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmPathLabel_h
-#define cmPathLabel_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -33,5 +32,3 @@ protected:
std::string Label;
unsigned int Hash;
};
-
-#endif
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 1a12dab..f9ec0d6 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmPolicies_h
-#define cmPolicies_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -330,6 +329,14 @@ class cmMakefile;
SELECT(POLICY, CMP0111, \
"An imported target with a missing location fails during " \
"generation.", \
+ 3, 19, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0112, \
+ "Target file component generator expressions do not add target " \
+ "dependencies.", \
+ 3, 19, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0113, \
+ "Makefile generators do not repeat custom commands from target " \
+ "dependencies.", \
3, 19, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
@@ -363,7 +370,9 @@ class cmMakefile;
F(CMP0099) \
F(CMP0104) \
F(CMP0105) \
- F(CMP0108)
+ F(CMP0108) \
+ F(CMP0112) \
+ F(CMP0113)
/** \class cmPolicies
* \brief Handles changes in CMake behavior and policies
@@ -444,5 +453,3 @@ public:
std::bitset<cmPolicies::CMPCOUNT * POLICY_STATUS_COUNT> Status;
};
};
-
-#endif
diff --git a/Source/cmProcessOutput.h b/Source/cmProcessOutput.h
index 3db47a4..a1f73bd 100644
--- a/Source/cmProcessOutput.h
+++ b/Source/cmProcessOutput.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmProcessOutput_h
-#define cmProcessOutput_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -84,5 +83,3 @@ private:
bool DoDecodeText(std::string raw, std::string& decoded, wchar_t* lastChar);
#endif
};
-
-#endif
diff --git a/Source/cmProcessTools.h b/Source/cmProcessTools.h
index 21d59c4..74ec5e0 100644
--- a/Source/cmProcessTools.h
+++ b/Source/cmProcessTools.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmProcessTools_h
-#define cmProcessTools_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -86,5 +85,3 @@ public:
OutputParser* err = nullptr,
Encoding encoding = cmProcessOutput::Auto);
};
-
-#endif
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index bb6db92..0cfba63 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -15,6 +15,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -302,7 +303,7 @@ bool cmProjectCommand(std::vector<std::string> const& args,
}
std::string vw;
for (std::string const& i : vv) {
- const char* const v = mf.GetDefinition(i);
+ cmProp v = mf.GetDefinition(i);
if (cmNonempty(v)) {
if (cmp0048 == cmPolicies::WARN) {
if (!injectedProjectCommand) {
@@ -352,12 +353,12 @@ static bool IncludeByVariable(cmExecutionStatus& status,
const std::string& variable)
{
cmMakefile& mf = status.GetMakefile();
- const char* const include = mf.GetDefinition(variable);
+ cmProp include = mf.GetDefinition(variable);
if (!include) {
return true;
}
- const bool readit = mf.ReadDependentFile(include);
+ const bool readit = mf.ReadDependentFile(*include);
if (readit) {
return true;
}
@@ -366,7 +367,7 @@ static bool IncludeByVariable(cmExecutionStatus& status,
return true;
}
- status.SetError(cmStrCat("could not find file:\n ", include));
+ status.SetError(cmStrCat("could not find file:\n ", *include));
return false;
}
diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h
index c06b459..33f0955 100644
--- a/Source/cmProjectCommand.h
+++ b/Source/cmProjectCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmProjectCommand_h
-#define cmProjectCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmProjectCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmProperty.h b/Source/cmProperty.h
index b0fcce7..1e03c3f 100644
--- a/Source/cmProperty.h
+++ b/Source/cmProperty.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmProperty_h
-#define cmProperty_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -26,4 +25,12 @@ public:
using cmProp = const std::string*;
-#endif
+inline const char* cmToCStr(cmProp p)
+{
+ return p ? p->c_str() : nullptr;
+}
+
+inline const char* cmToCStrSafe(cmProp p)
+{
+ return p ? p->c_str() : "";
+}
diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h
index f83bc4f..fca936e 100644
--- a/Source/cmPropertyDefinition.h
+++ b/Source/cmPropertyDefinition.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmPropertyDefinition_h
-#define cmPropertyDefinition_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -65,5 +64,3 @@ private:
using key_type = std::pair<std::string, cmProperty::ScopeType>;
std::map<key_type, cmPropertyDefinition> Map_;
};
-
-#endif
diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h
index 5fc46a2..cda585a 100644
--- a/Source/cmPropertyMap.h
+++ b/Source/cmPropertyMap.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmPropertyMap_h
-#define cmPropertyMap_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -49,5 +48,3 @@ public:
private:
std::unordered_map<std::string, std::string> Map_;
};
-
-#endif
diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx
index 795c2ee..de462db 100644
--- a/Source/cmQTWrapCPPCommand.cxx
+++ b/Source/cmQTWrapCPPCommand.cxx
@@ -41,7 +41,7 @@ bool cmQTWrapCPPCommand(std::vector<std::string> const& args,
cmSourceFile* sf = mf.GetOrCreateSource(newName, true);
if (curr) {
cmProp p = curr->GetProperty("ABSTRACT");
- sf->SetProperty("ABSTRACT", p ? p->c_str() : nullptr);
+ sf->SetProperty("ABSTRACT", cmToCStr(p));
}
// Compute the name of the header from which to generate the file.
diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h
index 75fa180..28ceb3a 100644
--- a/Source/cmQTWrapCPPCommand.h
+++ b/Source/cmQTWrapCPPCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmQTWrapCPPCommand_h
-#define cmQTWrapCPPCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmQTWrapCPPCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h
index a17ef54..3f92ea9 100644
--- a/Source/cmQTWrapUICommand.h
+++ b/Source/cmQTWrapUICommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmQTWrapUICommand_h
-#define cmQTWrapUICommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmQTWrapUICommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h
index a740ba3..cf90417 100644
--- a/Source/cmQtAutoGen.h
+++ b/Source/cmQtAutoGen.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmQtAutoGen_h
-#define cmQtAutoGen_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -141,5 +140,3 @@ public:
std::vector<std::string> ListOptions_;
};
};
-
-#endif
diff --git a/Source/cmQtAutoGenGlobalInitializer.h b/Source/cmQtAutoGenGlobalInitializer.h
index 2f6e581..cdae137 100644
--- a/Source/cmQtAutoGenGlobalInitializer.h
+++ b/Source/cmQtAutoGenGlobalInitializer.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmQtAutoGenGlobalInitializer_h
-#define cmQtAutoGenGlobalInitializer_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -82,5 +81,3 @@ private:
CompilerFeatures_;
Keywords const Keywords_;
};
-
-#endif
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 8c2cacd..3b62e9c 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -1517,6 +1517,7 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
info.SetConfig("PARSE_CACHE_FILE", this->AutogenTarget.ParseCacheFile);
info.Set("DEP_FILE", this->AutogenTarget.DepFile);
info.Set("DEP_FILE_RULE_NAME", this->AutogenTarget.DepFileRuleName);
+ info.SetArray("CMAKE_LIST_FILES", this->Makefile->GetListFiles());
info.SetArray("HEADER_EXTENSIONS",
this->Makefile->GetCMakeInstance()->GetHeaderExtensions());
info.SetArrayArray(
@@ -1757,8 +1758,8 @@ cmQtAutoGenInitializer::GetQtVersion(cmGeneratorTarget const* target)
// Read versions from variables
for (auto const& keyPair : keys) {
- addVersion(target->Makefile->GetDef(std::string(keyPair.first)),
- target->Makefile->GetDef(std::string(keyPair.second)));
+ addVersion(target->Makefile->GetDefinition(std::string(keyPair.first)),
+ target->Makefile->GetDefinition(std::string(keyPair.second)));
}
// Read versions from directory properties
diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h
index 48ec1a0..3ab303a 100644
--- a/Source/cmQtAutoGenInitializer.h
+++ b/Source/cmQtAutoGenInitializer.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmQtAutoGenInitializer_h
-#define cmQtAutoGenInitializer_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -249,5 +248,3 @@ private:
std::vector<Qrc> Qrcs;
} Rcc;
};
-
-#endif
diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h
index 83fb3ed..b4f057d 100644
--- a/Source/cmQtAutoGenerator.h
+++ b/Source/cmQtAutoGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmQtAutoGenerator_h
-#define cmQtAutoGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -177,5 +176,3 @@ private:
// -- Directories
ProjectDirsT ProjectDirs_;
};
-
-#endif
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index f6cccfb..9cb172b 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -184,6 +184,7 @@ public:
std::string DepFile;
std::string DepFileRuleName;
std::vector<std::string> HeaderExtensions;
+ std::vector<std::string> ListFiles;
};
/** Shared common variables. */
@@ -191,7 +192,7 @@ public:
{
public:
// -- Parse Cache
- bool ParseCacheChanged = false;
+ std::atomic<bool> ParseCacheChanged = ATOMIC_VAR_INIT(false);
cmFileTime ParseCacheTime;
ParseCacheT ParseCache;
@@ -1776,16 +1777,24 @@ bool cmQtAutoMocUicT::JobProbeDepsMocT::Probe(MappingT const& mapping,
{
// Check dependency timestamps
std::string const sourceDir = SubDirPrefix(sourceFile);
- for (std::string const& dep : mapping.SourceFile->ParseData->Moc.Depends) {
+ auto& dependencies = mapping.SourceFile->ParseData->Moc.Depends;
+ for (auto it = dependencies.begin(); it != dependencies.end(); ++it) {
+ auto& dep = *it;
+
// Find dependency file
auto const depMatch = FindDependency(sourceDir, dep);
if (depMatch.first.empty()) {
- Log().Warning(GenT::MOC,
- cmStrCat(MessagePath(sourceFile), " depends on ",
- MessagePath(dep),
- " but the file does not exist."));
- continue;
+ if (reason != nullptr) {
+ *reason =
+ cmStrCat("Generating ", MessagePath(outputFile), " from ",
+ MessagePath(sourceFile), ", because its dependency ",
+ MessagePath(dep), " vanished.");
+ }
+ dependencies.erase(it);
+ BaseEval().ParseCacheChanged = true;
+ return true;
}
+
// Test if dependency file is older
if (outputFileTime.Older(depMatch.second)) {
if (reason != nullptr) {
@@ -2176,7 +2185,7 @@ void cmQtAutoMocUicT::JobDepFilesMergeT::Process()
return dependenciesFromDepFile(f.c_str());
};
- std::vector<std::string> dependencies;
+ std::vector<std::string> dependencies = BaseConst().ListFiles;
ParseCacheT& parseCache = BaseEval().ParseCache;
auto processMappingEntry = [&](const MappingMapT::value_type& m) {
auto cacheEntry = parseCache.GetOrInsert(m.first);
@@ -2257,6 +2266,7 @@ bool cmQtAutoMocUicT::InitFromInfo(InfoT const& info)
!info.GetString("DEP_FILE_RULE_NAME", BaseConst_.DepFileRuleName,
false) ||
!info.GetStringConfig("SETTINGS_FILE", SettingsFile_, true) ||
+ !info.GetArray("CMAKE_LIST_FILES", BaseConst_.ListFiles, true) ||
!info.GetArray("HEADER_EXTENSIONS", BaseConst_.HeaderExtensions, true) ||
!info.GetString("QT_MOC_EXECUTABLE", MocConst_.Executable, false) ||
!info.GetString("QT_UIC_EXECUTABLE", UicConst_.Executable, false)) {
diff --git a/Source/cmQtAutoMocUic.h b/Source/cmQtAutoMocUic.h
index ffcc2db..20f9d6e 100644
--- a/Source/cmQtAutoMocUic.h
+++ b/Source/cmQtAutoMocUic.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmQtAutoMocUic_h
-#define cmQtAutoMocUic_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@
* @return true on success
*/
bool cmQtAutoMocUic(cm::string_view infoFile, cm::string_view config);
-
-#endif
diff --git a/Source/cmQtAutoRcc.h b/Source/cmQtAutoRcc.h
index a74b33a..d525efa 100644
--- a/Source/cmQtAutoRcc.h
+++ b/Source/cmQtAutoRcc.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmQtAutoRcc_h
-#define cmQtAutoRcc_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@
* @return true on success
*/
bool cmQtAutoRcc(cm::string_view infoFile, cm::string_view config);
-
-#endif
diff --git a/Source/cmRST.h b/Source/cmRST.h
index 6b5d416..17cdfe8 100644
--- a/Source/cmRST.h
+++ b/Source/cmRST.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef _cmRST_h
-#define _cmRST_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -97,5 +96,3 @@ private:
std::set<std::string> Replaced;
std::string ReplaceName;
};
-
-#endif
diff --git a/Source/cmRange.h b/Source/cmRange.h
index 3be5193..30af7d2 100644
--- a/Source/cmRange.h
+++ b/Source/cmRange.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmRange_h
-#define cmRange_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -235,5 +234,3 @@ auto cmReverseRange(Range const& range) -> cmRange<decltype(range.rbegin())>
{
return { range.rbegin(), range.rend() };
}
-
-#endif
diff --git a/Source/cmRemoveCommand.cxx b/Source/cmRemoveCommand.cxx
index 457b708..1345588 100644
--- a/Source/cmRemoveCommand.cxx
+++ b/Source/cmRemoveCommand.cxx
@@ -4,6 +4,7 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmStringAlgorithms.h"
// cmRemoveCommand
@@ -16,7 +17,7 @@ bool cmRemoveCommand(std::vector<std::string> const& args,
std::string const& variable = args[0]; // VAR is always first
// get the old value
- const char* cacheValue = status.GetMakefile().GetDefinition(variable);
+ cmProp cacheValue = status.GetMakefile().GetDefinition(variable);
// if there is no old value then return
if (!cacheValue) {
@@ -24,7 +25,7 @@ bool cmRemoveCommand(std::vector<std::string> const& args,
}
// expand the variable
- std::vector<std::string> const varArgsExpanded = cmExpandedList(cacheValue);
+ std::vector<std::string> const varArgsExpanded = cmExpandedList(*cacheValue);
// expand the args
// check for REMOVE(VAR v1 v2 ... vn)
diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h
index fb72ab5..37bfd8c 100644
--- a/Source/cmRemoveCommand.h
+++ b/Source/cmRemoveCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmRemoveCommand_h
-#define cmRemoveCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -17,5 +16,3 @@ class cmExecutionStatus;
*/
bool cmRemoveCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h
index 868416b..8d0fe18 100644
--- a/Source/cmRemoveDefinitionsCommand.h
+++ b/Source/cmRemoveDefinitionsCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmRemoveDefinitionsCommand_h
-#define cmRemoveDefinitionsCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmRemoveDefinitionsCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h
index 2404a36..abae1a4 100644
--- a/Source/cmReturnCommand.h
+++ b/Source/cmReturnCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmReturnCommand_h
-#define cmReturnCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -13,5 +12,3 @@ class cmExecutionStatus;
/// Return from a directory or function
bool cmReturnCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx
index 4ff81c1..6f40ec6 100644
--- a/Source/cmRulePlaceholderExpander.cxx
+++ b/Source/cmRulePlaceholderExpander.cxx
@@ -90,6 +90,11 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
return replaceValues.AIXExports;
}
}
+ if (replaceValues.ISPCHeader) {
+ if (variable == "ISPC_HEADER") {
+ return replaceValues.ISPCHeader;
+ }
+ }
if (replaceValues.Defines && variable == "DEFINES") {
return replaceValues.Defines;
}
diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h
index 09e8a3b..dfce8bb 100644
--- a/Source/cmRulePlaceholderExpander.h
+++ b/Source/cmRulePlaceholderExpander.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmRulePlaceholderExpander_h
-#define cmRulePlaceholderExpander_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -64,6 +63,7 @@ public:
const char* SwiftModuleName;
const char* SwiftOutputFileMap;
const char* SwiftSources;
+ const char* ISPCHeader;
};
// Expand rule variables in CMake of the type found in language rules
@@ -84,5 +84,3 @@ private:
std::string CompilerSysroot;
std::string LinkerSysroot;
};
-
-#endif
diff --git a/Source/cmRuntimeDependencyArchive.h b/Source/cmRuntimeDependencyArchive.h
index 9e2dfb6..7f3b8e9 100644
--- a/Source/cmRuntimeDependencyArchive.h
+++ b/Source/cmRuntimeDependencyArchive.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmRuntimeDependencyArchive_h
-#define cmRuntimeDependencyArchive_h
+#pragma once
#include <map>
#include <memory>
@@ -66,5 +65,3 @@ private:
std::map<std::string, std::set<std::string>> ResolvedPaths;
std::set<std::string> UnresolvedPaths;
};
-
-#endif // cmRuntimeDependencyArchive_h
diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h
index 7d676c9..46d794c 100644
--- a/Source/cmScriptGenerator.h
+++ b/Source/cmScriptGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmScriptGenerator_h
-#define cmScriptGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -90,5 +89,3 @@ private:
void GenerateScriptActionsOnce(std::ostream& os, Indent indent);
void GenerateScriptActionsPerConfig(std::ostream& os, Indent indent);
};
-
-#endif
diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx
index eb8fcaf..a58be62 100644
--- a/Source/cmSearchPath.cxx
+++ b/Source/cmSearchPath.cxx
@@ -8,6 +8,7 @@
#include "cmFindCommon.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -77,8 +78,8 @@ void cmSearchPath::AddCMakePath(const std::string& variable)
assert(this->FC != nullptr);
// Get a path from a CMake variable.
- if (const char* value = this->FC->Makefile->GetDefinition(variable)) {
- std::vector<std::string> expanded = cmExpandedList(value);
+ if (cmProp value = this->FC->Makefile->GetDefinition(variable)) {
+ std::vector<std::string> expanded = cmExpandedList(*value);
for (std::string const& p : expanded) {
this->AddPathInternal(
@@ -101,8 +102,8 @@ void cmSearchPath::AddCMakePrefixPath(const std::string& variable)
assert(this->FC != nullptr);
// Get a path from a CMake variable.
- if (const char* value = this->FC->Makefile->GetDefinition(variable)) {
- std::vector<std::string> expanded = cmExpandedList(value);
+ if (cmProp value = this->FC->Makefile->GetDefinition(variable)) {
+ std::vector<std::string> expanded = cmExpandedList(*value);
this->AddPrefixPaths(
expanded, this->FC->Makefile->GetCurrentSourceDirectory().c_str());
@@ -178,15 +179,15 @@ void cmSearchPath::AddPrefixPaths(const std::vector<std::string>& paths,
dir += "/";
}
if (subdir == "include" || subdir == "lib") {
- const char* arch =
+ cmProp arch =
this->FC->Makefile->GetDefinition("CMAKE_LIBRARY_ARCHITECTURE");
if (cmNonempty(arch)) {
if (this->FC->Makefile->IsDefinitionSet("CMAKE_SYSROOT") &&
this->FC->Makefile->IsDefinitionSet(
"CMAKE_PREFIX_LIBRARY_ARCHITECTURE")) {
- this->AddPathInternal(cmStrCat('/', arch, dir, subdir), base);
+ this->AddPathInternal(cmStrCat('/', *arch, dir, subdir), base);
} else {
- this->AddPathInternal(cmStrCat(dir, subdir, '/', arch), base);
+ this->AddPathInternal(cmStrCat(dir, subdir, '/', *arch), base);
}
}
}
diff --git a/Source/cmSearchPath.h b/Source/cmSearchPath.h
index 3ecc73b..c15cb97 100644
--- a/Source/cmSearchPath.h
+++ b/Source/cmSearchPath.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmSearchPath_h
-#define cmSearchPath_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -50,5 +49,3 @@ protected:
cmFindCommon* FC;
std::vector<std::string> Paths;
};
-
-#endif
diff --git a/Source/cmSeparateArgumentsCommand.cxx b/Source/cmSeparateArgumentsCommand.cxx
index cfe3087..e45f3b0 100644
--- a/Source/cmSeparateArgumentsCommand.cxx
+++ b/Source/cmSeparateArgumentsCommand.cxx
@@ -6,6 +6,7 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -65,8 +66,8 @@ bool cmSeparateArgumentsCommand(std::vector<std::string> const& args,
if (mode == ModeOld) {
// Original space-replacement version of command.
- if (const char* def = status.GetMakefile().GetDefinition(var)) {
- std::string value = def;
+ if (cmProp def = status.GetMakefile().GetDefinition(var)) {
+ std::string value = *def;
std::replace(value.begin(), value.end(), ' ', ';');
status.GetMakefile().AddDefinition(var, value);
}
diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h
index e000c51..d284a40 100644
--- a/Source/cmSeparateArgumentsCommand.h
+++ b/Source/cmSeparateArgumentsCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmSeparateArgumentsCommand_h
-#define cmSeparateArgumentsCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -17,5 +16,3 @@ class cmExecutionStatus;
*/
bool cmSeparateArgumentsCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h
index 0973d33..695b185 100644
--- a/Source/cmSetCommand.h
+++ b/Source/cmSetCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmSetCommand_h
-#define cmSetCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -17,5 +16,3 @@ class cmExecutionStatus;
*/
bool cmSetCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h
index c243dd7..f5b6406 100644
--- a/Source/cmSetDirectoryPropertiesCommand.h
+++ b/Source/cmSetDirectoryPropertiesCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmSetDirectoryPropertiesCommand_h
-#define cmSetDirectoryPropertiesCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmSetDirectoryPropertiesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h
index af566a3..89fdd9a 100644
--- a/Source/cmSetPropertyCommand.h
+++ b/Source/cmSetPropertyCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmSetsPropertiesCommand_h
-#define cmSetsPropertiesCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -41,5 +40,3 @@ void MakeSourceFilePathsAbsoluteIfNeeded(
std::vector<std::string>::const_iterator files_it_begin,
std::vector<std::string>::const_iterator files_it_end, bool needed);
}
-
-#endif
diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h
index 5eef785..8f88522 100644
--- a/Source/cmSetSourceFilesPropertiesCommand.h
+++ b/Source/cmSetSourceFilesPropertiesCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmSetSourceFilesPropertiesCommand_h
-#define cmSetSourceFilesPropertiesCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmSetSourceFilesPropertiesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h
index 9d40c74..0c04f31 100644
--- a/Source/cmSetTargetPropertiesCommand.h
+++ b/Source/cmSetTargetPropertiesCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmSetTargetsPropertiesCommand_h
-#define cmSetTargetsPropertiesCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmSetTargetPropertiesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h
index 4b75464..b4f1641 100644
--- a/Source/cmSetTestsPropertiesCommand.h
+++ b/Source/cmSetTestsPropertiesCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmSetTestsPropertiesCommand_h
-#define cmSetTestsPropertiesCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmSetTestsPropertiesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx
index b2d905e..58af8f0 100644
--- a/Source/cmSiteNameCommand.cxx
+++ b/Source/cmSiteNameCommand.cxx
@@ -6,6 +6,7 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -26,15 +27,15 @@ bool cmSiteNameCommand(std::vector<std::string> const& args,
paths.emplace_back("/sbin");
paths.emplace_back("/usr/local/bin");
- const char* cacheValue = status.GetMakefile().GetDefinition(args[0]);
+ cmProp cacheValue = status.GetMakefile().GetDefinition(args[0]);
if (cacheValue) {
return true;
}
- const char* temp = status.GetMakefile().GetDefinition("HOSTNAME");
+ cmProp temp = status.GetMakefile().GetDefinition("HOSTNAME");
std::string hostname_cmd;
if (temp) {
- hostname_cmd = temp;
+ hostname_cmd = *temp;
} else {
hostname_cmd = cmSystemTools::FindProgram("hostname", paths);
}
diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h
index e8fc608..432ba37 100644
--- a/Source/cmSiteNameCommand.h
+++ b/Source/cmSiteNameCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmSiteNameCommand_h
-#define cmSiteNameCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -17,5 +16,3 @@ class cmExecutionStatus;
*/
bool cmSiteNameCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index e669015..39ea8e3 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmSourceFile_h
-#define cmSourceFile_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -161,5 +160,3 @@ private:
#define CM_PCH_REGEX "cmake_pch(_[^.]+)?\\.(h|hxx)$"
#define CM_RESOURCE_REGEX "\\.(pdf|plist|png|jpeg|jpg|storyboard|xcassets)$"
-
-#endif
diff --git a/Source/cmSourceFileLocation.h b/Source/cmSourceFileLocation.h
index 87040b8..b373d3d 100644
--- a/Source/cmSourceFileLocation.h
+++ b/Source/cmSourceFileLocation.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmSourceFileLocation_h
-#define cmSourceFileLocation_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -102,5 +101,3 @@ private:
void Update(cmSourceFileLocation const& loc);
void UpdateExtension(const std::string& name);
};
-
-#endif
diff --git a/Source/cmSourceFileLocationKind.h b/Source/cmSourceFileLocationKind.h
index dd4c6dd..73108f1 100644
--- a/Source/cmSourceFileLocationKind.h
+++ b/Source/cmSourceFileLocationKind.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmSourceFileLocationKind_h
-#define cmSourceFileLocationKind_h
+#pragma once
enum class cmSourceFileLocationKind
{
@@ -11,5 +10,3 @@ enum class cmSourceFileLocationKind
// extensions or absolute path.
Known
};
-
-#endif
diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h
index 623cded..295240d 100644
--- a/Source/cmSourceGroup.h
+++ b/Source/cmSourceGroup.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmSourceGroup_h
-#define cmSourceGroup_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -125,5 +124,3 @@ private:
std::unique_ptr<cmSourceGroupInternals> Internal;
};
-
-#endif
diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h
index ad39701..44e1f8e 100644
--- a/Source/cmSourceGroupCommand.h
+++ b/Source/cmSourceGroupCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmSourceGroupCommand_h
-#define cmSourceGroupCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmSourceGroupCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmStandardLevelResolver.cxx b/Source/cmStandardLevelResolver.cxx
index 6dbab98..8672f61 100644
--- a/Source/cmStandardLevelResolver.cxx
+++ b/Source/cmStandardLevelResolver.cxx
@@ -63,7 +63,7 @@ struct StanardLevelComputer
const auto& stds = this->Levels;
const auto& stdsStrings = this->LevelsAsStrings;
- const char* defaultStd = makefile->GetDefinition(
+ cmProp defaultStd = makefile->GetDefinition(
cmStrCat("CMAKE_", this->Language, "_STANDARD_DEFAULT"));
if (!cmNonempty(defaultStd)) {
// this compiler has no notion of language standard levels
@@ -93,8 +93,7 @@ struct StanardLevelComputer
std::string option_flag = cmStrCat(
"CMAKE_", this->Language, *standardProp, "_", type, "_COMPILE_OPTION");
- const char* opt =
- target->Target->GetMakefile()->GetDefinition(option_flag);
+ cmProp opt = target->Target->GetMakefile()->GetDefinition(option_flag);
if (!opt) {
std::ostringstream e;
e << "Target \"" << target->GetName()
@@ -118,7 +117,7 @@ struct StanardLevelComputer
int defaultValue = -1;
try {
standardValue = std::stoi(standardStr);
- defaultValue = std::stoi(defaultStd);
+ defaultValue = std::stoi(*defaultStd);
} catch (std::invalid_argument&) {
// fall through as we want an error
// when we can't find the bad value in the `stds` vector
@@ -139,7 +138,7 @@ struct StanardLevelComputer
if (defaultStdIt == cm::cend(stds)) {
std::string e = cmStrCat("CMAKE_", this->Language,
"_STANDARD_DEFAULT is set to invalid value '",
- defaultStd, "'");
+ *defaultStd, "'");
makefile->IssueMessage(MessageType::INTERNAL_ERROR, e);
return std::string{};
}
@@ -185,7 +184,7 @@ struct StanardLevelComputer
cmProp existingStandard = currentLangStandardValue;
if (existingStandard == nullptr) {
- cmProp defaultStandard = makefile->GetDef(
+ cmProp defaultStandard = makefile->GetDefinition(
cmStrCat("CMAKE_", this->Language, "_STANDARD_DEFAULT"));
if (cmNonempty(defaultStandard)) {
existingStandard = defaultStandard;
@@ -228,7 +227,7 @@ struct StanardLevelComputer
std::string const& config,
std::string const& feature) const
{
- cmProp defaultStandard = makefile->GetDef(
+ cmProp defaultStandard = makefile->GetDefinition(
cmStrCat("CMAKE_", this->Language, "_STANDARD_DEFAULT"));
if (!defaultStandard) {
makefile->IssueMessage(
@@ -280,9 +279,9 @@ struct StanardLevelComputer
std::string prefix = cmStrCat("CMAKE_", this->Language);
StandardNeeded maxLevel = { -1, -1 };
for (size_t i = 0; i < this->Levels.size(); ++i) {
- if (const char* prop = makefile->GetDefinition(
+ if (cmProp prop = makefile->GetDefinition(
cmStrCat(prefix, this->LevelsAsStrings[i], "_COMPILE_FEATURES"))) {
- std::vector<std::string> props = cmExpandedList(prop);
+ std::vector<std::string> props = cmExpandedList(*prop);
if (cm::contains(props, feature)) {
maxLevel = { static_cast<int>(i), this->Levels[i] };
}
@@ -390,9 +389,10 @@ bool cmStandardLevelResolver::CheckCompileFeaturesAvailable(
std::ostringstream e;
e << "The compiler feature \"" << feature << "\" is not known to " << lang
<< " compiler\n\""
- << this->Makefile->GetDefinition("CMAKE_" + lang + "_COMPILER_ID")
+ << this->Makefile->GetSafeDefinition("CMAKE_" + lang + "_COMPILER_ID")
<< "\"\nversion "
- << this->Makefile->GetDefinition("CMAKE_" + lang + "_COMPILER_VERSION")
+ << this->Makefile->GetSafeDefinition("CMAKE_" + lang +
+ "_COMPILER_VERSION")
<< ".";
if (error) {
*error = e.str();
@@ -469,7 +469,7 @@ const char* cmStandardLevelResolver::CompileFeaturesAvailable(
return nullptr;
}
- const char* featuresKnown =
+ cmProp featuresKnown =
this->Makefile->GetDefinition("CMAKE_" + lang + "_COMPILE_FEATURES");
if (!cmNonempty(featuresKnown)) {
@@ -492,7 +492,7 @@ const char* cmStandardLevelResolver::CompileFeaturesAvailable(
}
return nullptr;
}
- return featuresKnown;
+ return cmToCStr(featuresKnown);
}
bool cmStandardLevelResolver::GetNewRequiredStandard(
diff --git a/Source/cmStandardLevelResolver.h b/Source/cmStandardLevelResolver.h
index 959a5f9..d84fbcb 100644
--- a/Source/cmStandardLevelResolver.h
+++ b/Source/cmStandardLevelResolver.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmStandardLevelResolver_h
-#define cmStandardLevelResolver_h
+#pragma once
#include <string>
@@ -56,4 +55,3 @@ private:
cmMakefile* Makefile;
};
-#endif
diff --git a/Source/cmStandardLexer.h b/Source/cmStandardLexer.h
index e0b2116..0203779 100644
--- a/Source/cmStandardLexer.h
+++ b/Source/cmStandardLexer.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmStandardLexer_h
-#define cmStandardLexer_h
+#pragma once
#if defined(__linux)
/* Needed for glibc < 2.12 */
@@ -74,5 +73,3 @@ typedef KWIML_INT_int16_t flex_int16_t;
typedef KWIML_INT_uint16_t flex_uint16_t;
typedef KWIML_INT_int32_t flex_int32_t;
typedef KWIML_INT_uint32_t flex_uint32_t;
-
-#endif
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 73f166c..e96c82f 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -469,9 +469,10 @@ void cmState::AddUnexpectedCommand(std::string const& name, const char* error)
name,
[name, error](std::vector<cmListFileArgument> const&,
cmExecutionStatus& status) -> bool {
- const char* versionValue =
+ cmProp versionValue =
status.GetMakefile().GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
- if (name == "endif" && (!versionValue || atof(versionValue) <= 1.4)) {
+ if (name == "endif" &&
+ (!versionValue || atof(versionValue->c_str()) <= 1.4)) {
return true;
}
status.SetError(error);
diff --git a/Source/cmState.h b/Source/cmState.h
index 885496a..14870eb 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmState_h
-#define cmState_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -249,5 +248,3 @@ private:
bool NinjaMulti = false;
Mode CurrentMode = Unknown;
};
-
-#endif
diff --git a/Source/cmStateDirectory.h b/Source/cmStateDirectory.h
index 765af6f..56a262d 100644
--- a/Source/cmStateDirectory.h
+++ b/Source/cmStateDirectory.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmStateDirectory_h
-#define cmStateDirectory_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -104,5 +103,3 @@ private:
cmStateSnapshot Snapshot_;
friend class cmStateSnapshot;
};
-
-#endif
diff --git a/Source/cmStatePrivate.h b/Source/cmStatePrivate.h
index 4efaf97..4892644 100644
--- a/Source/cmStatePrivate.h
+++ b/Source/cmStatePrivate.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmStatePrivate_h
-#define cmStatePrivate_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -99,5 +98,3 @@ struct cmStateDetail::BuildsystemDirectoryStateType
std::vector<cmStateSnapshot> Children;
};
-
-#endif
diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx
index bf8e331..1e20abb 100644
--- a/Source/cmStateSnapshot.cxx
+++ b/Source/cmStateSnapshot.cxx
@@ -53,7 +53,7 @@ void cmStateSnapshot::SetListFile(const std::string& listfile)
*this->Position->ExecutionListFile = listfile;
}
-std::string cmStateSnapshot::GetExecutionListFile() const
+std::string const& cmStateSnapshot::GetExecutionListFile() const
{
return *this->Position->ExecutionListFile;
}
@@ -411,8 +411,7 @@ void cmStateSnapshot::InitializeFromParent()
parent->BuildSystemDirectory->Properties.GetPropertyValue(
"INCLUDE_REGULAR_EXPRESSION");
this->Position->BuildSystemDirectory->Properties.SetProperty(
- "INCLUDE_REGULAR_EXPRESSION",
- include_regex ? include_regex->c_str() : nullptr);
+ "INCLUDE_REGULAR_EXPRESSION", cmToCStr(include_regex));
}
cmState* cmStateSnapshot::GetState() const
diff --git a/Source/cmStateSnapshot.h b/Source/cmStateSnapshot.h
index c19f174..d06cba3 100644
--- a/Source/cmStateSnapshot.h
+++ b/Source/cmStateSnapshot.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmStateSnapshot_h
-#define cmStateSnapshot_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -33,7 +32,7 @@ public:
void SetListFile(std::string const& listfile);
- std::string GetExecutionListFile() const;
+ std::string const& GetExecutionListFile() const;
std::vector<cmStateSnapshot> GetChildren();
@@ -87,5 +86,3 @@ private:
bool operator==(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs);
bool operator!=(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs);
-
-#endif
diff --git a/Source/cmStateTypes.h b/Source/cmStateTypes.h
index d089ea7..b8c1cca 100644
--- a/Source/cmStateTypes.h
+++ b/Source/cmStateTypes.h
@@ -1,8 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmStateTypes_h
-#define cmStateTypes_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -60,5 +59,3 @@ enum ArtifactType
ImportLibraryArtifact
};
}
-
-#endif
diff --git a/Source/cmString.hxx b/Source/cmString.hxx
index 40fe20d..b41b960 100644
--- a/Source/cmString.hxx
+++ b/Source/cmString.hxx
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmString_hxx
-#define cmString_hxx
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -928,5 +927,3 @@ struct hash<cm::String>
}
};
}
-
-#endif
diff --git a/Source/cmStringAlgorithms.cxx b/Source/cmStringAlgorithms.cxx
index 71d28a4..e0af281 100644
--- a/Source/cmStringAlgorithms.cxx
+++ b/Source/cmStringAlgorithms.cxx
@@ -7,6 +7,7 @@
#include <cstddef> // IWYU pragma: keep
#include <cstdio>
#include <cstdlib>
+#include <iterator>
std::string cmTrimWhitespace(cm::string_view str)
{
@@ -323,3 +324,52 @@ bool cmStrToULong(std::string const& str, unsigned long* value)
{
return cmStrToULong(str.c_str(), value);
}
+
+template <typename Range>
+std::size_t getJoinedLength(Range const& rng, cm::string_view separator)
+{
+ std::size_t rangeLength{};
+ for (auto const& item : rng) {
+ rangeLength += item.size();
+ }
+
+ auto const separatorsLength = (rng.size() - 1) * separator.size();
+
+ return rangeLength + separatorsLength;
+}
+
+template <typename Range>
+std::string cmJoinImpl(Range const& rng, cm::string_view separator,
+ cm::string_view initial)
+{
+ if (rng.empty()) {
+ return { std::begin(initial), std::end(initial) };
+ }
+
+ std::string result;
+ result.reserve(initial.size() + getJoinedLength(rng, separator));
+ result.append(std::begin(initial), std::end(initial));
+
+ auto begin = std::begin(rng);
+ auto end = std::end(rng);
+ result += *begin;
+
+ for (++begin; begin != end; ++begin) {
+ result.append(std::begin(separator), std::end(separator));
+ result += *begin;
+ }
+
+ return result;
+}
+
+std::string cmJoin(std::vector<std::string> const& rng,
+ cm::string_view separator, cm::string_view initial)
+{
+ return cmJoinImpl(rng, separator, initial);
+}
+
+std::string cmJoin(cmStringRange const& rng, cm::string_view separator,
+ cm::string_view initial)
+{
+ return cmJoinImpl(rng, separator, initial);
+}
diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h
index 4b0090b..01e3d94 100644
--- a/Source/cmStringAlgorithms.h
+++ b/Source/cmStringAlgorithms.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmStringAlgorithms_h
-#define cmStringAlgorithms_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -34,6 +33,13 @@ inline bool cmNonempty(std::string const* str)
return str && !str->empty();
}
+/** Returns length of a literal string. */
+template <size_t N>
+constexpr size_t cmStrLen(const char (&/*str*/)[N])
+{
+ return N - 1;
+}
+
/** Callable string comparison struct. */
struct cmStrCmp
{
@@ -81,6 +87,17 @@ std::string cmJoin(Range const& rng, cm::string_view separator)
return os.str();
}
+/**
+ * Faster overloads for std::string ranges.
+ * If @a initial is provided, it prepends the resulted string without
+ * @a separator between them.
+ */
+std::string cmJoin(std::vector<std::string> const& rng,
+ cm::string_view separator, cm::string_view initial = {});
+
+std::string cmJoin(cmStringRange const& rng, cm::string_view separator,
+ cm::string_view initial = {});
+
/** Extract tokens that are separated by any of the characters in @a sep. */
std::vector<std::string> cmTokenize(cm::string_view str, cm::string_view sep);
@@ -306,5 +323,3 @@ bool cmStrToLong(std::string const& str, long* value);
* integer */
bool cmStrToULong(const char* str, unsigned long* value);
bool cmStrToULong(std::string const& str, unsigned long* value);
-
-#endif
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index a7c21cc..4000a7d 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -11,6 +11,7 @@
#include <memory>
#include <cm/iterator>
+#include <cm/string_view>
#include <cmext/string_view>
#include "cmsys/RegularExpression.hxx"
@@ -20,6 +21,7 @@
#include "cmGeneratorExpression.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmProperty.h"
#include "cmRange.h"
#include "cmStringAlgorithms.h"
#include "cmStringReplaceHelper.h"
@@ -533,15 +535,14 @@ bool HandleAppendCommand(std::vector<std::string> const& args,
return true;
}
- const std::string& variable = args[1];
+ auto const& variableName = args[1];
+
+ cm::string_view oldView{ status.GetMakefile().GetSafeDefinition(
+ variableName) };
+
+ auto const newValue = cmJoin(cmMakeRange(args).advance(2), {}, oldView);
+ status.GetMakefile().AddDefinition(variableName, newValue);
- std::string value;
- const char* oldValue = status.GetMakefile().GetDefinition(variable);
- if (oldValue) {
- value = oldValue;
- }
- value += cmJoin(cmMakeRange(args).advance(2), std::string());
- status.GetMakefile().AddDefinition(variable, value);
return true;
}
@@ -561,9 +562,9 @@ bool HandlePrependCommand(std::vector<std::string> const& args,
const std::string& variable = args[1];
std::string value = cmJoin(cmMakeRange(args).advance(2), std::string());
- const char* oldValue = status.GetMakefile().GetDefinition(variable);
+ cmProp oldValue = status.GetMakefile().GetDefinition(variable);
if (oldValue) {
- value += oldValue;
+ value += *oldValue;
}
status.GetMakefile().AddDefinition(variable, value);
return true;
diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h
index bd71ba2..5320ea5 100644
--- a/Source/cmStringCommand.h
+++ b/Source/cmStringCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmStringCommand_h
-#define cmStringCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -16,5 +15,3 @@ class cmExecutionStatus;
*/
bool cmStringCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmStringReplaceHelper.h b/Source/cmStringReplaceHelper.h
index 74d481d..fd59d17 100644
--- a/Source/cmStringReplaceHelper.h
+++ b/Source/cmStringReplaceHelper.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmStringReplaceHelper_h
-#define cmStringReplaceHelper_h
+#pragma once
#include <string>
#include <utility>
@@ -64,5 +63,3 @@ private:
std::vector<RegexReplacement> Replacements;
cmMakefile* Makefile = nullptr;
};
-
-#endif
diff --git a/Source/cmSubcommandTable.h b/Source/cmSubcommandTable.h
index 7deaaed..80d8c6d 100644
--- a/Source/cmSubcommandTable.h
+++ b/Source/cmSubcommandTable.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmSubcommandTable_h
-#define cmSubcommandTable_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -32,5 +31,3 @@ public:
private:
std::vector<Elem> Impl;
};
-
-#endif
diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h
index 3254e84..6770874 100644
--- a/Source/cmSubdirCommand.h
+++ b/Source/cmSubdirCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmSubdirCommand_h
-#define cmSubdirCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmSubdirCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h
index bf99bd1..133d702 100644
--- a/Source/cmSubdirDependsCommand.h
+++ b/Source/cmSubdirDependsCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmSubdirDependsCommand_h
-#define cmSubdirDependsCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmSubdirDependsCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 798c29a..87176d6 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -749,33 +749,140 @@ std::string cmSystemTools::FileExistsInParentDirectories(
}
#ifdef _WIN32
-cmSystemTools::WindowsFileRetry cmSystemTools::GetWindowsFileRetry()
+namespace {
+
+/* Helper class to save and restore the specified file (or directory)
+ attribute bits. Instantiate this class as an automatic variable on the
+ stack. Its constructor saves a copy of the file attributes, and then its
+ destructor restores the original attribute settings. */
+class SaveRestoreFileAttributes
{
- static WindowsFileRetry retry = { 0, 0 };
- if (!retry.Count) {
- unsigned int data[2] = { 0, 0 };
- HKEY const keys[2] = { HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE };
- wchar_t const* const values[2] = { L"FilesystemRetryCount",
- L"FilesystemRetryDelay" };
- for (int k = 0; k < 2; ++k) {
- HKEY hKey;
- if (RegOpenKeyExW(keys[k], L"Software\\Kitware\\CMake\\Config", 0,
- KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) {
- for (int v = 0; v < 2; ++v) {
- DWORD dwData, dwType, dwSize = 4;
- if (!data[v] &&
- RegQueryValueExW(hKey, values[v], 0, &dwType, (BYTE*)&dwData,
- &dwSize) == ERROR_SUCCESS &&
- dwType == REG_DWORD && dwSize == 4) {
- data[v] = static_cast<unsigned int>(dwData);
- }
+public:
+ SaveRestoreFileAttributes(std::wstring const& path,
+ uint32_t file_attrs_to_set);
+ ~SaveRestoreFileAttributes();
+
+ SaveRestoreFileAttributes(SaveRestoreFileAttributes const&) = delete;
+ SaveRestoreFileAttributes& operator=(SaveRestoreFileAttributes const&) =
+ delete;
+
+ void SetPath(std::wstring const& path) { path_ = path; }
+
+private:
+ std::wstring path_;
+ uint32_t original_attr_bits_;
+};
+
+SaveRestoreFileAttributes::SaveRestoreFileAttributes(
+ std::wstring const& path, uint32_t file_attrs_to_set)
+ : path_(path)
+ , original_attr_bits_(0)
+{
+ // Set the specified attributes for the source file/directory.
+ original_attr_bits_ = GetFileAttributesW(path_.c_str());
+ if ((INVALID_FILE_ATTRIBUTES != original_attr_bits_) &&
+ ((file_attrs_to_set & original_attr_bits_) != file_attrs_to_set)) {
+ SetFileAttributesW(path_.c_str(), original_attr_bits_ | file_attrs_to_set);
+ }
+}
+
+// We set attribute bits. Now we need to restore their original state.
+SaveRestoreFileAttributes::~SaveRestoreFileAttributes()
+{
+ DWORD last_error = GetLastError();
+ // Verify or restore the original attributes.
+ const DWORD source_attr_bits = GetFileAttributesW(path_.c_str());
+ if (INVALID_FILE_ATTRIBUTES != source_attr_bits) {
+ if (original_attr_bits_ != source_attr_bits) {
+ // The file still exists, and its attributes aren't our saved values.
+ // Time to restore them.
+ SetFileAttributesW(path_.c_str(), original_attr_bits_);
+ }
+ }
+ SetLastError(last_error);
+}
+
+struct WindowsFileRetryInit
+{
+ cmSystemTools::WindowsFileRetry Retry;
+ bool Explicit;
+};
+
+WindowsFileRetryInit InitWindowsFileRetry(wchar_t const* const values[2],
+ unsigned int const defaults[2])
+{
+ unsigned int data[2] = { 0, 0 };
+ HKEY const keys[2] = { HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE };
+ for (int k = 0; k < 2; ++k) {
+ HKEY hKey;
+ if (RegOpenKeyExW(keys[k], L"Software\\Kitware\\CMake\\Config", 0,
+ KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) {
+ for (int v = 0; v < 2; ++v) {
+ DWORD dwData, dwType, dwSize = 4;
+ if (!data[v] &&
+ RegQueryValueExW(hKey, values[v], 0, &dwType, (BYTE*)&dwData,
+ &dwSize) == ERROR_SUCCESS &&
+ dwType == REG_DWORD && dwSize == 4) {
+ data[v] = static_cast<unsigned int>(dwData);
}
- RegCloseKey(hKey);
}
+ RegCloseKey(hKey);
}
- retry.Count = data[0] ? data[0] : 5;
- retry.Delay = data[1] ? data[1] : 500;
}
+ WindowsFileRetryInit init;
+ init.Explicit = data[0] || data[1];
+ init.Retry.Count = data[0] ? data[0] : defaults[0];
+ init.Retry.Delay = data[1] ? data[1] : defaults[1];
+ return init;
+}
+
+WindowsFileRetryInit InitWindowsFileRetry()
+{
+ static wchar_t const* const values[2] = { L"FilesystemRetryCount",
+ L"FilesystemRetryDelay" };
+ static unsigned int const defaults[2] = { 5, 500 };
+ return InitWindowsFileRetry(values, defaults);
+}
+
+WindowsFileRetryInit InitWindowsDirectoryRetry()
+{
+ static wchar_t const* const values[2] = { L"FilesystemDirectoryRetryCount",
+ L"FilesystemDirectoryRetryDelay" };
+ static unsigned int const defaults[2] = { 120, 500 };
+ WindowsFileRetryInit dirInit = InitWindowsFileRetry(values, defaults);
+ if (dirInit.Explicit) {
+ return dirInit;
+ }
+ WindowsFileRetryInit fileInit = InitWindowsFileRetry();
+ if (fileInit.Explicit) {
+ return fileInit;
+ }
+ return dirInit;
+}
+
+cmSystemTools::WindowsFileRetry GetWindowsRetry(std::wstring const& path)
+{
+ // If we are performing a directory operation, then try and get the
+ // appropriate timing info.
+ DWORD const attrs = GetFileAttributesW(path.c_str());
+ if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY)) {
+ return cmSystemTools::GetWindowsDirectoryRetry();
+ }
+ return cmSystemTools::GetWindowsFileRetry();
+}
+
+} // end of anonymous namespace
+
+cmSystemTools::WindowsFileRetry cmSystemTools::GetWindowsFileRetry()
+{
+ static WindowsFileRetry retry = InitWindowsFileRetry().Retry;
+ return retry;
+}
+
+cmSystemTools::WindowsFileRetry cmSystemTools::GetWindowsDirectoryRetry()
+{
+ static cmSystemTools::WindowsFileRetry retry =
+ InitWindowsDirectoryRetry().Retry;
return retry;
}
#endif
@@ -836,6 +943,21 @@ void cmSystemTools::InitializeLibUV()
#endif
}
+#ifdef _WIN32
+namespace {
+bool cmMoveFile(std::wstring const& oldname, std::wstring const& newname)
+{
+ // Not only ignore any previous error, but clear any memory of it.
+ SetLastError(0);
+
+ // Use MOVEFILE_REPLACE_EXISTING to replace an existing destination file.
+ // Use MOVEFILE_WRITE_THROUGH to flush the change to disk before returning.
+ return MoveFileExW(oldname.c_str(), newname.c_str(),
+ MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH);
+}
+}
+#endif
+
bool cmSystemTools::RenameFile(const std::string& oldname,
const std::string& newname)
{
@@ -843,35 +965,63 @@ bool cmSystemTools::RenameFile(const std::string& oldname,
# ifndef INVALID_FILE_ATTRIBUTES
# define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
# endif
+ std::wstring const oldname_wstr =
+ SystemTools::ConvertToWindowsExtendedPath(oldname);
+ std::wstring const newname_wstr =
+ SystemTools::ConvertToWindowsExtendedPath(newname);
+
/* Windows MoveFileEx may not replace read-only or in-use files. If it
fails then remove the read-only attribute from any existing destination.
Try multiple times since we may be racing against another process
creating/opening the destination file just before our MoveFileEx. */
- WindowsFileRetry retry = cmSystemTools::GetWindowsFileRetry();
- while (
- !MoveFileExW(SystemTools::ConvertToWindowsExtendedPath(oldname).c_str(),
- SystemTools::ConvertToWindowsExtendedPath(newname).c_str(),
- MOVEFILE_REPLACE_EXISTING) &&
- --retry.Count) {
- DWORD last_error = GetLastError();
+ WindowsFileRetry retry = GetWindowsRetry(oldname_wstr);
+
+ // Use RAII to set the attribute bit blocking Microsoft Search Indexing,
+ // and restore the previous value upon return.
+ SaveRestoreFileAttributes save_restore_file_attributes(
+ oldname_wstr, FILE_ATTRIBUTE_NOT_CONTENT_INDEXED);
+
+ DWORD move_last_error = 0;
+ while (!cmMoveFile(oldname_wstr, newname_wstr) && --retry.Count) {
+ move_last_error = GetLastError();
+
+ // There was no error ==> the operation is not yet complete.
+ if (move_last_error == NO_ERROR) {
+ break;
+ }
+
// Try again only if failure was due to access/sharing permissions.
- if (last_error != ERROR_ACCESS_DENIED &&
- last_error != ERROR_SHARING_VIOLATION) {
+ // Most often ERROR_ACCESS_DENIED (a.k.a. I/O error) for a directory, and
+ // ERROR_SHARING_VIOLATION for a file, are caused by one of the following:
+ // 1) Anti-Virus Software
+ // 2) Windows Search Indexer
+ // 3) Windows Explorer has an associated directory already opened.
+ if (move_last_error != ERROR_ACCESS_DENIED &&
+ move_last_error != ERROR_SHARING_VIOLATION) {
return false;
}
- DWORD attrs = GetFileAttributesW(
- SystemTools::ConvertToWindowsExtendedPath(newname).c_str());
+
+ DWORD const attrs = GetFileAttributesW(newname_wstr.c_str());
if ((attrs != INVALID_FILE_ATTRIBUTES) &&
- (attrs & FILE_ATTRIBUTE_READONLY)) {
+ (attrs & FILE_ATTRIBUTE_READONLY) &&
+ // FILE_ATTRIBUTE_READONLY is not honored on directories.
+ !(attrs & FILE_ATTRIBUTE_DIRECTORY)) {
// Remove the read-only attribute from the destination file.
- SetFileAttributesW(
- SystemTools::ConvertToWindowsExtendedPath(newname).c_str(),
- attrs & ~FILE_ATTRIBUTE_READONLY);
+ SetFileAttributesW(newname_wstr.c_str(),
+ attrs & ~FILE_ATTRIBUTE_READONLY);
} else {
// The file may be temporarily in use so wait a bit.
cmSystemTools::Delay(retry.Delay);
}
}
+
+ // If we were successful, then there was no error.
+ if (retry.Count > 0) {
+ move_last_error = 0;
+ // Restore the attributes on the new name.
+ save_restore_file_attributes.SetPath(newname_wstr);
+ }
+ SetLastError(move_last_error);
return retry.Count > 0;
#else
/* On UNIX we have an OS-provided call to do this atomically. */
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index b886c58..1362af8 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmSystemTools_h
-#define cmSystemTools_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -434,6 +433,7 @@ public:
unsigned int Delay;
};
static WindowsFileRetry GetWindowsFileRetry();
+ static WindowsFileRetry GetWindowsDirectoryRetry();
#endif
/** Get the real path for a given path, removing all symlinks.
@@ -464,5 +464,3 @@ private:
static bool s_FatalErrorOccured;
static bool s_DisableRunCommandOutput;
};
-
-#endif
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 6aa23c2..e076d1e 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -265,16 +265,16 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
auto initProp = [this, mf, &defKey](const std::string& property) {
// Replace everything after "CMAKE_"
defKey.replace(defKey.begin() + 6, defKey.end(), property);
- if (const char* value = mf->GetDefinition(defKey)) {
- this->SetProperty(property, value);
+ if (cmProp value = mf->GetDefinition(defKey)) {
+ this->SetProperty(property, *value);
}
};
auto initPropValue = [this, mf, &defKey](const std::string& property,
const char* default_value) {
// Replace everything after "CMAKE_"
defKey.replace(defKey.begin() + 6, defKey.end(), property);
- if (const char* value = mf->GetDefinition(defKey)) {
- this->SetProperty(property, value);
+ if (cmProp value = mf->GetDefinition(defKey)) {
+ this->SetProperty(property, *value);
} else if (default_value) {
this->SetProperty(property, default_value);
}
@@ -325,6 +325,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("Fortran_MODULE_DIRECTORY");
initProp("Fortran_COMPILER_LAUNCHER");
initProp("Fortran_PREPROCESS");
+ initProp("Fortran_VISIBILITY_PRESET");
initProp("GNUtoMS");
initProp("OSX_ARCHITECTURES");
initProp("IOS_INSTALL_COMBINED");
@@ -366,6 +367,9 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("JOB_POOL_COMPILE");
initProp("JOB_POOL_LINK");
initProp("JOB_POOL_PRECOMPILE_HEADER");
+ initProp("ISPC_COMPILER_LAUNCHER");
+ initProp("ISPC_HEADER_DIRECTORY");
+ initProp("ISPC_INSTRUCTION_SETS");
initProp("LINK_SEARCH_START_STATIC");
initProp("LINK_SEARCH_END_STATIC");
initProp("Swift_LANGUAGE_VERSION");
@@ -399,6 +403,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE");
initProp("XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS");
initProp("XCODE_SCHEME_ENVIRONMENT");
+ initPropValue("XCODE_LINK_BUILD_PHASE_MODE", "NONE");
}
#endif
}
@@ -523,11 +528,11 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
// check for "CMAKE_VS_GLOBALS" variable and set up target properties
// if any
- const char* globals = mf->GetDefinition("CMAKE_VS_GLOBALS");
+ cmProp globals = mf->GetDefinition("CMAKE_VS_GLOBALS");
if (globals) {
const std::string genName = mf->GetGlobalGenerator()->GetName();
if (cmHasLiteralPrefix(genName, "Visual Studio")) {
- std::vector<std::string> props = cmExpandedList(globals);
+ std::vector<std::string> props = cmExpandedList(*globals);
const std::string vsGlobal = "VS_GLOBAL_";
for (const std::string& i : props) {
// split NAME=VALUE
@@ -1016,9 +1021,9 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, std::string const& lib,
this->GetPolicyStatusCMP0073() == cmPolicies::WARN)) {
std::string targetEntry = cmStrCat(impl->Name, "_LIB_DEPENDS");
std::string dependencies;
- const char* old_val = mf.GetDefinition(targetEntry);
+ cmProp old_val = mf.GetDefinition(targetEntry);
if (old_val) {
- dependencies += old_val;
+ dependencies += *old_val;
}
switch (llt) {
case GENERAL_LibraryType:
@@ -1328,7 +1333,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
cmStrCat(reusedFrom, ".dir/"));
cmProp tmp = reusedTarget->GetProperty("COMPILE_PDB_NAME");
- this->SetProperty("COMPILE_PDB_NAME", tmp ? tmp->c_str() : nullptr);
+ this->SetProperty("COMPILE_PDB_NAME", cmToCStr(tmp));
this->AddUtility(reusedFrom, false, impl->Makefile);
} else if (prop == propC_STANDARD || prop == propCXX_STANDARD ||
prop == propCUDA_STANDARD || prop == propOBJC_STANDARD ||
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 43f1887..d8f66bc 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTarget_h
-#define cmTarget_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -291,5 +290,3 @@ private:
private:
std::unique_ptr<cmTargetInternals> impl;
};
-
-#endif
diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h
index 05ff092..54a20fd 100644
--- a/Source/cmTargetCompileDefinitionsCommand.h
+++ b/Source/cmTargetCompileDefinitionsCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTargetCompileDefinitionsCommand_h
-#define cmTargetCompileDefinitionsCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmTargetCompileDefinitionsCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmTargetCompileFeaturesCommand.h b/Source/cmTargetCompileFeaturesCommand.h
index db0c04b..9dbf486 100644
--- a/Source/cmTargetCompileFeaturesCommand.h
+++ b/Source/cmTargetCompileFeaturesCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTargetCompileFeaturesCommand_h
-#define cmTargetCompileFeaturesCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmTargetCompileFeaturesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmTargetCompileOptionsCommand.h b/Source/cmTargetCompileOptionsCommand.h
index 3ab1a89..1f7c684 100644
--- a/Source/cmTargetCompileOptionsCommand.h
+++ b/Source/cmTargetCompileOptionsCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTargetCompileOptionsCommand_h
-#define cmTargetCompileOptionsCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmTargetCompileOptionsCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmTargetDepend.h b/Source/cmTargetDepend.h
index 5452cc7..36702bd 100644
--- a/Source/cmTargetDepend.h
+++ b/Source/cmTargetDepend.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTargetDepend_h
-#define cmTargetDepend_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -60,5 +59,3 @@ public:
class cmTargetDependSet : public std::set<cmTargetDepend>
{
};
-
-#endif
diff --git a/Source/cmTargetExport.h b/Source/cmTargetExport.h
index 9304eab..cb4d8da 100644
--- a/Source/cmTargetExport.h
+++ b/Source/cmTargetExport.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTargetExport_h
-#define cmTargetExport_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -33,5 +32,3 @@ public:
std::string InterfaceIncludeDirectories;
///@}
};
-
-#endif
diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h
index 9958f41..223da7d 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.h
+++ b/Source/cmTargetIncludeDirectoriesCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTargetIncludeDirectoriesCommand_h
-#define cmTargetIncludeDirectoriesCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmTargetIncludeDirectoriesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmTargetLinkDirectoriesCommand.h b/Source/cmTargetLinkDirectoriesCommand.h
index 3724d6c..e305709 100644
--- a/Source/cmTargetLinkDirectoriesCommand.h
+++ b/Source/cmTargetLinkDirectoriesCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTargetLinkDirectoriesCommand_h
-#define cmTargetLinkDirectoriesCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmTargetLinkDirectoriesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index df751da..7db2c46 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTargetLinkLibrariesCommand.h"
-#include <cstring>
#include <memory>
#include <sstream>
#include <unordered_set>
@@ -14,6 +13,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
@@ -277,12 +277,12 @@ bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args,
// with old versions of CMake and new)
llt = GENERAL_LibraryType;
std::string linkType = cmStrCat(args[0], "_LINK_TYPE");
- const char* linkTypeString = mf.GetDefinition(linkType);
+ cmProp linkTypeString = mf.GetDefinition(linkType);
if (linkTypeString) {
- if (strcmp(linkTypeString, "debug") == 0) {
+ if (*linkTypeString == "debug") {
llt = DEBUG_LibraryType;
}
- if (strcmp(linkTypeString, "optimized") == 0) {
+ if (*linkTypeString == "optimized") {
llt = OPTIMIZED_LibraryType;
}
}
diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index 4b2deab..bc76f3e 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTargetLinkLibrariesCommand_h
-#define cmTargetLinkLibrariesCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmTargetLinkLibraryType.h b/Source/cmTargetLinkLibraryType.h
index 192c6da..16ac41a 100644
--- a/Source/cmTargetLinkLibraryType.h
+++ b/Source/cmTargetLinkLibraryType.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTargetLinkLibraryType_h
-#define cmTargetLinkLibraryType_h
+#pragma once
enum cmTargetLinkLibraryType
{
@@ -9,5 +8,3 @@ enum cmTargetLinkLibraryType
DEBUG_LibraryType,
OPTIMIZED_LibraryType
};
-
-#endif
diff --git a/Source/cmTargetLinkOptionsCommand.h b/Source/cmTargetLinkOptionsCommand.h
index 13fb40c..fbe7d49 100644
--- a/Source/cmTargetLinkOptionsCommand.h
+++ b/Source/cmTargetLinkOptionsCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTargetLinkOptionsCommand_h
-#define cmTargetLinkOptionsCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmTargetLinkOptionsCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmTargetPrecompileHeadersCommand.h b/Source/cmTargetPrecompileHeadersCommand.h
index 8b0ac97..dd08a6d 100644
--- a/Source/cmTargetPrecompileHeadersCommand.h
+++ b/Source/cmTargetPrecompileHeadersCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTargetPrecompileHeadersCommand_h
-#define cmTargetPrecompileHeadersCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmTargetPrecompileHeadersCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmTargetPropCommandBase.h b/Source/cmTargetPropCommandBase.h
index 601ad01..50ac1aa 100644
--- a/Source/cmTargetPropCommandBase.h
+++ b/Source/cmTargetPropCommandBase.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTargetPropCommandBase_h
-#define cmTargetPropCommandBase_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -58,5 +57,3 @@ private:
cmExecutionStatus& Status;
};
-
-#endif
diff --git a/Source/cmTargetPropertyComputer.h b/Source/cmTargetPropertyComputer.h
index bafa43b..f2be318 100644
--- a/Source/cmTargetPropertyComputer.h
+++ b/Source/cmTargetPropertyComputer.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTargetPropertyComputer_h
-#define cmTargetPropertyComputer_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -101,5 +100,3 @@ private:
static cmProp GetSources(Target const* tgt, cmMessenger* messenger,
cmListFileBacktrace const& context);
};
-
-#endif
diff --git a/Source/cmTargetSourcesCommand.h b/Source/cmTargetSourcesCommand.h
index 5eecf34..306226c 100644
--- a/Source/cmTargetSourcesCommand.h
+++ b/Source/cmTargetSourcesCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTargetSourcesCommand_h
-#define cmTargetSourcesCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmTargetSourcesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmTest.h b/Source/cmTest.h
index 72d4ed9..f33b7e2 100644
--- a/Source/cmTest.h
+++ b/Source/cmTest.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTest_h
-#define cmTest_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -66,5 +65,3 @@ private:
cmMakefile* Makefile;
cmListFileBacktrace Backtrace;
};
-
-#endif
diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h
index e388c16..6903140 100644
--- a/Source/cmTestGenerator.h
+++ b/Source/cmTestGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTestGenerator_h
-#define cmTestGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -56,5 +55,3 @@ protected:
cmTest* Test;
bool TestGenerated;
};
-
-#endif
diff --git a/Source/cmTimestamp.h b/Source/cmTimestamp.h
index 40338f8..8941abe 100644
--- a/Source/cmTimestamp.h
+++ b/Source/cmTimestamp.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTimestamp_h
-#define cmTimestamp_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -30,5 +29,3 @@ private:
std::string AddTimestampComponent(char flag, struct tm& timeStruct,
time_t timeT) const;
};
-
-#endif
diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h
index e525e85..d8cc16e 100644
--- a/Source/cmTryCompileCommand.h
+++ b/Source/cmTryCompileCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTryCompileCommand_h
-#define cmTryCompileCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -38,5 +37,3 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
};
-
-#endif
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 64d71bc..3f89641 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -146,10 +146,10 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv,
if (!this->OutputVariable.empty()) {
// if the TryCompileCore saved output in this outputVariable then
// prepend that output to this output
- const char* compileOutput =
+ cmProp compileOutput =
this->Makefile->GetDefinition(this->OutputVariable);
if (compileOutput) {
- runOutputContents = compileOutput + runOutputContents;
+ runOutputContents = *compileOutput + runOutputContents;
}
this->Makefile->AddDefinition(this->OutputVariable, runOutputContents);
}
@@ -328,12 +328,12 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
file << comment << "\n\n";
file << "set( " << this->RunResultVariable << " \n \""
- << this->Makefile->GetDefinition(this->RunResultVariable)
+ << this->Makefile->GetSafeDefinition(this->RunResultVariable)
<< "\"\n CACHE STRING \"Result from TRY_RUN\" FORCE)\n\n";
if (out) {
file << "set( " << internalRunOutputName << " \n \""
- << this->Makefile->GetDefinition(internalRunOutputName)
+ << this->Makefile->GetSafeDefinition(internalRunOutputName)
<< "\"\n CACHE STRING \"Output from TRY_RUN\" FORCE)\n\n";
}
file.close();
@@ -354,6 +354,6 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
}
if (out) {
- (*out) = this->Makefile->GetDefinition(internalRunOutputName);
+ (*out) = *this->Makefile->GetDefinition(internalRunOutputName);
}
}
diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h
index c53a694..070c63c 100644
--- a/Source/cmTryRunCommand.h
+++ b/Source/cmTryRunCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmTryRunCommand_h
-#define cmTryRunCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -51,5 +50,3 @@ private:
std::string RunOutputVariable;
std::string CompileOutputVariable;
};
-
-#endif
diff --git a/Source/cmUVProcessChain.h b/Source/cmUVProcessChain.h
index b5ccb19..5e8e7e6 100644
--- a/Source/cmUVProcessChain.h
+++ b/Source/cmUVProcessChain.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmUVProcessChain_h
-#define cmUVProcessChain_h
+#pragma once
#include <array>
#include <cstddef> // IWYU pragma: keep
@@ -96,5 +95,3 @@ private:
struct InternalData;
std::unique_ptr<InternalData> Data;
};
-
-#endif
diff --git a/Source/cmUVStreambuf.h b/Source/cmUVStreambuf.h
index 50faede..efe45de 100644
--- a/Source/cmUVStreambuf.h
+++ b/Source/cmUVStreambuf.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmUVStreambuf_h
-#define cmUVStreambuf_h
+#pragma once
#include <algorithm>
#include <cstring>
@@ -215,5 +214,3 @@ void cmBasicUVStreambuf<CharT, Traits>::StreamRead(ssize_t nread)
}
using cmUVStreambuf = cmBasicUVStreambuf<char>;
-
-#endif
diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h
index be4c166..3faa053 100644
--- a/Source/cmUnsetCommand.h
+++ b/Source/cmUnsetCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmUnsetCommand_h
-#define cmUnsetCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -17,5 +16,3 @@ class cmExecutionStatus;
*/
bool cmUnsetCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h
index 215e4a3..5670c5d 100644
--- a/Source/cmUseMangledMesaCommand.h
+++ b/Source/cmUseMangledMesaCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmUseMangledMesaCommand_h
-#define cmUseMangledMesaCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmUseMangledMesaCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx
index 6de78ff..d276c8a 100644
--- a/Source/cmUtilitySourceCommand.cxx
+++ b/Source/cmUtilitySourceCommand.cxx
@@ -6,6 +6,7 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
@@ -24,7 +25,7 @@ bool cmUtilitySourceCommand(std::vector<std::string> const& args,
// The first argument is the cache entry name.
std::string const& cacheEntry = *arg++;
- const char* cacheValue = status.GetMakefile().GetDefinition(cacheEntry);
+ cmProp cacheValue = status.GetMakefile().GetDefinition(cacheEntry);
// If it exists already and appears up to date then we are done. If
// the string contains "(IntDir)" but that is not the
// CMAKE_CFG_INTDIR setting then the value is out of date.
@@ -45,7 +46,7 @@ bool cmUtilitySourceCommand(std::vector<std::string> const& args,
} else {
cmState* state = status.GetMakefile().GetState();
haveCacheValue = (cacheValue &&
- (strstr(cacheValue, "(IntDir)") == nullptr ||
+ (strstr(cacheValue->c_str(), "(IntDir)") == nullptr ||
(intDir == "$(IntDir)")) &&
(state->GetCacheMajorVersion() != 0 &&
state->GetCacheMinorVersion() != 0));
@@ -84,8 +85,9 @@ bool cmUtilitySourceCommand(std::vector<std::string> const& args,
std::string utilityDirectory =
status.GetMakefile().GetCurrentBinaryDirectory();
std::string exePath;
- if (auto d = status.GetMakefile().GetDefinition("EXECUTABLE_OUTPUT_PATH")) {
- exePath = d;
+ if (cmProp d =
+ status.GetMakefile().GetDefinition("EXECUTABLE_OUTPUT_PATH")) {
+ exePath = *d;
}
if (!exePath.empty()) {
utilityDirectory = exePath;
@@ -96,7 +98,7 @@ bool cmUtilitySourceCommand(std::vector<std::string> const& args,
// Construct the cache entry for the executable's location.
std::string utilityExecutable = utilityDirectory + "/" + cmakeCFGout + "/" +
utilityName +
- status.GetMakefile().GetDefinition("CMAKE_EXECUTABLE_SUFFIX");
+ *status.GetMakefile().GetDefinition("CMAKE_EXECUTABLE_SUFFIX");
// make sure we remove any /./ in the name
cmSystemTools::ReplaceString(utilityExecutable, "/./", "/");
diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h
index 934d539..8cf7e7f 100644
--- a/Source/cmUtilitySourceCommand.h
+++ b/Source/cmUtilitySourceCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmUtilitySourceCommand_h
-#define cmUtilitySourceCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmUtilitySourceCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmUtils.hxx b/Source/cmUtils.hxx
index a7a3e81..733e72f 100644
--- a/Source/cmUtils.hxx
+++ b/Source/cmUtils.hxx
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmUtils_hxx
-#define cmUtils_hxx
+#pragma once
#include "cmsys/SystemTools.hxx"
@@ -13,5 +12,3 @@ inline bool isCMakeVerbose()
return (cmSystemTools::HasEnv("VERBOSE") &&
!cmSystemTools::HasEnv("CMAKE_NO_VERBOSE"));
}
-
-#endif
diff --git a/Source/cmUuid.h b/Source/cmUuid.h
index 7de20dd..f5f724d 100644
--- a/Source/cmUuid.h
+++ b/Source/cmUuid.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmUuid_h
-#define cmUuid_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -41,5 +40,3 @@ private:
bool IntFromHexDigit(char input, char& output) const;
};
-
-#endif
diff --git a/Source/cmVSSetupHelper.h b/Source/cmVSSetupHelper.h
index a926eee..04ea46d 100644
--- a/Source/cmVSSetupHelper.h
+++ b/Source/cmVSSetupHelper.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmVSSetupHelper_h
-#define cmVSSetupHelper_h
+#pragma once
#ifndef NOMINMAX
# define NOMINMAX // Undefine min and max defined by windows.h
@@ -136,5 +135,3 @@ private:
std::string SpecifiedVSInstallLocation;
};
-
-#endif
diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx
index 6b93c63..1fe03ab 100644
--- a/Source/cmVariableRequiresCommand.cxx
+++ b/Source/cmVariableRequiresCommand.cxx
@@ -4,6 +4,7 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -37,11 +38,11 @@ bool cmVariableRequiresCommand(std::vector<std::string> const& args,
}
}
}
- const char* reqVar = status.GetMakefile().GetDefinition(resultVariable);
+ cmProp reqVar = status.GetMakefile().GetDefinition(resultVariable);
// if reqVar is unset, then set it to requirementsMet
// if reqVar is set to true, but requirementsMet is false , then
// set reqVar to false.
- if (!reqVar || (!requirementsMet && status.GetMakefile().IsOn(reqVar))) {
+ if (!reqVar || (!requirementsMet && status.GetMakefile().IsOn(*reqVar))) {
status.GetMakefile().AddDefinitionBool(resultVariable, requirementsMet);
}
diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h
index fb0520e..c6bfe8a 100644
--- a/Source/cmVariableRequiresCommand.h
+++ b/Source/cmVariableRequiresCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmVariableRequiresCommand_h
-#define cmVariableRequiresCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -12,5 +11,3 @@ class cmExecutionStatus;
bool cmVariableRequiresCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h
index 6c418ed..349ce0e 100644
--- a/Source/cmVariableWatch.h
+++ b/Source/cmVariableWatch.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmVariableWatch_h
-#define cmVariableWatch_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -81,5 +80,3 @@ protected:
StringToVectorOfPairs WatchMap;
};
-
-#endif
diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index ecae16d..750b0b5 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -10,6 +10,7 @@
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmProperty.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmVariableWatch.h"
@@ -45,7 +46,7 @@ void cmVariableWatchCommandVariableAccessed(const std::string& variable,
std::string stack = *mf->GetProperty("LISTFILE_STACK");
if (!data->Command.empty()) {
cmListFileFunction newLFF;
- const char* const currentListFile =
+ cmProp const currentListFile =
mf->GetDefinition("CMAKE_CURRENT_LIST_FILE");
const auto fakeLineNo =
std::numeric_limits<decltype(cmListFileArgument::Line)>::max();
@@ -53,7 +54,7 @@ void cmVariableWatchCommandVariableAccessed(const std::string& variable,
{ variable, cmListFileArgument::Quoted, fakeLineNo },
{ accessString, cmListFileArgument::Quoted, fakeLineNo },
{ newValue ? newValue : "", cmListFileArgument::Quoted, fakeLineNo },
- { currentListFile, cmListFileArgument::Quoted, fakeLineNo },
+ { *currentListFile, cmListFileArgument::Quoted, fakeLineNo },
{ stack, cmListFileArgument::Quoted, fakeLineNo }
};
newLFF.Name = data->Command;
diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h
index 3f9f244..4477cb7 100644
--- a/Source/cmVariableWatchCommand.h
+++ b/Source/cmVariableWatchCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmVariableWatchCommand_h
-#define cmVariableWatchCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -16,5 +15,3 @@ class cmExecutionStatus;
*/
bool cmVariableWatchCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmVersion.h b/Source/cmVersion.h
index 932ef04..9072c9f 100644
--- a/Source/cmVersion.h
+++ b/Source/cmVersion.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmVersion_h
-#define cmVersion_h
+#pragma once
#include <cm3p/kwiml/int.h>
@@ -30,5 +29,3 @@ public:
((((major)*1000u) * CMake_VERSION_ENCODE__BASE) + \
(((minor) % 1000u) * CMake_VERSION_ENCODE__BASE) + \
(((patch) % CMake_VERSION_ENCODE__BASE)))
-
-#endif
diff --git a/Source/cmVersionMacros.h b/Source/cmVersionMacros.h
index e8ac4f8..f33f0df 100644
--- a/Source/cmVersionMacros.h
+++ b/Source/cmVersionMacros.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmVersionMacros_h
-#define cmVersionMacros_h
+#pragma once
#include "cmVersionConfig.h"
@@ -9,5 +8,3 @@
#if CMake_VERSION_PATCH_IS_RELEASE(CMake_VERSION_PATCH)
# define CMake_VERSION_IS_RELEASE 1
#endif
-
-#endif
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index fa6ad47..ae4a5be 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -314,10 +314,6 @@ std::ostream& cmVisualStudio10TargetGenerator::Elem::WriteString(
void cmVisualStudio10TargetGenerator::Generate()
{
- // do not generate external ms projects
- if (this->GeneratorTarget->GetProperty("EXTERNAL_MSPROJECT")) {
- return;
- }
const std::string ProjectFileExtension =
computeProjectFileExtension(this->GeneratorTarget);
if (ProjectFileExtension == ".vcxproj") {
@@ -515,7 +511,7 @@ void cmVisualStudio10TargetGenerator::Generate()
p = this->GeneratorTarget->GetProperty(
"DOTNET_TARGET_FRAMEWORK_VERSION");
}
- const char* targetFrameworkVersion = p ? p->c_str() : nullptr;
+ const char* targetFrameworkVersion = cmToCStr(p);
if (!targetFrameworkVersion && this->ProjectType == csproj &&
this->GlobalGenerator->TargetsWindowsCE() &&
this->GlobalGenerator->GetVersion() ==
@@ -1226,9 +1222,9 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues(
Elem& e1, std::string const& config)
{
cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator;
- const char* mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG");
+ cmProp mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG");
if (mfcFlag) {
- std::string const mfcFlagValue = mfcFlag;
+ std::string const mfcFlagValue = *mfcFlag;
std::string useOfMfcValue = "false";
if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) {
@@ -2603,42 +2599,42 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions(
e1.WritePlatformConfigTag("IntDir", cond, intermediateDir);
- if (const char* sdkExecutableDirectories = this->Makefile->GetDefinition(
+ if (cmProp sdkExecutableDirectories = this->Makefile->GetDefinition(
"CMAKE_VS_SDK_EXECUTABLE_DIRECTORIES")) {
e1.WritePlatformConfigTag("ExecutablePath", cond,
- sdkExecutableDirectories);
+ *sdkExecutableDirectories);
}
- if (const char* sdkIncludeDirectories = this->Makefile->GetDefinition(
+ if (cmProp sdkIncludeDirectories = this->Makefile->GetDefinition(
"CMAKE_VS_SDK_INCLUDE_DIRECTORIES")) {
- e1.WritePlatformConfigTag("IncludePath", cond, sdkIncludeDirectories);
+ e1.WritePlatformConfigTag("IncludePath", cond, *sdkIncludeDirectories);
}
- if (const char* sdkReferenceDirectories = this->Makefile->GetDefinition(
+ if (cmProp sdkReferenceDirectories = this->Makefile->GetDefinition(
"CMAKE_VS_SDK_REFERENCE_DIRECTORIES")) {
e1.WritePlatformConfigTag("ReferencePath", cond,
- sdkReferenceDirectories);
+ *sdkReferenceDirectories);
}
- if (const char* sdkLibraryDirectories = this->Makefile->GetDefinition(
+ if (cmProp sdkLibraryDirectories = this->Makefile->GetDefinition(
"CMAKE_VS_SDK_LIBRARY_DIRECTORIES")) {
- e1.WritePlatformConfigTag("LibraryPath", cond, sdkLibraryDirectories);
+ e1.WritePlatformConfigTag("LibraryPath", cond, *sdkLibraryDirectories);
}
- if (const char* sdkLibraryWDirectories = this->Makefile->GetDefinition(
+ if (cmProp sdkLibraryWDirectories = this->Makefile->GetDefinition(
"CMAKE_VS_SDK_LIBRARY_WINRT_DIRECTORIES")) {
e1.WritePlatformConfigTag("LibraryWPath", cond,
- sdkLibraryWDirectories);
+ *sdkLibraryWDirectories);
}
- if (const char* sdkSourceDirectories =
+ if (cmProp sdkSourceDirectories =
this->Makefile->GetDefinition("CMAKE_VS_SDK_SOURCE_DIRECTORIES")) {
- e1.WritePlatformConfigTag("SourcePath", cond, sdkSourceDirectories);
+ e1.WritePlatformConfigTag("SourcePath", cond, *sdkSourceDirectories);
}
- if (const char* sdkExcludeDirectories = this->Makefile->GetDefinition(
+ if (cmProp sdkExcludeDirectories = this->Makefile->GetDefinition(
"CMAKE_VS_SDK_EXCLUDE_DIRECTORIES")) {
- e1.WritePlatformConfigTag("ExcludePath", cond, sdkExcludeDirectories);
+ e1.WritePlatformConfigTag("ExcludePath", cond, *sdkExcludeDirectories);
}
std::string name =
@@ -3769,9 +3765,9 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
};
}
- if (const char* stackVal = this->Makefile->GetDefinition(
+ if (cmProp stackVal = this->Makefile->GetDefinition(
"CMAKE_" + linkLanguage + "_STACK_SIZE")) {
- linkOptions.AddFlag("StackReserveSize", stackVal);
+ linkOptions.AddFlag("StackReserveSize", *stackVal);
}
linkOptions.AddFlag("GenerateDebugInformation", "false");
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index c54057a..35dbba8 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmVisualStudioTargetGenerator_h
-#define cmVisualStudioTargetGenerator_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -259,5 +258,3 @@ private:
ConfigToSettings& toolSettings);
std::string GetCMakeFilePath(const char* name) const;
};
-
-#endif
diff --git a/Source/cmVisualStudio10ToolsetOptions.h b/Source/cmVisualStudio10ToolsetOptions.h
index 875a35b..85cc2b6 100644
--- a/Source/cmVisualStudio10ToolsetOptions.h
+++ b/Source/cmVisualStudio10ToolsetOptions.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmVisualStudio10ToolsetOptions_h
-#define cmVisualStudio10ToolsetOptions_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -30,4 +29,3 @@ public:
std::string GetToolsetName(std::string const& name,
std::string const& toolset) const;
};
-#endif
diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h
index f9b50a7..b123019 100644
--- a/Source/cmVisualStudioGeneratorOptions.h
+++ b/Source/cmVisualStudioGeneratorOptions.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmVisualStudioGeneratorOptions_h
-#define cmVisualStudioGeneratorOptions_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -100,5 +99,3 @@ private:
FlagValue TakeFlag(std::string const& key);
};
-
-#endif
diff --git a/Source/cmVisualStudioSlnData.h b/Source/cmVisualStudioSlnData.h
index 5ce7d74..b217bd8 100644
--- a/Source/cmVisualStudioSlnData.h
+++ b/Source/cmVisualStudioSlnData.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmVisualStudioSlnData_h
-#define cmVisualStudioSlnData_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -50,5 +49,3 @@ private:
using ProjectStringIndex = std::map<std::string, ProjectStorage::iterator>;
ProjectStringIndex ProjectNameIndex;
};
-
-#endif
diff --git a/Source/cmVisualStudioSlnParser.h b/Source/cmVisualStudioSlnParser.h
index 4557cdb..1c33759 100644
--- a/Source/cmVisualStudioSlnParser.h
+++ b/Source/cmVisualStudioSlnParser.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmVisualStudioSlnParser_h
-#define cmVisualStudioSlnParser_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -103,5 +102,3 @@ protected:
bool ParseValue(const std::string& value, ParsedLine& parsedLine);
};
-
-#endif
diff --git a/Source/cmVisualStudioWCEPlatformParser.h b/Source/cmVisualStudioWCEPlatformParser.h
index 60a6611..eb4e978 100644
--- a/Source/cmVisualStudioWCEPlatformParser.h
+++ b/Source/cmVisualStudioWCEPlatformParser.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmVisualStudioWCEPlatformParser_h
-#define cmVisualStudioWCEPlatformParser_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -67,5 +66,3 @@ private:
std::string VcInstallDir;
std::string VsInstallDir;
};
-
-#endif
diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h
index beca652..5b8f078 100644
--- a/Source/cmWhileCommand.h
+++ b/Source/cmWhileCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmWhileCommand_h
-#define cmWhileCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -13,5 +12,3 @@ struct cmListFileArgument;
/// \brief Starts a while loop
bool cmWhileCommand(std::vector<cmListFileArgument> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmWorkerPool.h b/Source/cmWorkerPool.h
index 9179922..0fb6707 100644
--- a/Source/cmWorkerPool.h
+++ b/Source/cmWorkerPool.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmWorkerPool_h
-#define cmWorkerPool_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -221,5 +220,3 @@ private:
unsigned int ThreadCount_ = 1;
std::unique_ptr<cmWorkerPoolInternal> Int_;
};
-
-#endif
diff --git a/Source/cmWorkingDirectory.h b/Source/cmWorkingDirectory.h
index 4c7576d..c8adea9 100644
--- a/Source/cmWorkingDirectory.h
+++ b/Source/cmWorkingDirectory.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmWorkingDirectory_h
-#define cmWorkingDirectory_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -43,5 +42,3 @@ private:
std::string OldDir;
int ResultCode;
};
-
-#endif
diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h
index 3e0e043..0225e4f 100644
--- a/Source/cmWriteFileCommand.h
+++ b/Source/cmWriteFileCommand.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmWriteFileCommand_h
-#define cmWriteFileCommand_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -16,5 +15,3 @@ class cmExecutionStatus;
*/
bool cmWriteFileCommand(std::vector<std::string> const& args,
cmExecutionStatus& status);
-
-#endif
diff --git a/Source/cmXCode21Object.cxx b/Source/cmXCode21Object.cxx
index 6b133a9..1cf9a95 100644
--- a/Source/cmXCode21Object.cxx
+++ b/Source/cmXCode21Object.cxx
@@ -16,7 +16,7 @@ cmXCode21Object::cmXCode21Object(PBXType ptype, Type type)
void cmXCode21Object::PrintComment(std::ostream& out)
{
if (this->Comment.empty()) {
- cmXCodeObject* n = this->GetObject("name");
+ cmXCodeObject* n = this->GetAttribute("name");
if (n) {
this->Comment = n->GetString();
cmSystemTools::ReplaceString(this->Comment, "\"", "");
diff --git a/Source/cmXCode21Object.h b/Source/cmXCode21Object.h
index 76fad23..eb017447 100644
--- a/Source/cmXCode21Object.h
+++ b/Source/cmXCode21Object.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmXCode21Object_h
-#define cmXCode21Object_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -21,4 +20,3 @@ public:
static void PrintList(std::vector<std::unique_ptr<cmXCodeObject>> const&,
std::ostream& out);
};
-#endif
diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h
index 24ecaa2..78d4727 100644
--- a/Source/cmXCodeObject.h
+++ b/Source/cmXCodeObject.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmXCodeObject_h
-#define cmXCodeObject_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -82,6 +81,10 @@ public:
void SetObject(cmXCodeObject* value) { this->Object = value; }
cmXCodeObject* GetObject() { return this->Object; }
void AddObject(cmXCodeObject* value) { this->List.push_back(value); }
+ void PrependObject(cmXCodeObject* value)
+ {
+ this->List.insert(this->List.begin(), value);
+ }
bool HasObject(cmXCodeObject* o) const
{
return cm::contains(this->List, o);
@@ -107,7 +110,7 @@ public:
void SetTarget(cmGeneratorTarget* t) { this->Target = t; }
const std::string& GetComment() const { return this->Comment; }
bool HasComment() const { return (!this->Comment.empty()); }
- cmXCodeObject* GetObject(const char* name) const
+ cmXCodeObject* GetAttribute(const char* name) const
{
auto const i = this->ObjectAttributes.find(name);
if (i != this->ObjectAttributes.end()) {
@@ -167,4 +170,3 @@ protected:
std::map<std::string, StringVec> DependTargets;
std::map<std::string, cmXCodeObject*> ObjectAttributes;
};
-#endif
diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h
index da40856..11f043e 100644
--- a/Source/cmXCodeScheme.h
+++ b/Source/cmXCodeScheme.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmXCodeScheme_h
-#define cmXCodeScheme_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -74,5 +73,3 @@ private:
static bool IsExecutable(const cmXCodeObject* target);
};
-
-#endif
diff --git a/Source/cmXMLParser.h b/Source/cmXMLParser.h
index 1bc8d64..7e805d7 100644
--- a/Source/cmXMLParser.h
+++ b/Source/cmXMLParser.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmXMLParser_h
-#define cmXMLParser_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -107,5 +106,3 @@ protected:
friend void cmXMLParserEndElement(void*, const char*);
friend void cmXMLParserCharacterDataHandler(void*, const char*, int);
};
-
-#endif
diff --git a/Source/cmXMLSafe.h b/Source/cmXMLSafe.h
index 9aaf2d1..9b4c539 100644
--- a/Source/cmXMLSafe.h
+++ b/Source/cmXMLSafe.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmXMLSafe_h
-#define cmXMLSafe_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -33,5 +32,3 @@ private:
bool DoQuotes;
friend std::ostream& operator<<(std::ostream&, cmXMLSafe const&);
};
-
-#endif
diff --git a/Source/cmXMLWriter.h b/Source/cmXMLWriter.h
index 00ea08c..a16c4c8 100644
--- a/Source/cmXMLWriter.h
+++ b/Source/cmXMLWriter.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmXMLWiter_h
-#define cmXMLWiter_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -196,5 +195,3 @@ public:
private:
cmXMLWriter& xmlwr;
};
-
-#endif
diff --git a/Source/cm_codecvt.hxx b/Source/cm_codecvt.hxx
index b2cb9e6..1860211 100644
--- a/Source/cm_codecvt.hxx
+++ b/Source/cm_codecvt.hxx
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_codecvt_hxx
-#define cm_codecvt_hxx
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -62,5 +61,3 @@ private:
#endif
};
-
-#endif
diff --git a/Source/cm_get_date.h b/Source/cm_get_date.h
index 38a690e..65722df 100644
--- a/Source/cm_get_date.h
+++ b/Source/cm_get_date.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_get_date_h
-#define cm_get_date_h
+#pragma once
#include <time.h> /* NOLINT(modernize-deprecated-headers) */
@@ -15,5 +14,3 @@ time_t cm_get_date(time_t now, const char* str);
#ifdef __cplusplus
} /* extern "C" */
#endif
-
-#endif
diff --git a/Source/cm_sys_stat.h b/Source/cm_sys_stat.h
index 9194286..c4e3d84 100644
--- a/Source/cm_sys_stat.h
+++ b/Source/cm_sys_stat.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_sys_stat_h
-#define cm_sys_stat_h
+#pragma once
#if defined(_MSC_VER)
using mode_t = unsigned short;
@@ -10,5 +9,3 @@ using mode_t = unsigned short;
#include <sys/types.h>
// include sys/stat.h after sys/types.h
#include <sys/stat.h> // IWYU pragma: export
-
-#endif
diff --git a/Source/cm_utf8.h b/Source/cm_utf8.h
index 27dc559..fa9ed3a 100644
--- a/Source/cm_utf8.h
+++ b/Source/cm_utf8.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_utf8_h
-#define cm_utf8_h
+#pragma once
#ifdef __cplusplus
extern "C" {
@@ -20,5 +19,3 @@ int cm_utf8_is_valid(const char* s);
#ifdef __cplusplus
} /* extern "C" */
#endif
-
-#endif
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index f630a7e..bca938e 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -205,6 +205,7 @@ cmake::cmake(Role role, cmState::Mode mode)
setupExts(this->CudaFileExtensions, { "cu" });
setupExts(this->FortranFileExtensions,
{ "f", "F", "for", "f77", "f90", "f95", "f03" });
+ setupExts(this->ISPCFileExtensions, { "ispc" });
}
}
@@ -1978,6 +1979,8 @@ std::vector<std::string> cmake::GetAllExtensions() const
// cuda extensions are also in SourceFileExtensions so we ignore it here
allExt.insert(allExt.end(), this->FortranFileExtensions.ordered.begin(),
this->FortranFileExtensions.ordered.end());
+ allExt.insert(allExt.end(), this->ISPCFileExtensions.ordered.begin(),
+ this->ISPCFileExtensions.ordered.end());
return allExt;
}
@@ -2283,7 +2286,8 @@ int cmake::CheckBuildSystem()
if (this->ClearBuildSystem) {
// Get the generator used for this build system.
- const char* genName = mf.GetDefinition("CMAKE_DEPENDS_GENERATOR");
+ const char* genName =
+ cmToCStr(mf.GetDefinition("CMAKE_DEPENDS_GENERATOR"));
if (!cmNonempty(genName)) {
genName = "Unix Makefiles";
}
diff --git a/Source/cmake.h b/Source/cmake.h
index 0c4f429..44c35c2 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmake_h
-#define cmake_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -268,7 +267,8 @@ public:
{
return this->CLikeSourceFileExtensions.Test(ext) ||
this->CudaFileExtensions.Test(ext) ||
- this->FortranFileExtensions.Test(ext);
+ this->FortranFileExtensions.Test(ext) ||
+ this->ISPCFileExtensions.Test(ext);
}
bool IsACLikeSourceExtension(cm::string_view ext) const
@@ -617,6 +617,7 @@ private:
FileExtensions CLikeSourceFileExtensions;
FileExtensions HeaderFileExtensions;
FileExtensions CudaFileExtensions;
+ FileExtensions ISPCFileExtensions;
FileExtensions FortranFileExtensions;
bool ClearBuildSystem = false;
bool DebugTryCompile = false;
@@ -780,5 +781,3 @@ private:
F(cuda_std_14) \
F(cuda_std_17) \
F(cuda_std_20)
-
-#endif
diff --git a/Source/cmcmd.h b/Source/cmcmd.h
index 5b6c813..605df23 100644
--- a/Source/cmcmd.h
+++ b/Source/cmcmd.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmcmd_h
-#define cmcmd_h
+#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
@@ -36,5 +35,3 @@ protected:
static int RunLLVMRC(std::vector<std::string> const& args);
static int VisualStudioLink(std::vector<std::string> const& args, int type);
};
-
-#endif
diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt
index 0b2c8f6..87925bd 100644
--- a/Tests/CMakeLib/CMakeLists.txt
+++ b/Tests/CMakeLib/CMakeLists.txt
@@ -13,6 +13,7 @@ set(CMakeLib_TESTS
testCTestResourceGroups.cxx
testGccDepfileReader.cxx
testGeneratedFileStream.cxx
+ testJSONHelpers.cxx
testRST.cxx
testRange.cxx
testOptional.cxx
diff --git a/Tests/CMakeLib/testJSONHelpers.cxx b/Tests/CMakeLib/testJSONHelpers.cxx
new file mode 100644
index 0000000..78eed5b
--- /dev/null
+++ b/Tests/CMakeLib/testJSONHelpers.cxx
@@ -0,0 +1,493 @@
+#include <functional>
+#include <iostream>
+#include <map>
+#include <string>
+#include <vector>
+
+#include <cm/optional>
+#include <cmext/string_view>
+
+#include <cm3p/json/value.h>
+
+#include "cmJSONHelpers.h"
+
+#define ASSERT_TRUE(x) \
+ do { \
+ if (!(x)) { \
+ std::cout << "ASSERT_TRUE(" #x ") failed on line " << __LINE__ << "\n"; \
+ return false; \
+ } \
+ } while (false)
+
+namespace {
+struct ObjectStruct
+{
+ std::string Field1;
+ int Field2;
+};
+
+struct InheritedStruct : public ObjectStruct
+{
+ std::string Field3;
+};
+
+enum class ErrorCode
+{
+ Success,
+ InvalidInt,
+ InvalidBool,
+ InvalidString,
+ InvalidObject,
+ InvalidArray,
+ MissingRequired,
+};
+
+auto const IntHelper =
+ cmJSONIntHelper<ErrorCode>(ErrorCode::Success, ErrorCode::InvalidInt, 1);
+auto const RequiredIntHelper =
+ cmJSONRequiredHelper<int, ErrorCode>(ErrorCode::MissingRequired, IntHelper);
+auto const UIntHelper =
+ cmJSONUIntHelper<ErrorCode>(ErrorCode::Success, ErrorCode::InvalidInt, 1);
+auto const BoolHelper = cmJSONBoolHelper<ErrorCode>(
+ ErrorCode::Success, ErrorCode::InvalidBool, false);
+auto const StringHelper = cmJSONStringHelper<ErrorCode>(
+ ErrorCode::Success, ErrorCode::InvalidString, "default");
+auto const RequiredStringHelper = cmJSONRequiredHelper<std::string, ErrorCode>(
+ ErrorCode::MissingRequired, StringHelper);
+auto const StringVectorHelper = cmJSONVectorHelper<std::string, ErrorCode>(
+ ErrorCode::Success, ErrorCode::InvalidArray, StringHelper);
+auto const StringVectorFilterHelper =
+ cmJSONVectorFilterHelper<std::string, ErrorCode>(
+ ErrorCode::Success, ErrorCode::InvalidArray, StringHelper,
+ [](const std::string& value) { return value != "ignore"; });
+auto const StringMapHelper = cmJSONMapHelper<std::string, ErrorCode>(
+ ErrorCode::Success, ErrorCode::InvalidObject, StringHelper);
+auto const StringMapFilterHelper =
+ cmJSONMapFilterHelper<std::string, ErrorCode>(
+ ErrorCode::Success, ErrorCode::InvalidObject, StringHelper,
+ [](const std::string& key) { return key != "ignore"; });
+auto const OptionalStringHelper =
+ cmJSONOptionalHelper<std::string>(ErrorCode::Success, StringHelper);
+
+bool testInt()
+{
+ Json::Value v(2);
+ int i = 0;
+ ASSERT_TRUE(IntHelper(i, &v) == ErrorCode::Success);
+ ASSERT_TRUE(i == 2);
+
+ i = 0;
+ v = Json::nullValue;
+ ASSERT_TRUE(IntHelper(i, &v) == ErrorCode::InvalidInt);
+
+ i = 0;
+ ASSERT_TRUE(IntHelper(i, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(i == 1);
+
+ return true;
+}
+
+bool testUInt()
+{
+ Json::Value v(2);
+ unsigned int i = 0;
+ ASSERT_TRUE(UIntHelper(i, &v) == ErrorCode::Success);
+ ASSERT_TRUE(i == 2);
+
+ i = 0;
+ v = Json::nullValue;
+ ASSERT_TRUE(UIntHelper(i, &v) == ErrorCode::InvalidInt);
+
+ i = 0;
+ ASSERT_TRUE(UIntHelper(i, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(i == 1);
+
+ return true;
+}
+
+bool testBool()
+{
+ Json::Value v(true);
+ bool b = false;
+ ASSERT_TRUE(BoolHelper(b, &v) == ErrorCode::Success);
+ ASSERT_TRUE(b);
+
+ b = false;
+ v = false;
+ ASSERT_TRUE(BoolHelper(b, &v) == ErrorCode::Success);
+ ASSERT_TRUE(!b);
+
+ b = false;
+ v = 4;
+ ASSERT_TRUE(BoolHelper(b, &v) == ErrorCode::InvalidBool);
+
+ b = true;
+ ASSERT_TRUE(BoolHelper(b, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(!b);
+
+ return true;
+}
+
+bool testString()
+{
+ Json::Value v("str");
+ std::string str = "";
+ ASSERT_TRUE(StringHelper(str, &v) == ErrorCode::Success);
+ ASSERT_TRUE(str == "str");
+
+ str = "";
+ v = Json::nullValue;
+ ASSERT_TRUE(StringHelper(str, &v) == ErrorCode::InvalidString);
+
+ str = "";
+ ASSERT_TRUE(StringHelper(str, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(str == "default");
+
+ return true;
+}
+
+bool testObject()
+{
+ auto const helper = cmJSONObjectHelper<ObjectStruct, ErrorCode>(
+ ErrorCode::Success, ErrorCode::InvalidObject)
+ .Bind("field1"_s, &ObjectStruct::Field1, StringHelper)
+ .Bind("field2"_s, &ObjectStruct::Field2, IntHelper)
+ .Bind<std::string>("field3"_s, nullptr, StringHelper);
+
+ Json::Value v(Json::objectValue);
+ v["field1"] = "Hello";
+ v["field2"] = 2;
+ v["field3"] = "world!";
+ v["extra"] = "extra";
+
+ ObjectStruct s1;
+ ASSERT_TRUE(helper(s1, &v) == ErrorCode::Success);
+ ASSERT_TRUE(s1.Field1 == "Hello");
+ ASSERT_TRUE(s1.Field2 == 2);
+
+ v["field2"] = "wrong";
+ ObjectStruct s2;
+ ASSERT_TRUE(helper(s2, &v) == ErrorCode::InvalidInt);
+
+ v.removeMember("field2");
+ ObjectStruct s3;
+ ASSERT_TRUE(helper(s3, &v) == ErrorCode::InvalidObject);
+
+ v["field2"] = 2;
+ v["field3"] = 3;
+ ObjectStruct s4;
+ ASSERT_TRUE(helper(s4, &v) == ErrorCode::InvalidString);
+
+ v.removeMember("field3");
+ ObjectStruct s5;
+ ASSERT_TRUE(helper(s5, &v) == ErrorCode::InvalidObject);
+
+ v = "Hello";
+ ObjectStruct s6;
+ ASSERT_TRUE(helper(s6, &v) == ErrorCode::InvalidObject);
+
+ ObjectStruct s7;
+ ASSERT_TRUE(helper(s7, nullptr) == ErrorCode::InvalidObject);
+
+ return true;
+}
+
+bool testObjectInherited()
+{
+ auto const helper =
+ cmJSONObjectHelper<InheritedStruct, ErrorCode>(ErrorCode::Success,
+ ErrorCode::InvalidObject)
+ .Bind("field1"_s, &InheritedStruct::Field1, StringHelper)
+ .Bind("field2"_s, &InheritedStruct::Field2, IntHelper)
+ .Bind("field3"_s, &InheritedStruct::Field3, StringHelper);
+
+ Json::Value v(Json::objectValue);
+ v["field1"] = "Hello";
+ v["field2"] = 2;
+ v["field3"] = "world!";
+ v["extra"] = "extra";
+
+ InheritedStruct s1;
+ ASSERT_TRUE(helper(s1, &v) == ErrorCode::Success);
+ ASSERT_TRUE(s1.Field1 == "Hello");
+ ASSERT_TRUE(s1.Field2 == 2);
+ ASSERT_TRUE(s1.Field3 == "world!");
+
+ v["field2"] = "wrong";
+ InheritedStruct s2;
+ ASSERT_TRUE(helper(s2, &v) == ErrorCode::InvalidInt);
+
+ v.removeMember("field2");
+ InheritedStruct s3;
+ ASSERT_TRUE(helper(s3, &v) == ErrorCode::InvalidObject);
+
+ v["field2"] = 2;
+ v["field3"] = 3;
+ InheritedStruct s4;
+ ASSERT_TRUE(helper(s4, &v) == ErrorCode::InvalidString);
+
+ v.removeMember("field3");
+ InheritedStruct s5;
+ ASSERT_TRUE(helper(s5, &v) == ErrorCode::InvalidObject);
+
+ v = "Hello";
+ InheritedStruct s6;
+ ASSERT_TRUE(helper(s6, &v) == ErrorCode::InvalidObject);
+
+ InheritedStruct s7;
+ ASSERT_TRUE(helper(s7, nullptr) == ErrorCode::InvalidObject);
+
+ return true;
+}
+
+bool testObjectNoExtra()
+{
+ auto const helper = cmJSONObjectHelper<ObjectStruct, ErrorCode>(
+ ErrorCode::Success, ErrorCode::InvalidObject, false)
+ .Bind("field1"_s, &ObjectStruct::Field1, StringHelper)
+ .Bind("field2"_s, &ObjectStruct::Field2, IntHelper);
+
+ Json::Value v(Json::objectValue);
+ v["field1"] = "Hello";
+ v["field2"] = 2;
+
+ ObjectStruct s1;
+ ASSERT_TRUE(helper(s1, &v) == ErrorCode::Success);
+ ASSERT_TRUE(s1.Field1 == "Hello");
+ ASSERT_TRUE(s1.Field2 == 2);
+
+ v["extra"] = "world!";
+ ObjectStruct s2;
+ ASSERT_TRUE(helper(s2, &v) == ErrorCode::InvalidObject);
+
+ return true;
+}
+
+bool testObjectOptional()
+{
+ auto const helper =
+ cmJSONObjectHelper<ObjectStruct, ErrorCode>(ErrorCode::Success,
+ ErrorCode::InvalidObject)
+ .Bind("field1"_s, &ObjectStruct::Field1, StringHelper, false)
+ .Bind("field2"_s, &ObjectStruct::Field2, IntHelper, false)
+ .Bind<std::string>("field3_s", nullptr, StringHelper, false);
+
+ Json::Value v(Json::objectValue);
+ v["field1"] = "Hello";
+ v["field2"] = 2;
+ v["field3"] = "world!";
+ v["extra"] = "extra";
+
+ ObjectStruct s1;
+ ASSERT_TRUE(helper(s1, &v) == ErrorCode::Success);
+ ASSERT_TRUE(s1.Field1 == "Hello");
+ ASSERT_TRUE(s1.Field2 == 2);
+
+ v = Json::objectValue;
+ ObjectStruct s2;
+ ASSERT_TRUE(helper(s2, &v) == ErrorCode::Success);
+ ASSERT_TRUE(s2.Field1 == "default");
+ ASSERT_TRUE(s2.Field2 == 1);
+
+ ObjectStruct s3;
+ ASSERT_TRUE(helper(s3, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(s3.Field1 == "default");
+ ASSERT_TRUE(s3.Field2 == 1);
+
+ return true;
+}
+
+bool testVector()
+{
+ Json::Value v(Json::arrayValue);
+ v.append("Hello");
+ v.append("world!");
+ v.append("ignore");
+
+ std::vector<std::string> l{ "default" };
+ std::vector<std::string> expected{ "Hello", "world!", "ignore" };
+ ASSERT_TRUE(StringVectorHelper(l, &v) == ErrorCode::Success);
+ ASSERT_TRUE(l == expected);
+
+ v[1] = 2;
+ l = { "default" };
+ ASSERT_TRUE(StringVectorHelper(l, &v) == ErrorCode::InvalidString);
+
+ v = "Hello";
+ l = { "default" };
+ ASSERT_TRUE(StringVectorHelper(l, &v) == ErrorCode::InvalidArray);
+
+ l = { "default" };
+ ASSERT_TRUE(StringVectorHelper(l, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(l.empty());
+
+ return true;
+}
+
+bool testVectorFilter()
+{
+ Json::Value v(Json::arrayValue);
+ v.append("Hello");
+ v.append("world!");
+ v.append("ignore");
+
+ std::vector<std::string> l{ "default" };
+ std::vector<std::string> expected{
+ "Hello",
+ "world!",
+ };
+ ASSERT_TRUE(StringVectorFilterHelper(l, &v) == ErrorCode::Success);
+ ASSERT_TRUE(l == expected);
+
+ v[1] = 2;
+ l = { "default" };
+ ASSERT_TRUE(StringVectorFilterHelper(l, &v) == ErrorCode::InvalidString);
+
+ v = "Hello";
+ l = { "default" };
+ ASSERT_TRUE(StringVectorFilterHelper(l, &v) == ErrorCode::InvalidArray);
+
+ l = { "default" };
+ ASSERT_TRUE(StringVectorFilterHelper(l, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(l.empty());
+
+ return true;
+}
+
+bool testMap()
+{
+ Json::Value v(Json::objectValue);
+ v["field1"] = "Hello";
+ v["field2"] = "world!";
+ v["ignore"] = "ignore";
+
+ std::map<std::string, std::string> m{ { "key", "default" } };
+ std::map<std::string, std::string> expected{ { "field1", "Hello" },
+ { "field2", "world!" },
+ { "ignore", "ignore" } };
+ ASSERT_TRUE(StringMapHelper(m, &v) == ErrorCode::Success);
+ ASSERT_TRUE(m == expected);
+
+ v = Json::arrayValue;
+ m = { { "key", "default" } };
+ ASSERT_TRUE(StringMapHelper(m, &v) == ErrorCode::InvalidObject);
+
+ m = { { "key", "default" } };
+ ASSERT_TRUE(StringMapHelper(m, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(m.empty());
+
+ return true;
+}
+
+bool testMapFilter()
+{
+ Json::Value v(Json::objectValue);
+ v["field1"] = "Hello";
+ v["field2"] = "world!";
+ v["ignore"] = "ignore";
+
+ std::map<std::string, std::string> m{ { "key", "default" } };
+ std::map<std::string, std::string> expected{ { "field1", "Hello" },
+ { "field2", "world!" } };
+ ASSERT_TRUE(StringMapFilterHelper(m, &v) == ErrorCode::Success);
+ ASSERT_TRUE(m == expected);
+
+ v = Json::arrayValue;
+ m = { { "key", "default" } };
+ ASSERT_TRUE(StringMapFilterHelper(m, &v) == ErrorCode::InvalidObject);
+
+ m = { { "key", "default" } };
+ ASSERT_TRUE(StringMapFilterHelper(m, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(m.empty());
+
+ return true;
+}
+
+bool testOptional()
+{
+ Json::Value v = "Hello";
+
+ cm::optional<std::string> str{ "default" };
+ ASSERT_TRUE(OptionalStringHelper(str, &v) == ErrorCode::Success);
+ ASSERT_TRUE(str == "Hello");
+
+ str.emplace("default");
+ ASSERT_TRUE(OptionalStringHelper(str, nullptr) == ErrorCode::Success);
+ ASSERT_TRUE(str == cm::nullopt);
+
+ return true;
+}
+
+bool testRequired()
+{
+ Json::Value v = "Hello";
+
+ std::string str = "default";
+ int i = 1;
+ ASSERT_TRUE(RequiredStringHelper(str, &v) == ErrorCode::Success);
+ ASSERT_TRUE(str == "Hello");
+ ASSERT_TRUE(RequiredIntHelper(i, &v) == ErrorCode::InvalidInt);
+
+ v = 2;
+ str = "default";
+ i = 1;
+ ASSERT_TRUE(RequiredStringHelper(str, &v) == ErrorCode::InvalidString);
+ ASSERT_TRUE(RequiredIntHelper(i, &v) == ErrorCode::Success);
+ ASSERT_TRUE(i == 2);
+
+ str = "default";
+ i = 1;
+ ASSERT_TRUE(RequiredStringHelper(str, nullptr) ==
+ ErrorCode::MissingRequired);
+ ASSERT_TRUE(RequiredIntHelper(i, nullptr) == ErrorCode::MissingRequired);
+
+ return true;
+}
+}
+
+int testJSONHelpers(int /*unused*/, char* /*unused*/ [])
+{
+ if (!testInt()) {
+ return 1;
+ }
+ if (!testUInt()) {
+ return 1;
+ }
+ if (!testBool()) {
+ return 1;
+ }
+ if (!testString()) {
+ return 1;
+ }
+ if (!testObject()) {
+ return 1;
+ }
+ if (!testObjectInherited()) {
+ return 1;
+ }
+ if (!testObjectNoExtra()) {
+ return 1;
+ }
+ if (!testObjectOptional()) {
+ return 1;
+ }
+ if (!testVector()) {
+ return 1;
+ }
+ if (!testVectorFilter()) {
+ return 1;
+ }
+ if (!testMap()) {
+ return 1;
+ }
+ if (!testMapFilter()) {
+ return 1;
+ }
+ if (!testOptional()) {
+ return 1;
+ }
+ if (!testRequired()) {
+ return 1;
+ }
+ return 0;
+}
diff --git a/Tests/CMakeLib/testOptional.cxx b/Tests/CMakeLib/testOptional.cxx
index c6bc9c2..de09c0f 100644
--- a/Tests/CMakeLib/testOptional.cxx
+++ b/Tests/CMakeLib/testOptional.cxx
@@ -29,6 +29,13 @@ public:
CONST_RVALUE_REFERENCE,
SWAP,
+
+ COMPARE_EE_EQ,
+ COMPARE_EE_NE,
+ COMPARE_EE_LT,
+ COMPARE_EE_LE,
+ COMPARE_EE_GT,
+ COMPARE_EE_GE,
};
EventType Type;
@@ -75,6 +82,14 @@ public:
int Value = 0;
};
+#define ASSERT_TRUE(x) \
+ do { \
+ if (!(x)) { \
+ std::cout << "ASSERT_TRUE(" #x ") failed on line " << __LINE__ << "\n"; \
+ return false; \
+ } \
+ } while (false)
+
// Certain builds of GCC generate false -Wmaybe-uninitialized warnings when
// doing a release build with the system version of std::optional. These
// warnings do not manifest when using our own cm::optional implementation.
@@ -153,6 +168,42 @@ EventLogger& EventLogger::operator=(int value)
return *this;
}
+bool operator==(const EventLogger& lhs, const EventLogger& rhs)
+{
+ events.push_back({ Event::COMPARE_EE_EQ, &lhs, &rhs, lhs.Value });
+ return lhs.Value == rhs.Value;
+}
+
+bool operator!=(const EventLogger& lhs, const EventLogger& rhs)
+{
+ events.push_back({ Event::COMPARE_EE_NE, &lhs, &rhs, lhs.Value });
+ return lhs.Value != rhs.Value;
+}
+
+bool operator<(const EventLogger& lhs, const EventLogger& rhs)
+{
+ events.push_back({ Event::COMPARE_EE_LT, &lhs, &rhs, lhs.Value });
+ return lhs.Value < rhs.Value;
+}
+
+bool operator<=(const EventLogger& lhs, const EventLogger& rhs)
+{
+ events.push_back({ Event::COMPARE_EE_LE, &lhs, &rhs, lhs.Value });
+ return lhs.Value <= rhs.Value;
+}
+
+bool operator>(const EventLogger& lhs, const EventLogger& rhs)
+{
+ events.push_back({ Event::COMPARE_EE_GT, &lhs, &rhs, lhs.Value });
+ return lhs.Value > rhs.Value;
+}
+
+bool operator>=(const EventLogger& lhs, const EventLogger& rhs)
+{
+ events.push_back({ Event::COMPARE_EE_GE, &lhs, &rhs, lhs.Value });
+ return lhs.Value >= rhs.Value;
+}
+
void EventLogger::Reference() &
{
events.push_back({ Event::REFERENCE, this, nullptr, this->Value });
@@ -368,42 +419,23 @@ static bool testDereference(std::vector<Event>& expected)
static bool testHasValue(std::vector<Event>& expected)
{
- bool retval = true;
-
const cm::optional<EventLogger> o1{ 4 };
const cm::optional<EventLogger> o2{};
- if (!o1.has_value()) {
- std::cout << "o1 should have a value" << std::endl;
- retval = false;
- }
-
- if (!o1) {
- std::cout << "(bool)o1 should be true" << std::endl;
- retval = false;
- }
-
- if (o2.has_value()) {
- std::cout << "o2 should not have a value" << std::endl;
- retval = false;
- }
-
- if (o2) {
- std::cout << "(bool)o2 should be false" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(o1.has_value());
+ ASSERT_TRUE(o1);
+ ASSERT_TRUE(!o2.has_value());
+ ASSERT_TRUE(!o2);
expected = {
{ Event::VALUE_CONSTRUCT, &*o1, nullptr, 4 },
{ Event::DESTRUCT, &*o1, nullptr, 4 },
};
- return retval;
+ return true;
}
static bool testValue(std::vector<Event>& expected)
{
- bool retval = true;
-
cm::optional<EventLogger> o1{ 4 };
const cm::optional<EventLogger> o2{ 5 };
cm::optional<EventLogger> o3{};
@@ -418,10 +450,7 @@ static bool testValue(std::vector<Event>& expected)
} catch (cm::bad_optional_access&) {
thrown = true;
}
- if (!thrown) {
- std::cout << "o3.value() did not throw" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(thrown);
thrown = false;
try {
@@ -429,10 +458,7 @@ static bool testValue(std::vector<Event>& expected)
} catch (cm::bad_optional_access&) {
thrown = true;
}
- if (!thrown) {
- std::cout << "o4.value() did not throw" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(thrown);
expected = {
{ Event::VALUE_CONSTRUCT, &*o1, nullptr, 4 },
@@ -442,13 +468,11 @@ static bool testValue(std::vector<Event>& expected)
{ Event::DESTRUCT, &*o2, nullptr, 5 },
{ Event::DESTRUCT, &*o1, nullptr, 4 },
};
- return retval;
+ return true;
}
static bool testValueOr()
{
- bool retval = true;
-
const cm::optional<EventLogger> o1{ 4 };
cm::optional<EventLogger> o2{ 5 };
const cm::optional<EventLogger> o3{};
@@ -460,33 +484,133 @@ static bool testValueOr()
EventLogger e4{ 9 };
EventLogger r1 = o1.value_or(e1);
- if (r1.Value != 4) {
- std::cout << "r1.Value should be 4" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(r1.Value == 4);
EventLogger r2 = std::move(o2).value_or(e2);
- if (r2.Value != 5) {
- std::cout << "r2.Value should be 5" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(r2.Value == 5);
EventLogger r3 = o3.value_or(e3);
- if (r3.Value != 8) {
- std::cout << "r3.Value should be 8" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(r3.Value == 8);
EventLogger r4 = std::move(o4).value_or(e4);
- if (r4.Value != 9) {
- std::cout << "r4.Value should be 9" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(r4.Value == 9);
- return retval;
+ return true;
}
-static bool testSwap(std::vector<Event>& expected)
+static bool testComparison(std::vector<Event>& expected)
{
- bool retval = true;
+ const cm::optional<EventLogger> o1{ 1 };
+ const cm::optional<EventLogger> o2{ 2 };
+ const cm::optional<EventLogger> o3{ 2 };
+ const cm::optional<EventLogger> o4{};
+ const cm::optional<EventLogger> o5{};
+ const EventLogger e1{ 2 };
+
+ ASSERT_TRUE(!(o1 == o2) && o1 != o2);
+ ASSERT_TRUE(o1 < o2 && !(o1 >= o2));
+ ASSERT_TRUE(!(o1 > o2) && o1 <= o2);
+
+ ASSERT_TRUE(o2 == o3 && !(o2 != o3));
+ ASSERT_TRUE(!(o2 < o3) && o2 >= o3);
+ ASSERT_TRUE(!(o2 > o3) && o2 <= o3);
+
+ ASSERT_TRUE(!(o3 == o4) && o3 != o4);
+ ASSERT_TRUE(!(o3 < o4) && o3 >= o4);
+ ASSERT_TRUE(o3 > o4 && !(o3 <= o4));
+
+ ASSERT_TRUE(o4 == o5 && !(o4 != o5));
+ ASSERT_TRUE(!(o4 < o5) && o4 >= o5);
+ ASSERT_TRUE(!(o4 > o5) && o4 <= o5);
+
+ ASSERT_TRUE(!(o1 == cm::nullopt) && o1 != cm::nullopt);
+ ASSERT_TRUE(!(o1 < cm::nullopt) && o1 >= cm::nullopt);
+ ASSERT_TRUE(o1 > cm::nullopt && !(o1 <= cm::nullopt));
+
+ ASSERT_TRUE(!(cm::nullopt == o1) && cm::nullopt != o1);
+ ASSERT_TRUE(cm::nullopt < o1 && !(cm::nullopt >= o1));
+ ASSERT_TRUE(!(cm::nullopt > o1) && cm::nullopt <= o1);
+
+ ASSERT_TRUE(o4 == cm::nullopt && !(o4 != cm::nullopt));
+ ASSERT_TRUE(!(o4 < cm::nullopt) && o4 >= cm::nullopt);
+ ASSERT_TRUE(!(o4 > cm::nullopt) && o4 <= cm::nullopt);
+
+ ASSERT_TRUE(cm::nullopt == o4 && !(cm::nullopt != o4));
+ ASSERT_TRUE(!(cm::nullopt < o4) && cm::nullopt >= o4);
+ ASSERT_TRUE(!(cm::nullopt > o4) && cm::nullopt <= o4);
+
+ ASSERT_TRUE(!(o1 == e1) && o1 != e1);
+ ASSERT_TRUE(o1 < e1 && !(o1 >= e1));
+ ASSERT_TRUE(!(o1 > e1) && o1 <= e1);
+
+ ASSERT_TRUE(o2 == e1 && !(o2 != e1));
+ ASSERT_TRUE(!(o2 < e1) && o2 >= e1);
+ ASSERT_TRUE(!(o2 > e1) && o2 <= e1);
+ ASSERT_TRUE(!(o4 == e1) && o4 != e1);
+ ASSERT_TRUE(o4 < e1 && !(o4 >= e1));
+ ASSERT_TRUE(!(o4 > e1) && o4 <= e1);
+
+ ASSERT_TRUE(!(e1 == o1) && e1 != o1);
+ ASSERT_TRUE(!(e1 < o1) && e1 >= o1);
+ ASSERT_TRUE(e1 > o1 && !(e1 <= o1));
+
+ ASSERT_TRUE(e1 == o2 && !(e1 != o2));
+ ASSERT_TRUE(!(e1 < o2) && e1 >= o2);
+ ASSERT_TRUE(!(e1 > o2) && e1 <= o2);
+
+ ASSERT_TRUE(!(e1 == o4) && e1 != o4);
+ ASSERT_TRUE(!(e1 < o4) && e1 >= o4);
+ ASSERT_TRUE(e1 > o4 && !(e1 <= o4));
+
+ expected = {
+ { Event::VALUE_CONSTRUCT, &*o1, nullptr, 1 },
+ { Event::VALUE_CONSTRUCT, &*o2, nullptr, 2 },
+ { Event::VALUE_CONSTRUCT, &*o3, nullptr, 2 },
+ { Event::VALUE_CONSTRUCT, &e1, nullptr, 2 },
+ { Event::COMPARE_EE_EQ, &*o1, &*o2, 1 },
+ { Event::COMPARE_EE_NE, &*o1, &*o2, 1 },
+ { Event::COMPARE_EE_LT, &*o1, &*o2, 1 },
+ { Event::COMPARE_EE_GE, &*o1, &*o2, 1 },
+ { Event::COMPARE_EE_GT, &*o1, &*o2, 1 },
+ { Event::COMPARE_EE_LE, &*o1, &*o2, 1 },
+ { Event::COMPARE_EE_EQ, &*o2, &*o3, 2 },
+ { Event::COMPARE_EE_NE, &*o2, &*o3, 2 },
+ { Event::COMPARE_EE_LT, &*o2, &*o3, 2 },
+ { Event::COMPARE_EE_GE, &*o2, &*o3, 2 },
+ { Event::COMPARE_EE_GT, &*o2, &*o3, 2 },
+ { Event::COMPARE_EE_LE, &*o2, &*o3, 2 },
+ { Event::COMPARE_EE_EQ, &*o1, &e1, 1 },
+ { Event::COMPARE_EE_NE, &*o1, &e1, 1 },
+ { Event::COMPARE_EE_LT, &*o1, &e1, 1 },
+ { Event::COMPARE_EE_GE, &*o1, &e1, 1 },
+ { Event::COMPARE_EE_GT, &*o1, &e1, 1 },
+ { Event::COMPARE_EE_LE, &*o1, &e1, 1 },
+ { Event::COMPARE_EE_EQ, &*o2, &e1, 2 },
+ { Event::COMPARE_EE_NE, &*o2, &e1, 2 },
+ { Event::COMPARE_EE_LT, &*o2, &e1, 2 },
+ { Event::COMPARE_EE_GE, &*o2, &e1, 2 },
+ { Event::COMPARE_EE_GT, &*o2, &e1, 2 },
+ { Event::COMPARE_EE_LE, &*o2, &e1, 2 },
+ { Event::COMPARE_EE_EQ, &e1, &*o1, 2 },
+ { Event::COMPARE_EE_NE, &e1, &*o1, 2 },
+ { Event::COMPARE_EE_LT, &e1, &*o1, 2 },
+ { Event::COMPARE_EE_GE, &e1, &*o1, 2 },
+ { Event::COMPARE_EE_GT, &e1, &*o1, 2 },
+ { Event::COMPARE_EE_LE, &e1, &*o1, 2 },
+ { Event::COMPARE_EE_EQ, &e1, &*o2, 2 },
+ { Event::COMPARE_EE_NE, &e1, &*o2, 2 },
+ { Event::COMPARE_EE_LT, &e1, &*o2, 2 },
+ { Event::COMPARE_EE_GE, &e1, &*o2, 2 },
+ { Event::COMPARE_EE_GT, &e1, &*o2, 2 },
+ { Event::COMPARE_EE_LE, &e1, &*o2, 2 },
+ { Event::DESTRUCT, &e1, nullptr, 2 },
+ { Event::DESTRUCT, &*o3, nullptr, 2 },
+ { Event::DESTRUCT, &*o2, nullptr, 2 },
+ { Event::DESTRUCT, &*o1, nullptr, 1 },
+ };
+ return true;
+}
+
+static bool testSwap(std::vector<Event>& expected)
+{
cm::optional<EventLogger> o1{ 4 };
auto const* v1 = &*o1;
cm::optional<EventLogger> o2{};
@@ -494,66 +618,30 @@ static bool testSwap(std::vector<Event>& expected)
o1.swap(o2);
auto const* v2 = &*o2;
- if (o1.has_value()) {
- std::cout << "o1 should not have value" << std::endl;
- retval = false;
- }
- if (!o2.has_value()) {
- std::cout << "o2 should have value" << std::endl;
- retval = false;
- }
- if (o2.value().Value != 4) {
- std::cout << "value of o2 should be 4" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(!o1.has_value());
+ ASSERT_TRUE(o2.has_value());
+ ASSERT_TRUE(o2.value().Value == 4);
o1.swap(o2);
- if (!o1.has_value()) {
- std::cout << "o1 should have value" << std::endl;
- retval = false;
- }
- if (o1.value().Value != 4) {
- std::cout << "value of o1 should be 4" << std::endl;
- retval = false;
- }
- if (o2.has_value()) {
- std::cout << "o2 should not have value" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(o1.has_value());
+ ASSERT_TRUE(o1.value().Value == 4);
+ ASSERT_TRUE(!o2.has_value());
o2.emplace(5);
o1.swap(o2);
- if (!o1.has_value()) {
- std::cout << "o1 should have value" << std::endl;
- retval = false;
- }
- if (o1.value().Value != 5) {
- std::cout << "value of o1 should be 5" << std::endl;
- retval = false;
- }
- if (!o2.has_value()) {
- std::cout << "o2 should not have value" << std::endl;
- retval = false;
- }
- if (o2.value().Value != 4) {
- std::cout << "value of o2 should be 4" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(o1.has_value());
+ ASSERT_TRUE(o1.value().Value == 5);
+ ASSERT_TRUE(o2.has_value());
+ ASSERT_TRUE(o2.value().Value == 4);
o1.reset();
o2.reset();
o1.swap(o2);
- if (o1.has_value()) {
- std::cout << "o1 should not have value" << std::endl;
- retval = false;
- }
- if (o2.has_value()) {
- std::cout << "o2 should not have value" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(!o1.has_value());
+ ASSERT_TRUE(!o2.has_value());
expected = {
{ Event::VALUE_CONSTRUCT, v1, nullptr, 4 },
@@ -566,22 +654,17 @@ static bool testSwap(std::vector<Event>& expected)
{ Event::DESTRUCT, v1, nullptr, 5 },
{ Event::DESTRUCT, v2, nullptr, 4 },
};
- return retval;
+ return true;
}
static bool testReset(std::vector<Event>& expected)
{
- bool retval = true;
-
cm::optional<EventLogger> o{ 4 };
auto const* v = &*o;
o.reset();
- if (o.has_value()) {
- std::cout << "o should not have value" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(!o.has_value());
o.reset();
@@ -589,7 +672,7 @@ static bool testReset(std::vector<Event>& expected)
{ Event::VALUE_CONSTRUCT, v, nullptr, 4 },
{ Event::DESTRUCT, v, nullptr, 4 },
};
- return retval;
+ return true;
}
static bool testEmplace(std::vector<Event>& expected)
@@ -630,8 +713,6 @@ static bool testMakeOptional(std::vector<Event>& expected)
static bool testMemoryRange(std::vector<Event>& expected)
{
- bool retval = true;
-
cm::optional<EventLogger> o{ 4 };
auto* ostart = &o;
@@ -639,17 +720,14 @@ static bool testMemoryRange(std::vector<Event>& expected)
auto* estart = &o.value();
auto* eend = estart + 1;
- if (static_cast<void*>(estart) < static_cast<void*>(ostart) ||
- static_cast<void*>(eend) > static_cast<void*>(oend)) {
- std::cout << "value is not within memory range of optional" << std::endl;
- retval = false;
- }
+ ASSERT_TRUE(static_cast<void*>(estart) >= static_cast<void*>(ostart) &&
+ static_cast<void*>(eend) <= static_cast<void*>(oend));
expected = {
{ Event::VALUE_CONSTRUCT, &*o, nullptr, 4 },
{ Event::DESTRUCT, &*o, nullptr, 4 },
};
- return retval;
+ return true;
}
int testOptional(int /*unused*/, char* /*unused*/ [])
@@ -691,6 +769,7 @@ int testOptional(int /*unused*/, char* /*unused*/ [])
DO_EVENT_TEST(testHasValue);
DO_EVENT_TEST(testValue);
DO_TEST(testValueOr);
+ DO_EVENT_TEST(testComparison);
DO_EVENT_TEST(testSwap);
DO_EVENT_TEST(testReset);
DO_EVENT_TEST(testEmplace);
diff --git a/Tests/CMakeLib/testStringAlgorithms.cxx b/Tests/CMakeLib/testStringAlgorithms.cxx
index 63826cf..c2706c1 100644
--- a/Tests/CMakeLib/testStringAlgorithms.cxx
+++ b/Tests/CMakeLib/testStringAlgorithms.cxx
@@ -226,5 +226,15 @@ int testStringAlgorithms(int /*unused*/, char* /*unused*/ [])
"cmStrToULong rejects trailing content.");
}
+ // ----------------------------------------------------------------------
+ // Test cmStrLen
+ {
+ constexpr auto len = cmStrLen("Hello world!");
+ assert_ok(len == 12,
+ "cmStrLen returns length of non-empty literal string");
+ assert_ok(cmStrLen("") == 0,
+ "cmStrLen returns length of empty literal string");
+ }
+
return failed;
}
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 5d4ffae..95162ec 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1483,6 +1483,10 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
add_subdirectory(CudaOnly)
endif()
+ if(CMake_TEST_ISPC)
+ add_subdirectory(ISPC)
+ endif()
+
if(CMake_TEST_FindGTest)
add_subdirectory(FindGTest)
add_subdirectory(GoogleTest)
diff --git a/Tests/ISPC/CMakeLists.txt b/Tests/ISPC/CMakeLists.txt
new file mode 100644
index 0000000..c13271a
--- /dev/null
+++ b/Tests/ISPC/CMakeLists.txt
@@ -0,0 +1,16 @@
+
+
+macro (add_ispc_test_macro name)
+ add_test_macro("${name}" ${ARGN})
+ set_property(TEST "${name}" APPEND
+ PROPERTY LABELS "ISPC")
+endmacro ()
+
+add_ispc_test_macro(ISPC.ChainedStaticLibraries ISPCChainedStaticLibraries)
+add_ispc_test_macro(ISPC.Defines ISPCDefines)
+add_ispc_test_macro(ISPC.DynamicLibrary ISPCDynamicLibrary)
+add_ispc_test_macro(ISPC.ObjectGenex ISPCObjectGenex)
+add_ispc_test_macro(ISPC.ObjectLibrary ISPCObjectLibrary)
+add_ispc_test_macro(ISPC.ResponseAndDefine ISPCResponseAndDefine)
+add_ispc_test_macro(ISPC.StaticLibrary ISPCStaticLibrary)
+add_ispc_test_macro(ISPC.TryCompile ISPCTryCompile)
diff --git a/Tests/ISPC/ChainedStaticLibraries/CMakeLists.txt b/Tests/ISPC/ChainedStaticLibraries/CMakeLists.txt
new file mode 100644
index 0000000..9a255a0
--- /dev/null
+++ b/Tests/ISPC/ChainedStaticLibraries/CMakeLists.txt
@@ -0,0 +1,22 @@
+
+cmake_minimum_required(VERSION 3.18)
+project(ISPCChainedStaticLibraries CXX ISPC)
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(CMAKE_ISPC_FLAGS "--arch=x86")
+endif()
+
+
+add_library(ispc_objects1 STATIC extra.ispc extra.cxx)
+add_library(ispc_objects2 STATIC simple.ispc)
+
+set_target_properties(ispc_objects1 PROPERTIES POSITION_INDEPENDENT_CODE ON)
+set_target_properties(ispc_objects1 PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;avx1-i32x16;avx2-i32x4")
+
+set_target_properties(ispc_objects2 PROPERTIES POSITION_INDEPENDENT_CODE ON)
+set_target_properties(ispc_objects2 PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4")
+
+target_link_libraries(ispc_objects2 PRIVATE ispc_objects1)
+
+add_executable(ISPCChainedStaticLibraries main.cxx)
+target_link_libraries(ISPCChainedStaticLibraries PUBLIC ispc_objects2)
diff --git a/Tests/ISPC/ChainedStaticLibraries/extra.cxx b/Tests/ISPC/ChainedStaticLibraries/extra.cxx
new file mode 100644
index 0000000..88ef3a7
--- /dev/null
+++ b/Tests/ISPC/ChainedStaticLibraries/extra.cxx
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+#include "extra.ispc.h"
+
+int extra()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::extra(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: extra(%f) = %f\n", i, vin[i], vout[i]);
+
+ return 0;
+}
diff --git a/Tests/ISPC/ChainedStaticLibraries/extra.ispc b/Tests/ISPC/ChainedStaticLibraries/extra.ispc
new file mode 100644
index 0000000..5a4a442
--- /dev/null
+++ b/Tests/ISPC/ChainedStaticLibraries/extra.ispc
@@ -0,0 +1,12 @@
+
+export void extra(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < 3.)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/ChainedStaticLibraries/main.cxx b/Tests/ISPC/ChainedStaticLibraries/main.cxx
new file mode 100644
index 0000000..4f1c9be
--- /dev/null
+++ b/Tests/ISPC/ChainedStaticLibraries/main.cxx
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+#include "simple.ispc.h"
+
+int main()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::simple(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]);
+}
diff --git a/Tests/ISPC/ChainedStaticLibraries/simple.ispc b/Tests/ISPC/ChainedStaticLibraries/simple.ispc
new file mode 100644
index 0000000..70cb588
--- /dev/null
+++ b/Tests/ISPC/ChainedStaticLibraries/simple.ispc
@@ -0,0 +1,12 @@
+
+export void simple(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < 3.)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/Defines/CMakeLists.txt b/Tests/ISPC/Defines/CMakeLists.txt
new file mode 100644
index 0000000..7645804
--- /dev/null
+++ b/Tests/ISPC/Defines/CMakeLists.txt
@@ -0,0 +1,16 @@
+cmake_minimum_required(VERSION 3.18)
+project(ISPCDefines CXX ISPC)
+
+set(CMAKE_ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4;avx512knl-i32x16;avx512skx-i32x8")
+set(CMAKE_ISPC_FLAGS -DM_PI=3.1415926535f)
+add_compile_definitions([==[STRUCT_DEFINE=struct{uniform int a]==])
+
+add_executable(ISPCDefines
+ main.cxx
+ simple.ispc
+ )
+
+set_target_properties(ISPCDefines PROPERTIES POSITION_INDEPENDENT_CODE ON)
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set_source_files_properties(simple.ispc PROPERTIES COMPILE_OPTIONS "--arch=x86")
+endif()
diff --git a/Tests/ISPC/Defines/main.cxx b/Tests/ISPC/Defines/main.cxx
new file mode 100644
index 0000000..4f1c9be
--- /dev/null
+++ b/Tests/ISPC/Defines/main.cxx
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+#include "simple.ispc.h"
+
+int main()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::simple(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]);
+}
diff --git a/Tests/ISPC/Defines/simple.ispc b/Tests/ISPC/Defines/simple.ispc
new file mode 100644
index 0000000..d8d6465
--- /dev/null
+++ b/Tests/ISPC/Defines/simple.ispc
@@ -0,0 +1,15 @@
+
+//textual error if STRUCT_DEFINE not set
+STRUCT_DEFINE;};
+
+export void simple(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < M_PI)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/DynamicLibrary/CMakeLists.txt b/Tests/ISPC/DynamicLibrary/CMakeLists.txt
new file mode 100644
index 0000000..cbfbb3e
--- /dev/null
+++ b/Tests/ISPC/DynamicLibrary/CMakeLists.txt
@@ -0,0 +1,20 @@
+
+cmake_minimum_required(VERSION 3.18)
+project(ISPCDynamicLibrary CXX ISPC)
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(CMAKE_ISPC_FLAGS "--arch=x86")
+endif()
+
+
+add_library(ispc_objects1 STATIC extra.ispc extra.cxx)
+add_library(ispc_objects2 SHARED simple.ispc)
+
+set_target_properties(ispc_objects1 PROPERTIES POSITION_INDEPENDENT_CODE ON)
+set_target_properties(ispc_objects1 PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;avx1-i32x16;avx2-i32x4")
+set_target_properties(ispc_objects2 PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4")
+
+target_link_libraries(ispc_objects2 PRIVATE ispc_objects1)
+
+add_executable(ISPCDynamicLibrary main.cxx)
+target_link_libraries(ISPCDynamicLibrary PUBLIC ispc_objects2)
diff --git a/Tests/ISPC/DynamicLibrary/extra.cxx b/Tests/ISPC/DynamicLibrary/extra.cxx
new file mode 100644
index 0000000..88ef3a7
--- /dev/null
+++ b/Tests/ISPC/DynamicLibrary/extra.cxx
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+#include "extra.ispc.h"
+
+int extra()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::extra(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: extra(%f) = %f\n", i, vin[i], vout[i]);
+
+ return 0;
+}
diff --git a/Tests/ISPC/DynamicLibrary/extra.ispc b/Tests/ISPC/DynamicLibrary/extra.ispc
new file mode 100644
index 0000000..5a4a442
--- /dev/null
+++ b/Tests/ISPC/DynamicLibrary/extra.ispc
@@ -0,0 +1,12 @@
+
+export void extra(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < 3.)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/DynamicLibrary/main.cxx b/Tests/ISPC/DynamicLibrary/main.cxx
new file mode 100644
index 0000000..4f1c9be
--- /dev/null
+++ b/Tests/ISPC/DynamicLibrary/main.cxx
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+#include "simple.ispc.h"
+
+int main()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::simple(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]);
+}
diff --git a/Tests/ISPC/DynamicLibrary/simple.ispc b/Tests/ISPC/DynamicLibrary/simple.ispc
new file mode 100644
index 0000000..70cb588
--- /dev/null
+++ b/Tests/ISPC/DynamicLibrary/simple.ispc
@@ -0,0 +1,12 @@
+
+export void simple(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < 3.)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/ObjectGenex/CMakeLists.txt b/Tests/ISPC/ObjectGenex/CMakeLists.txt
new file mode 100644
index 0000000..bc0cbf6
--- /dev/null
+++ b/Tests/ISPC/ObjectGenex/CMakeLists.txt
@@ -0,0 +1,45 @@
+cmake_minimum_required(VERSION 3.18)
+project(ISPCObjectGenex CXX ISPC)
+
+set(CMAKE_ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4;avx512knl-i32x16;avx512skx-i32x8")
+
+add_library(ispc_objects OBJECT
+ simple.ispc
+ )
+target_compile_definitions(ispc_objects PRIVATE
+ $<$<COMPILE_LANG_AND_ID:ISPC,Intel>:M_PI=3.1415926535f>
+)
+set_target_properties(ispc_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set_source_files_properties(simple.ispc PROPERTIES COMPILE_OPTIONS "--arch=x86")
+endif()
+
+
+#Test ObjectFiles with file(GENERATE)
+file(GENERATE
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gen_$<LOWER_CASE:$<CONFIG>/>path_to_objs.h
+ CONTENT [[
+#ifndef path_to_objs
+#define path_to_objs
+
+#include <string>
+
+static std::string obj_paths = "$<TARGET_OBJECTS:ispc_objects>";
+
+#endif
+
+]]
+)
+
+
+add_executable(ISPCObjectGenex main.cxx)
+add_dependencies(ISPCObjectGenex ispc_objects)
+
+list(LENGTH CMAKE_ISPC_INSTRUCTION_SETS numberOfTargets)
+math(EXPR numberOfTargets "${numberOfTargets}+1")
+target_compile_definitions(ISPCObjectGenex PRIVATE
+ "ExpectedISPCObjects=${numberOfTargets}"
+ "CONFIG_TYPE=gen_$<LOWER_CASE:$<CONFIG>>"
+ )
+target_include_directories(ISPCObjectGenex PRIVATE ${CMAKE_CURRENT_BINARY_DIR} )
+target_compile_features(ISPCObjectGenex PRIVATE cxx_std_11)
diff --git a/Tests/ISPC/ObjectGenex/main.cxx b/Tests/ISPC/ObjectGenex/main.cxx
new file mode 100644
index 0000000..143e74e
--- /dev/null
+++ b/Tests/ISPC/ObjectGenex/main.cxx
@@ -0,0 +1,87 @@
+#include <stdio.h>
+
+/*
+ Define GENERATED_HEADER macro to allow c++ files to include headers
+ generated based on different configuration types.
+*/
+
+/* clang-format off */
+#define GENERATED_HEADER(x) GENERATED_HEADER0(CONFIG_TYPE/x)
+/* clang-format on */
+#define GENERATED_HEADER0(x) GENERATED_HEADER1(x)
+#define GENERATED_HEADER1(x) <x>
+
+#include GENERATED_HEADER(path_to_objs.h)
+
+#include <vector>
+std::vector<std::string> expandList(std::string const& arg)
+{
+ std::vector<std::string> output;
+ // If argument is empty or no `;` just copy the current string
+ if (arg.empty() || arg.find(';') == std::string::npos) {
+ output.emplace_back(arg);
+ return output;
+ }
+
+ std::string newArg;
+ // Break the string at non-escaped semicolons not nested in [].
+ int squareNesting = 0;
+ auto last = arg.begin();
+ auto const cend = arg.end();
+ for (auto c = last; c != cend; ++c) {
+ switch (*c) {
+ case '\\': {
+ // We only want to allow escaping of semicolons. Other
+ // escapes should not be processed here.
+ auto cnext = c + 1;
+ if ((cnext != cend) && *cnext == ';') {
+ newArg.append(last, c);
+ // Skip over the escape character
+ last = cnext;
+ c = cnext;
+ }
+ } break;
+ case '[': {
+ ++squareNesting;
+ } break;
+ case ']': {
+ --squareNesting;
+ } break;
+ case ';': {
+ // Break the string here if we are not nested inside square
+ // brackets.
+ if (squareNesting == 0) {
+ newArg.append(last, c);
+ // Skip over the semicolon
+ last = c + 1;
+ if (!newArg.empty()) {
+ // Add the last argument if the string is not empty.
+ output.push_back(newArg);
+ newArg.clear();
+ }
+ }
+ } break;
+ default: {
+ // Just append this character.
+ } break;
+ }
+ }
+ newArg.append(last, cend);
+ if (!newArg.empty()) {
+ // Add the last argument if the string is not empty.
+ output.push_back(std::move(newArg));
+ }
+
+ return output;
+}
+
+int main()
+{
+ // determine that the number of object files specified in obj_paths
+ // is equal to the number of arch's
+
+ std::vector<std::string> paths = expandList(obj_paths);
+ const bool correctSize = (paths.size() == ExpectedISPCObjects);
+
+ return (correctSize) ? 0 : 1;
+}
diff --git a/Tests/ISPC/ObjectGenex/simple.ispc b/Tests/ISPC/ObjectGenex/simple.ispc
new file mode 100644
index 0000000..a76b76c
--- /dev/null
+++ b/Tests/ISPC/ObjectGenex/simple.ispc
@@ -0,0 +1,12 @@
+
+export void simple(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < M_PI)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/ObjectLibrary/CMakeLists.txt b/Tests/ISPC/ObjectLibrary/CMakeLists.txt
new file mode 100644
index 0000000..4767d7e
--- /dev/null
+++ b/Tests/ISPC/ObjectLibrary/CMakeLists.txt
@@ -0,0 +1,18 @@
+
+cmake_minimum_required(VERSION 3.18)
+project(ISPCObjectLibrary CXX ISPC)
+
+set(CMAKE_NINJA_FORCE_RESPONSE_FILE ON)
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(CMAKE_ISPC_FLAGS "--arch=x86")
+endif()
+
+
+add_library(ispc_objects OBJECT simple.ispc extra.ispc)
+
+set_target_properties(ispc_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
+set_target_properties(ispc_objects PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i8x16")
+
+
+add_executable(ISPCObjectLibrary main.cxx extra.cxx)
+target_link_libraries(ISPCObjectLibrary PRIVATE ispc_objects)
diff --git a/Tests/ISPC/ObjectLibrary/extra.cxx b/Tests/ISPC/ObjectLibrary/extra.cxx
new file mode 100644
index 0000000..88ef3a7
--- /dev/null
+++ b/Tests/ISPC/ObjectLibrary/extra.cxx
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+#include "extra.ispc.h"
+
+int extra()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::extra(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: extra(%f) = %f\n", i, vin[i], vout[i]);
+
+ return 0;
+}
diff --git a/Tests/ISPC/ObjectLibrary/extra.ispc b/Tests/ISPC/ObjectLibrary/extra.ispc
new file mode 100644
index 0000000..5a4a442
--- /dev/null
+++ b/Tests/ISPC/ObjectLibrary/extra.ispc
@@ -0,0 +1,12 @@
+
+export void extra(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < 3.)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/ObjectLibrary/main.cxx b/Tests/ISPC/ObjectLibrary/main.cxx
new file mode 100644
index 0000000..4f1c9be
--- /dev/null
+++ b/Tests/ISPC/ObjectLibrary/main.cxx
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+#include "simple.ispc.h"
+
+int main()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::simple(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]);
+}
diff --git a/Tests/ISPC/ObjectLibrary/simple.ispc b/Tests/ISPC/ObjectLibrary/simple.ispc
new file mode 100644
index 0000000..70cb588
--- /dev/null
+++ b/Tests/ISPC/ObjectLibrary/simple.ispc
@@ -0,0 +1,12 @@
+
+export void simple(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < 3.)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/ResponseAndDefine/CMakeLists.txt b/Tests/ISPC/ResponseAndDefine/CMakeLists.txt
new file mode 100644
index 0000000..7539209
--- /dev/null
+++ b/Tests/ISPC/ResponseAndDefine/CMakeLists.txt
@@ -0,0 +1,28 @@
+cmake_minimum_required(VERSION 3.18)
+project(ispc_spaces_in_path ISPC CXX)
+
+set(CMAKE_NINJA_FORCE_RESPONSE_FILE ON)
+
+# Make sure we can handle an arg file with tricky defines including spaces in -I include
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/path with spaces/simple_include.h"
+"
+ typedef float FLOAT_TYPE;
+"
+)
+
+add_executable(ISPCResponseAndDefine main.cxx simple.ispc)
+set_target_properties(ISPCResponseAndDefine PROPERTIES POSITION_INDEPENDENT_CODE ON)
+target_include_directories(ISPCResponseAndDefine PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
+
+target_compile_options(ISPCResponseAndDefine PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>")
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ target_compile_options(ISPCResponseAndDefine PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>")
+endif()
+
+
+
+target_compile_definitions(ISPCResponseAndDefine PRIVATE
+ "$<$<COMPILE_LANGUAGE:ISPC>:STRUCT_DEFINE=struct{uniform int a>;M_PI=3.14159f")
+target_include_directories(ISPCResponseAndDefine PRIVATE
+ "$<$<COMPILE_LANGUAGE:ISPC>:${CMAKE_CURRENT_BINARY_DIR}/fake path with spaces>"
+ "$<$<COMPILE_LANGUAGE:ISPC>:${CMAKE_CURRENT_BINARY_DIR}/path with spaces>")
diff --git a/Tests/ISPC/ResponseAndDefine/main.cxx b/Tests/ISPC/ResponseAndDefine/main.cxx
new file mode 100644
index 0000000..4f1c9be
--- /dev/null
+++ b/Tests/ISPC/ResponseAndDefine/main.cxx
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+#include "simple.ispc.h"
+
+int main()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::simple(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]);
+}
diff --git a/Tests/ISPC/ResponseAndDefine/simple.ispc b/Tests/ISPC/ResponseAndDefine/simple.ispc
new file mode 100644
index 0000000..81fd7ca
--- /dev/null
+++ b/Tests/ISPC/ResponseAndDefine/simple.ispc
@@ -0,0 +1,16 @@
+
+STRUCT_DEFINE;};
+
+#include "simple_include.h"
+
+export void simple(uniform FLOAT_TYPE vin[], uniform FLOAT_TYPE vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ FLOAT_TYPE v = vin[index];
+ if (v < M_PI)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/StaticLibrary/CMakeLists.txt b/Tests/ISPC/StaticLibrary/CMakeLists.txt
new file mode 100644
index 0000000..ebe5960
--- /dev/null
+++ b/Tests/ISPC/StaticLibrary/CMakeLists.txt
@@ -0,0 +1,15 @@
+
+cmake_minimum_required(VERSION 3.18)
+project(ISPCStaticLibrary CXX ISPC)
+
+add_library(ispc_objects STATIC simple.ispc)
+
+target_compile_options(ispc_objects PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>")
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ target_compile_options(ispc_objects PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>")
+endif()
+
+set_target_properties(ispc_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
+
+add_executable(ISPCStaticLibrary main.cxx)
+target_link_libraries(ISPCStaticLibrary PRIVATE ispc_objects)
diff --git a/Tests/ISPC/StaticLibrary/main.cxx b/Tests/ISPC/StaticLibrary/main.cxx
new file mode 100644
index 0000000..4f1c9be
--- /dev/null
+++ b/Tests/ISPC/StaticLibrary/main.cxx
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+#include "simple.ispc.h"
+
+int main()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::simple(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]);
+}
diff --git a/Tests/ISPC/StaticLibrary/simple.ispc b/Tests/ISPC/StaticLibrary/simple.ispc
new file mode 100644
index 0000000..70cb588
--- /dev/null
+++ b/Tests/ISPC/StaticLibrary/simple.ispc
@@ -0,0 +1,12 @@
+
+export void simple(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < 3.)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/ISPC/TryCompile/CMakeLists.txt b/Tests/ISPC/TryCompile/CMakeLists.txt
new file mode 100644
index 0000000..742f511
--- /dev/null
+++ b/Tests/ISPC/TryCompile/CMakeLists.txt
@@ -0,0 +1,16 @@
+
+cmake_minimum_required(VERSION 3.18)
+project(ISPCTryCompile ISPC CXX)
+
+set(CMAKE_NINJA_FORCE_RESPONSE_FILE ON)
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(CMAKE_ISPC_FLAGS "--arch=x86")
+endif()
+
+#Verify we can use try_compile with ISPC
+try_compile(result "${CMAKE_CURRENT_BINARY_DIR}"
+ SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/simple.ispc"
+ COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/result.o")
+
+add_executable(ISPCTryCompile main.cxx )
+target_link_libraries(ISPCTryCompile "${CMAKE_CURRENT_BINARY_DIR}/result.o")
diff --git a/Tests/ISPC/TryCompile/main.cxx b/Tests/ISPC/TryCompile/main.cxx
new file mode 100644
index 0000000..c8d1ed6
--- /dev/null
+++ b/Tests/ISPC/TryCompile/main.cxx
@@ -0,0 +1,19 @@
+#include <stdio.h>
+
+namespace ispc {
+extern "C" {
+void simple(float*, float*, int);
+}
+}
+
+int main()
+{
+ float vin[16], vout[16];
+ for (int i = 0; i < 16; ++i)
+ vin[i] = i;
+
+ ispc::simple(vin, vout, 16);
+
+ for (int i = 0; i < 16; ++i)
+ printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]);
+}
diff --git a/Tests/ISPC/TryCompile/simple.ispc b/Tests/ISPC/TryCompile/simple.ispc
new file mode 100644
index 0000000..70cb588
--- /dev/null
+++ b/Tests/ISPC/TryCompile/simple.ispc
@@ -0,0 +1,12 @@
+
+export void simple(uniform float vin[], uniform float vout[],
+ uniform int count) {
+ foreach (index = 0 ... count) {
+ float v = vin[index];
+ if (v < 3.)
+ v = v * v;
+ else
+ v = sqrt(v);
+ vout[index] = v;
+ }
+}
diff --git a/Tests/QtAutogen/RerunMocOnAddFile/CMakeLists.txt b/Tests/QtAutogen/RerunMocOnAddFile/CMakeLists.txt
new file mode 100644
index 0000000..2677659
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnAddFile/CMakeLists.txt
@@ -0,0 +1,96 @@
+# This test checks whether adding a source file to the project triggers an AUTOMOC re-run.
+
+cmake_minimum_required(VERSION 3.10)
+project(RerunMocOnAddFile)
+include("../AutogenCoreTest.cmake")
+
+# Create an executable to generate a clean target
+set(main_source "${CMAKE_CURRENT_BINARY_DIR}/generated_main.cpp")
+file(WRITE "${main_source}" "int main() {}")
+add_executable(exe "${main_source}")
+
+# Utility variables
+set(timeformat "%Y.%j.%H.%M%S")
+set(testProjectTemplateDir "${CMAKE_CURRENT_SOURCE_DIR}/MocOnAddFile")
+set(testProjectSrc "${CMAKE_CURRENT_BINARY_DIR}/MocOnAddFile")
+set(testProjectBinDir "${CMAKE_CURRENT_BINARY_DIR}/MocOnAddFile-build")
+
+# Utility macros
+macro(sleep)
+ message(STATUS "Sleeping for a few seconds.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+endmacro()
+
+macro(acquire_timestamp When)
+ file(TIMESTAMP "${mocBasicBin}" time${When} "${timeformat}")
+endmacro()
+
+macro(rebuild buildName)
+ message(STATUS "Starting build ${buildName}.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${testProjectBinDir}" RESULT_VARIABLE result)
+ if (result)
+ message(FATAL_ERROR "Build ${buildName} failed.")
+ else()
+ message(STATUS "Build ${buildName} finished.")
+ endif()
+endmacro()
+
+macro(require_change)
+ if (timeAfter VERSION_GREATER timeBefore)
+ message(STATUS "As expected the file ${mocBasicBin} changed.")
+ else()
+ message(SEND_ERROR "Unexpectedly the file ${mocBasicBin} did not change!\nTimestamp pre: ${timeBefore}\nTimestamp aft: ${timeAfter}\n")
+ endif()
+endmacro()
+
+macro(require_change_not)
+ if (timeAfter VERSION_GREATER timeBefore)
+ message(SEND_ERROR "Unexpectedly the file ${mocBasicBin} changed!\nTimestamp pre: ${timeBefore}\nTimestamp aft: ${timeAfter}\n")
+ else()
+ message(STATUS "As expected the file ${mocBasicBin} did not change.")
+ endif()
+endmacro()
+
+# Create the test project from the template
+unset(additional_project_sources)
+unset(main_cpp_includes)
+configure_file("${testProjectTemplateDir}/CMakeLists.txt.in" "${testProjectSrc}/CMakeLists.txt")
+configure_file("${testProjectTemplateDir}/main.cpp.in" "${testProjectSrc}/main.cpp")
+
+# Initial build
+try_compile(MOC_RERUN
+ "${testProjectBinDir}"
+ "${testProjectSrc}"
+ MocOnAddFile
+ CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
+ "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
+ OUTPUT_VARIABLE output
+)
+if (NOT MOC_RERUN)
+ message(FATAL_ERROR "Initial build of mocOnAddFile failed. Output: ${output}")
+endif()
+
+# Sleep to ensure new timestamps
+sleep()
+
+# Add a QObject class (defined in header) to the project and build
+set(additional_project_sources myobject.cpp)
+set(main_cpp_includes "#include \"myobject.h\"")
+configure_file("${testProjectTemplateDir}/CMakeLists.txt.in" "${testProjectSrc}/CMakeLists.txt"
+ @ONLY)
+configure_file("${testProjectTemplateDir}/main.cpp.in" "${testProjectSrc}/main.cpp" @ONLY)
+configure_file("${testProjectTemplateDir}/myobject.h" "${testProjectSrc}/myobject.h" COPYONLY)
+configure_file("${testProjectTemplateDir}/myobject.cpp" "${testProjectSrc}/myobject.cpp" COPYONLY)
+rebuild(2)
+
+# Sleep to ensure new timestamps
+sleep()
+
+# Add a QObject class (defined in source) to the project and build
+set(additional_project_sources myobject.cpp anotherobject.cpp)
+configure_file("${testProjectTemplateDir}/CMakeLists.txt.in" "${testProjectSrc}/CMakeLists.txt"
+ @ONLY)
+configure_file("${testProjectTemplateDir}/anotherobject.cpp" "${testProjectSrc}/anotherobject.cpp"
+ COPYONLY)
+rebuild(3)
diff --git a/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/CMakeLists.txt.in b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/CMakeLists.txt.in
new file mode 100644
index 0000000..9e5e21c
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/CMakeLists.txt.in
@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 3.10)
+project(MocOnAddFile)
+include("@CMAKE_CURRENT_LIST_DIR@/../AutogenCoreTest.cmake")
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+
+add_executable(mocOnAddFile main.cpp @additional_project_sources@)
+target_link_libraries(mocOnAddFile ${QT_QTCORE_TARGET})
diff --git a/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/anotherobject.cpp b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/anotherobject.cpp
new file mode 100644
index 0000000..45c5af6
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/anotherobject.cpp
@@ -0,0 +1,15 @@
+#include <qobject.h>
+
+class AnotherObject : public QObject
+{
+ Q_OBJECT
+public:
+ AnotherObject() {}
+};
+
+AnotherObject* createAnotherObject()
+{
+ return new AnotherObject();
+}
+
+#include "anotherobject.moc"
diff --git a/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/main.cpp.in b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/main.cpp.in
new file mode 100644
index 0000000..f62027a
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/main.cpp.in
@@ -0,0 +1,6 @@
+@main_cpp_includes@
+
+int main(int argc, char *argv[])
+{
+ return 0;
+}
diff --git a/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.cpp b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.cpp
new file mode 100644
index 0000000..7a15300
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.cpp
@@ -0,0 +1,6 @@
+#include "myobject.h"
+
+MyObject::MyObject(QObject* parent)
+ : QObject(parent)
+{
+}
diff --git a/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.h b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.h
new file mode 100644
index 0000000..e373ee8
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.h
@@ -0,0 +1,13 @@
+#ifndef MYOBJECT_H
+#define MYOBJECT_H
+
+#include <qobject.h>
+
+class MyObject : public QObject
+{
+ Q_OBJECT
+public:
+ MyObject(QObject* parent = 0);
+};
+
+#endif
diff --git a/Tests/QtAutogen/RerunMocOnMissingDependency/CMakeLists.txt b/Tests/QtAutogen/RerunMocOnMissingDependency/CMakeLists.txt
new file mode 100644
index 0000000..c5811eb
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnMissingDependency/CMakeLists.txt
@@ -0,0 +1,80 @@
+# This test checks whether a missing dependency of the moc output triggers an AUTOMOC re-run.
+
+cmake_minimum_required(VERSION 3.10)
+project(RerunMocOnMissingDependency)
+include("../AutogenCoreTest.cmake")
+
+# Create an executable to generate a clean target
+set(main_source "${CMAKE_CURRENT_BINARY_DIR}/generated_main.cpp")
+file(WRITE "${main_source}" "int main() {}")
+add_executable(exe "${main_source}")
+
+# Utility variables
+set(testProjectTemplateDir "${CMAKE_CURRENT_SOURCE_DIR}/MocOnMissingDependency")
+set(testProjectSrc "${CMAKE_CURRENT_BINARY_DIR}/MocOnMissingDependency")
+set(testProjectBinDir "${CMAKE_CURRENT_BINARY_DIR}/MocOnMissingDependency-build")
+if(DEFINED Qt5Core_VERSION AND Qt5Core_VERSION VERSION_GREATER_EQUAL "5.15.0")
+ set(moc_depfiles_supported TRUE)
+else()
+ set(moc_depfiles_supported FALSE)
+endif()
+
+# Utility macros
+macro(sleep)
+ message(STATUS "Sleeping for a few seconds.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+endmacro()
+
+macro(rebuild buildName)
+ message(STATUS "Starting build ${buildName}.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${testProjectBinDir}"
+ RESULT_VARIABLE result OUTPUT_VARIABLE output)
+ if (result)
+ message(FATAL_ERROR "Build ${buildName} failed.")
+ else()
+ message(STATUS "Build ${buildName} finished.")
+ endif()
+endmacro()
+
+# Create the test project from the template
+file(COPY "${testProjectTemplateDir}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
+configure_file("${testProjectTemplateDir}/CMakeLists.txt.in" "${testProjectSrc}/CMakeLists.txt" @ONLY)
+
+# Initial build
+file(REMOVE_RECURSE "${testProjectBinDir}")
+try_compile(MOC_RERUN
+ "${testProjectBinDir}"
+ "${testProjectSrc}"
+ MocOnMissingDependency
+ CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_AUTOGEN_VERBOSE=ON"
+ "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
+ OUTPUT_VARIABLE output
+)
+if (NOT MOC_RERUN)
+ message(FATAL_ERROR "Initial build of mocOnMissingDependency failed. Output: ${output}")
+endif()
+
+# Sleep to ensure new timestamps
+sleep()
+
+if(moc_depfiles_supported)
+ # Remove the dependency inc1/foo.h and build again.
+ # We expect that the moc_XXX.cpp file gets re-generated. But only if we have depfile support.
+ file(REMOVE_RECURSE "${testProjectSrc}/inc1")
+ rebuild(2)
+ if(NOT output MATCHES "AutoMoc: Generating \"[^\"]*moc_myobject.cpp\"")
+ message(FATAL_ERROR "moc_myobject.cpp was not re-generated "
+ "after removing one of its dependencies")
+ endif()
+endif()
+
+# Sleep to ensure new timestamps
+sleep()
+
+# The next build should *not* re-renerate any moc outputs
+rebuild(3)
+if(output MATCHES "AutoMoc: Generating")
+ message(FATAL_ERROR "moc_myobject.cpp was not re-generated "
+ "after removing one of its dependencies")
+endif()
diff --git a/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/CMakeLists.txt.in b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/CMakeLists.txt.in
new file mode 100644
index 0000000..2155f45
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/CMakeLists.txt.in
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.18)
+project(MocOnMissingDependency)
+include("@CMAKE_CURRENT_LIST_DIR@/../AutogenCoreTest.cmake")
+set(CMAKE_AUTOMOC ON)
+add_executable(MocOnMissingDependency main.cpp myobject.cpp)
+target_include_directories(MocOnMissingDependency PRIVATE inc1 inc2)
+target_link_libraries(MocOnMissingDependency PRIVATE ${QT_QTCORE_TARGET})
diff --git a/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/inc1/foo.h b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/inc1/foo.h
new file mode 100644
index 0000000..cd8b2f9
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/inc1/foo.h
@@ -0,0 +1,2 @@
+
+#include <qobject.h>
diff --git a/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/inc2/foo.h b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/inc2/foo.h
new file mode 100644
index 0000000..cd8b2f9
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/inc2/foo.h
@@ -0,0 +1,2 @@
+
+#include <qobject.h>
diff --git a/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/main.cpp b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/main.cpp
new file mode 100644
index 0000000..36d51fa
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/main.cpp
@@ -0,0 +1,9 @@
+#include <iostream>
+
+#include "myobject.h"
+
+int main(int argc, char* argv[])
+{
+ MyObject obj;
+ return 0;
+}
diff --git a/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/myobject.cpp b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/myobject.cpp
new file mode 100644
index 0000000..7a15300
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/myobject.cpp
@@ -0,0 +1,6 @@
+#include "myobject.h"
+
+MyObject::MyObject(QObject* parent)
+ : QObject(parent)
+{
+}
diff --git a/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/myobject.h b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/myobject.h
new file mode 100644
index 0000000..25176cc
--- /dev/null
+++ b/Tests/QtAutogen/RerunMocOnMissingDependency/MocOnMissingDependency/myobject.h
@@ -0,0 +1,10 @@
+#pragma once
+
+#include <foo.h>
+
+class MyObject : public QObject
+{
+ Q_OBJECT
+public:
+ MyObject(QObject* parent = 0);
+};
diff --git a/Tests/QtAutogen/Tests.cmake b/Tests/QtAutogen/Tests.cmake
index dfa5ea0..b1337d6 100644
--- a/Tests/QtAutogen/Tests.cmake
+++ b/Tests/QtAutogen/Tests.cmake
@@ -20,6 +20,8 @@ ADD_AUTOGEN_TEST(RccOffMocLibrary)
ADD_AUTOGEN_TEST(RccOnly rccOnly)
ADD_AUTOGEN_TEST(RccSkipSource)
ADD_AUTOGEN_TEST(RerunMocBasic)
+ADD_AUTOGEN_TEST(RerunMocOnAddFile)
+ADD_AUTOGEN_TEST(RerunMocOnMissingDependency)
ADD_AUTOGEN_TEST(RerunRccConfigChange)
ADD_AUTOGEN_TEST(RerunRccDepends)
ADD_AUTOGEN_TEST(SameName sameName)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 88d0004..e586961 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -144,14 +144,14 @@ if(CMAKE_GENERATOR MATCHES "Ninja")
list(APPEND Ninja_ARGS -DTEST_Fortran=1)
endif()
if(CMake_TEST_Qt5 AND Qt5Core_FOUND)
- list(APPEND Ninja_ARGS -DCMake_TEST_Qt5=1 -DCMAKE_TEST_Qt5Core_Version=${Qt5Core_VERSION})
+ list(APPEND Ninja_ARGS -DCMake_TEST_Qt5=1 -DQt5Core_DIR=${Qt5Core_DIR} -DCMAKE_TEST_Qt5Core_Version=${Qt5Core_VERSION})
endif()
add_RunCMake_test(Ninja)
set(NinjaMultiConfig_ARGS
-DCYGWIN=${CYGWIN}
)
if(CMake_TEST_Qt5 AND Qt5Core_FOUND)
- list(APPEND NinjaMultiConfig_ARGS -DCMake_TEST_Qt5=1)
+ list(APPEND NinjaMultiConfig_ARGS -DCMake_TEST_Qt5=1 -DQt5Core_DIR=${Qt5Core_DIR} -DCMAKE_TEST_Qt5Core_Version=${Qt5Core_VERSION})
endif()
if(DEFINED CMake_TEST_CUDA)
list(APPEND NinjaMultiConfig_ARGS -DCMake_TEST_CUDA=${CMake_TEST_CUDA})
@@ -305,6 +305,7 @@ add_RunCMake_test(export)
add_RunCMake_test(cmake_language)
add_RunCMake_test(cmake_minimum_required)
add_RunCMake_test(cmake_parse_arguments)
+add_RunCMake_test(cmake_path)
add_RunCMake_test(continue)
add_executable(color_warning color_warning.c)
add_RunCMake_test(ctest_build -DCOLOR_WARNING=$<TARGET_FILE:color_warning>)
@@ -322,6 +323,7 @@ add_RunCMake_test(ctest_update)
add_RunCMake_test(ctest_upload)
add_RunCMake_test(ctest_fixtures)
add_RunCMake_test(file)
+add_RunCMake_test(file-CHMOD)
add_RunCMake_test(find_file)
add_RunCMake_test(find_library -DCYGWIN=${CYGWIN})
add_RunCMake_test(find_package)
@@ -385,6 +387,7 @@ function(add_RunCMake_test_try_compile)
CMAKE_CXX_COMPILER_VERSION
CMAKE_CXX_STANDARD_DEFAULT
CMake_TEST_CUDA
+ CMake_TEST_ISPC
CMake_TEST_FILESYSTEM_1S
CMAKE_OBJC_STANDARD_DEFAULT
CMAKE_OBJCXX_STANDARD_DEFAULT
@@ -395,7 +398,7 @@ function(add_RunCMake_test_try_compile)
endforeach()
add_RunCMake_test(try_compile)
set_property(TEST RunCMake.try_compile APPEND
- PROPERTY LABELS "CUDA")
+ PROPERTY LABELS "CUDA;ISPC")
endfunction()
add_RunCMake_test_try_compile()
@@ -550,7 +553,10 @@ add_RunCMake_test(install -DNO_NAMELINK=${NO_NAMELINK} -DCYGWIN=${CYGWIN}
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-DCMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG=${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}
-DCMAKE_EXECUTABLE_FORMAT=${CMAKE_EXECUTABLE_FORMAT}
+ -DCMake_TEST_ISPC=${CMake_TEST_ISPC}
)
+set_property(TEST RunCMake.install APPEND
+ PROPERTY LABELS "ISPC")
add_RunCMake_test(file-GET_RUNTIME_DEPENDENCIES
-DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
@@ -628,6 +634,9 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
if(DEFINED CMake_TEST_CUDA)
list(APPEND CompilerLauncher_ARGS -DCMake_TEST_CUDA=${CMake_TEST_CUDA})
endif()
+ if(DEFINED CMake_TEST_ISPC)
+ list(APPEND CompilerLauncher_ARGS -DCMake_TEST_ISPC=${CMake_TEST_ISPC})
+ endif()
if(CMAKE_Fortran_COMPILER)
list(APPEND CompilerLauncher_ARGS -DCMake_TEST_Fortran=1)
endif()
@@ -636,7 +645,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
endif()
add_RunCMake_test(CompilerLauncher)
set_property(TEST RunCMake.CompilerLauncher APPEND
- PROPERTY LABELS "CUDA")
+ PROPERTY LABELS "CUDA;ISPC")
add_RunCMake_test(ctest_labels_for_subprojects)
add_RunCMake_test(CompilerArgs)
endif()
diff --git a/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt
index cf2c087..f6d72a9 100644
--- a/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt
+++ b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt
@@ -1,8 +1,19 @@
add_custom_command(
- OUTPUT output.txt
- COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt
+ OUTPUT output1.txt
+ COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output1.txt
)
-add_custom_target(CustomTarget ALL DEPENDS output.txt)
-add_custom_target(CustomTarget2 ALL DEPENDS output.txt)
-add_custom_target(CustomTarget3 ALL DEPENDS output.txt)
+add_custom_target(CustomTarget ALL DEPENDS output1.txt)
+
+add_custom_command(
+ OUTPUT output2.txt
+ COMMAND ${CMAKE_COMMAND} -E echo CustomCommand2 > output2.txt
+ )
+add_custom_target(CustomTarget2 ALL DEPENDS output2.txt)
+
+add_custom_command(
+ OUTPUT output3.txt
+ COMMAND ${CMAKE_COMMAND} -E echo CustomCommand2 > output3.txt
+ )
+add_custom_target(CustomTarget3 ALL DEPENDS output3.txt)
+
add_custom_target(CustomTargetFail COMMAND DoesNotExist)
diff --git a/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt b/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt
index fc62914..0fee56c 100644
--- a/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt
+++ b/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt
@@ -1,9 +1,20 @@
cmake_minimum_required(VERSION 3.14)
project(ExplicitDirs NONE)
+
add_custom_command(
- OUTPUT output.txt
- COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt
+ OUTPUT output1.txt
+ COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output1.txt
)
-add_custom_target(CustomTarget ALL DEPENDS output.txt)
-add_custom_target(CustomTarget2 ALL DEPENDS output.txt)
-add_custom_target(CustomTarget3 ALL DEPENDS output.txt)
+add_custom_target(CustomTarget ALL DEPENDS output1.txt)
+
+add_custom_command(
+ OUTPUT output2.txt
+ COMMAND ${CMAKE_COMMAND} -E echo CustomCommand2 > output2.txt
+ )
+add_custom_target(CustomTarget2 ALL DEPENDS output2.txt)
+
+add_custom_command(
+ OUTPUT output3.txt
+ COMMAND ${CMAKE_COMMAND} -E echo CustomCommand2 > output3.txt
+ )
+add_custom_target(CustomTarget3 ALL DEPENDS output3.txt)
diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/ISPC-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/ISPC-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-common.cmake b/Tests/RunCMake/CompilerLauncher/ISPC-common.cmake
new file mode 100644
index 0000000..5beff3d
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/ISPC-common.cmake
@@ -0,0 +1,4 @@
+enable_language(ISPC)
+enable_language(CXX)
+set(CMAKE_VERBOSE_MAKEFILE TRUE)
+add_executable(main main.cxx test.ispc)
diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-env-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/ISPC-env-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/ISPC-env-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-env-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/ISPC-env-launch-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/ISPC-env-launch-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-env.cmake b/Tests/RunCMake/CompilerLauncher/ISPC-env.cmake
new file mode 100644
index 0000000..4afd919
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/ISPC-env.cmake
@@ -0,0 +1 @@
+include(ISPC-common.cmake)
diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/ISPC-launch-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/ISPC-launch-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-launch-env.cmake b/Tests/RunCMake/CompilerLauncher/ISPC-launch-env.cmake
new file mode 100644
index 0000000..f50fb65
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/ISPC-launch-env.cmake
@@ -0,0 +1,3 @@
+set(CTEST_USE_LAUNCHERS 1)
+include(CTestUseLaunchers)
+include(ISPC-env.cmake)
diff --git a/Tests/RunCMake/CompilerLauncher/ISPC-launch.cmake b/Tests/RunCMake/CompilerLauncher/ISPC-launch.cmake
new file mode 100644
index 0000000..b0cafbe
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/ISPC-launch.cmake
@@ -0,0 +1,3 @@
+set(CTEST_USE_LAUNCHERS 1)
+include(CTestUseLaunchers)
+include(ISPC.cmake)
diff --git a/Tests/RunCMake/CompilerLauncher/ISPC.cmake b/Tests/RunCMake/CompilerLauncher/ISPC.cmake
new file mode 100644
index 0000000..83efa80
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/ISPC.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_ISPC_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1")
+include(ISPC-common.cmake)
diff --git a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake
index 69fff20..293d711 100644
--- a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake
@@ -29,6 +29,9 @@ endif()
if(CMake_TEST_Fortran)
list(APPEND langs Fortran)
endif()
+if(CMake_TEST_ISPC)
+ list(APPEND langs ISPC)
+endif()
if(CMake_TEST_OBJC)
list(APPEND langs OBJC OBJCXX)
endif()
diff --git a/Tests/RunCMake/CompilerLauncher/test.ispc b/Tests/RunCMake/CompilerLauncher/test.ispc
new file mode 100644
index 0000000..b061f40
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/test.ispc
@@ -0,0 +1,4 @@
+
+float func(float a, float b) {
+ return a + b / 2.;
+}
diff --git a/Tests/RunCMake/ExternalProject/DownloadServer.py b/Tests/RunCMake/ExternalProject/DownloadServer.py
index 3738317..63b7fa7 100644
--- a/Tests/RunCMake/ExternalProject/DownloadServer.py
+++ b/Tests/RunCMake/ExternalProject/DownloadServer.py
@@ -8,8 +8,11 @@ import threading
args = None
outerthread = None
+barrier = threading.Barrier(2)
+
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
+ barrier.wait()
self.send_response(200)
self.end_headers()
data = b'D'
@@ -46,4 +49,5 @@ if __name__ == "__main__":
serverThread = threading.Thread(target=runServer,args=(args.file,))
serverThread.daemon = True
serverThread.start()
- serverThread.join(15)
+ barrier.wait(60)
+ serverThread.join(20)
diff --git a/Tests/RunCMake/ExternalProject/MultiCommand.cmake b/Tests/RunCMake/ExternalProject/MultiCommand.cmake
index a8dbfea..c8d0457 100644
--- a/Tests/RunCMake/ExternalProject/MultiCommand.cmake
+++ b/Tests/RunCMake/ExternalProject/MultiCommand.cmake
@@ -20,10 +20,6 @@ ExternalProject_Add(multiCommand
COMMAND "${CMAKE_COMMAND}" -E echo "install 2"
)
-# Workaround for issue 17229 (missing dependency between update and patch steps)
-ExternalProject_Add_StepTargets(multiCommand NO_DEPENDS update)
-ExternalProject_Add_StepDependencies(multiCommand patch multiCommand-update)
-
# Force all steps to be re-run by removing timestamps from any previous run
ExternalProject_Get_Property(multiCommand STAMP_DIR)
file(REMOVE_RECURSE "${STAMP_DIR}")
diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake
index ccec633..55b0f9b 100644
--- a/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake
@@ -2,8 +2,10 @@ include(RunCMake)
run_cmake(TARGET_FILE-recursion)
run_cmake(OUTPUT_NAME-recursion)
-run_cmake(TARGET_FILE_PREFIX)
+run_cmake(TARGET_FILE_DIR-dependency)
+run_cmake(TARGET_FILE_DIR-no-dependency)
run_cmake(TARGET_FILE_PREFIX-imported-target)
+run_cmake(TARGET_FILE_PREFIX)
run_cmake(TARGET_FILE_PREFIX-non-valid-target)
run_cmake(TARGET_LINKER_FILE_PREFIX-non-valid-target)
run_cmake(TARGET_FILE_SUFFIX)
diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-stderr.txt
new file mode 100644
index 0000000..0a79032
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency-stderr.txt
@@ -0,0 +1,6 @@
+.*Policy CMP0112 is not set.*
+.*Dependency being added to target.*
+.*exec1.*
+CMake Error: The inter-target dependency graph.*
+.*"exec1" of type EXECUTABLE
+ depends on "copyFile" \(strong\)
diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency.cmake
new file mode 100644
index 0000000..e18ccd9
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-dependency.cmake
@@ -0,0 +1,12 @@
+set(CMAKE_POLICY_WARNING_CMP0112 TRUE)
+
+enable_language (C)
+
+add_executable (exec1 empty.c)
+
+add_custom_target(copyFile
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ "${CMAKE_CURRENT_SOURCE_DIR}/empty.c"
+ "$<TARGET_FILE_DIR:exec1>/$<TARGET_FILE_BASE_NAME:exec1>_e.c"
+)
+add_dependencies(exec1 copyFile)
diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-no-dependency.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-no-dependency.cmake
new file mode 100644
index 0000000..e048e10
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_DIR-no-dependency.cmake
@@ -0,0 +1,12 @@
+cmake_policy(SET CMP0112 NEW)
+
+enable_language (C)
+
+add_executable (exec1 empty.c)
+
+add_custom_target(copyFile
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ "${CMAKE_CURRENT_SOURCE_DIR}/empty.c"
+ "$<TARGET_FILE_DIR:exec1>/$<TARGET_FILE_BASE_NAME:exec1>_e.c"
+)
+add_dependencies(exec1 copyFile)
diff --git a/Tests/RunCMake/Make/CMP0113-Common.cmake b/Tests/RunCMake/Make/CMP0113-Common.cmake
new file mode 100644
index 0000000..8ce26c4
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-Common.cmake
@@ -0,0 +1,17 @@
+add_custom_command(
+ OUTPUT output-not-created
+ COMMAND ${CMAKE_COMMAND} -E echo output-not-created
+ DEPENDS ${CMAKE_CURRENT_LIST_FILE}
+ VERBATIM
+ )
+
+add_custom_command(
+ OUTPUT output-created
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_FILE} output-created
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/output-not-created
+ VERBATIM
+ )
+
+add_custom_target(drive1 ALL DEPENDS output-not-created)
+add_custom_target(drive2 ALL DEPENDS output-created)
+add_dependencies(drive2 drive1)
diff --git a/Tests/RunCMake/Make/CMP0113-NEW-build-gnu-stderr.txt b/Tests/RunCMake/Make/CMP0113-NEW-build-gnu-stderr.txt
new file mode 100644
index 0000000..0af354a
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-NEW-build-gnu-stderr.txt
@@ -0,0 +1,5 @@
+No rule to make target [^
+]*output-not-created[^
+]*, needed by [^
+]*output-created[^
+]*
diff --git a/Tests/RunCMake/Make/CMP0113-NEW-build-result.txt b/Tests/RunCMake/Make/CMP0113-NEW-build-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-NEW-build-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/Make/CMP0113-NEW-build-stderr.txt b/Tests/RunCMake/Make/CMP0113-NEW-build-stderr.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-NEW-build-stderr.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/Make/CMP0113-NEW-build-stdout.txt b/Tests/RunCMake/Make/CMP0113-NEW-build-stdout.txt
new file mode 100644
index 0000000..a6b851e
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-NEW-build-stdout.txt
@@ -0,0 +1 @@
+Generating output-not-created.*Built target drive1
diff --git a/Tests/RunCMake/Make/CMP0113-NEW.cmake b/Tests/RunCMake/Make/CMP0113-NEW.cmake
new file mode 100644
index 0000000..a2d1db5
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0113 NEW)
+include(CMP0113-Common.cmake)
diff --git a/Tests/RunCMake/Make/CMP0113-OLD-build-stdout.txt b/Tests/RunCMake/Make/CMP0113-OLD-build-stdout.txt
new file mode 100644
index 0000000..f6e1f0f
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-OLD-build-stdout.txt
@@ -0,0 +1 @@
+Generating output-not-created.*Built target drive1.*Generating output-not-created.*Built target drive2
diff --git a/Tests/RunCMake/Make/CMP0113-OLD.cmake b/Tests/RunCMake/Make/CMP0113-OLD.cmake
new file mode 100644
index 0000000..b6ab120
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0113 OLD)
+include(CMP0113-Common.cmake)
diff --git a/Tests/RunCMake/Make/CMP0113-WARN-build-stdout.txt b/Tests/RunCMake/Make/CMP0113-WARN-build-stdout.txt
new file mode 100644
index 0000000..f6e1f0f
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-WARN-build-stdout.txt
@@ -0,0 +1 @@
+Generating output-not-created.*Built target drive1.*Generating output-not-created.*Built target drive2
diff --git a/Tests/RunCMake/Make/CMP0113-WARN.cmake b/Tests/RunCMake/Make/CMP0113-WARN.cmake
new file mode 100644
index 0000000..48e035a
--- /dev/null
+++ b/Tests/RunCMake/Make/CMP0113-WARN.cmake
@@ -0,0 +1,2 @@
+# Policy CMP0113 not set.
+include(CMP0113-Common.cmake)
diff --git a/Tests/RunCMake/Make/RunCMakeTest.cmake b/Tests/RunCMake/Make/RunCMakeTest.cmake
index 32aafca..5562aca 100644
--- a/Tests/RunCMake/Make/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Make/RunCMakeTest.cmake
@@ -41,3 +41,25 @@ run_VerboseBuild()
run_cmake(CustomCommandDepfile-ERROR)
run_cmake(IncludeRegexSubdir)
+
+function(run_CMP0113 val)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0113-${val}-build)
+ run_cmake(CMP0113-${val})
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(_backup_lang "$ENV{LANG}")
+ set(_backup_lc_Messages "$ENV{LC_MESSAGES}")
+ if(MAKE_IS_GNU)
+ set(RunCMake-stderr-file CMP0113-${val}-build-gnu-stderr.txt)
+ set(ENV{LANG} "C")
+ set(ENV{LC_MESSAGES} "C")
+ endif()
+ run_cmake_command(CMP0113-${val}-build ${CMAKE_COMMAND} --build .)
+ set(ENV{LANG} "${_backup_lang}")
+ set(ENV{LC_MESSAGES} "${_backup_lc_messages}")
+endfunction()
+
+if(NOT RunCMake_GENERATOR STREQUAL "Watcom WMake")
+ run_CMP0113(WARN)
+ run_CMP0113(OLD)
+ run_CMP0113(NEW)
+endif()
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index d43023b..e6f86a1 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -327,6 +327,7 @@ run_ChangeBuildType()
function(run_Qt5AutoMocDeps)
if(CMake_TEST_Qt5 AND CMAKE_TEST_Qt5Core_Version VERSION_GREATER_EQUAL 5.15.0)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Qt5AutoMocDeps-build)
+ set(RunCMake_TEST_OPTIONS "-DQt5Core_DIR=${Qt5Core_DIR}")
run_cmake(Qt5AutoMocDeps)
unset(RunCMake_TEST_OPTIONS)
# Build the project.
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-clean-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-clean-build-check.cmake
new file mode 100644
index 0000000..a6eb088
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-clean-build-check.cmake
@@ -0,0 +1,3 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+ INCLUDE
+ )
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-leaf-custom-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-leaf-custom-ninja-check.cmake
new file mode 100644
index 0000000..b142ed2
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-leaf-custom-ninja-check.cmake
@@ -0,0 +1,6 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+ INCLUDE
+ ${TARGET_BYPRODUCTS_LeafCustom}
+ ${TARGET_BYPRODUCTS_RootCustom}
+ ${TARGET_FILE_RootExe_Release}
+ )
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-leaf-exe-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-leaf-exe-ninja-check.cmake
new file mode 100644
index 0000000..3f51983
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets-release-leaf-exe-ninja-check.cmake
@@ -0,0 +1,6 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+ INCLUDE
+ ${TARGET_FILE_LeafExe_Release}
+ ${TARGET_BYPRODUCTS_RootCustom}
+ ${TARGET_FILE_RootExe_Release}
+ )
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets.cmake
index b2b24e8..b6f1152 100644
--- a/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandsAndTargets.cmake
@@ -34,6 +34,16 @@ add_subdirectory(CustomCommandsAndTargetsSubdir)
create_targets(Top)
+add_executable(RootExe main.c)
+add_custom_target(RootCustom COMMAND ${CMAKE_COMMAND} -E touch Root.txt BYPRODUCTS Root.txt)
+add_executable(LeafExe main.c)
+add_custom_target(LeafCustom COMMAND ${CMAKE_COMMAND} -E touch Leaf.txt BYPRODUCTS Leaf.txt DEPENDS RootCustom RootExe)
+add_dependencies(LeafExe RootExe RootCustom)
+file(APPEND "${CMAKE_BINARY_DIR}/target_files_custom.cmake"
+"set(TARGET_BYPRODUCTS_LeafCustom [==[${CMAKE_CURRENT_BINARY_DIR}/Leaf.txt]==])
+set(TARGET_BYPRODUCTS_RootCustom [==[${CMAKE_CURRENT_BINARY_DIR}/Root.txt]==])
+")
+
include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake)
-generate_output_files(TopPostBuild SubdirPostBuild)
+generate_output_files(TopPostBuild SubdirPostBuild RootExe LeafExe)
file(APPEND "${CMAKE_BINARY_DIR}/target_files.cmake" "include(\${CMAKE_CURRENT_LIST_DIR}/target_files_custom.cmake)\n")
diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
index 9249724..86d726b 100644
--- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
@@ -235,6 +235,10 @@ run_cmake_build(CustomCommandsAndTargets debug-in-release-graph-postbuild Releas
run_ninja(CustomCommandsAndTargets release-postbuild build-Release.ninja SubdirPostBuild)
run_cmake_build(CustomCommandsAndTargets debug-targetpostbuild Debug TopTargetPostBuild)
run_ninja(CustomCommandsAndTargets release-targetpostbuild build-Release.ninja SubdirTargetPostBuild)
+run_cmake_build(CustomCommandsAndTargets release-clean Release clean:all)
+run_ninja(CustomCommandsAndTargets release-leaf-custom build-Release.ninja Leaf.txt)
+run_cmake_build(CustomCommandsAndTargets release-clean Release clean:all)
+run_ninja(CustomCommandsAndTargets release-leaf-exe build-Release.ninja LeafExe)
unset(RunCMake_TEST_BINARY_DIR)
@@ -305,7 +309,7 @@ endif()
if(CMake_TEST_Qt5)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Qt5-build)
- set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all")
+ set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all" "-DQt5Core_DIR=${Qt5Core_DIR}")
run_cmake_configure(Qt5)
unset(RunCMake_TEST_OPTIONS)
include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt
index aecd4d3..141d66d 100644
--- a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt
+++ b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt
@@ -19,6 +19,6 @@ CMake Error at CMP0053-Dollar-OLD.cmake:6 \(message\):
-->\${\$}<--
- syntax error, unexpected \$, expecting } \(7\)
+ syntax error, unexpected \$, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt b/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt
index 7448b59..71b9c3c 100644
--- a/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt
@@ -7,6 +7,6 @@
\${var\\rwith\\rcarriagereturn}
- syntax error, unexpected cal_SYMBOL, expecting } \(7\)
+ syntax error, unexpected cal_SYMBOL, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt
index f5e03ed..c43e1be 100644
--- a/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt
@@ -7,6 +7,6 @@
\${var\\rwith\\rcarriagereturn}
- syntax error, unexpected cal_SYMBOL, expecting } \(7\)
+ syntax error, unexpected cal_SYMBOL, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt b/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt
index fa16a8a..3a26135 100644
--- a/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt
@@ -7,6 +7,6 @@
\${var\\ with\\ escaped\\ space}
- syntax error, unexpected cal_SYMBOL, expecting } \(7\)
+ syntax error, unexpected cal_SYMBOL, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt
index 07cbf24..0f40649 100644
--- a/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt
@@ -7,6 +7,6 @@
\${var\\ with\\ escaped\\ space}
- syntax error, unexpected cal_SYMBOL, expecting } \(7\)
+ syntax error, unexpected cal_SYMBOL, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt b/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt
index 5cc111b..77bd470 100644
--- a/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt
@@ -7,6 +7,6 @@
\${var\\nwith\\nnewline}
- syntax error, unexpected cal_SYMBOL, expecting } \(7\)
+ syntax error, unexpected cal_SYMBOL, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt
index 0067c2f..1d14b1d 100644
--- a/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt
@@ -7,6 +7,6 @@
\${var\\nwith\\nnewline}
- syntax error, unexpected cal_SYMBOL, expecting } \(7\)
+ syntax error, unexpected cal_SYMBOL, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt b/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt
index 04bc226..cf6dad5 100644
--- a/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt
@@ -7,6 +7,6 @@
\${var
- syntax error, unexpected \$end, expecting } \(5\)
+ syntax error, unexpected \$end, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt
index 66cf9a2..6e3744a 100644
--- a/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt
@@ -7,6 +7,6 @@
\${var with space}
- syntax error, unexpected cal_SYMBOL, expecting } \(17\)
+ syntax error, unexpected cal_SYMBOL, expecting } \(3\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt b/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt
index e888096..70e7c12 100644
--- a/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt
@@ -7,6 +7,6 @@
\${var
- syntax error, unexpected \$end, expecting } \(5\)
+ syntax error, unexpected \$end, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt
index b020074..e18268a 100644
--- a/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt
+++ b/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt
@@ -7,6 +7,6 @@
\${var with tab}
- syntax error, unexpected cal_SYMBOL, expecting } \(15\)
+ syntax error, unexpected cal_SYMBOL, expecting } \(3\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/ParenInENV-stderr.txt b/Tests/RunCMake/Syntax/ParenInENV-stderr.txt
index d7861e2..144b57c 100644
--- a/Tests/RunCMake/Syntax/ParenInENV-stderr.txt
+++ b/Tests/RunCMake/Syntax/ParenInENV-stderr.txt
@@ -15,6 +15,6 @@ CMake Error at ParenInENV.cmake:2 \(message\):
-->\$ENV{e
- syntax error, unexpected \$end, expecting } \(9\)
+ syntax error, unexpected \$end, expecting } \(10\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt b/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt
index 81b1717..18ca946 100644
--- a/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt
+++ b/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt
@@ -7,6 +7,6 @@ CMake Error at ParenInVarName1.cmake:4 \(message\):
-->\${e\(x\)}<--
- syntax error, unexpected cal_SYMBOL, expecting } \(10\)
+ syntax error, unexpected cal_SYMBOL, expecting } \(6\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt
index 1e0ce49..cf63dbe 100644
--- a/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt
+++ b/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt
@@ -7,6 +7,6 @@ CMake Error at UnterminatedBrace0.cmake:2 \(set\):
\${
- syntax error, unexpected \$end, expecting } \(2\)
+ syntax error, unexpected \$end, expecting } \(3\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt
index 4e3c2b5..0e6f786 100644
--- a/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt
+++ b/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt
@@ -7,7 +7,7 @@ CMake Warning \(dev\) at UnterminatedBrace1.cmake:3 \(set\):
\${
- syntax error, unexpected \$end, expecting } \(2\)
+ syntax error, unexpected \$end, expecting } \(3\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
index 2454f25..b3f3a5e 100644
--- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
+++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
@@ -32,6 +32,8 @@
\* CMP0104
\* CMP0105
\* CMP0108
+ \* CMP0112
+ \* CMP0113
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake b/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake
index 288735e..3d8fa17 100644
--- a/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake
+++ b/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake
@@ -5,15 +5,18 @@ project(DeploymentTarget C)
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(CMAKE_OSX_DEPLOYMENT_TARGET "9.1")
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO")
elseif(CMAKE_SYSTEM_NAME STREQUAL "watchOS")
set(CMAKE_OSX_DEPLOYMENT_TARGET "2.0")
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")
elseif(CMAKE_SYSTEM_NAME STREQUAL "tvOS")
set(CMAKE_OSX_DEPLOYMENT_TARGET "9.0")
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase.cmake
new file mode 100644
index 0000000..22a181f
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase.cmake
@@ -0,0 +1,87 @@
+enable_language(C)
+
+set(prototypes [[
+#include <stdio.h>
+#include <zlib.h>
+#include <resolv.h>
+int func1();
+int func2();
+int func3();
+int func4();
+int func5();
+]])
+set(impl [[
+{
+ printf("%p %p\n", compress, res_close);
+ return func1() + func2() + func3() + func4() + func5();
+}
+]])
+
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/mainOuter.c
+ "${prototypes}\nint main(int argc, char** argv) ${impl}"
+)
+
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/funcOuter.c
+ "${prototypes}\nint funcOuter() ${impl}"
+)
+
+foreach(i RANGE 1 5)
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/func${i}.c
+ "int func${i}() { return 32 + ${i}; }\n"
+ )
+endforeach()
+
+add_executable(app1 mainOuter.c)
+add_library(static1 STATIC funcOuter.c)
+add_library(shared1 SHARED funcOuter.c)
+add_library(module1 MODULE funcOuter.c)
+add_library(obj1 OBJECT funcOuter.c)
+add_library(staticFramework1 STATIC funcOuter.c)
+add_library(sharedFramework1 SHARED funcOuter.c)
+set_target_properties(staticFramework1 PROPERTIES FRAMEWORK TRUE)
+set_target_properties(sharedFramework1 PROPERTIES FRAMEWORK TRUE)
+
+add_library(static2 STATIC func1.c)
+add_library(shared2 SHARED func2.c)
+add_library(obj2 OBJECT func3.c)
+add_library(staticFramework2 STATIC func4.c)
+add_library(sharedFramework2 SHARED func5.c)
+set_target_properties(staticFramework2 PROPERTIES FRAMEWORK TRUE)
+set_target_properties(sharedFramework2 PROPERTIES FRAMEWORK TRUE)
+
+# Pick a couple of libraries that are always present in the Xcode SDK
+find_library(libz z REQUIRED)
+find_library(libresolv resolv REQUIRED)
+add_library(imported2 UNKNOWN IMPORTED)
+set_target_properties(imported2 PROPERTIES IMPORTED_LOCATION ${libz})
+
+# Save these for the check script to use
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/foundLibs.cmake "
+set(libz \"${libz}\")
+set(libresolv \"${libresolv}\")
+")
+
+set(mainTargets
+ app1
+ static1
+ shared1
+ module1
+ obj1
+ staticFramework1
+ sharedFramework1
+)
+set(linkToThings
+ static2
+ shared2
+ obj2
+ staticFramework2
+ sharedFramework2
+ imported2
+ ${libresolv}
+)
+
+foreach(mainTarget IN LISTS mainTargets)
+ foreach(linkTo IN LISTS linkToThings)
+ target_link_libraries(${mainTarget} PRIVATE ${linkTo})
+ endforeach()
+endforeach()
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY-check.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY-check.cmake
new file mode 100644
index 0000000..2b7edf5
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY-check.cmake
@@ -0,0 +1,19 @@
+include(${RunCMake_TEST_SOURCE_DIR}/LinkBinariesBuildPhase_Funcs.cmake)
+include(${RunCMake_TEST_BINARY_DIR}/foundLibs.cmake)
+
+# obj2 --> Embeds func3.o in the link flags, but obj2 is part of the path
+# ${libz} --> This is for imported2
+
+foreach(mainTarget IN ITEMS app1 shared1 module1 sharedFramework1)
+ checkFlags(OTHER_LDFLAGS ${mainTarget}
+ "obj2;${libz};${libresolv}"
+ "static2;shared2;staticFramework2;sharedFramework2"
+ )
+endforeach()
+
+foreach(mainTarget IN ITEMS static1 staticFramework1)
+ checkFlags(OTHER_LIBTOOLFLAGS ${mainTarget}
+ "obj2"
+ "static2;shared2;staticFramework2;sharedFramework2;${libz};${libresolv}"
+ )
+endforeach()
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY.cmake
new file mode 100644
index 0000000..f9dd643
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_BUILT_ONLY.cmake
@@ -0,0 +1 @@
+include(${CMAKE_CURRENT_LIST_DIR}/LinkBinariesBuildPhase.cmake)
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_Funcs.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_Funcs.cmake
new file mode 100644
index 0000000..601e52f
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_Funcs.cmake
@@ -0,0 +1,55 @@
+macro(returnOnError errorMsg)
+ if(NOT "${errorMsg}" STREQUAL "")
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}\n${errorMsg}" PARENT_SCOPE)
+ return()
+ endif()
+endmacro()
+
+function(getTargetFlags mainTarget projFlagsVar flagsVar errorVar)
+ # The flags variables in the project file might span over multiple lines
+ # so we can't easily read the flags directly from there. Instead, we use
+ # the xcodebuild -showBuildSettings option to report it on a single line.
+ execute_process(
+ COMMAND ${CMAKE_COMMAND}
+ --build ${RunCMake_TEST_BINARY_DIR}
+ --target ${mainTarget}
+ --config Debug
+ --
+ -showBuildSettings
+ COMMAND grep ${projFlagsVar}
+ OUTPUT_VARIABLE flagsContents
+ RESULT_VARIABLE result
+ )
+
+ if(result)
+ set(${errorVar} "Failed to get flags for ${mainTarget}: ${result}" PARENT_SCOPE)
+ else()
+ unset(${errorVar} PARENT_SCOPE)
+ endif()
+ set(${flagsVar} "${flagsContents}" PARENT_SCOPE)
+endfunction()
+
+function(checkFlags projFlagsVar mainTarget present absent)
+ getTargetFlags(${mainTarget} ${projFlagsVar} flags errorMsg)
+ returnOnError("${errorMsg}")
+
+ foreach(linkTo IN LISTS present)
+ string(REGEX MATCH "${linkTo}" result "${flags}")
+ if("${result}" STREQUAL "")
+ string(APPEND RunCMake_TEST_FAILED
+ "\n${mainTarget} ${projFlagsVar} is missing ${linkTo}"
+ )
+ endif()
+ endforeach()
+
+ foreach(linkTo IN LISTS absent)
+ string(REGEX MATCH "${linkTo}" result "${flags}")
+ if(NOT "${result}" STREQUAL "")
+ string(APPEND RunCMake_TEST_FAILED
+ "\n${mainTarget} ${projFlagsVar} unexpectedly contains ${linkTo}"
+ )
+ endif()
+ endforeach()
+
+ set(RunCMake_TEST_FAILED ${RunCMake_TEST_FAILED} PARENT_SCOPE)
+endfunction()
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-result.txt b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-stderr.txt b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-stderr.txt
new file mode 100644
index 0000000..0664304
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID-stderr.txt
@@ -0,0 +1 @@
+CMake Error: Invalid value for XCODE_LINK_BUILD_PHASE_MODE: INVALID
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID.cmake
new file mode 100644
index 0000000..0a20d20
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_INVALID.cmake
@@ -0,0 +1,4 @@
+enable_language(CXX)
+
+add_executable(app main.cpp)
+set_target_properties(app PROPERTIES XCODE_LINK_BUILD_PHASE_MODE INVALID)
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION-check.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION-check.cmake
new file mode 100644
index 0000000..b0d2f7f
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION-check.cmake
@@ -0,0 +1,19 @@
+include(${RunCMake_TEST_SOURCE_DIR}/LinkBinariesBuildPhase_Funcs.cmake)
+include(${RunCMake_TEST_BINARY_DIR}/foundLibs.cmake)
+
+# obj2 --> Embeds func3.o in the link flags, but obj2 is part of the path
+# ${libz} --> This is for imported2
+
+foreach(mainTarget IN ITEMS app1 shared1 module1 sharedFramework1)
+ checkFlags(OTHER_LDFLAGS ${mainTarget}
+ "obj2"
+ "static2;shared2;staticFramework2;sharedFramework2;${libz};${libresolv}"
+ )
+endforeach()
+
+foreach(mainTarget IN ITEMS static1 staticFramework1)
+ checkFlags(OTHER_LIBTOOLFLAGS ${mainTarget}
+ "obj2"
+ "static2;shared2;staticFramework2;sharedFramework2;${libz};${libresolv}"
+ )
+endforeach()
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION.cmake
new file mode 100644
index 0000000..f9dd643
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_KNOWN_LOCATION.cmake
@@ -0,0 +1 @@
+include(${CMAKE_CURRENT_LIST_DIR}/LinkBinariesBuildPhase.cmake)
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE-check.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE-check.cmake
new file mode 100644
index 0000000..3074881
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE-check.cmake
@@ -0,0 +1,19 @@
+include(${RunCMake_TEST_SOURCE_DIR}/LinkBinariesBuildPhase_Funcs.cmake)
+include(${RunCMake_TEST_BINARY_DIR}/foundLibs.cmake)
+
+# obj2 --> Embeds func3.o in the link flags, but obj2 is part of the path
+# ${libz} --> This is for imported2
+
+foreach(mainTarget IN ITEMS app1 shared1 module1 sharedFramework1)
+ checkFlags(OTHER_LDFLAGS ${mainTarget}
+ "static2;shared2;staticFramework2;sharedFramework2;obj2;${libz};${libresolv}"
+ ""
+ )
+endforeach()
+
+foreach(mainTarget IN ITEMS static1 staticFramework1)
+ checkFlags(OTHER_LIBTOOLFLAGS ${mainTarget}
+ "obj2"
+ "static2;shared2;staticFramework2;sharedFramework2;${libz};${libresolv}"
+ )
+endforeach()
diff --git a/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE.cmake b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE.cmake
new file mode 100644
index 0000000..f9dd643
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/LinkBinariesBuildPhase_NONE.cmake
@@ -0,0 +1 @@
+include(${CMAKE_CURRENT_LIST_DIR}/LinkBinariesBuildPhase.cmake)
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index ed300bb..70eaaeb 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -19,6 +19,19 @@ endfunction()
XcodeGenerateTopLevelProjectOnlyWithObjectLibrary()
+function(LinkBinariesBuildPhase mode)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/LinkBinariesBuildPhase_${mode}-build)
+ set(RunCMake_TEST_OPTIONS "-DCMAKE_XCODE_LINK_BUILD_PHASE_MODE=${mode}")
+ run_cmake(LinkBinariesBuildPhase_${mode})
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(LinkBinariesBuildPhase_${mode}-build ${CMAKE_COMMAND} --build .)
+endfunction()
+
+LinkBinariesBuildPhase(NONE)
+LinkBinariesBuildPhase(BUILT_ONLY)
+LinkBinariesBuildPhase(KNOWN_LOCATION)
+run_cmake(LinkBinariesBuildPhase_INVALID)
+
run_cmake(XcodeObjectNeedsEscape)
run_cmake(XcodeObjectNeedsQuote)
run_cmake(XcodeOptimizationFlags)
diff --git a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake
index 8c0b470..bc14874 100644
--- a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake
@@ -4,12 +4,14 @@ cmake_minimum_required(VERSION 3.3)
enable_language(C)
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO")
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS")
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")
diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake
index c221033..19f8e2f 100644
--- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake
@@ -10,6 +10,7 @@ if(NOT IOS)
message(FATAL_ERROR "IOS variable is not set")
endif()
+set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf")
diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake
index 172f2e8..7d14d19 100644
--- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake
@@ -6,6 +6,7 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 9)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10)
endif()
+set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf")
diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake
index 038a890..974ae47 100644
--- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake
@@ -6,6 +6,7 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 9)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10)
endif()
+set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf")
diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake
new file mode 100644
index 0000000..4fd3c7d
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/ABSOLUTE_PATH.cmake
@@ -0,0 +1,39 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "../../a/d")
+cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f")
+if (NOT path STREQUAL "/x/y/a/f/../../a/d")
+ list (APPEND errors "'${path}' instead of '/x/y/a/f/../../a/d'")
+endif()
+
+set (path "../../a/d")
+cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f" NORMALIZE)
+if (NOT path STREQUAL "/x/y/a/d")
+ list (APPEND errors "'${path}' instead of '/x/y/a/d'")
+endif()
+
+set (path "../../a/d")
+cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f" NORMALIZE OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "../../a/d")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "/x/y/a/d")
+ list (APPEND errors "'${output}' instead of '/x/y/a/d'")
+endif()
+
+set (path "/a/d/../e")
+cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f")
+if (NOT path STREQUAL "/a/d/../e")
+ list (APPEND errors "'${path}' instead of '/a/d/../e'")
+endif()
+
+set (path "/a/d/../e")
+cmake_path(ABSOLUTE_PATH path BASE_DIRECTORY "/x/y/a/f" NORMALIZE)
+if (NOT path STREQUAL "/a/e")
+ list (APPEND errors "'${path}' instead of '/a/e'")
+endif()
+
+
+check_errors (ABSOLUTE_PATH ${errors})
diff --git a/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/APPEND-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/APPEND-wrong-path-result.txt b/Tests/RunCMake/cmake_path/APPEND-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/APPEND-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/APPEND.cmake b/Tests/RunCMake/cmake_path/APPEND.cmake
new file mode 100644
index 0000000..565b26d
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/APPEND.cmake
@@ -0,0 +1,77 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+cmake_path (APPEND path "/a/b" "c")
+if (NOT path STREQUAL "/a/b/c")
+ list (APPEND errors "'${path}' instead of '/a/b/c'")
+endif()
+
+set (path "/a/b")
+cmake_path (APPEND path "c")
+if (NOT path STREQUAL "/a/b/c")
+ list (APPEND errors "'${path}' instead of '/a/b/c'")
+endif()
+
+cmake_path (APPEND path "x/y" "z" OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "/a/b/c")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "/a/b/c/x/y/z")
+ list (APPEND errors "'${output}' instead of '/a/b/c/x/y/z'")
+endif()
+
+set (path "a")
+cmake_path (APPEND path "")
+if (NOT path STREQUAL "a/")
+ list (APPEND errors "'${path}' instead of 'a/'")
+endif()
+
+cmake_path (APPEND path "/b")
+if (NOT path STREQUAL "/b")
+ list (APPEND errors "'${path}' instead of '/b'")
+endif()
+
+if (WIN32)
+ set (path "a")
+ cmake_path (APPEND path "c:/b")
+ if (NOT path STREQUAL "c:/b")
+ list (APPEND errors "'${path}' instead of 'c:/b'")
+ endif()
+
+ set (path "a")
+ cmake_path (APPEND path "c:")
+ if (NOT path STREQUAL "c:")
+ list (APPEND errors "'${path}' instead of 'c:'")
+ endif()
+ cmake_path (APPEND path "")
+ if (NOT path STREQUAL "c:")
+ list (APPEND errors "'${path}' instead of 'c:'")
+ endif()
+
+ set (path "c:a")
+ cmake_path (APPEND path "/b")
+ if (NOT path STREQUAL "c:/b")
+ list (APPEND errors "'${path}' instead of 'c:/b'")
+ endif()
+
+ set (path "c:a")
+ cmake_path (APPEND path "c:b")
+ if (NOT path STREQUAL "c:a/b")
+ list (APPEND errors "'${path}' instead of 'c:a/b'")
+ endif()
+
+ set (path "//host")
+ cmake_path (APPEND path "b")
+ if (NOT path STREQUAL "//host/b")
+ list (APPEND errors "'${path}' instead of '//host/b'")
+ endif()
+
+ set (path "//host/")
+ cmake_path (APPEND path "b")
+ if (NOT path STREQUAL "//host/b")
+ list (APPEND errors "'${path}' instead of '//host/b'")
+ endif()
+endif()
+
+check_errors (APPEND ${errors})
diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/CMAKE_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CMAKE_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CMAKE_PATH.cmake b/Tests/RunCMake/cmake_path/CMAKE_PATH.cmake
new file mode 100644
index 0000000..b9320f3
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CMAKE_PATH.cmake
@@ -0,0 +1,43 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+cmake_path(CMAKE_PATH path "/x/y/z/../../a/d")
+if (NOT path STREQUAL "/x/y/z/../../a/d")
+ list (APPEND errors "'${path}' instead of '/x/y/z/../../a/d'")
+endif()
+cmake_path(CMAKE_PATH path NORMALIZE "/x/y/z/../../a/d")
+if (NOT path STREQUAL "/x/a/d")
+ list (APPEND errors "'${path}' instead of '/x/a/d'")
+endif()
+
+if (WIN32)
+ cmake_path(CMAKE_PATH path "/x\\y/z\\..\\../a/d")
+ if (NOT path STREQUAL "/x/y/z/../../a/d")
+ list (APPEND errors "'${path}' instead of '/x/y/z/../../a/d'")
+ endif()
+ cmake_path(CMAKE_PATH path NORMALIZE "/x\\y/z\\..\\../a/d")
+ if (NOT path STREQUAL "/x/a/d")
+ list (APPEND errors "'${path}' instead of '/x/a/d'")
+ endif()
+
+ cmake_path(CMAKE_PATH path "//?/c:/x\\y/z\\..\\../a/d")
+ if (NOT path STREQUAL "c:/x/y/z/../../a/d")
+ list (APPEND errors "'${path}' instead of 'c:/x/y/z/../../a/d'")
+ endif()
+ cmake_path(CMAKE_PATH path NORMALIZE "//?/c:/x\\y/z\\..\\../a/d")
+ if (NOT path STREQUAL "c:/x/a/d")
+ list (APPEND errors "'${path}' instead of 'c:/x/a/d'")
+ endif()
+
+ cmake_path(CMAKE_PATH path "\\\\?\\UNC/host/x\\y/z\\..\\../a/d")
+ if (NOT path STREQUAL "//host/x/y/z/../../a/d")
+ list (APPEND errors "'${path}' instead of '//host/x/y/z/../../a/d'")
+ endif()
+ cmake_path(CMAKE_PATH path NORMALIZE "\\\\?\\UNC\\host/x\\y/z\\..\\../a/d")
+ if (NOT path STREQUAL "//host/x/a/d")
+ list (APPEND errors "'${path}' instead of '//host/x/a/d'")
+ endif()
+endif()
+
+check_errors (CMAKE_PATH ${errors})
diff --git a/Tests/RunCMake/cmake_path/CMakeLists.txt b/Tests/RunCMake/cmake_path/CMakeLists.txt
new file mode 100644
index 0000000..1f195c6
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.18...3.19)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/cmake_path/COMPARE-EQUAL-invalid-output-result.txt b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/COMPARE-EQUAL-missing-output-result.txt b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/COMPARE-EQUAL-wrong-path-result.txt b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE-EQUAL-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-invalid-output-result.txt b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-missing-output-result.txt b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-wrong-path-result.txt b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE-NOT_EQUAL-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-result.txt b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-stderr.txt b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-stderr.txt
new file mode 100644
index 0000000..674d942
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at COMPARE-wrong-operator.cmake:[0-9]+ \(cmake_path\):
+ cmake_path COMPARE called with an unknown comparison operator: FOO.
diff --git a/Tests/RunCMake/cmake_path/COMPARE-wrong-operator.cmake b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator.cmake
new file mode 100644
index 0000000..7da5d29
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE-wrong-operator.cmake
@@ -0,0 +1,3 @@
+
+set (path "/a/b")
+cmake_path(COMPARE path FOO "/other" output)
diff --git a/Tests/RunCMake/cmake_path/COMPARE.cmake b/Tests/RunCMake/cmake_path/COMPARE.cmake
new file mode 100644
index 0000000..bc6b9b4
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/COMPARE.cmake
@@ -0,0 +1,22 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "a///b/c")
+cmake_path(COMPARE path EQUAL "a/b/c" output)
+if (NOT output)
+ list (APPEND errors "'${path}' not equal to 'a/b/c'")
+endif()
+
+set (path "a/b/d/../c")
+cmake_path(COMPARE path NOT_EQUAL "a/b/c" output)
+if (NOT output)
+ list (APPEND errors "'${path}' equal to 'a/b/c'")
+endif()
+cmake_path(NORMAL_PATH path)
+cmake_path(COMPARE path EQUAL "a/b/c" output)
+if (NOT output)
+ list (APPEND errors "'${path}' not equal to 'a/b/c'")
+endif()
+
+check_errors (COMPARE ${errors})
diff --git a/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONCAT-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONCAT-wrong-path-result.txt b/Tests/RunCMake/cmake_path/CONCAT-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONCAT-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONCAT.cmake b/Tests/RunCMake/cmake_path/CONCAT.cmake
new file mode 100644
index 0000000..62b5eb0
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONCAT.cmake
@@ -0,0 +1,20 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "/a/b")
+cmake_path (CONCAT path "cd")
+if (NOT path STREQUAL "/a/bcd")
+ list (APPEND errors "'${path}' instead of 'a/bcd'")
+endif()
+
+set (path "/a/b")
+cmake_path (CONCAT path "cd" "ef" OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "/a/b")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "/a/bcdef")
+ list (APPEND errors "'${output}' instead of 'a/bcdef'")
+endif()
+
+check_errors (CONCAT ${errors})
diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-invalid-output-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-missing-output-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT-TO_CMAKE_PATH_LIST-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-invalid-output-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-missing-output-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT-TO_NATIVE_PATH_LIST-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-result.txt b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-stderr.txt b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-stderr.txt
new file mode 100644
index 0000000..9aa75ec
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at CONVERT-wrong-operator.cmake:[0-9]+ \(cmake_path\):
+ cmake_path CONVERT called with an unknown action: FOO.
diff --git a/Tests/RunCMake/cmake_path/CONVERT-wrong-operator.cmake b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator.cmake
new file mode 100644
index 0000000..12ffccc
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT-wrong-operator.cmake
@@ -0,0 +1,2 @@
+
+cmake_path(CONVERT "/a/b" FOO output)
diff --git a/Tests/RunCMake/cmake_path/CONVERT.cmake b/Tests/RunCMake/cmake_path/CONVERT.cmake
new file mode 100644
index 0000000..b08bc26
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/CONVERT.cmake
@@ -0,0 +1,110 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+cmake_path(CONVERT "/x/y/z/../../a/d" TO_CMAKE_PATH_LIST output)
+if (NOT output STREQUAL "/x/y/z/../../a/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d'")
+endif()
+cmake_path(CONVERT "/x/y/z/../../a/d" TO_CMAKE_PATH_LIST output NORMALIZE)
+if (NOT output STREQUAL "/x/a/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d'")
+endif()
+
+if (WIN32)
+ cmake_path(CONVERT "/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output)
+ if (NOT output STREQUAL "/x/y/z/../../a/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d'")
+ endif()
+ cmake_path(CONVERT "/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "/x/a/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d'")
+ endif()
+
+ cmake_path(CONVERT "//?/c:/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output)
+ if (NOT output STREQUAL "c:/x/y/z/../../a/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of 'c:/x/y/z/../../a/d'")
+ endif()
+ cmake_path(CONVERT "//?/c:/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "c:/x/a/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of 'c:/x/a/d'")
+ endif()
+
+ cmake_path(CONVERT "//?/UNC/host/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output)
+ if (NOT output STREQUAL "//host/x/y/z/../../a/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '//host/x/y/z/../../a/d'")
+ endif()
+ cmake_path(CONVERT "//?/UNC/host/x\\y/z\\..\\../a/d" TO_CMAKE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "//host/x/a/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '//host/x/a/d'")
+ endif()
+endif()
+
+if (WIN32)
+ cmake_path(CONVERT "/x\\y/z/..\\../a\\d;c:\\a/b\\c/..\\d" TO_CMAKE_PATH_LIST output)
+ if (NOT output STREQUAL "/x/y/z/../../a/d;c:/a/b/c/../d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d;c:/a/b/c/../d'")
+ endif()
+ cmake_path(CONVERT "/x\\y/z/..\\../a\\d;c:\\a/b\\c/..\\d" TO_CMAKE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "/x/a/d;c:/a/b/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d;c:/a/b/d'")
+ endif()
+else()
+ cmake_path(CONVERT "/x/y/z/../../a/d:/a/b/c/../d" TO_CMAKE_PATH_LIST output)
+ if (NOT output STREQUAL "/x/y/z/../../a/d;/a/b/c/../d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${outputh}' instead of '/x/y/z/../../a/d;/a/b/c/../d'")
+ endif()
+ cmake_path(CONVERT "/x/y/z/../../a/d:/a/b/c/../d" TO_CMAKE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "/x/a/d;/a/b/d")
+ list (APPEND errors "TO_CMAKE_PATH_LIST: '${output}' instead of '/x/a/d;/a/b/d'")
+ endif()
+endif()
+
+
+if (WIN32)
+ cmake_path(CONVERT "c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output)
+ if (NOT output STREQUAL "c:\\a\\\\b\\c\\..\\d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of 'c:\\a\\\\b\\c\\..\\d'")
+ endif()
+ cmake_path(CONVERT "c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "c:\\a\\b\\d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of 'c:\\a\\b\\d'")
+ endif()
+
+ cmake_path(CONVERT "//host/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output)
+ if (NOT output STREQUAL "\\\\host\\a\\\\b\\c\\..\\d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\\\b\\c\\..\\d'")
+ endif()
+ cmake_path(CONVERT "//host/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "\\\\host\\a\\b\\d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\b\\d'")
+ endif()
+ cmake_path(CONVERT "//host/a//b\\c/..\\d;c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output)
+ if (NOT output STREQUAL "\\\\host\\a\\\\b\\c\\..\\d;c:\\a\\\\b\\c\\..\\d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\\\b\\c\\..\\d;c:\\a\\\\b\\c\\..\\d'")
+ endif()
+ cmake_path(CONVERT "//host/a//b\\c/..\\d;c:/a//b\\c/..\\d" TO_NATIVE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "\\\\host\\a\\b\\d;c:\\a\\b\\d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '\\\\host\\a\\b\\d;c:\\a\\b\\d'")
+ endif()
+else()
+ cmake_path(CONVERT "/a//b/c/../d" TO_NATIVE_PATH_LIST output)
+ if (NOT output STREQUAL "/a//b/c/../d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/a//b/c/../d'")
+ endif()
+ cmake_path(CONVERT "/a//b/c/../d" TO_NATIVE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "/a/b/d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/a/b/d'")
+ endif()
+ cmake_path(CONVERT "/x/y/z/../../a/d;/a/b/c/../d" TO_NATIVE_PATH_LIST output)
+ if (NOT output STREQUAL "/x/y/z/../../a/d:/a/b/c/../d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/x/y/z/../../a/d:/a/b/c/../d'")
+ endif()
+ cmake_path(CONVERT "/x/y/z/../../a/d;/a/b/c/../d" TO_NATIVE_PATH_LIST output NORMALIZE)
+ if (NOT output STREQUAL "/x/a/d:/a/b/d")
+ list (APPEND errors "TO_NATIVE_PATH_LIST: '${output}' instead of '/x/a/d:/a/b/d'")
+ endif()
+endif()
+
+
+check_errors (CONVERT ${errors})
diff --git a/Tests/RunCMake/cmake_path/GET-EXTENSION-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-EXTENSION-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-EXTENSION-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-EXTENSION-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-EXTENSION-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-EXTENSION-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-EXTENSION-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-EXTENSION-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-EXTENSION-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-EXTENSION-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-EXTENSION-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-EXTENSION-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-FILENAME-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-FILENAME-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-FILENAME-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-FILENAME-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-FILENAME-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-FILENAME-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-FILENAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-FILENAME-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-FILENAME-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-FILENAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-FILENAME-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-FILENAME-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-PARENT_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-PARENT_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-PARENT_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-PARENT_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-PARENT_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-RELATIVE_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_DIRECTORY-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_NAME-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_NAME-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_NAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_NAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_NAME-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-ROOT_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-ROOT_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-STEM-invalid-output-result.txt b/Tests/RunCMake/cmake_path/GET-STEM-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-STEM-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-STEM-missing-output-result.txt b/Tests/RunCMake/cmake_path/GET-STEM-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-STEM-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-STEM-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/GET-STEM-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-STEM-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-STEM-wrong-path-result.txt b/Tests/RunCMake/cmake_path/GET-STEM-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-STEM-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-wrong-operator-result.txt b/Tests/RunCMake/cmake_path/GET-wrong-operator-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-wrong-operator-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/GET-wrong-operator-stderr.txt b/Tests/RunCMake/cmake_path/GET-wrong-operator-stderr.txt
new file mode 100644
index 0000000..71afc92
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-wrong-operator-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at GET-wrong-operator.cmake:[0-9]+ \(cmake_path\):
+ cmake_path GET called with an unknown action: FOO.
diff --git a/Tests/RunCMake/cmake_path/GET-wrong-operator.cmake b/Tests/RunCMake/cmake_path/GET-wrong-operator.cmake
new file mode 100644
index 0000000..e09d6d7
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET-wrong-operator.cmake
@@ -0,0 +1,3 @@
+
+set (path "/a/b")
+cmake_path(GET path FOO output)
diff --git a/Tests/RunCMake/cmake_path/GET.cmake b/Tests/RunCMake/cmake_path/GET.cmake
new file mode 100644
index 0000000..e68e654
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/GET.cmake
@@ -0,0 +1,248 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+###############################################
+## First test with a path defining all elements
+###############################################
+if (WIN32)
+ set (path "C:/aa/bb/cc.ext1.ext2")
+else()
+ set (path "/aa/bb/cc.ext1.ext2")
+endif()
+
+cmake_path(GET path ROOT_NAME output)
+if (WIN32)
+ if (NOT output STREQUAL "C:")
+ list (APPEND errors "ROOT_NAME returns bad data: ${output}")
+ endif()
+else()
+ if (NOT output STREQUAL "")
+ list (APPEND errors "ROOT_NAME returns bad data: ${output}")
+ endif()
+endif()
+
+cmake_path(GET path ROOT_DIRECTORY output)
+if (NOT output STREQUAL "/")
+ list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_PATH output)
+if (WIN32)
+ if (NOT output STREQUAL "C:/")
+ list (APPEND errors "ROOT_PATH returns bad data: ${output}")
+ endif()
+else()
+ if (NOT output STREQUAL "/")
+ list (APPEND errors "ROOT_PATH returns bad data: ${output}")
+ endif()
+endif()
+
+cmake_path(GET path FILENAME output)
+if (NOT output STREQUAL "cc.ext1.ext2")
+ list (APPEND errors "FILENAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path EXTENSION output)
+if (NOT output STREQUAL ".ext1.ext2")
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+cmake_path(GET path EXTENSION LAST_ONLY output)
+if (NOT output STREQUAL ".ext2")
+ list (APPEND errors "EXTENSION LAST_ONLY returns bad data: ${output}")
+endif()
+
+cmake_path(GET path STEM output)
+if (NOT output STREQUAL "cc")
+ list (APPEND errors "STEM returns bad data: ${output}")
+endif()
+cmake_path(GET path STEM LAST_ONLY output)
+if (NOT output STREQUAL "cc.ext1")
+ list (APPEND errors "STEM LAST_ONLY returns bad data: ${output}")
+endif()
+
+cmake_path(GET path RELATIVE_PATH output)
+if (NOT output STREQUAL "aa/bb/cc.ext1.ext2")
+ list (APPEND errors "RELATIVE_PATH returns bad data: ${output}")
+endif()
+
+cmake_path(GET path PARENT_PATH output)
+if (WIN32)
+ if (NOT output STREQUAL "C:/aa/bb")
+ list (APPEND errors "PARENT_PATH returns bad data: ${output}")
+ endif()
+else()
+ if (NOT output STREQUAL "/aa/bb")
+ list (APPEND errors "PARENT_PATH returns bad data: ${output}")
+ endif()
+endif()
+
+######################################
+## second, tests with missing elements
+######################################
+set (path "aa/bb/")
+
+cmake_path(GET path ROOT_NAME output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "ROOT_NAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_DIRECTORY output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_PATH output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "ROOT_PATH returns bad data: ${output}")
+endif()
+
+cmake_path(GET path FILENAME output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "FILENAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path EXTENSION output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+
+cmake_path(GET path STEM output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "STEM returns bad data: ${output}")
+endif()
+
+cmake_path(GET path RELATIVE_PATH output)
+if (NOT output STREQUAL path)
+ list (APPEND errors "RELATIVE_PATH returns bad data: ${output}")
+endif()
+
+cmake_path(GET path PARENT_PATH output)
+if (NOT output STREQUAL "aa/bb")
+ list (APPEND errors "PARENT_PATH returns bad data: ${output}")
+endif()
+
+##################################
+set (path "/aa/bb/")
+
+cmake_path(GET path ROOT_NAME output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "ROOT_NAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_DIRECTORY output)
+if (NOT output STREQUAL "/")
+ list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_PATH output)
+if (NOT output STREQUAL "/")
+ list (APPEND errors "ROOT_PATH returns bad data: ${output}")
+endif()
+
+###################################
+set (path "/")
+
+cmake_path(GET path ROOT_NAME output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "ROOT_NAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_DIRECTORY output)
+if (NOT output STREQUAL "/")
+ list (APPEND errors "ROOT_DIRECTORY returns bad data: ${output}")
+endif()
+
+cmake_path(GET path ROOT_PATH output)
+if (NOT output STREQUAL "/")
+ list (APPEND errors "ROOT_PATH returns bad data: ${output}")
+endif()
+
+cmake_path(GET path FILENAME output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "FILENAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path EXTENSION output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+
+cmake_path(GET path STEM output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "STEM returns bad data: ${output}")
+endif()
+
+cmake_path(GET path RELATIVE_PATH output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "RELATIVE_PATH returns bad data: ${output}")
+endif()
+
+cmake_path(GET path PARENT_PATH output)
+if (NOT output STREQUAL "/")
+ list (APPEND errors "PARENT_PATH returns bad data: ${output}")
+endif()
+
+###################################
+set (path ".file")
+
+cmake_path(GET path FILENAME output)
+if (NOT output STREQUAL ".file")
+ list (APPEND errors "FILENAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path EXTENSION output)
+if (NOT output STREQUAL "")
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+
+cmake_path(GET path STEM output)
+if (NOT output STREQUAL ".file")
+ list (APPEND errors "STEM returns bad data: ${output}")
+endif()
+
+###################################
+set (path ".file.ext")
+
+cmake_path(GET path FILENAME output)
+if (NOT output STREQUAL ".file.ext")
+ list (APPEND errors "FILENAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path EXTENSION output)
+if (NOT output STREQUAL ".ext")
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+cmake_path(GET path EXTENSION LAST_ONLY output)
+if (NOT output STREQUAL ".ext")
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+
+cmake_path(GET path STEM output)
+if (NOT output STREQUAL ".file")
+ list (APPEND errors "STEM returns bad data: ${output}")
+endif()
+
+###################################
+set (path ".file.ext1.ext2")
+
+cmake_path(GET path FILENAME output)
+if (NOT output STREQUAL ".file.ext1.ext2")
+ list (APPEND errors "FILENAME returns bad data: ${output}")
+endif()
+
+cmake_path(GET path EXTENSION output)
+if (NOT output STREQUAL ".ext1.ext2")
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+cmake_path(GET path EXTENSION LAST_ONLY output)
+if (NOT output STREQUAL ".ext2")
+ list (APPEND errors "EXTENSION returns bad data: ${output}")
+endif()
+
+cmake_path(GET path STEM output)
+if (NOT output STREQUAL ".file")
+ list (APPEND errors "STEM returns bad data: ${output}")
+endif()
+
+check_errors (GET ${errors})
diff --git a/Tests/RunCMake/cmake_path/HASH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HASH-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HASH-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HASH-missing-output-result.txt b/Tests/RunCMake/cmake_path/HASH-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HASH-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HASH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HASH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HASH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HASH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HASH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HASH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HASH.cmake b/Tests/RunCMake/cmake_path/HASH.cmake
new file mode 100644
index 0000000..dfcf2b2
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HASH.cmake
@@ -0,0 +1,27 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path1 "a///b/c")
+cmake_path(HASH path1 hash1)
+set (path2 "a/b////c")
+cmake_path(HASH path2 hash2)
+if (NOT hash1 STREQUAL hash2)
+ list (APPEND errors "'hash values not equal for '${path1}' and '${path2}'")
+endif()
+
+set (path1 "a///b/c/../d")
+cmake_path(HASH path1 hash1)
+set (path2 "a/b////d")
+cmake_path(HASH path2 hash2)
+if (hash1 STREQUAL hash2)
+ list (APPEND errors "'hash values equal for '${path1}' and '${path2}'")
+endif()
+cmake_path(HASH path1 hash1 NORMALIZE)
+cmake_path(HASH path2 NORMALIZE hash2)
+if (NOT hash1 STREQUAL hash2)
+ list (APPEND errors "'hash values not equal for '${path1}' and '${path2}'")
+endif()
+
+
+check_errors (HASH ${errors})
diff --git a/Tests/RunCMake/cmake_path/HAS_EXTENSION-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_EXTENSION-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_EXTENSION-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_EXTENSION-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_EXTENSION-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_EXTENSION-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_EXTENSION-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_EXTENSION-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_EXTENSION-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_EXTENSION-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_EXTENSION-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_EXTENSION-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_FILENAME-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_FILENAME-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_FILENAME-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_FILENAME-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_FILENAME-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_FILENAME-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_FILENAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_FILENAME-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_FILENAME-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_FILENAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_FILENAME-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_FILENAME-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ITEM.cmake b/Tests/RunCMake/cmake_path/HAS_ITEM.cmake
new file mode 100644
index 0000000..eb73bd5
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ITEM.cmake
@@ -0,0 +1,232 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "/a/b")
+cmake_path(HAS_ROOT_NAME path output)
+if (output)
+ list (APPEND errors "ROOT_NAME: ${path} has root name")
+endif()
+cmake_path(HAS_ROOT_DIRECTORY path output)
+if (NOT output)
+ list (APPEND errors "ROOT_DIRECTORY: ${path} does not have root directory")
+endif()
+cmake_path(HAS_ROOT_PATH path output)
+if (NOT output)
+ list (APPEND errors "ROOT_PATH: ${path} does not have root path")
+endif()
+
+set (path "a/b")
+cmake_path(HAS_ROOT_PATH path output)
+if (output)
+ list (APPEND errors "ROOT_PATH: ${path} has root path")
+endif()
+
+set (path "/a/b")
+cmake_path(HAS_FILENAME path output)
+if (NOT output)
+ list (APPEND errors "FILENAME: ${path} does not have filename")
+endif()
+set (path "a.b")
+cmake_path(HAS_FILENAME path output)
+if (NOT output)
+ list (APPEND errors "FILENAME: ${path} does not have filename")
+endif()
+set (path "/a/b/")
+cmake_path(HAS_FILENAME path output)
+if (output)
+ list (APPEND errors "FILENAME: ${path} has filename")
+endif()
+set (path "/")
+cmake_path(HAS_FILENAME path output)
+if (output)
+ list (APPEND errors "FILENAME: ${path} has filename")
+endif()
+
+set (path "/a/b")
+cmake_path(HAS_STEM path output)
+if (NOT output)
+ list (APPEND errors "STEM: ${path} does not have stem")
+endif()
+set (path "a.b")
+cmake_path(HAS_STEM path output)
+if (NOT output)
+ list (APPEND errors "STEM: ${path} does not have stem")
+endif()
+set (path ".a")
+cmake_path(HAS_STEM path output)
+if (NOT output)
+ list (APPEND errors "STEM: ${path} does not have stem")
+endif()
+set (path "/a/")
+cmake_path(HAS_STEM path output)
+if (output)
+ list (APPEND errors "STEM: ${path} has stem")
+endif()
+set (path "/")
+cmake_path(HAS_STEM path output)
+if (output)
+ list (APPEND errors "STEM: ${path} has stem")
+endif()
+
+set (path "/a/b.c")
+cmake_path(HAS_EXTENSION path output)
+if (NOT output)
+ list (APPEND errors "EXTENSION: ${path} does not have extension")
+endif()
+set (path "b.c")
+cmake_path(HAS_EXTENSION path output)
+if (NOT output)
+ list (APPEND errors "EXTENSION: ${path} does not have extension")
+endif()
+set (path "/.a")
+cmake_path(HAS_EXTENSION path output)
+if (output)
+ list (APPEND errors "EXTENSION: ${path} has extension")
+endif()
+set (path "/a/")
+cmake_path(HAS_EXTENSION path output)
+if (output)
+ list (APPEND errors "EXTENSION: ${path} has extension")
+endif()
+set (path "/")
+cmake_path(HAS_EXTENSION path output)
+if (output)
+ list (APPEND errors "EXTENSION: ${path} has extension")
+endif()
+
+set (path "/a/b")
+cmake_path(HAS_RELATIVE_PATH path output)
+if (NOT output)
+ list (APPEND errors "RELATIVE_PATH: ${path} does not have relative path")
+endif()
+set (path "/")
+cmake_path(HAS_RELATIVE_PATH path output)
+if (output)
+ list (APPEND errors "RELATIVE_PATH: ${path} has relative path")
+endif()
+
+set (path "/a/b")
+cmake_path(HAS_PARENT_PATH path output)
+if (NOT output)
+ list (APPEND errors "PARENT_PATH: ${path} does not have parent path")
+endif()
+set (path "/")
+cmake_path(HAS_PARENT_PATH path output)
+if (NOT output)
+ list (APPEND errors "PARENT_PATH: ${path} does not have parent path")
+endif()
+set (path "a")
+cmake_path(HAS_PARENT_PATH path output)
+if (output)
+ list (APPEND errors "PARENT_PATH: ${path} has parent path")
+endif()
+
+if (WIN32)
+ set (path "c:/a/b")
+ cmake_path(HAS_ROOT_NAME path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_NAME: ${path} does not have root name")
+ endif()
+ cmake_path(HAS_ROOT_DIRECTORY path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_DIRECTORY: ${path} does not have root directory")
+ endif()
+ cmake_path(HAS_ROOT_PATH path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_PATH: ${path} does not have root path")
+ endif()
+
+ set (path "c:a/b")
+ cmake_path(HAS_ROOT_NAME path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_NAME: ${path} does not have root name")
+ endif()
+ cmake_path(HAS_ROOT_DIRECTORY path output)
+ if (output)
+ list (APPEND errors "ROOT_DIRECTORY: ${path} has root directory")
+ endif()
+ cmake_path(HAS_ROOT_PATH path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_PATH: ${path} does not have root path")
+ endif()
+
+ set (path "//host/b")
+ cmake_path(HAS_ROOT_NAME path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_NAME: ${path} does not have root name")
+ endif()
+ cmake_path(HAS_ROOT_DIRECTORY path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_DIRECTORY: ${path} does not have root directory")
+ endif()
+ cmake_path(HAS_ROOT_PATH path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_PATH: ${path} does not have root path")
+ endif()
+
+ set (path "//host")
+ cmake_path(HAS_ROOT_NAME path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_NAME: ${path} does not have root name")
+ endif()
+ cmake_path(HAS_ROOT_DIRECTORY path output)
+ if (output)
+ list (APPEND errors "ROOT_DIRECTORY: ${path} has root directory")
+ endif()
+ cmake_path(HAS_ROOT_PATH path output)
+ if (NOT output)
+ list (APPEND errors "ROOT_PATH: ${path} does not have root path")
+ endif()
+
+ set (path "c:/a/b")
+ cmake_path(HAS_RELATIVE_PATH path output)
+ if (NOT output)
+ list (APPEND errors "RELATIVE_PATH: ${path} does not have relative path")
+ endif()
+
+ set (path "c:a/b")
+ cmake_path(HAS_RELATIVE_PATH path output)
+ if (NOT output)
+ list (APPEND errors "RELATIVE_PATH: ${path} does not have relative path")
+ endif()
+
+ set (path "//host/b")
+ cmake_path(HAS_RELATIVE_PATH path output)
+ if (NOT output)
+ list (APPEND errors "RELATIVE_PATH: ${path} does not have relative path")
+ endif()
+
+ set (path "c:/a/b")
+ cmake_path(HAS_PARENT_PATH path output)
+ if (NOT output)
+ list (APPEND errors "PARENT_PATH: ${path} does not have parent path")
+ endif()
+
+ set (path "c:/")
+ cmake_path(HAS_PARENT_PATH path output)
+ if (NOT output)
+ list (APPEND errors "PARENT_PATH: ${path} does not have parent path")
+ endif()
+
+ set (path "c:")
+ cmake_path(HAS_PARENT_PATH path output)
+ if (NOT output)
+ list (APPEND errors "PARENT_PATH: ${path} does not have parent path")
+ endif()
+
+ set (path "//host/")
+ cmake_path(HAS_PARENT_PATH path output)
+ if (NOT output)
+ list (APPEND errors "PARENT_PATH: ${path} does not have parent path")
+ endif()
+
+ set (path "//host")
+ cmake_path(HAS_PARENT_PATH path output)
+ if (NOT output)
+ list (APPEND errors "PARENT_PATH: ${path} does not have parent path")
+ endif()
+endif()
+
+
+check_errors (HAS ${errors})
diff --git a/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_PARENT_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_RELATIVE_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_DIRECTORY-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_NAME-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_ROOT_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_STEM-invalid-output-result.txt b/Tests/RunCMake/cmake_path/HAS_STEM-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_STEM-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_STEM-missing-output-result.txt b/Tests/RunCMake/cmake_path/HAS_STEM-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_STEM-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_STEM-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/HAS_STEM-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_STEM-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/HAS_STEM-wrong-path-result.txt b/Tests/RunCMake/cmake_path/HAS_STEM-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/HAS_STEM-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE-invalid-output-result.txt b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE-missing-output-result.txt b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE-wrong-path-result.txt b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_ABSOLUTE.cmake b/Tests/RunCMake/cmake_path/IS_ABSOLUTE.cmake
new file mode 100644
index 0000000..794e786
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_ABSOLUTE.cmake
@@ -0,0 +1,48 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+if (WIN32)
+ set (path "c:/a")
+else()
+ set (path "/a")
+endif()
+cmake_path(IS_ABSOLUTE path output)
+if (NOT output)
+ list (APPEND errors "'${path} is not absolute")
+endif()
+
+set (path "a/b")
+cmake_path(IS_ABSOLUTE path output)
+if (output)
+ list (APPEND errors "'${path} is absolute")
+endif()
+
+if (WIN32)
+ set (path "c:/a/b")
+ cmake_path(IS_ABSOLUTE path output)
+ if (NOT output)
+ list (APPEND errors "'${path} is not absolute")
+ endif()
+
+ set (path "//host/b")
+ cmake_path(IS_ABSOLUTE path output)
+ if (NOT output)
+ list (APPEND errors "'${path} is not absolute")
+ endif()
+
+ set (path "/a")
+ cmake_path(IS_ABSOLUTE path output)
+ if (output)
+ list (APPEND errors "'${path} is absolute")
+ endif()
+
+ set (path "c:a")
+ cmake_path(IS_ABSOLUTE path output)
+ if (output)
+ list (APPEND errors "'${path} is absolute")
+ endif()
+endif()
+
+
+check_errors (IS_ABSOLUTE ${errors})
diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX-invalid-output-result.txt b/Tests/RunCMake/cmake_path/IS_PREFIX-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_PREFIX-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX-missing-output-result.txt b/Tests/RunCMake/cmake_path/IS_PREFIX-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_PREFIX-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/IS_PREFIX-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_PREFIX-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX-wrong-path-result.txt b/Tests/RunCMake/cmake_path/IS_PREFIX-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_PREFIX-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_PREFIX.cmake b/Tests/RunCMake/cmake_path/IS_PREFIX.cmake
new file mode 100644
index 0000000..53da93b
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_PREFIX.cmake
@@ -0,0 +1,22 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "a///b/c")
+cmake_path(IS_PREFIX path "a/b/c/d" output)
+if (NOT output)
+ list (APPEND errors "'${path} is not prefix of 'a/b/c/d'")
+endif()
+
+set (path "a///b/c/../d")
+cmake_path(IS_PREFIX path "a/b/d/e" output)
+if (output)
+ list (APPEND errors "'${path} is prefix of 'a/b/d/e'")
+endif()
+cmake_path(IS_PREFIX path "a/b/d/e" NORMALIZE output)
+if (NOT output)
+ list (APPEND errors "'${path} is not prefix of 'a/b/d/e'")
+endif()
+
+
+check_errors (IS_PREFIX ${errors})
diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE-invalid-output-result.txt b/Tests/RunCMake/cmake_path/IS_RELATIVE-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_RELATIVE-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE-missing-output-result.txt b/Tests/RunCMake/cmake_path/IS_RELATIVE-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_RELATIVE-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/IS_RELATIVE-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_RELATIVE-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE-wrong-path-result.txt b/Tests/RunCMake/cmake_path/IS_RELATIVE-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_RELATIVE-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/IS_RELATIVE.cmake b/Tests/RunCMake/cmake_path/IS_RELATIVE.cmake
new file mode 100644
index 0000000..ad12253
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/IS_RELATIVE.cmake
@@ -0,0 +1,48 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+if (WIN32)
+ set (path "c:/a")
+else()
+ set (path "/a")
+endif()
+cmake_path(IS_RELATIVE path output)
+if (output)
+ list (APPEND errors "'${path} is relative")
+endif()
+
+set (path "a/b")
+cmake_path(IS_RELATIVE path output)
+if (NOT output)
+ list (APPEND errors "'${path} is not relative")
+endif()
+
+if (WIN32)
+ set (path "c:/a/b")
+ cmake_path(IS_RELATIVE path output)
+ if (output)
+ list (APPEND errors "'${path} is relative")
+ endif()
+
+ set (path "//host/b")
+ cmake_path(IS_RELATIVE path output)
+ if (output)
+ list (APPEND errors "'${path} is relative")
+ endif()
+
+ set (path "/a")
+ cmake_path(IS_RELATIVE path output)
+ if (NOT output)
+ list (APPEND errors "'${path} is not relative")
+ endif()
+
+ set (path "c:a")
+ cmake_path(IS_RELATIVE path output)
+ if (NOT output)
+ list (APPEND errors "'${path} is not relative")
+ endif()
+endif()
+
+
+check_errors (IS_RELATIVE ${errors})
diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-invalid-output-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-invalid-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-invalid-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-missing-output-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-missing-output-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-missing-output-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/NATIVE_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NATIVE_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/NATIVE_PATH.cmake b/Tests/RunCMake/cmake_path/NATIVE_PATH.cmake
new file mode 100644
index 0000000..066c44d
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NATIVE_PATH.cmake
@@ -0,0 +1,37 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+if (WIN32)
+ set (path "c:/a//b\\c/..\\d")
+ cmake_path(NATIVE_PATH path output)
+ if (NOT output STREQUAL "c:\\a\\\\b\\c\\..\\d")
+ list (APPEND errors "'${output}' instead of 'c:\\a\\\\b\\c\\..\\d'")
+ endif()
+ cmake_path(NATIVE_PATH path output NORMALIZE)
+ if (NOT output STREQUAL "c:\\a\\b\\d")
+ list (APPEND errors "'${output}' instead of 'c:\\a\\b\\d'")
+ endif()
+
+ set (path "//host/a//b\\c/..\\d")
+ cmake_path(NATIVE_PATH path output)
+ if (NOT output STREQUAL "\\\\host\\a\\\\b\\c\\..\\d")
+ list (APPEND errors "'${output}' instead of '\\\\host\\a\\\\b\\c\\..\\d'")
+ endif()
+ cmake_path(NATIVE_PATH path output NORMALIZE)
+ if (NOT output STREQUAL "\\\\host\\a\\b\\d")
+ list (APPEND errors "'${output}' instead of '\\\\host\\a\\b\\d'")
+ endif()
+else()
+ set (path "/a//b/c/../d")
+ cmake_path(NATIVE_PATH path output)
+ if (NOT output STREQUAL "/a//b/c/../d")
+ list (APPEND errors "'${output}' instead of '/a//b/c/../d'")
+ endif()
+ cmake_path(NATIVE_PATH path NORMALIZE output)
+ if (NOT output STREQUAL "/a/b/d")
+ list (APPEND errors "'${output}' instead of '/a/b/d'")
+ endif()
+endif()
+
+check_errors (NATIVE_PATH ${errors})
diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NORMAL_PATH-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/NORMAL_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NORMAL_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/NORMAL_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NORMAL_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH.cmake b/Tests/RunCMake/cmake_path/NORMAL_PATH.cmake
new file mode 100644
index 0000000..88db76a
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/NORMAL_PATH.cmake
@@ -0,0 +1,46 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "a/./b/..")
+cmake_path(NORMAL_PATH path)
+if (NOT path STREQUAL "a/")
+ list (APPEND errors "'${path}' instead of 'a/'")
+endif()
+
+set (path "a/.///b/../")
+cmake_path(NORMAL_PATH path)
+if (NOT path STREQUAL "a/")
+ list (APPEND errors "'${path}' instead of 'a/'")
+endif()
+
+set (path "a/.///b/../")
+cmake_path(NORMAL_PATH path OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "a/.///b/../")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "a/")
+ list (APPEND errors "'${output}' instead of 'a/'")
+endif()
+
+if (WIN32)
+ set (path "//host/./b/..")
+ cmake_path(NORMAL_PATH path)
+ if (NOT path STREQUAL "//host/")
+ list (APPEND errors "'${path}' instead of '//host/'")
+ endif()
+
+ set (path "//host/./b/../")
+ cmake_path(NORMAL_PATH path)
+ if (NOT path STREQUAL "//host/")
+ list (APPEND errors "'${path}' instead of '//host/'")
+ endif()
+
+ set (path "c://a/.///b/../")
+ cmake_path(NORMAL_PATH path)
+ if (NOT path STREQUAL "c:/a/")
+ list (APPEND errors "'${path}' instead of 'c:/a/'")
+ endif()
+endif()
+
+check_errors (NORMAL_PATH ${errors})
diff --git a/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt
new file mode 100644
index 0000000..e1d6592
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/OUTPUT_VARIABLE-no-arg-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\):
+ cmake_path OUTPUT_VARIABLE requires an argument.
diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/PROXIMATE_PATH.cmake b/Tests/RunCMake/cmake_path/PROXIMATE_PATH.cmake
new file mode 100644
index 0000000..ad23377
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/PROXIMATE_PATH.cmake
@@ -0,0 +1,41 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+if (WIN32)
+ set (path "c:/a/d")
+ cmake_path(PROXIMATE_PATH path BASE_DIRECTORY "e/d/c")
+ if (NOT path STREQUAL "c:/a/d")
+ list (APPEND errors "'${path}' instead of 'c:/a/d'")
+ endif()
+else()
+ set (path "/a/d")
+ cmake_path(PROXIMATE_PATH path BASE_DIRECTORY "e/d/c")
+ if (NOT path STREQUAL "/a/d")
+ list (APPEND errors "'${path}' instead of '/a/d'")
+ endif()
+endif()
+
+set (path "/a/d")
+cmake_path(PROXIMATE_PATH path BASE_DIRECTORY "/a/b/c" OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "/a/d")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "../../d")
+ list (APPEND errors "'${output}' instead of '../../d'")
+endif()
+
+set (path "${CMAKE_CURRENT_SOURCE_DIR}/a/d")
+cmake_path(PROXIMATE_PATH path)
+if (NOT path STREQUAL "a/d")
+ list (APPEND errors "'${path}' instead of 'a/d'")
+endif()
+
+set (path "a/b/c")
+cmake_path(PROXIMATE_PATH path)
+if (NOT path STREQUAL "a/b/c")
+ list (APPEND errors "'${path}' instead of 'a/b/c'")
+endif()
+
+
+check_errors (PROXIMATE_PATH ${errors})
diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/RELATIVE_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH-wrong-path-result.txt b/Tests/RunCMake/cmake_path/RELATIVE_PATH-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/RELATIVE_PATH.cmake b/Tests/RunCMake/cmake_path/RELATIVE_PATH.cmake
new file mode 100644
index 0000000..522a899
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/RELATIVE_PATH.cmake
@@ -0,0 +1,76 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "/a//d")
+cmake_path(RELATIVE_PATH path BASE_DIRECTORY "/a/b/c")
+if (NOT path STREQUAL "../../d")
+ list (APPEND errors "'${path}' instead of '../../d'")
+endif()
+
+set (path "/a//b///c")
+cmake_path(RELATIVE_PATH path BASE_DIRECTORY "/a/d")
+if (NOT path STREQUAL "../b/c")
+ list (APPEND errors "'${path}' instead of '../b/c'")
+endif()
+
+set (path "a/b/c")
+cmake_path(RELATIVE_PATH path BASE_DIRECTORY "a")
+if (NOT path STREQUAL "b/c")
+ list (APPEND errors "'${path}' instead of 'b/c'")
+endif()
+
+set (path "a/b/c")
+cmake_path(RELATIVE_PATH path BASE_DIRECTORY "a/b/c/x/y")
+if (NOT path STREQUAL "../..")
+ list (APPEND errors "'${path}' instead of '../..'")
+endif()
+
+set (path "a/b/c")
+cmake_path(RELATIVE_PATH path BASE_DIRECTORY "a/b/c")
+if (NOT path STREQUAL ".")
+ list (APPEND errors "'${path}' instead of '.'")
+endif()
+
+set (path "a/b")
+cmake_path(RELATIVE_PATH path BASE_DIRECTORY "c/d")
+if (NOT path STREQUAL "../../a/b")
+ list (APPEND errors "'${path}' instead of '../../a/b'")
+endif()
+
+set (path "${CMAKE_CURRENT_SOURCE_DIR}/../../b")
+cmake_path(RELATIVE_PATH path)
+if (NOT path STREQUAL "../../b")
+ list (APPEND errors "'${path}' instead of '../../b'")
+endif()
+
+set (path "${CMAKE_CURRENT_SOURCE_DIR}/../../b")
+cmake_path(RELATIVE_PATH path OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/../../b")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "../../b")
+ list (APPEND errors "'${output}' instead of '../../b'")
+endif()
+
+if (WIN32)
+ set (path "/a/d")
+ cmake_path(RELATIVE_PATH path BASE_DIRECTORY "e/d/c")
+ if (NOT path STREQUAL "/a/d")
+ list (APPEND errors "'${path}' instead of '/a/d'")
+ endif()
+
+ set (path "c:/a/d")
+ cmake_path(RELATIVE_PATH path BASE_DIRECTORY "e/d/c")
+ if (NOT path STREQUAL "")
+ list (APPEND errors "'${path}' instead of ''")
+ endif()
+elseif()
+ set (path "/a/d")
+ cmake_path(RELATIVE_PATH path BASE_DIRECTORY "e/d/c")
+ if (NOT path STREQUAL "")
+ list (APPEND errors "'${path}' instead of ''")
+ endif()
+endif()
+
+check_errors (RELATIVE_PATH ${errors})
diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-wrong-path-result.txt b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REMOVE_EXTENSION.cmake b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION.cmake
new file mode 100644
index 0000000..ac06fde
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_EXTENSION.cmake
@@ -0,0 +1,52 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "a/b/c.e.f")
+cmake_path (REMOVE_EXTENSION path)
+if (NOT path STREQUAL "a/b/c")
+ list (APPEND errors "'${path}' instead of 'a/b/c'")
+endif()
+
+set (path "a/b/c.e.f")
+cmake_path (REMOVE_EXTENSION path LAST_ONLY)
+if (NOT path STREQUAL "a/b/c.e")
+ list (APPEND errors "'${path}' instead of 'a/b/c.e'")
+endif()
+cmake_path (REMOVE_EXTENSION path)
+if (NOT path STREQUAL "a/b/c")
+ list (APPEND errors "'${path}' instead of 'a/b/c'")
+endif()
+
+set (path "a/b/c.e.f")
+cmake_path (REMOVE_EXTENSION path OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "a/b/c.e.f")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "a/b/c")
+ list (APPEND errors "'${output}' instead of 'a/b/'")
+endif()
+
+set (path "a/b/c")
+cmake_path (REMOVE_EXTENSION path)
+if (NOT path STREQUAL "a/b/c")
+ list (APPEND errors "'${path}' instead of 'a/b/c'")
+endif()
+
+set (path "a/b/.c")
+cmake_path (REMOVE_EXTENSION path)
+if (NOT path STREQUAL "a/b/.c")
+ list (APPEND errors "'${path}' instead of 'a/b/.c'")
+endif()
+cmake_path (REMOVE_EXTENSION path LAST_ONLY)
+if (NOT path STREQUAL "a/b/.c")
+ list (APPEND errors "'${path}' instead of 'a/b/.c'")
+endif()
+
+set (path "a/b/.")
+cmake_path (REMOVE_EXTENSION path LAST_ONLY)
+if (NOT path STREQUAL "a/b/.")
+ list (APPEND errors "'${path}' instead of 'a/b/.'")
+endif()
+
+check_errors (REMOVE_EXTENSION ${errors})
diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REMOVE_FILENAME.cmake b/Tests/RunCMake/cmake_path/REMOVE_FILENAME.cmake
new file mode 100644
index 0000000..385dcd0
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REMOVE_FILENAME.cmake
@@ -0,0 +1,25 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "a/b/c.e.f")
+cmake_path (REMOVE_FILENAME path)
+if (NOT path STREQUAL "a/b/")
+ list (APPEND errors "'${path}' instead of 'a/b/'")
+endif()
+
+cmake_path (REMOVE_FILENAME path)
+if (NOT path STREQUAL "a/b/")
+ list (APPEND errors "'${path}' instead of 'a/b/'")
+endif()
+
+set (path "a/b/c.e.f")
+cmake_path (REMOVE_FILENAME path OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "a/b/c.e.f")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "a/b/")
+ list (APPEND errors "'${output}' instead of 'a/b/'")
+endif()
+
+check_errors (REMOVE_FILENAME ${errors})
diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-wrong-path-result.txt b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REPLACE_EXTENSION.cmake b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION.cmake
new file mode 100644
index 0000000..45c1575
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_EXTENSION.cmake
@@ -0,0 +1,58 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "a/b/c.e.f")
+cmake_path (REPLACE_EXTENSION path ".x")
+if (NOT path STREQUAL "a/b/c.x")
+ list (APPEND errors "'${path}' instead of 'a/b/c.x'")
+endif()
+cmake_path (REPLACE_EXTENSION path ".y")
+if (NOT path STREQUAL "a/b/c.y")
+ list (APPEND errors "'${path}' instead of 'a/b/c.y'")
+endif()
+cmake_path (REPLACE_EXTENSION path "")
+if (NOT path STREQUAL "a/b/c")
+ list (APPEND errors "'${path}' instead of 'a/b/c'")
+endif()
+
+set (path "a/b/c.e.f")
+cmake_path (REPLACE_EXTENSION path ".x" LAST_ONLY)
+if (NOT path STREQUAL "a/b/c.e.x")
+ list (APPEND errors "'${path}' instead of 'a/b/c.e.x'")
+endif()
+cmake_path (REPLACE_EXTENSION path ".y" LAST_ONLY)
+if (NOT path STREQUAL "a/b/c.e.y")
+ list (APPEND errors "'${path}' instead of 'a/b/c.e.y'")
+endif()
+cmake_path (REPLACE_EXTENSION path "" LAST_ONLY)
+if (NOT path STREQUAL "a/b/c.e")
+ list (APPEND errors "'${path}' instead of 'a/b/c.e'")
+endif()
+
+set (path "/a/.b")
+cmake_path (REPLACE_EXTENSION path ".x")
+if (NOT path STREQUAL "/a/.b.x")
+ list (APPEND errors "'${path}' instead of '/a/.b.x'")
+endif()
+cmake_path (REPLACE_EXTENSION path ".x" LAST_ONLY)
+if (NOT path STREQUAL "/a/.b.x")
+ list (APPEND errors "'${path}' instead of '/a/.b.x'")
+endif()
+
+set (path "/a/b")
+cmake_path (REPLACE_EXTENSION path ".x")
+if (NOT path STREQUAL "/a/b.x")
+ list (APPEND errors "'${path}' instead of '/a/b.x'")
+endif()
+
+set (path "/a/b/")
+cmake_path (REPLACE_EXTENSION path ".x" OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "/a/b/")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "/a/b/.x")
+ list (APPEND errors "'${output}' instead of '/a/b/.x'")
+endif()
+
+check_errors (REPLACE_EXTENSION ${errors})
diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-invalid-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-OUTPUT_VARIABLE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME-unexpected-arg-result.txt b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME-wrong-path-result.txt b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-wrong-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME-wrong-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_path/REPLACE_FILENAME.cmake b/Tests/RunCMake/cmake_path/REPLACE_FILENAME.cmake
new file mode 100644
index 0000000..f7a9600
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/REPLACE_FILENAME.cmake
@@ -0,0 +1,26 @@
+
+include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
+unset (errors)
+
+set (path "a/b/c.e.f")
+cmake_path (REPLACE_FILENAME path "x.y")
+if (NOT path STREQUAL "a/b/x.y")
+ list (APPEND errors "'${path}' instead of 'a/b/x.y'")
+endif()
+
+set (path "a/b/")
+cmake_path (REPLACE_FILENAME path "x.y")
+if (NOT path STREQUAL "a/b/")
+ list (APPEND errors "'${path}' instead of 'a/b/'")
+endif()
+
+set (path "a/b/c.e.f")
+cmake_path (REPLACE_FILENAME path "" OUTPUT_VARIABLE output)
+if (NOT path STREQUAL "a/b/c.e.f")
+ list (APPEND errors "input changed unexpectedly")
+endif()
+if (NOT output STREQUAL "a/b/")
+ list (APPEND errors "'${output}' instead of 'a/b/'")
+endif()
+
+check_errors (REPLACE_FILENAME ${errors})
diff --git a/Tests/RunCMake/cmake_path/RunCMakeTest.cmake b/Tests/RunCMake/cmake_path/RunCMakeTest.cmake
new file mode 100644
index 0000000..ca9cba6
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/RunCMakeTest.cmake
@@ -0,0 +1,191 @@
+include(RunCMake)
+
+# Validate parsing arguments
+
+## input path is not a variable
+set (RunCMake-stderr-file "wrong-path-stderr.txt")
+
+### GET sub-command
+foreach (subcommand IN ITEMS ROOT_NAME ROOT_DIRECTORY ROOT_PATH FILENAME EXTENSION
+ STEM RELATIVE_PATH PARENT_PATH)
+ run_cmake_command (GET-${subcommand}-wrong-path "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=GET wrong_path ${subcommand} output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+### COMPARE sub-command
+foreach (subcommand IN ITEMS EQUAL NOT_EQUAL)
+ run_cmake_command (COMPARE-${subcommand}-wrong-path "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=COMPARE wrong_path ${subcommand} path2 output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+foreach (command IN ITEMS CONCAT REMOVE_FILENAME REPLACE_FILENAME
+ REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH
+ RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH)
+ run_cmake_command (${command}-wrong-path "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} wrong_path" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+foreach (command IN ITEMS NATIVE_PATH
+ HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH
+ HAS_FILENAME HAS_EXTENSION HAS_STEM
+ HAS_RELATIVE_PATH HAS_PARENT_PATH
+ IS_ABSOLUTE IS_RELATIVE IS_PREFIX HASH)
+ if (command STREQUAL "IS_PREFIX")
+ set (extra_args path2)
+ else()
+ unset (extra_args)
+ endif()
+ run_cmake_command (${command}-wrong-path "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} wrong_path ${extra_args} output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+
+## missing output parameter
+set (RunCMake-stderr-file "missing-output-stderr.txt")
+
+### GET sub-command
+foreach (subcommand IN ITEMS ROOT_NAME ROOT_DIRECTORY ROOT_PATH FILENAME EXTENSION
+ STEM RELATIVE_PATH PARENT_PATH)
+ run_cmake_command (GET-${subcommand}-missing-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=GET path ${subcommand}" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+### CONVERT sub-command
+foreach (subcommand IN ITEMS TO_CMAKE_PATH_LIST TO_NATIVE_PATH_LIST)
+ run_cmake_command (CONVERT-${subcommand}-missing-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=CONVERT path ${subcommand}" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+### COMPARE sub-command
+foreach (subcommand IN ITEMS EQUAL NOT_EQUAL)
+ run_cmake_command (COMPARE-${subcommand}-missing-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=COMPARE path ${subcommand} path2" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+foreach (command IN ITEMS CMAKE_PATH NATIVE_PATH
+ HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH
+ HAS_FILENAME HAS_EXTENSION HAS_STEM
+ HAS_RELATIVE_PATH HAS_PARENT_PATH
+ IS_ABSOLUTE IS_RELATIVE IS_PREFIX HASH)
+ if (command STREQUAL "IS_PREFIX")
+ set (extra_args path2)
+ else()
+ unset (extra_args)
+ endif()
+ run_cmake_command (${command}-missing-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args}" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+
+## OUTPUT_VARIABLE without argument
+set (RunCMake-stderr-file "OUTPUT_VARIABLE-no-arg-stderr.txt")
+
+foreach (command IN ITEMS APPEND CONCAT REMOVE_FILENAME REPLACE_FILENAME
+ REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH
+ RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH)
+ run_cmake_command (${command}-OUTPUT_VARIABLE-no-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path OUTPUT_VARIABLE" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+
+## Invalid output variable
+set (RunCMake-stderr-file "invalid-output-var-stderr.txt")
+
+### GET sub-command
+foreach (subcommand IN ITEMS ROOT_NAME ROOT_DIRECTORY ROOT_PATH FILENAME EXTENSION
+ STEM RELATIVE_PATH PARENT_PATH)
+ run_cmake_command (GET-${subcommand}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=GET path ${subcommand}" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+### CONVERT sub-command
+foreach (subcommand IN ITEMS TO_CMAKE_PATH_LIST TO_NATIVE_PATH_LIST)
+ run_cmake_command (CONVERT-${subcommand}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=CONVERT path ${subcommand}" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+### COMPARE sub-command
+foreach (subcommand IN ITEMS EQUAL NOT_EQUAL)
+ run_cmake_command (COMPARE-${subcommand}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=COMPARE path ${subcommand} path2" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+foreach (command IN ITEMS CMAKE_PATH NATIVE_PATH
+ HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH
+ HAS_FILENAME HAS_EXTENSION HAS_STEM
+ HAS_RELATIVE_PATH HAS_PARENT_PATH
+ IS_ABSOLUTE IS_RELATIVE IS_PREFIX HASH)
+ if (command STREQUAL "IS_PREFIX")
+ set (extra_args path2)
+ else()
+ unset (extra_args)
+ endif()
+ run_cmake_command (${command}-invalid-output "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args}" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+foreach (command IN ITEMS APPEND CONCAT REMOVE_FILENAME REPLACE_FILENAME
+ REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH
+ RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH)
+ run_cmake_command (${command}-OUTPUT_VARIABLE-invalid-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path OUTPUT_VARIABLE" -DCHECK_INVALID_OUTPUT=ON -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+
+## Unexpected arguments
+set (RunCMake-stderr-file "unexpected-arg-stderr.txt")
+
+### GET sub-command
+foreach (subcommand IN ITEMS ROOT_NAME ROOT_DIRECTORY ROOT_PATH FILENAME EXTENSION
+ STEM RELATIVE_PATH PARENT_PATH)
+ if (subcommand STREQUAL "EXTENSION" OR subcommand STREQUAL "STEM")
+ set (extra_args LAST_ONLY)
+ else()
+ unset (extra_args)
+ endif()
+ run_cmake_command (GET-${subcommand}-unexpected-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=GET path ${subcommand} ${extra_args} unexpected output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+### CONVERT sub-command
+foreach (subcommand IN ITEMS TO_CMAKE_PATH_LIST TO_NATIVE_PATH_LIST)
+ run_cmake_command (CONVERT-${subcommand}-unexpected-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=CONVERT path ${subcommand} output unexpected" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+foreach (command IN ITEMS REMOVE_FILENAME REPLACE_FILENAME
+ REMOVE_EXTENSION REPLACE_EXTENSION NORMAL_PATH
+ RELATIVE_PATH PROXIMATE_PATH ABSOLUTE_PATH)
+ if (command STREQUAL "REPLACE_FILENAME" OR command STREQUAL "REPLACE_EXTENSION")
+ set (extra_args input)
+ else()
+ unset (extra_args)
+ endif()
+ run_cmake_command (${command}-unexpected-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args} unexpected" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+
+foreach (command IN ITEMS CMAKE_PATH NATIVE_PATH
+ HAS_ROOT_NAME HAS_ROOT_DIRECTORY HAS_ROOT_PATH
+ HAS_FILENAME HAS_EXTENSION HAS_STEM
+ HAS_RELATIVE_PATH HAS_PARENT_PATH
+ IS_ABSOLUTE IS_RELATIVE IS_PREFIX
+ HASH)
+ if (command STREQUAL "IS_PREFIX")
+ set (extra_args input)
+ else()
+ unset (extra_args)
+ endif()
+ run_cmake_command (${command}-unexpected-arg "${CMAKE_COMMAND}" "-DCMAKE_PATH_ARGUMENTS=${command} path ${extra_args} unexpected output" -P "${RunCMake_SOURCE_DIR}/call-cmake_path.cmake")
+endforeach()
+unset (RunCMake-stderr-file)
+
+run_cmake(GET-wrong-operator)
+run_cmake(CONVERT-wrong-operator)
+run_cmake(COMPARE-wrong-operator)
+
+set (RunCMake_TEST_OPTIONS "-DRunCMake_SOURCE_DIR=${RunCMake_SOURCE_DIR}")
+
+run_cmake(GET)
+run_cmake(APPEND)
+run_cmake(CONCAT)
+run_cmake(REMOVE_FILENAME)
+run_cmake(REPLACE_FILENAME)
+run_cmake(REMOVE_EXTENSION)
+run_cmake(REPLACE_EXTENSION)
+run_cmake(NORMAL_PATH)
+run_cmake(RELATIVE_PATH)
+run_cmake(PROXIMATE_PATH)
+run_cmake(ABSOLUTE_PATH)
+run_cmake(CMAKE_PATH)
+run_cmake(NATIVE_PATH)
+run_cmake(CONVERT)
+run_cmake(COMPARE)
+run_cmake(HAS_ITEM)
+run_cmake(IS_ABSOLUTE)
+run_cmake(IS_RELATIVE)
+run_cmake(IS_PREFIX)
+run_cmake(HASH)
diff --git a/Tests/RunCMake/cmake_path/call-cmake_path.cmake b/Tests/RunCMake/cmake_path/call-cmake_path.cmake
new file mode 100644
index 0000000..70fd6f5
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/call-cmake_path.cmake
@@ -0,0 +1,19 @@
+
+cmake_minimum_required(VERSION 3.18...3.19)
+
+# define input variable
+set (path "")
+
+separate_arguments(CMAKE_PATH_ARGUMENTS UNIX_COMMAND "${CMAKE_PATH_ARGUMENTS}")
+
+if (CHECK_INVALID_OUTPUT)
+ # special handling for CMAKE_PATH
+ list(GET CMAKE_PATH_ARGUMENTS 0 command)
+ if (command STREQUAL "CMAKE_PATH")
+ cmake_path(CMAKE_PATH "" "input")
+ else()
+ cmake_path(${CMAKE_PATH_ARGUMENTS} "")
+ endif()
+else()
+ cmake_path(${CMAKE_PATH_ARGUMENTS})
+endif()
diff --git a/Tests/RunCMake/cmake_path/check_errors.cmake b/Tests/RunCMake/cmake_path/check_errors.cmake
new file mode 100644
index 0000000..d136971
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/check_errors.cmake
@@ -0,0 +1,12 @@
+
+function (CHECK_ERRORS command)
+ set (errors ${ARGN})
+ if (errors)
+ string (LENGTH "${command}" length)
+ math (EXPR count "${length} + 2")
+ string (REPEAT " " ${count} shift)
+ list (TRANSFORM errors PREPEND "${shift}")
+ list (JOIN errors "\n" msg)
+ message (FATAL_ERROR "${command}: ${msg}")
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/cmake_path/invalid-output-var-stderr.txt b/Tests/RunCMake/cmake_path/invalid-output-var-stderr.txt
new file mode 100644
index 0000000..32a8948
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/invalid-output-var-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at .+/call-cmake_path.cmake:[0-9]+ \(cmake_path\):
+ cmake_path Invalid name for output variable.
diff --git a/Tests/RunCMake/cmake_path/missing-output-stderr.txt b/Tests/RunCMake/cmake_path/missing-output-stderr.txt
new file mode 100644
index 0000000..8ac049b
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/missing-output-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\):
+ cmake_path [A-Z_]+ must be called with ((at least )?(two|three|four)|two or three|three or four) arguments.
diff --git a/Tests/RunCMake/cmake_path/unexpected-arg-stderr.txt b/Tests/RunCMake/cmake_path/unexpected-arg-stderr.txt
new file mode 100644
index 0000000..8f0e2f2
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/unexpected-arg-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\):
+ cmake_path [A-Z_]+ (called with unexpected|must be called with two) arguments.
diff --git a/Tests/RunCMake/cmake_path/wrong-path-stderr.txt b/Tests/RunCMake/cmake_path/wrong-path-stderr.txt
new file mode 100644
index 0000000..c42b5a2
--- /dev/null
+++ b/Tests/RunCMake/cmake_path/wrong-path-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at .+/cmake_path/call-cmake_path.cmake:[0-9]+ \(cmake_path\):
+ cmake_path undefined variable for input path.
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt
new file mode 100644
index 0000000..b22387b
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at CHMOD-all-perms\.cmake:[0-9]+ \(file\):
+ file Remove either PERMISSIONS or FILE_PERMISSIONS or DIRECTORY_PERMISSIONS
+ from the invocation
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake
new file mode 100644
index 0000000..b49583d
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-all-perms.cmake
@@ -0,0 +1,6 @@
+file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_READ
+ FILE_PERMISSIONS OWNER_READ DIRECTORY_PERMISSIONS OWNER_READ)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt
new file mode 100644
index 0000000..8d09e35
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at CHMOD-invalid-path\.cmake:[0-9]+ \(file\):
+ file does not exist:
+
+ .*/chmod-tests/I_dont_exist
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake
new file mode 100644
index 0000000..36915c1
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-path.cmake
@@ -0,0 +1,4 @@
+file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/I_dont_exist PERMISSIONS OWNER_READ)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt
new file mode 100644
index 0000000..84ba2a2
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at CHMOD-invalid-perms\.cmake:[0-9]+ \(file\):
+ file INVALID_PERMISSION is an invalid permission specifier
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake
new file mode 100644
index 0000000..22cab0b
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-invalid-perms.cmake
@@ -0,0 +1,5 @@
+file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS INVALID_PERMISSION)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt
new file mode 100644
index 0000000..2c248f8
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at CHMOD-no-keyword\.cmake:[0-9]+ \(file\):
+ file No permissions given
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake
new file mode 100644
index 0000000..8b62106
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-keyword.cmake
@@ -0,0 +1,5 @@
+file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt
new file mode 100644
index 0000000..a18609f
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at CHMOD-no-perms\.cmake:[0-9]+ \(file\):
+ file No permissions given
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake
new file mode 100644
index 0000000..9fbd359
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-no-perms.cmake
@@ -0,0 +1,5 @@
+file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake
new file mode 100644
index 0000000..87e3e57
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-ok.cmake
@@ -0,0 +1,5 @@
+file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_READ)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-override.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-override.cmake
new file mode 100644
index 0000000..d9226b8
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-override.cmake
@@ -0,0 +1,6 @@
+file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+
+file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a)
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_READ
+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt b/Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-write-only-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt b/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt
new file mode 100644
index 0000000..1c87a59
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-write-only-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at CHMOD-write-only\.cmake:[0-9]+ \(file\):
+ file failed to open for reading \(Permission denied\):
+
+ .*/chmod-tests/a
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake b/Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake
new file mode 100644
index 0000000..1289efc
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CHMOD-write-only.cmake
@@ -0,0 +1,6 @@
+file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests)
+
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a "CONTENT")
+file(CHMOD ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a PERMISSIONS OWNER_WRITE)
+file(READ ${CMAKE_CURRENT_BINARY_DIR}/chmod-tests/a content)
diff --git a/Tests/RunCMake/file-CHMOD/CMakeLists.txt b/Tests/RunCMake/file-CHMOD/CMakeLists.txt
new file mode 100644
index 0000000..2897109
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.0)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake b/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake
new file mode 100644
index 0000000..c7bff15
--- /dev/null
+++ b/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake
@@ -0,0 +1,19 @@
+include(RunCMake)
+
+run_cmake(CHMOD-no-perms)
+run_cmake(CHMOD-no-keyword)
+run_cmake(CHMOD-all-perms)
+run_cmake(CHMOD-invalid-perms)
+run_cmake(CHMOD-invalid-path)
+run_cmake(CHMOD-ok)
+run_cmake(CHMOD-override)
+
+if(UNIX)
+ execute_process(COMMAND id -u $ENV{USER}
+ OUTPUT_VARIABLE uid
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif()
+
+if(NOT WIN32 AND NOT "${uid}" STREQUAL "0")
+ run_cmake(CHMOD-write-only)
+endif()
diff --git a/Tests/RunCMake/file/REAL_PATH-no-base-dir-result.txt b/Tests/RunCMake/file/REAL_PATH-no-base-dir-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH-no-base-dir-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt b/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt
new file mode 100644
index 0000000..7c58aeb
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at REAL_PATH-no-base-dir.cmake:[0-9]+ \(file\):
+ file BASE_DIRECTORY requires a value
diff --git a/Tests/RunCMake/file/REAL_PATH-no-base-dir.cmake b/Tests/RunCMake/file/REAL_PATH-no-base-dir.cmake
new file mode 100644
index 0000000..132aee6
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH-no-base-dir.cmake
@@ -0,0 +1,2 @@
+
+file(REAL_PATH "some-path" real_path BASE_DIRECTORY)
diff --git a/Tests/RunCMake/file/REAL_PATH-unexpected-arg-result.txt b/Tests/RunCMake/file/REAL_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/REAL_PATH-unexpected-arg-stderr.txt b/Tests/RunCMake/file/REAL_PATH-unexpected-arg-stderr.txt
new file mode 100644
index 0000000..301db75
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH-unexpected-arg-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at REAL_PATH-unexpected-arg.cmake:[0-9]+ \(file\):
+ file REAL_PATH called with unexpected arguments
diff --git a/Tests/RunCMake/file/REAL_PATH-unexpected-arg.cmake b/Tests/RunCMake/file/REAL_PATH-unexpected-arg.cmake
new file mode 100644
index 0000000..144f30b
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH-unexpected-arg.cmake
@@ -0,0 +1,2 @@
+
+file(REAL_PATH "some-path" real_path extra_arg)
diff --git a/Tests/RunCMake/file/REAL_PATH.cmake b/Tests/RunCMake/file/REAL_PATH.cmake
new file mode 100644
index 0000000..be25706
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH.cmake
@@ -0,0 +1,14 @@
+
+file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/test.txt")
+file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/test.sym")
+file(CREATE_LINK "test.txt" "${CMAKE_CURRENT_BINARY_DIR}/test.sym" SYMBOLIC)
+
+file(REAL_PATH "${CMAKE_CURRENT_BINARY_DIR}/test.sym" real_path)
+if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/test.txt")
+ message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/test.txt\"")
+endif()
+
+file(REAL_PATH "test.sym" real_path BASE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
+if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/test.txt")
+ message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/test.txt\"")
+endif()
diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake
index 8d84943..22813eb 100644
--- a/Tests/RunCMake/file/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file/RunCMakeTest.cmake
@@ -72,6 +72,9 @@ if(NOT WIN32 OR CYGWIN)
run_cmake(READ_SYMLINK-noexist)
run_cmake(READ_SYMLINK-notsymlink)
run_cmake(INSTALL-FOLLOW_SYMLINK_CHAIN)
+ run_cmake(REAL_PATH-unexpected-arg)
+ run_cmake(REAL_PATH-no-base-dir)
+ run_cmake(REAL_PATH)
endif()
if(RunCMake_GENERATOR MATCHES "Ninja")
diff --git a/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake
new file mode 100644
index 0000000..8750a76
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake
@@ -0,0 +1,11 @@
+
+set(objs obj1 obj2)
+set(targets sse2 sse4 avx avx2)
+foreach(o IN LISTS objs)
+ set(item "objs/${o}\\.ispc\\.(o|obj)")
+ check_installed("${item}")
+ foreach(t IN LISTS targets)
+ set(item "objs/${o}\\.ispc_${t}\\.(o|obj)")
+ check_installed("${item}")
+ endforeach()
+endforeach()
diff --git a/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake
new file mode 100644
index 0000000..ad542ed
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake
@@ -0,0 +1,4 @@
+enable_language(ISPC)
+add_library(objs OBJECT obj1.ispc obj2.ispc)
+set_target_properties(objs PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4")
+install(FILES $<TARGET_OBJECTS:objs> DESTINATION objs)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index d83a07c..3573fbd 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -96,6 +96,11 @@ if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES}
run_install_test(FILES-TARGET_OBJECTS)
endif()
+if(CMake_TEST_ISPC)
+ run_install_test(FILES-EXTRA_ISPC_TARGET_OBJECTS)
+endif()
+
+
run_install_test(TARGETS-InstallFromSubDir)
run_install_test(TARGETS-OPTIONAL)
run_install_test(FILES-OPTIONAL)
diff --git a/Tests/RunCMake/install/obj1.ispc b/Tests/RunCMake/install/obj1.ispc
new file mode 100644
index 0000000..0dc983c
--- /dev/null
+++ b/Tests/RunCMake/install/obj1.ispc
@@ -0,0 +1,4 @@
+
+float func1(float a, float b) {
+ return a + b / 2.;
+}
diff --git a/Tests/RunCMake/install/obj2.ispc b/Tests/RunCMake/install/obj2.ispc
new file mode 100644
index 0000000..7b2aeb9
--- /dev/null
+++ b/Tests/RunCMake/install/obj2.ispc
@@ -0,0 +1,4 @@
+
+float func2(float a, float b) {
+ return a + b / 2.;
+}
diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTarget-stderr.txt b/Tests/RunCMake/try_compile/ISPCDuplicateTarget-stderr.txt
new file mode 100644
index 0000000..7dcb1de
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCDuplicateTarget-stderr.txt
@@ -0,0 +1 @@
+.*Error: Can't compile to multiple variants of avx512skx target!.*
diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake b/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake
new file mode 100644
index 0000000..6d29069
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake
@@ -0,0 +1,8 @@
+enable_language(ISPC)
+set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16
+ avx512skx-i32x16)
+try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
+ OUTPUT_VARIABLE out
+ )
+message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-result.txt b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-stderr.txt b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-stderr.txt
new file mode 100644
index 0000000..99248bf
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-stderr.txt
@@ -0,0 +1 @@
+.*ninja: error: .* multiple rules generate.*src.ispc_avx512skx.o.*
diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake
new file mode 100644
index 0000000..7f59c14
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake
@@ -0,0 +1,11 @@
+enable_language(ISPC)
+set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16
+ avx512skx-i32x16)
+try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
+ OUTPUT_VARIABLE out
+ )
+message("try_compile output:\n${out}")
+if(NOT result)
+ message(FATAL_ERROR "making Ninja and Ninja Multi-Config behave the same")
+endif()
diff --git a/Tests/RunCMake/try_compile/ISPCInvalidTarget-stderr.txt b/Tests/RunCMake/try_compile/ISPCInvalidTarget-stderr.txt
new file mode 100644
index 0000000..44543ad
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCInvalidTarget-stderr.txt
@@ -0,0 +1 @@
+.*Error: Incorrect targets: avxknl-i32x16.*
diff --git a/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake b/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake
new file mode 100644
index 0000000..c1ab6f2
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake
@@ -0,0 +1,7 @@
+enable_language(ISPC)
+set(CMAKE_ISPC_INSTRUCTION_SETS "avxknl-i32x16")
+try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
+ OUTPUT_VARIABLE out
+ )
+message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt b/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt
new file mode 100644
index 0000000..72e0a01
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt
@@ -0,0 +1 @@
+.*Linking ISPC static library*
diff --git a/Tests/RunCMake/try_compile/ISPCTargets-stdout.txt b/Tests/RunCMake/try_compile/ISPCTargets-stdout.txt
new file mode 100644
index 0000000..a731d52
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCTargets-stdout.txt
@@ -0,0 +1 @@
+.*Detecting ISPC compiler ABI info - done.*
diff --git a/Tests/RunCMake/try_compile/ISPCTargets.cmake b/Tests/RunCMake/try_compile/ISPCTargets.cmake
new file mode 100644
index 0000000..0d3bd43
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ISPCTargets.cmake
@@ -0,0 +1,7 @@
+enable_language(ISPC)
+set(CMAKE_ISPC_INSTRUCTION_SETS avx512knl-i32x16 avx512skx-i32x16)
+try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
+ OUTPUT_VARIABLE out
+ )
+message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index 82c55cc..5b849bf 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -51,6 +51,15 @@ endif()
if(CMake_TEST_CUDA)
run_cmake(CudaStandard)
endif()
+if(CMake_TEST_ISPC)
+ run_cmake(ISPCTargets)
+ run_cmake(ISPCInvalidTarget)
+ set(ninja "")
+ if(RunCMake_GENERATOR MATCHES "Ninja")
+ set(ninja "Ninja")
+ endif()
+ run_cmake(ISPCDuplicateTarget${ninja})
+endif()
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
run_cmake(CStandardGNU)
endif()
diff --git a/Tests/RunCMake/try_compile/src.ispc b/Tests/RunCMake/try_compile/src.ispc
new file mode 100644
index 0000000..b061f40
--- /dev/null
+++ b/Tests/RunCMake/try_compile/src.ispc
@@ -0,0 +1,4 @@
+
+float func(float a, float b) {
+ return a + b / 2.;
+}
diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt
index 7046fab..aee3338 100644
--- a/Tests/UseSWIG/CMakeLists.txt
+++ b/Tests/UseSWIG/CMakeLists.txt
@@ -101,6 +101,15 @@ add_test(NAME UseSWIG.MultiplePython COMMAND
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+add_test(NAME UseSWIG.MultipleFiles COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/UseSWIG/MultipleFiles"
+ "${CMake_BINARY_DIR}/Tests/UseSWIG/MultipleFiles"
+ ${build_generator_args}
+ --build-project TestMultipleFiles
+ --build-options ${build_options}
+ )
add_test(NAME UseSWIG.ModuleVersion2 COMMAND
diff --git a/Tests/UseSWIG/MultipleFiles/CMakeLists.txt b/Tests/UseSWIG/MultipleFiles/CMakeLists.txt
new file mode 100644
index 0000000..bf3d946
--- /dev/null
+++ b/Tests/UseSWIG/MultipleFiles/CMakeLists.txt
@@ -0,0 +1,30 @@
+cmake_minimum_required(VERSION 3.18)
+
+project(TestMultipleFiles CXX)
+
+find_package(SWIG REQUIRED)
+include(UseSWIG)
+
+unset(SWIG_LANG_TYPE)
+unset(SWIG_LANG_INCLUDE_DIRECTORIES)
+unset(SWIG_LANG_DEFINITIONS)
+unset(SWIG_LANG_OPTIONS)
+unset(SWIG_LANG_LIBRARIES)
+
+find_package(Python3 REQUIRED COMPONENTS Development)
+
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/add.i" PROPERTY CPLUSPLUS ON)
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/sub.i" PROPERTY CPLUSPLUS ON)
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/add.i" PROPERTY SWIG_MODULE_NAME _add)
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/sub.i" PROPERTY SWIG_MODULE_NAME _sub)
+
+
+swig_add_library(example
+ LANGUAGE python
+ TYPE MODULE
+ SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/add.i"
+ "${CMAKE_CURRENT_SOURCE_DIR}/sub.i"
+ "${CMAKE_CURRENT_SOURCE_DIR}/add.cxx"
+ "${CMAKE_CURRENT_SOURCE_DIR}/sub.cxx")
+target_include_directories(example PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
+target_link_libraries(example PRIVATE Python3::Module)
diff --git a/Tests/UseSWIG/MultipleFiles/add.cxx b/Tests/UseSWIG/MultipleFiles/add.cxx
new file mode 100644
index 0000000..a4dcca3
--- /dev/null
+++ b/Tests/UseSWIG/MultipleFiles/add.cxx
@@ -0,0 +1,6 @@
+#include "add.h"
+
+int add(int a, int b)
+{
+ return a + b;
+}
diff --git a/Tests/UseSWIG/MultipleFiles/add.h b/Tests/UseSWIG/MultipleFiles/add.h
new file mode 100644
index 0000000..6295ab9
--- /dev/null
+++ b/Tests/UseSWIG/MultipleFiles/add.h
@@ -0,0 +1 @@
+int add(int a, int b);
diff --git a/Tests/UseSWIG/MultipleFiles/add.i b/Tests/UseSWIG/MultipleFiles/add.i
new file mode 100644
index 0000000..2046397
--- /dev/null
+++ b/Tests/UseSWIG/MultipleFiles/add.i
@@ -0,0 +1,4 @@
+%{
+#include "add.h"
+%}
+%include "add.h"
diff --git a/Tests/UseSWIG/MultipleFiles/sub.cxx b/Tests/UseSWIG/MultipleFiles/sub.cxx
new file mode 100644
index 0000000..d6874ef
--- /dev/null
+++ b/Tests/UseSWIG/MultipleFiles/sub.cxx
@@ -0,0 +1,6 @@
+#include "sub.h"
+
+int sub(int a, int b)
+{
+ return a - b;
+}
diff --git a/Tests/UseSWIG/MultipleFiles/sub.h b/Tests/UseSWIG/MultipleFiles/sub.h
new file mode 100644
index 0000000..de77111
--- /dev/null
+++ b/Tests/UseSWIG/MultipleFiles/sub.h
@@ -0,0 +1 @@
+int sub(int a, int b);
diff --git a/Tests/UseSWIG/MultipleFiles/sub.i b/Tests/UseSWIG/MultipleFiles/sub.i
new file mode 100644
index 0000000..fc70f10
--- /dev/null
+++ b/Tests/UseSWIG/MultipleFiles/sub.i
@@ -0,0 +1,5 @@
+%{
+#include "sub.h"
+%}
+
+%include "sub.h"
diff --git a/Tests/XCTest/CMakeLists.txt b/Tests/XCTest/CMakeLists.txt
index d0b07ea..a070651 100644
--- a/Tests/XCTest/CMakeLists.txt
+++ b/Tests/XCTest/CMakeLists.txt
@@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.1)
project(XCTest C)
enable_testing()
+set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
+set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
+set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
+
find_package(XCTest REQUIRED)
# Framework
diff --git a/Utilities/cm3p/Setup.Configuration.h b/Utilities/cm3p/Setup.Configuration.h
index a5cf058..9f4190e 100644
--- a/Utilities/cm3p/Setup.Configuration.h
+++ b/Utilities/cm3p/Setup.Configuration.h
@@ -1,8 +1,5 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm3p_Setup_Configuration_h
-#define cm3p_Setup_Configuration_h
+#pragma once
#include <cmvssetup/Setup.Configuration.h> // IWYU pragma: export
-
-#endif
diff --git a/Utilities/cm3p/archive.h b/Utilities/cm3p/archive.h
index 956b3ab..a775400 100644
--- a/Utilities/cm3p/archive.h
+++ b/Utilities/cm3p/archive.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm3p_archive_h
-#define cm3p_archive_h
+#pragma once
/* Use the libarchive configured for CMake. */
#include "cmThirdParty.h"
@@ -10,5 +9,3 @@
#else
# include <cmlibarchive/libarchive/archive.h> // IWYU pragma: export
#endif
-
-#endif
diff --git a/Utilities/cm3p/archive_entry.h b/Utilities/cm3p/archive_entry.h
index 230e87a..0f8376c 100644
--- a/Utilities/cm3p/archive_entry.h
+++ b/Utilities/cm3p/archive_entry.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm3p_archive_entry_h
-#define cm3p_archive_entry_h
+#pragma once
/* Use the libarchive configured for CMake. */
#include "cmThirdParty.h"
@@ -10,5 +9,3 @@
#else
# include <cmlibarchive/libarchive/archive_entry.h> // IWYU pragma: export
#endif
-
-#endif
diff --git a/Utilities/cm3p/bzlib.h b/Utilities/cm3p/bzlib.h
index 2a0f4dd..c0eef03 100644
--- a/Utilities/cm3p/bzlib.h
+++ b/Utilities/cm3p/bzlib.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm3p_bzlib_h
-#define cm3p_bzlib_h
+#pragma once
/* Use the bzip2 library configured for CMake. */
#include "cmThirdParty.h"
@@ -10,5 +9,3 @@
#else
# include <cmbzip2/bzlib.h> // IWYU pragma: export
#endif
-
-#endif
diff --git a/Utilities/cm3p/curl/curl.h b/Utilities/cm3p/curl/curl.h
index 6e2b822..272db8d 100644
--- a/Utilities/cm3p/curl/curl.h
+++ b/Utilities/cm3p/curl/curl.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm3p_curl_curl_h
-#define cm3p_curl_curl_h
+#pragma once
/* Use the curl library configured for CMake. */
#include "cmThirdParty.h"
@@ -10,5 +9,3 @@
#else
# include <cmcurl/include/curl/curl.h> // IWYU pragma: export
#endif
-
-#endif
diff --git a/Utilities/cm3p/expat.h b/Utilities/cm3p/expat.h
index 32e6fd0..bcf6195 100644
--- a/Utilities/cm3p/expat.h
+++ b/Utilities/cm3p/expat.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm3p_expat_h
-#define cm3p_expat_h
+#pragma once
/* Use the expat library configured for CMake. */
#include "cmThirdParty.h"
@@ -10,5 +9,3 @@
#else
# include <cmexpat/lib/expat.h> // IWYU pragma: export
#endif
-
-#endif
diff --git a/Utilities/cm3p/json/reader.h b/Utilities/cm3p/json/reader.h
index 0df09ee..9fa8d2d 100644
--- a/Utilities/cm3p/json/reader.h
+++ b/Utilities/cm3p/json/reader.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm3p_json_reader_h
-#define cm3p_json_reader_h
+#pragma once
/* Use the jsoncpp library configured for CMake. */
#include "cmThirdParty.h"
@@ -10,5 +9,3 @@
#else
# include <cmjsoncpp/include/json/reader.h> // IWYU pragma: export
#endif
-
-#endif
diff --git a/Utilities/cm3p/json/value.h b/Utilities/cm3p/json/value.h
index f59bed6..fc3b5f4 100644
--- a/Utilities/cm3p/json/value.h
+++ b/Utilities/cm3p/json/value.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm3p_json_value_h
-#define cm3p_json_value_h
+#pragma once
/* Use the jsoncpp library configured for CMake. */
#include "cmThirdParty.h"
@@ -10,5 +9,3 @@
#else
# include <cmjsoncpp/include/json/value.h> // IWYU pragma: export
#endif
-
-#endif
diff --git a/Utilities/cm3p/json/writer.h b/Utilities/cm3p/json/writer.h
index 7fcc3e2..7ee1e43 100644
--- a/Utilities/cm3p/json/writer.h
+++ b/Utilities/cm3p/json/writer.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm3p_json_writer_h
-#define cm3p_json_writer_h
+#pragma once
/* Use the jsoncpp library configured for CMake. */
#include "cmThirdParty.h"
@@ -10,5 +9,3 @@
#else
# include <cmjsoncpp/include/json/writer.h> // IWYU pragma: export
#endif
-
-#endif
diff --git a/Utilities/cm3p/kwiml/abi.h b/Utilities/cm3p/kwiml/abi.h
index 6d0dedf..8d5189a 100644
--- a/Utilities/cm3p/kwiml/abi.h
+++ b/Utilities/cm3p/kwiml/abi.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm3p_kwiml_abi_h
-#define cm3p_kwiml_abi_h
+#pragma once
/* Use the KWIML library configured for CMake. */
#include "cmThirdParty.h"
@@ -10,5 +9,3 @@
#else
# include <KWIML/include/kwiml/abi.h> // IWYU pragma: export
#endif
-
-#endif
diff --git a/Utilities/cm3p/kwiml/int.h b/Utilities/cm3p/kwiml/int.h
index 4c7c23d..2669df8 100644
--- a/Utilities/cm3p/kwiml/int.h
+++ b/Utilities/cm3p/kwiml/int.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm3p_kwiml_int_h
-#define cm3p_kwiml_int_h
+#pragma once
/* Use the KWIML library configured for CMake. */
#include "cmThirdParty.h"
@@ -10,5 +9,3 @@
#else
# include <KWIML/include/kwiml/int.h> // IWYU pragma: export
#endif
-
-#endif
diff --git a/Utilities/cm3p/lzma.h b/Utilities/cm3p/lzma.h
index abfacf3..7842f6b 100644
--- a/Utilities/cm3p/lzma.h
+++ b/Utilities/cm3p/lzma.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm3p_lzma_h
-#define cm3p_lzma_h
+#pragma once
/* Use the liblzma configured for CMake. */
#include "cmThirdParty.h"
@@ -10,5 +9,3 @@
#else
# include <cmliblzma/liblzma/api/lzma.h> // IWYU pragma: export
#endif
-
-#endif
diff --git a/Utilities/cm3p/rhash.h b/Utilities/cm3p/rhash.h
index 9d5e411..5828557 100644
--- a/Utilities/cm3p/rhash.h
+++ b/Utilities/cm3p/rhash.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm3p_rhash_h
-#define cm3p_rhash_h
+#pragma once
/* Use the LibRHash library configured for CMake. */
#include "cmThirdParty.h"
@@ -10,5 +9,3 @@
#else
# include <cmlibrhash/librhash/rhash.h> // IWYU pragma: export
#endif
-
-#endif
diff --git a/Utilities/cm3p/uv.h b/Utilities/cm3p/uv.h
index 307a09f..36a86b6 100644
--- a/Utilities/cm3p/uv.h
+++ b/Utilities/cm3p/uv.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm3p_uv_h
-#define cm3p_uv_h
+#pragma once
/* Use the libuv library configured for CMake. */
#include "cmThirdParty.h"
@@ -10,5 +9,3 @@
#else
# include <cmlibuv/include/uv.h> // IWYU pragma: export
#endif
-
-#endif
diff --git a/Utilities/cm3p/zlib.h b/Utilities/cm3p/zlib.h
index fe7baee..6b82aa2 100644
--- a/Utilities/cm3p/zlib.h
+++ b/Utilities/cm3p/zlib.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm3p_zlib_h
-#define cm3p_zlib_h
+#pragma once
/* Use the zlib library configured for CMake. */
#include "cmThirdParty.h"
@@ -10,5 +9,3 @@
#else
# include <cmzlib/zlib.h> // IWYU pragma: export
#endif
-
-#endif
diff --git a/Utilities/cm3p/zstd.h b/Utilities/cm3p/zstd.h
index 07cc3e4..51972de 100644
--- a/Utilities/cm3p/zstd.h
+++ b/Utilities/cm3p/zstd.h
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm3p_zstd_h
-#define cm3p_zstd_h
+#pragma once
/* Use the libzstd configured for CMake. */
#include "cmThirdParty.h"
@@ -10,5 +9,3 @@
#else
# include <cmzstd/lib/zstd.h> // IWYU pragma: export
#endif
-
-#endif
diff --git a/Utilities/cmThirdParty.h.in b/Utilities/cmThirdParty.h.in
index 1456e34..bd0edb7 100644
--- a/Utilities/cmThirdParty.h.in
+++ b/Utilities/cmThirdParty.h.in
@@ -1,7 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmThirdParty_h
-#define cmThirdParty_h
+#pragma once
/* Whether CMake is using its own utility libraries. */
#cmakedefine CMAKE_USE_SYSTEM_CURL
@@ -16,5 +15,3 @@
#cmakedefine CMAKE_USE_SYSTEM_LIBRHASH
#cmakedefine CMAKE_USE_SYSTEM_LIBUV
#cmakedefine CMAKE_USE_SYSTEM_ZSTD
-
-#endif
diff --git a/Utilities/std/cm/algorithm b/Utilities/std/cm/algorithm
index 8ade99c..93fe224 100644
--- a/Utilities/std/cm/algorithm
+++ b/Utilities/std/cm/algorithm
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_algorithm
-#define cm_algorithm
+#pragma once
#include <algorithm> // IWYU pragma: export
#include <cassert>
@@ -34,5 +33,3 @@ T const& clamp(T const& v, T const& lo, T const& hi, Comp comp)
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/bits/erase_if.hxx b/Utilities/std/cm/bits/erase_if.hxx
index 8952fb5..354b0c2 100644
--- a/Utilities/std/cm/bits/erase_if.hxx
+++ b/Utilities/std/cm/bits/erase_if.hxx
@@ -4,8 +4,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_bits_erase_if_hxx
-#define cm_bits_erase_if_hxx
+#pragma once
namespace cm {
namespace internals {
@@ -25,5 +24,3 @@ void erase_if(Container& cont, Predicate pred)
} // namespace internals
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/bits/fs_path.cxx b/Utilities/std/cm/bits/fs_path.cxx
index 8089998..1f52878 100644
--- a/Utilities/std/cm/bits/fs_path.cxx
+++ b/Utilities/std/cm/bits/fs_path.cxx
@@ -847,7 +847,7 @@ cm::string_view path::get_filename_fragment(filename_fragment fragment) const
{
auto file = this->get_filename();
- if (file == "." || file == ".." || file.empty()) {
+ if (file.empty() || file == "." || file == "..") {
return fragment == filename_fragment::stem ? file : cm::string_view{};
}
diff --git a/Utilities/std/cm/deque b/Utilities/std/cm/deque
index 4bb6725..b7b6959 100644
--- a/Utilities/std/cm/deque
+++ b/Utilities/std/cm/deque
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_deque
-#define cm_deque
+#pragma once
#include <algorithm>
#include <deque> // IWYU pragma: export
@@ -36,5 +35,3 @@ inline void erase_if(std::deque<T, Allocator>& cont, Predicate pred)
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/filesystem b/Utilities/std/cm/filesystem
index 6021712..6cbdea9 100644
--- a/Utilities/std/cm/filesystem
+++ b/Utilities/std/cm/filesystem
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_filesystem
-#define cm_filesystem
+#pragma once
#include "cmSTL.hxx" // IWYU pragma: keep
@@ -1151,6 +1150,8 @@ inline path::iterator path::end() const
return iterator(this, true);
}
+// Non-member functions
+// ====================
bool operator==(const path::iterator& lhs, const path::iterator& rhs);
inline bool operator!=(const path::iterator& lhs, const path::iterator& rhs)
@@ -1158,8 +1159,6 @@ inline bool operator!=(const path::iterator& lhs, const path::iterator& rhs)
return !(lhs == rhs);
}
-// Non-member functions
-// ====================
inline void swap(path& lhs, path& rhs) noexcept
{
lhs.swap(rhs);
@@ -1171,5 +1170,3 @@ std::size_t hash_value(const path& p) noexcept;
} // namespace filesystem
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/iomanip b/Utilities/std/cm/iomanip
index 6f68530..602b912 100644
--- a/Utilities/std/cm/iomanip
+++ b/Utilities/std/cm/iomanip
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_iomanip
-#define cm_iomanip
+#pragma once
#include <iomanip> // IWYU pragma: export
#if __cplusplus < 201402L || defined(_MSVC_LANG) && _MSVC_LANG < 201402L
@@ -179,5 +178,3 @@ inline internals::quoted_string<cm::string_view, char> quoted(
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/iterator b/Utilities/std/cm/iterator
index 718f1d6..3b38cc7 100644
--- a/Utilities/std/cm/iterator
+++ b/Utilities/std/cm/iterator
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_iterator
-#define cm_iterator
+#pragma once
#include <iterator> // IWYU pragma: export
@@ -212,5 +211,3 @@ constexpr T* data(T (&arr)[N]) noexcept
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/list b/Utilities/std/cm/list
index ba5d94a..380bff8 100644
--- a/Utilities/std/cm/list
+++ b/Utilities/std/cm/list
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_list
-#define cm_list
+#pragma once
#include <list> // IWYU pragma: export
@@ -35,5 +34,3 @@ inline void erase_if(std::list<T, Allocator>& cont, Predicate pred)
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/map b/Utilities/std/cm/map
index e348dec..1794cd7 100644
--- a/Utilities/std/cm/map
+++ b/Utilities/std/cm/map
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_map
-#define cm_map
+#pragma once
#include <map> // IWYU pragma: export
@@ -40,5 +39,3 @@ inline void erase_if(std::multimap<Key, T, Compare, Allocator>& cont,
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/memory b/Utilities/std/cm/memory
index 5611f6b..005e6e2 100644
--- a/Utilities/std/cm/memory
+++ b/Utilities/std/cm/memory
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_memory
-#define cm_memory
+#pragma once
#include "cmSTL.hxx" // IWYU pragma: keep
@@ -66,5 +65,3 @@ typename internals::make_unique_if<T>::bound_array make_unique(Args&&...) =
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/optional b/Utilities/std/cm/optional
index 80b0951..9a5d840 100644
--- a/Utilities/std/cm/optional
+++ b/Utilities/std/cm/optional
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_optional
-#define cm_optional
+#pragma once
#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
# define CMake_HAVE_CXX_OPTIONAL
@@ -219,6 +218,210 @@ optional<T>& optional<T>::operator=(U&& v)
return *this;
}
+template <typename T, typename U>
+bool operator==(const optional<T>& lhs, const optional<U>& rhs)
+{
+ if (lhs.has_value()) {
+ return rhs.has_value() && *lhs == *rhs;
+ }
+ return !rhs.has_value();
+}
+
+template <typename T, typename U>
+bool operator!=(const optional<T>& lhs, const optional<U>& rhs)
+{
+ if (lhs.has_value()) {
+ return !rhs.has_value() || *lhs != *rhs;
+ }
+ return rhs.has_value();
+}
+
+template <typename T, typename U>
+bool operator<(const optional<T>& lhs, const optional<U>& rhs)
+{
+ if (rhs.has_value()) {
+ return !lhs.has_value() || *lhs < *rhs;
+ }
+ return false;
+}
+
+template <typename T, typename U>
+bool operator<=(const optional<T>& lhs, const optional<U>& rhs)
+{
+ if (!lhs.has_value()) {
+ return true;
+ }
+ if (rhs.has_value()) {
+ return *lhs <= *rhs;
+ }
+ return false;
+}
+
+template <typename T, typename U>
+bool operator>(const optional<T>& lhs, const optional<U>& rhs)
+{
+ if (lhs.has_value()) {
+ return !rhs.has_value() || *lhs > *rhs;
+ }
+ return false;
+}
+
+template <typename T, typename U>
+bool operator>=(const optional<T>& lhs, const optional<U>& rhs)
+{
+ if (!rhs.has_value()) {
+ return true;
+ }
+ if (lhs.has_value()) {
+ return *lhs >= *rhs;
+ }
+ return false;
+}
+
+template <typename T>
+bool operator==(const optional<T>& opt, nullopt_t) noexcept
+{
+ return !opt.has_value();
+}
+
+template <typename T>
+bool operator!=(const optional<T>& opt, nullopt_t) noexcept
+{
+ return opt.has_value();
+}
+
+template <typename T>
+bool operator<(const optional<T>& opt, nullopt_t) noexcept
+{
+ return false;
+}
+
+template <typename T>
+bool operator<=(const optional<T>& opt, nullopt_t) noexcept
+{
+ return !opt.has_value();
+}
+
+template <typename T>
+bool operator>(const optional<T>& opt, nullopt_t) noexcept
+{
+ return opt.has_value();
+}
+
+template <typename T>
+bool operator>=(const optional<T>& opt, nullopt_t) noexcept
+{
+ return true;
+}
+
+template <typename T>
+bool operator==(nullopt_t, const optional<T>& opt) noexcept
+{
+ return !opt.has_value();
+}
+
+template <typename T>
+bool operator!=(nullopt_t, const optional<T>& opt) noexcept
+{
+ return opt.has_value();
+}
+
+template <typename T>
+bool operator<(nullopt_t, const optional<T>& opt) noexcept
+{
+ return opt.has_value();
+}
+
+template <typename T>
+bool operator<=(nullopt_t, const optional<T>& opt) noexcept
+{
+ return true;
+}
+
+template <typename T>
+bool operator>(nullopt_t, const optional<T>& opt) noexcept
+{
+ return false;
+}
+
+template <typename T>
+bool operator>=(nullopt_t, const optional<T>& opt) noexcept
+{
+ return !opt.has_value();
+}
+
+template <typename T, typename U>
+bool operator==(const optional<T>& opt, const U& value)
+{
+ return opt.has_value() && *opt == value;
+}
+
+template <typename T, typename U>
+bool operator!=(const optional<T>& opt, const U& value)
+{
+ return !opt.has_value() || *opt != value;
+}
+
+template <typename T, typename U>
+bool operator<(const optional<T>& opt, const U& value)
+{
+ return !opt.has_value() || *opt < value;
+}
+
+template <typename T, typename U>
+bool operator<=(const optional<T>& opt, const U& value)
+{
+ return !opt.has_value() || *opt <= value;
+}
+
+template <typename T, typename U>
+bool operator>(const optional<T>& opt, const U& value)
+{
+ return opt.has_value() && *opt > value;
+}
+
+template <typename T, typename U>
+bool operator>=(const optional<T>& opt, const U& value)
+{
+ return opt.has_value() && *opt >= value;
+}
+
+template <typename T, typename U>
+bool operator==(const T& value, const optional<U>& opt)
+{
+ return opt.has_value() && value == *opt;
+}
+
+template <typename T, typename U>
+bool operator!=(const T& value, const optional<U>& opt)
+{
+ return !opt.has_value() || value != *opt;
+}
+
+template <typename T, typename U>
+bool operator<(const T& value, const optional<U>& opt)
+{
+ return opt.has_value() && value < *opt;
+}
+
+template <typename T, typename U>
+bool operator<=(const T& value, const optional<U>& opt)
+{
+ return opt.has_value() && value <= *opt;
+}
+
+template <typename T, typename U>
+bool operator>(const T& value, const optional<U>& opt)
+{
+ return !opt.has_value() || value > *opt;
+}
+
+template <typename T, typename U>
+bool operator>=(const T& value, const optional<U>& opt)
+{
+ return !opt.has_value() || value >= *opt;
+}
+
template <typename T>
const T* optional<T>::operator->() const
{
@@ -340,5 +543,3 @@ T& optional<T>::emplace(Args&&... args)
#endif
}
-
-#endif
diff --git a/Utilities/std/cm/set b/Utilities/std/cm/set
index 56dd474..9fd24d3 100644
--- a/Utilities/std/cm/set
+++ b/Utilities/std/cm/set
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_set
-#define cm_set
+#pragma once
#include <set> // IWYU pragma: export
@@ -39,5 +38,3 @@ inline void erase_if(std::multiset<Key, Compare, Allocator>& cont,
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/shared_mutex b/Utilities/std/cm/shared_mutex
index ec63a7b..a1204fa 100644
--- a/Utilities/std/cm/shared_mutex
+++ b/Utilities/std/cm/shared_mutex
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_shared_mutex
-#define cm_shared_mutex
+#pragma once
#if __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L
# define CMake_HAVE_CXX_SHARED_LOCK
@@ -72,5 +71,3 @@ public:
};
#endif
}
-
-#endif
diff --git a/Utilities/std/cm/string b/Utilities/std/cm/string
index cc4c796..30b1b85 100644
--- a/Utilities/std/cm/string
+++ b/Utilities/std/cm/string
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_string
-#define cm_string
+#pragma once
#include <algorithm>
#include <string> // IWYU pragma: export
@@ -38,5 +37,3 @@ inline void erase_if(std::basic_string<T, Traits, Allocator>& cont,
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/string_view b/Utilities/std/cm/string_view
index 4d359cb..9542bac 100644
--- a/Utilities/std/cm/string_view
+++ b/Utilities/std/cm/string_view
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_string_view
-#define cm_string_view
+#pragma once
#if __cplusplus >= 201703L || defined(_MSVC_LANG) && _MSVC_LANG >= 201703L
# define CMake_HAVE_CXX_STRING_VIEW
@@ -215,4 +214,3 @@ struct hash<cm::string_view>
}
#endif
-#endif
diff --git a/Utilities/std/cm/type_traits b/Utilities/std/cm/type_traits
index e32c2c6..56ec64f 100644
--- a/Utilities/std/cm/type_traits
+++ b/Utilities/std/cm/type_traits
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_type_traits
-#define cm_type_traits
+#pragma once
#include <type_traits> // IWYU pragma: export
@@ -59,5 +58,3 @@ using void_t = typename make_void<ArgTypes...>::type;
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/unordered_map b/Utilities/std/cm/unordered_map
index 5b8a456..d21c37e 100644
--- a/Utilities/std/cm/unordered_map
+++ b/Utilities/std/cm/unordered_map
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_unordered_map
-#define cm_unordered_map
+#pragma once
#include <unordered_map> // IWYU pragma: export
@@ -41,5 +40,3 @@ inline void erase_if(
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/unordered_set b/Utilities/std/cm/unordered_set
index 9debac4..2545ff6 100644
--- a/Utilities/std/cm/unordered_set
+++ b/Utilities/std/cm/unordered_set
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_unordered_set
-#define cm_unordered_set
+#pragma once
#include <unordered_set> // IWYU pragma: export
@@ -41,5 +40,3 @@ inline void erase_if(
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cm/utility b/Utilities/std/cm/utility
index 3acac4f..c257fc8 100644
--- a/Utilities/std/cm/utility
+++ b/Utilities/std/cm/utility
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_utility
-#define cm_utility
+#pragma once
#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
# define CMake_HAVE_CXX_IN_PLACE
@@ -30,5 +29,3 @@ constexpr in_place_t in_place{};
#endif
}
-
-#endif
diff --git a/Utilities/std/cm/vector b/Utilities/std/cm/vector
index 2dbe704..33d9365 100644
--- a/Utilities/std/cm/vector
+++ b/Utilities/std/cm/vector
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cm_vector
-#define cm_vector
+#pragma once
#include <algorithm>
#include <vector> // IWYU pragma: export
@@ -36,5 +35,3 @@ inline void erase_if(std::vector<T, Allocator>& cont, Predicate pred)
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cmSTL.hxx.in b/Utilities/std/cmSTL.hxx.in
index 9c8605c..5e94864 100644
--- a/Utilities/std/cmSTL.hxx.in
+++ b/Utilities/std/cmSTL.hxx.in
@@ -1,10 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmSTL_hxx
-#define cmSTL_hxx
+#pragma once
/* Whether CMake is using its own STL implementation. */
#cmakedefine CMake_HAVE_CXX_MAKE_UNIQUE
#cmakedefine CMake_HAVE_CXX_FILESYSTEM
-
-#endif
diff --git a/Utilities/std/cmext/algorithm b/Utilities/std/cmext/algorithm
index 251c89a..11514fc 100644
--- a/Utilities/std/cmext/algorithm
+++ b/Utilities/std/cmext/algorithm
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmext_algorithm
-#define cmext_algorithm
+#pragma once
#include <algorithm>
#include <iterator>
@@ -247,5 +246,3 @@ bool contains(Range const& range, Key const& key)
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cmext/iterator b/Utilities/std/cmext/iterator
index ce9462f..83d7890 100644
--- a/Utilities/std/cmext/iterator
+++ b/Utilities/std/cmext/iterator
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmext_iterator
-#define cmext_iterator
+#pragma once
#include <iterator>
@@ -47,5 +46,3 @@ using is_input_range =
#endif
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cmext/memory b/Utilities/std/cmext/memory
index fa326f0..3681d97 100644
--- a/Utilities/std/cmext/memory
+++ b/Utilities/std/cmext/memory
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmext_memory
-#define cmext_memory
+#pragma once
#include <typeinfo>
@@ -37,5 +36,3 @@ T& dynamic_reference_cast(O& item)
}
} // namespace cm
-
-#endif
diff --git a/Utilities/std/cmext/string_view b/Utilities/std/cmext/string_view
index ad52b11..369cc90 100644
--- a/Utilities/std/cmext/string_view
+++ b/Utilities/std/cmext/string_view
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmext_string_view
-#define cmext_string_view
+#pragma once
#include <cstddef>
@@ -38,5 +37,3 @@ inline static_string_view operator"" _s(const char* data, size_t size)
} // namespace cm
using cm::operator"" _s;
-
-#endif
diff --git a/Utilities/std/cmext/type_traits b/Utilities/std/cmext/type_traits
index f02b488..4468e31 100644
--- a/Utilities/std/cmext/type_traits
+++ b/Utilities/std/cmext/type_traits
@@ -3,8 +3,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmext_type_traits
-#define cmext_type_traits
+#pragma once
#include <memory>
@@ -84,5 +83,3 @@ using is_sequence_container =
!cm::is_unordered_associative_container<T>::value>;
} // namespace cm
-
-#endif
diff --git a/bootstrap b/bootstrap
index eabe06b..1e161db 100755
--- a/bootstrap
+++ b/bootstrap
@@ -288,6 +288,8 @@ CMAKE_CXX_SOURCES="\
cmBreakCommand \
cmBuildCommand \
cmCMakeMinimumRequired \
+ cmCMakePath \
+ cmCMakePathCommand \
cmCMakePolicyCommand \
cmCPackPropertiesGenerator \
cmCacheManager \
@@ -1594,8 +1596,7 @@ for a in ${KWSYS_FILES}; do
cmsys_header_files="${cmsys_header_files} cmsys/${a}"
done
-echo "#ifndef cmThirdParty_h" > "${cmake_bootstrap_dir}/cmThirdParty.h.tmp"
-echo "#define cmThirdParty_h" >> "${cmake_bootstrap_dir}/cmThirdParty.h.tmp"
+echo "#pragma once" > "${cmake_bootstrap_dir}/cmThirdParty.h.tmp"
if test "x${bootstrap_system_libuv}" != "x"; then
echo "#define CMAKE_USE_SYSTEM_LIBUV" >> "${cmake_bootstrap_dir}/cmThirdParty.h.tmp"
fi
@@ -1605,7 +1606,6 @@ fi
if test "x${bootstrap_system_librhash}" != "x"; then
echo "#define CMAKE_USE_SYSTEM_LIBRHASH" >> "${cmake_bootstrap_dir}/cmThirdParty.h.tmp"
fi
-echo "#endif" >> "${cmake_bootstrap_dir}/cmThirdParty.h.tmp"
cmake_generate_file_tmp "${cmake_bootstrap_dir}/cmThirdParty.h" "${cmake_bootstrap_dir}/cmThirdParty.h.tmp"
# Generate Makefile