summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/.gitattributes2
-rw-r--r--Source/CMakeLists.txt48
-rw-r--r--Source/CMakeVersion.cmake79
-rw-r--r--Source/CMakeVersionCompute.cmake44
-rw-r--r--Source/CMakeVersionSource.cmake30
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackExternalGenerator.cxx3
-rw-r--r--Source/CPack/cmCPackGenerator.cxx31
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx5
-rw-r--r--Source/CPack/cmCPackNuGetGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.cxx2
-rw-r--r--Source/CPack/cmCPackPKGGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.cxx3
-rw-r--r--Source/CPack/cpack.cxx32
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx5
-rw-r--r--Source/CTest/cmCTestBuildCommand.cxx5
-rw-r--r--Source/CTest/cmCTestBuildCommand.h11
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx1
-rw-r--r--Source/CTest/cmCTestConfigureCommand.h11
-rw-r--r--Source/CTest/cmCTestCoverageCommand.h11
-rw-r--r--Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h12
-rw-r--r--Source/CTest/cmCTestGIT.cxx2
-rw-r--r--Source/CTest/cmCTestHandlerCommand.cxx34
-rw-r--r--Source/CTest/cmCTestLaunch.cxx1
-rw-r--r--Source/CTest/cmCTestMemCheckCommand.cxx4
-rw-r--r--Source/CTest/cmCTestMemCheckCommand.h12
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx7
-rw-r--r--Source/CTest/cmCTestReadCustomFilesCommand.h11
-rw-r--r--Source/CTest/cmCTestRunScriptCommand.cxx2
-rw-r--r--Source/CTest/cmCTestRunScriptCommand.h11
-rw-r--r--Source/CTest/cmCTestRunTest.cxx49
-rw-r--r--Source/CTest/cmCTestRunTest.h3
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx86
-rw-r--r--Source/CTest/cmCTestScriptHandler.h4
-rw-r--r--Source/CTest/cmCTestSleepCommand.h11
-rw-r--r--Source/CTest/cmCTestStartCommand.h11
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx12
-rw-r--r--Source/CTest/cmCTestSubmitCommand.h5
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx1
-rw-r--r--Source/CTest/cmCTestTestCommand.h11
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx377
-rw-r--r--Source/CTest/cmCTestTestHandler.h15
-rw-r--r--Source/CTest/cmCTestUpdateCommand.h11
-rw-r--r--Source/CTest/cmCTestUpdateHandler.cxx4
-rw-r--r--Source/CTest/cmCTestUploadCommand.h11
-rw-r--r--Source/CTest/cmParseGTMCoverage.cxx2
-rw-r--r--Source/LexerParser/cmCommandArgumentParser.cxx302
-rw-r--r--Source/LexerParser/cmCommandArgumentParserTokens.h8
-rw-r--r--Source/LexerParser/cmDependsJavaParser.cxx1560
-rw-r--r--Source/LexerParser/cmDependsJavaParserTokens.h8
-rw-r--r--Source/LexerParser/cmExprParser.cxx371
-rw-r--r--Source/LexerParser/cmExprParser.y3
-rw-r--r--Source/LexerParser/cmExprParserTokens.h8
-rw-r--r--Source/LexerParser/cmFortranParser.cxx304
-rw-r--r--Source/LexerParser/cmFortranParserTokens.h12
-rw-r--r--Source/QtDialog/CMakeSetup.cxx1
-rw-r--r--Source/cmAddCompileDefinitionsCommand.h7
-rw-r--r--Source/cmAddCompileOptionsCommand.h7
-rw-r--r--Source/cmAddCustomCommandCommand.cxx47
-rw-r--r--Source/cmAddCustomCommandCommand.h7
-rw-r--r--Source/cmAddCustomTargetCommand.h7
-rw-r--r--Source/cmAddDefinitionsCommand.h7
-rw-r--r--Source/cmAddDependenciesCommand.h7
-rw-r--r--Source/cmAddExecutableCommand.h7
-rw-r--r--Source/cmAddLibraryCommand.h7
-rw-r--r--Source/cmAddLinkOptionsCommand.h7
-rw-r--r--Source/cmAddSubDirectoryCommand.h7
-rw-r--r--Source/cmAddTestCommand.cxx9
-rw-r--r--Source/cmAddTestCommand.h7
-rw-r--r--Source/cmAlgorithms.h146
-rw-r--r--Source/cmAuxSourceDirectoryCommand.cxx4
-rw-r--r--Source/cmAuxSourceDirectoryCommand.h7
-rw-r--r--Source/cmBinUtilsLinker.cxx15
-rw-r--r--Source/cmBinUtilsLinker.h30
-rw-r--r--Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.cxx18
-rw-r--r--Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h30
-rw-r--r--Source/cmBinUtilsLinuxELFLinker.cxx178
-rw-r--r--Source/cmBinUtilsLinuxELFLinker.h44
-rw-r--r--Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx84
-rw-r--r--Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h26
-rw-r--r--Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.cxx19
-rw-r--r--Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h29
-rw-r--r--Source/cmBinUtilsMacOSMachOLinker.cxx230
-rw-r--r--Source/cmBinUtilsMacOSMachOLinker.h59
-rw-r--r--Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx100
-rw-r--r--Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h25
-rw-r--r--Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx67
-rw-r--r--Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h25
-rw-r--r--Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.cxx18
-rw-r--r--Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h28
-rw-r--r--Source/cmBinUtilsWindowsPELinker.cxx122
-rw-r--r--Source/cmBinUtilsWindowsPELinker.h33
-rw-r--r--Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx67
-rw-r--r--Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h25
-rw-r--r--Source/cmBreakCommand.h7
-rw-r--r--Source/cmBuildCommand.cxx2
-rw-r--r--Source/cmBuildCommand.h7
-rw-r--r--Source/cmBuildNameCommand.h7
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.cxx2
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.h6
-rw-r--r--Source/cmCMakeMinimumRequired.cxx3
-rw-r--r--Source/cmCMakeMinimumRequired.h7
-rw-r--r--Source/cmCMakePolicyCommand.cxx3
-rw-r--r--Source/cmCMakePolicyCommand.h7
-rw-r--r--Source/cmCPluginAPI.cxx8
-rw-r--r--Source/cmCTest.cxx28
-rw-r--r--Source/cmCTest.h2
-rw-r--r--Source/cmCacheManager.cxx2
-rw-r--r--Source/cmCommand.cxx42
-rw-r--r--Source/cmCommand.h49
-rw-r--r--Source/cmCommands.cxx268
-rw-r--r--Source/cmCommonTargetGenerator.cxx2
-rw-r--r--Source/cmComputeLinkDepends.cxx7
-rw-r--r--Source/cmComputeLinkDepends.h3
-rw-r--r--Source/cmComputeLinkInformation.cxx44
-rw-r--r--Source/cmComputeLinkInformation.h1
-rw-r--r--Source/cmConditionEvaluator.cxx5
-rw-r--r--Source/cmConfigureFileCommand.h7
-rw-r--r--Source/cmContinueCommand.h7
-rw-r--r--Source/cmCoreTryCompile.cxx7
-rw-r--r--Source/cmCreateTestSourceList.cxx11
-rw-r--r--Source/cmCreateTestSourceList.h7
-rw-r--r--Source/cmCryptoHash.cxx4
-rw-r--r--Source/cmCryptoHash.h2
-rw-r--r--Source/cmCustomCommandGenerator.cxx2
-rw-r--r--Source/cmDefinePropertyCommand.h7
-rw-r--r--Source/cmDefinitions.cxx29
-rw-r--r--Source/cmDefinitions.h30
-rw-r--r--Source/cmDependsFortran.cxx2
-rw-r--r--Source/cmDisallowedCommand.cxx6
-rw-r--r--Source/cmDisallowedCommand.h23
-rw-r--r--Source/cmELF.cxx56
-rw-r--r--Source/cmELF.h3
-rw-r--r--Source/cmEnableLanguageCommand.h7
-rw-r--r--Source/cmEnableTestingCommand.cxx11
-rw-r--r--Source/cmEnableTestingCommand.h21
-rw-r--r--Source/cmExecProgramCommand.cxx2
-rw-r--r--Source/cmExecProgramCommand.h7
-rw-r--r--Source/cmExecuteProcessCommand.cxx5
-rw-r--r--Source/cmExecuteProcessCommand.h7
-rw-r--r--Source/cmExecutionStatus.h19
-rw-r--r--Source/cmExportBuildAndroidMKGenerator.cxx3
-rw-r--r--Source/cmExportBuildFileGenerator.cxx65
-rw-r--r--Source/cmExportBuildFileGenerator.h7
-rw-r--r--Source/cmExportCommand.h7
-rw-r--r--Source/cmExportFileGenerator.cxx15
-rw-r--r--Source/cmExportInstallFileGenerator.cxx2
-rw-r--r--Source/cmExportLibraryDependenciesCommand.cxx61
-rw-r--r--Source/cmExportLibraryDependenciesCommand.h14
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx2
-rw-r--r--Source/cmExtraCodeLiteGenerator.cxx19
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx25
-rw-r--r--Source/cmExtraEclipseCDT4Generator.h3
-rw-r--r--Source/cmFLTKWrapUICommand.cxx56
-rw-r--r--Source/cmFLTKWrapUICommand.h29
-rw-r--r--Source/cmFileAPI.cxx2
-rw-r--r--Source/cmFileAPI.h2
-rw-r--r--Source/cmFileAPICodemodel.cxx18
-rw-r--r--Source/cmFileCommand.cxx229
-rw-r--r--Source/cmFileCommand.h9
-rw-r--r--Source/cmFileCopier.cxx7
-rw-r--r--Source/cmFileInstaller.cxx2
-rw-r--r--Source/cmFileTimes.cxx3
-rw-r--r--Source/cmFileTimes.h2
-rw-r--r--Source/cmFindBase.cxx4
-rw-r--r--Source/cmFindCommon.cxx21
-rw-r--r--Source/cmFindCommon.h3
-rw-r--r--Source/cmFindFileCommand.h10
-rw-r--r--Source/cmFindLibraryCommand.h9
-rw-r--r--Source/cmFindPackageCommand.cxx40
-rw-r--r--Source/cmFindPackageCommand.h9
-rw-r--r--Source/cmFindPathCommand.h9
-rw-r--r--Source/cmFindProgramCommand.h9
-rw-r--r--Source/cmForEachCommand.cxx36
-rw-r--r--Source/cmForEachCommand.h7
-rw-r--r--Source/cmFunctionCommand.cxx84
-rw-r--r--Source/cmFunctionCommand.h7
-rw-r--r--Source/cmGeneratorExpression.cxx2
-rw-r--r--Source/cmGeneratorExpression.h2
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx6
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.h2
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.cxx2
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.h2
-rw-r--r--Source/cmGeneratorExpressionNode.cxx211
-rw-r--r--Source/cmGeneratorTarget.cxx761
-rw-r--r--Source/cmGeneratorTarget.h29
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx4
-rw-r--r--Source/cmGetCMakePropertyCommand.h7
-rw-r--r--Source/cmGetDirectoryPropertyCommand.cxx8
-rw-r--r--Source/cmGetDirectoryPropertyCommand.h7
-rw-r--r--Source/cmGetFilenameComponentCommand.cxx4
-rw-r--r--Source/cmGetFilenameComponentCommand.h7
-rw-r--r--Source/cmGetPropertyCommand.cxx4
-rw-r--r--Source/cmGetPropertyCommand.h7
-rw-r--r--Source/cmGetSourceFilePropertyCommand.cxx2
-rw-r--r--Source/cmGetSourceFilePropertyCommand.h7
-rw-r--r--Source/cmGetTargetPropertyCommand.cxx4
-rw-r--r--Source/cmGetTargetPropertyCommand.h7
-rw-r--r--Source/cmGetTestPropertyCommand.h7
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx32
-rw-r--r--Source/cmGlobalGenerator.h4
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx2
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.cxx6
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.cxx6
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx8
-rw-r--r--Source/cmGlobalNinjaGenerator.h2
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx2
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx5
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx5
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx3
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx6
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx11
-rw-r--r--Source/cmGraphVizWriter.cxx2
-rw-r--r--Source/cmIfCommand.cxx39
-rw-r--r--Source/cmIfCommand.h34
-rw-r--r--Source/cmIncludeCommand.h7
-rw-r--r--Source/cmIncludeDirectoryCommand.h7
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.h7
-rw-r--r--Source/cmIncludeGuardCommand.cxx2
-rw-r--r--Source/cmIncludeGuardCommand.h7
-rw-r--r--Source/cmIncludeRegularExpressionCommand.h7
-rw-r--r--Source/cmInstallCommand.cxx11
-rw-r--r--Source/cmInstallCommand.h7
-rw-r--r--Source/cmInstallDirectoryGenerator.cxx2
-rw-r--r--Source/cmInstallFilesCommand.cxx71
-rw-r--r--Source/cmInstallFilesCommand.h26
-rw-r--r--Source/cmInstallFilesGenerator.cxx2
-rw-r--r--Source/cmInstallProgramsCommand.cxx51
-rw-r--r--Source/cmInstallProgramsCommand.h25
-rw-r--r--Source/cmInstallScriptGenerator.cxx1
-rw-r--r--Source/cmInstallTargetGenerator.cxx84
-rw-r--r--Source/cmInstallTargetGenerator.h1
-rw-r--r--Source/cmInstallTargetsCommand.h7
-rw-r--r--Source/cmInstalledFile.h2
-rw-r--r--Source/cmJsonObjects.cxx10
-rw-r--r--Source/cmLDConfigLDConfigTool.cxx70
-rw-r--r--Source/cmLDConfigLDConfigTool.h22
-rw-r--r--Source/cmLDConfigTool.cxx9
-rw-r--r--Source/cmLDConfigTool.h24
-rw-r--r--Source/cmLinkDirectoriesCommand.cxx2
-rw-r--r--Source/cmLinkDirectoriesCommand.h7
-rw-r--r--Source/cmLinkItem.h4
-rw-r--r--Source/cmLinkLibrariesCommand.h7
-rw-r--r--Source/cmLinkLineComputer.cxx3
-rw-r--r--Source/cmLinkLineDeviceComputer.cxx2
-rw-r--r--Source/cmListCommand.cxx42
-rw-r--r--Source/cmListCommand.h7
-rw-r--r--Source/cmListFileCache.h2
-rw-r--r--Source/cmLoadCacheCommand.cxx2
-rw-r--r--Source/cmLoadCacheCommand.h7
-rw-r--r--Source/cmLoadCommandCommand.cxx193
-rw-r--r--Source/cmLoadCommandCommand.h7
-rw-r--r--Source/cmLocalGenerator.cxx41
-rw-r--r--Source/cmLocalNinjaGenerator.cxx2
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx4
-rw-r--r--Source/cmLocalVisualStudioGenerator.h2
-rw-r--r--Source/cmMachO.cxx17
-rw-r--r--Source/cmMachO.h2
-rw-r--r--Source/cmMacroCommand.cxx67
-rw-r--r--Source/cmMacroCommand.h7
-rw-r--r--Source/cmMakeDirectoryCommand.h7
-rw-r--r--Source/cmMakefile.cxx167
-rw-r--r--Source/cmMakefile.h35
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx8
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx3
-rw-r--r--Source/cmMakefileTargetGenerator.cxx3
-rw-r--r--Source/cmMakefileTargetGenerator.h1
-rw-r--r--Source/cmMakefileUtilityTargetGenerator.cxx3
-rw-r--r--Source/cmMarkAsAdvancedCommand.h7
-rw-r--r--Source/cmMathCommand.h7
-rw-r--r--Source/cmMessageCommand.cxx54
-rw-r--r--Source/cmMessageCommand.h7
-rw-r--r--Source/cmMessenger.cxx5
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx4
-rw-r--r--Source/cmNinjaTargetGenerator.cxx8
-rw-r--r--Source/cmNinjaTargetGenerator.h2
-rw-r--r--Source/cmOptionCommand.cxx2
-rw-r--r--Source/cmOptionCommand.h7
-rw-r--r--Source/cmOrderDirectories.cxx1
-rw-r--r--Source/cmOutputConverter.cxx193
-rw-r--r--Source/cmOutputConverter.h26
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx1
-rw-r--r--Source/cmOutputRequiredFilesCommand.h7
-rw-r--r--Source/cmParseArgumentsCommand.cxx13
-rw-r--r--Source/cmParseArgumentsCommand.h7
-rw-r--r--Source/cmPolicies.cxx2
-rw-r--r--Source/cmPolicies.h16
-rw-r--r--Source/cmProjectCommand.cxx157
-rw-r--r--Source/cmProjectCommand.h7
-rw-r--r--Source/cmProperty.cxx26
-rw-r--r--Source/cmProperty.h18
-rw-r--r--Source/cmPropertyMap.cxx77
-rw-r--r--Source/cmPropertyMap.h34
-rw-r--r--Source/cmQTWrapCPPCommand.cxx2
-rw-r--r--Source/cmQTWrapCPPCommand.h7
-rw-r--r--Source/cmQTWrapUICommand.cxx4
-rw-r--r--Source/cmQTWrapUICommand.h7
-rw-r--r--Source/cmQtAutoGen.cxx1
-rw-r--r--Source/cmQtAutoGen.h2
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.cxx4
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.h2
-rw-r--r--Source/cmQtAutoGenInitializer.cxx35
-rw-r--r--Source/cmQtAutoGenInitializer.h2
-rw-r--r--Source/cmQtAutoGenerator.cxx3
-rw-r--r--Source/cmQtAutoMocUic.cxx4
-rw-r--r--Source/cmQtAutoMocUic.h2
-rw-r--r--Source/cmQtAutoRcc.cxx1
-rw-r--r--Source/cmRST.cxx1
-rw-r--r--Source/cmRemoveCommand.cxx2
-rw-r--r--Source/cmRemoveCommand.h7
-rw-r--r--Source/cmRemoveDefinitionsCommand.h7
-rw-r--r--Source/cmReturnCommand.cxx4
-rw-r--r--Source/cmReturnCommand.h25
-rw-r--r--Source/cmRuntimeDependencyArchive.cxx376
-rw-r--r--Source/cmRuntimeDependencyArchive.h70
-rw-r--r--Source/cmSearchPath.cxx2
-rw-r--r--Source/cmSeparateArgumentsCommand.cxx4
-rw-r--r--Source/cmSeparateArgumentsCommand.h7
-rw-r--r--Source/cmServer.cxx4
-rw-r--r--Source/cmServer.h2
-rw-r--r--Source/cmServerProtocol.cxx4
-rw-r--r--Source/cmSetCommand.cxx4
-rw-r--r--Source/cmSetCommand.h7
-rw-r--r--Source/cmSetDirectoryPropertiesCommand.h7
-rw-r--r--Source/cmSetPropertyCommand.h7
-rw-r--r--Source/cmSetSourceFilesPropertiesCommand.h7
-rw-r--r--Source/cmSetTargetPropertiesCommand.h7
-rw-r--r--Source/cmSetTestsPropertiesCommand.h7
-rw-r--r--Source/cmSiteNameCommand.h7
-rw-r--r--Source/cmSourceFileLocation.cxx5
-rw-r--r--Source/cmSourceGroupCommand.h7
-rw-r--r--Source/cmState.cxx112
-rw-r--r--Source/cmState.h32
-rw-r--r--Source/cmStateDirectory.cxx9
-rw-r--r--Source/cmStateDirectory.h1
-rw-r--r--Source/cmStateSnapshot.cxx12
-rw-r--r--Source/cmStateSnapshot.h4
-rw-r--r--Source/cmStringAlgorithms.h139
-rw-r--r--Source/cmStringCommand.cxx43
-rw-r--r--Source/cmStringCommand.h7
-rw-r--r--Source/cmSubdirCommand.h7
-rw-r--r--Source/cmSubdirDependsCommand.h7
-rw-r--r--Source/cmSystemTools.cxx281
-rw-r--r--Source/cmSystemTools.h75
-rw-r--r--Source/cmTarget.cxx320
-rw-r--r--Source/cmTarget.h9
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.cxx2
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.h9
-rw-r--r--Source/cmTargetCompileFeaturesCommand.cxx2
-rw-r--r--Source/cmTargetCompileFeaturesCommand.h9
-rw-r--r--Source/cmTargetCompileOptionsCommand.cxx2
-rw-r--r--Source/cmTargetCompileOptionsCommand.h9
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.h9
-rw-r--r--Source/cmTargetLinkDirectoriesCommand.cxx2
-rw-r--r--Source/cmTargetLinkDirectoriesCommand.h9
-rw-r--r--Source/cmTargetLinkLibrariesCommand.h7
-rw-r--r--Source/cmTargetLinkOptionsCommand.cxx2
-rw-r--r--Source/cmTargetLinkOptionsCommand.h9
-rw-r--r--Source/cmTargetPropCommandBase.cxx7
-rw-r--r--Source/cmTargetPropertyComputer.cxx32
-rw-r--r--Source/cmTargetPropertyComputer.h2
-rw-r--r--Source/cmTargetSourcesCommand.cxx2
-rw-r--r--Source/cmTargetSourcesCommand.h9
-rw-r--r--Source/cmTest.cxx13
-rw-r--r--Source/cmTest.h5
-rw-r--r--Source/cmTestGenerator.cxx50
-rw-r--r--Source/cmTestGenerator.h4
-rw-r--r--Source/cmTryCompileCommand.h9
-rw-r--r--Source/cmTryRunCommand.cxx5
-rw-r--r--Source/cmTryRunCommand.h9
-rw-r--r--Source/cmUVProcessChain.cxx5
-rw-r--r--Source/cmUVProcessChain.h2
-rw-r--r--Source/cmUnexpectedCommand.cxx22
-rw-r--r--Source/cmUnexpectedCommand.h38
-rw-r--r--Source/cmUnsetCommand.cxx2
-rw-r--r--Source/cmUnsetCommand.h7
-rw-r--r--Source/cmUseMangledMesaCommand.h7
-rw-r--r--Source/cmUtilitySourceCommand.h7
-rw-r--r--Source/cmVariableRequiresCommand.cxx2
-rw-r--r--Source/cmVariableRequiresCommand.h7
-rw-r--r--Source/cmVariableWatch.h2
-rw-r--r--Source/cmVariableWatchCommand.cxx43
-rw-r--r--Source/cmVariableWatchCommand.h21
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx76
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h2
-rw-r--r--Source/cmWhileCommand.cxx23
-rw-r--r--Source/cmWhileCommand.h29
-rw-r--r--Source/cmWorkerPool.cxx2
-rw-r--r--Source/cmWorkerPool.h5
-rw-r--r--Source/cmWriteFileCommand.h7
-rw-r--r--Source/cm_memory.hxx31
-rw-r--r--Source/cmake.cxx100
-rw-r--r--Source/cmake.h87
-rw-r--r--Source/cmakemain.cxx182
-rw-r--r--Source/cmcmd.cxx15
-rw-r--r--Source/kwsys/CommandLineArguments.cxx6
-rw-r--r--Source/kwsys/RegularExpression.cxx3
-rw-r--r--Source/kwsys/RegularExpression.hxx.in18
-rw-r--r--Source/kwsys/SystemTools.cxx10
401 files changed, 7797 insertions, 4766 deletions
diff --git a/Source/.gitattributes b/Source/.gitattributes
index 7c160cc..d0aedc2 100644
--- a/Source/.gitattributes
+++ b/Source/.gitattributes
@@ -1,2 +1,4 @@
+CMakeVersion.cmake export-subst
+
# Do not format third-party sources.
/kwsys/** -format.clang-format-6.0
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 695e075..041c606 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -142,10 +142,33 @@ set(SRCS
cmAffinity.cxx
cmAffinity.h
+ cmAlgorithms.h
cmArchiveWrite.cxx
cmArgumentParser.cxx
cmArgumentParser.h
cmBase32.cxx
+ cmBinUtilsLinker.cxx
+ cmBinUtilsLinker.h
+ cmBinUtilsLinuxELFGetRuntimeDependenciesTool.cxx
+ cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h
+ cmBinUtilsLinuxELFLinker.cxx
+ cmBinUtilsLinuxELFLinker.h
+ cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx
+ cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h
+ cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.cxx
+ cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h
+ cmBinUtilsMacOSMachOLinker.cxx
+ cmBinUtilsMacOSMachOLinker.h
+ cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx
+ cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h
+ cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx
+ cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h
+ cmBinUtilsWindowsPEGetRuntimeDependenciesTool.cxx
+ cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h
+ cmBinUtilsWindowsPELinker.cxx
+ cmBinUtilsWindowsPELinker.h
+ cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx
+ cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h
cmCacheManager.cxx
cmCacheManager.h
cmCLocaleEnvironmentScope.h
@@ -295,6 +318,10 @@ set(SRCS
cmInstallTargetGenerator.cxx
cmInstallDirectoryGenerator.h
cmInstallDirectoryGenerator.cxx
+ cmLDConfigLDConfigTool.cxx
+ cmLDConfigLDConfigTool.h
+ cmLDConfigTool.cxx
+ cmLDConfigTool.h
cmLinkedTree.h
cmLinkItem.cxx
cmLinkItem.h
@@ -338,7 +365,6 @@ set(SRCS
cmProcessOutput.h
cmProcessTools.cxx
cmProcessTools.h
- cmProperty.cxx
cmProperty.h
cmPropertyDefinition.cxx
cmPropertyDefinition.h
@@ -360,6 +386,8 @@ set(SRCS
cmQtAutoRcc.h
cmRST.cxx
cmRST.h
+ cmRuntimeDependencyArchive.cxx
+ cmRuntimeDependencyArchive.h
cmScriptGenerator.h
cmScriptGenerator.cxx
cmSourceFile.cxx
@@ -376,6 +404,7 @@ set(SRCS
cmStateSnapshot.cxx
cmStateSnapshot.h
cmStateTypes.h
+ cmStringAlgorithms.h
cmSystemTools.cxx
cmSystemTools.h
cmTarget.cxx
@@ -635,8 +664,6 @@ set(SRCS
cmTryCompileCommand.h
cmTryRunCommand.cxx
cmTryRunCommand.h
- cmUnexpectedCommand.cxx
- cmUnexpectedCommand.h
cmUnsetCommand.cxx
cmUnsetCommand.h
cmUseMangledMesaCommand.cxx
@@ -1134,6 +1161,21 @@ include (${CMake_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
include (${CMake_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
if(WIN32)
+ # Compute the binary version that appears in the RC file. Version
+ # components in the RC file are 16-bit integers so we may have to
+ # split the patch component.
+ if(CMake_VERSION_PATCH MATCHES "^([0-9]+)([0-9][0-9][0-9][0-9])$")
+ set(CMake_RCVERSION_YEAR "${CMAKE_MATCH_1}")
+ set(CMake_RCVERSION_MONTH_DAY "${CMAKE_MATCH_2}")
+ string(REGEX REPLACE "^0+" "" CMake_RCVERSION_MONTH_DAY "${CMake_RCVERSION_MONTH_DAY}")
+ set(CMake_RCVERSION ${CMake_VERSION_MAJOR},${CMake_VERSION_MINOR},${CMake_RCVERSION_YEAR},${CMake_RCVERSION_MONTH_DAY})
+ unset(CMake_RCVERSION_MONTH_DAY)
+ unset(CMake_RCVERSION_YEAR)
+ else()
+ set(CMake_RCVERSION ${CMake_VERSION_MAJOR},${CMake_VERSION_MINOR},${CMake_VERSION_PATCH})
+ endif()
+ set(CMake_RCVERSION_STR ${CMake_VERSION})
+
# Add Windows executable version information.
configure_file("CMakeVersion.rc.in" "CMakeVersion.rc" @ONLY)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 4b4f9b0..f02ef52 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,82 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 15)
-set(CMake_VERSION_PATCH 1)
+set(CMake_VERSION_PATCH 20190731)
#set(CMake_VERSION_RC 0)
+set(CMake_VERSION_IS_DIRTY 0)
+
+# Start with the full version number used in tags. It has no dev info.
+set(CMake_VERSION
+ "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}")
+if(DEFINED CMake_VERSION_RC)
+ set(CMake_VERSION "${CMake_VERSION}-rc${CMake_VERSION_RC}")
+endif()
+
+# Releases define a small patch level.
+if("${CMake_VERSION_PATCH}" VERSION_LESS 20000000)
+ set(CMake_VERSION_IS_RELEASE 1)
+else()
+ set(CMake_VERSION_IS_RELEASE 0)
+endif()
+
+if(EXISTS ${CMake_SOURCE_DIR}/.git)
+ find_package(Git QUIET)
+ if(GIT_FOUND)
+ macro(_git)
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} ${ARGN}
+ WORKING_DIRECTORY ${CMake_SOURCE_DIR}
+ RESULT_VARIABLE _git_res
+ OUTPUT_VARIABLE _git_out OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE _git_err ERROR_STRIP_TRAILING_WHITESPACE
+ )
+ endmacro()
+ endif()
+endif()
+
+# Try to identify the current development source version.
+if(COMMAND _git)
+ # Get the commit checked out in this work tree.
+ _git(log -n 1 HEAD "--pretty=format:%h %s" --)
+ set(git_info "${_git_out}")
+else()
+ # Get the commit exported by 'git archive'.
+ set(git_info [==[$Format:%h %s$]==])
+endif()
+
+# Extract commit information if available.
+if(git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* (.*)$")
+ # Have commit information.
+ set(git_hash "${CMAKE_MATCH_1}")
+ set(git_subject "${CMAKE_MATCH_2}")
+
+ # If this is not the exact commit of a release, add dev info.
+ if(NOT "${git_subject}" MATCHES "^[Cc][Mm]ake ${CMake_VERSION}$")
+ set(CMake_VERSION "${CMake_VERSION}-g${git_hash}")
+ endif()
+
+ # If this is a work tree, check whether it is dirty.
+ if(COMMAND _git)
+ _git(update-index -q --refresh)
+ _git(diff-index --name-only HEAD --)
+ if(_git_out)
+ set(CMake_VERSION_IS_DIRTY 1)
+ endif()
+ endif()
+else()
+ # No commit information.
+ if(NOT CMake_VERSION_IS_RELEASE)
+ # Generic development version.
+ set(CMake_VERSION "${CMake_VERSION}-git")
+ endif()
+endif()
+
+# Extract the version suffix component.
+if(CMake_VERSION MATCHES "-(.*)$")
+ set(CMake_VERSION_SUFFIX "${CMAKE_MATCH_1}")
+else()
+ set(CMake_VERSION_SUFFIX "")
+endif()
+if(CMake_VERSION_IS_DIRTY)
+ set(CMake_VERSION ${CMake_VERSION}-dirty)
+endif()
diff --git a/Source/CMakeVersionCompute.cmake b/Source/CMakeVersionCompute.cmake
deleted file mode 100644
index 72a5800..0000000
--- a/Source/CMakeVersionCompute.cmake
+++ /dev/null
@@ -1,44 +0,0 @@
-# Load version number components.
-include(${CMake_SOURCE_DIR}/Source/CMakeVersion.cmake)
-
-# Releases define a small patch level.
-if("${CMake_VERSION_PATCH}" VERSION_LESS 20000000)
- set(CMake_VERSION_IS_DIRTY 0)
- set(CMake_VERSION_IS_RELEASE 1)
- set(CMake_VERSION_SOURCE "")
-else()
- set(CMake_VERSION_IS_DIRTY 0) # may be set to 1 by CMakeVersionSource
- set(CMake_VERSION_IS_RELEASE 0)
- include(${CMake_SOURCE_DIR}/Source/CMakeVersionSource.cmake)
-endif()
-
-# Compute the full version string.
-set(CMake_VERSION ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH})
-if(CMake_VERSION_SOURCE)
- set(CMake_VERSION_SUFFIX "${CMake_VERSION_SOURCE}")
-elseif(CMake_VERSION_RC)
- set(CMake_VERSION_SUFFIX "rc${CMake_VERSION_RC}")
-else()
- set(CMake_VERSION_SUFFIX "")
-endif()
-if(CMake_VERSION_SUFFIX)
- set(CMake_VERSION ${CMake_VERSION}-${CMake_VERSION_SUFFIX})
-endif()
-if(CMake_VERSION_IS_DIRTY)
- set(CMake_VERSION ${CMake_VERSION}-dirty)
-endif()
-
-# Compute the binary version that appears in the RC file. Version
-# components in the RC file are 16-bit integers so we may have to
-# split the patch component.
-if(CMake_VERSION_PATCH MATCHES "^([0-9]+)([0-9][0-9][0-9][0-9])$")
- set(CMake_RCVERSION_YEAR "${CMAKE_MATCH_1}")
- set(CMake_RCVERSION_MONTH_DAY "${CMAKE_MATCH_2}")
- string(REGEX REPLACE "^0+" "" CMake_RCVERSION_MONTH_DAY "${CMake_RCVERSION_MONTH_DAY}")
- set(CMake_RCVERSION ${CMake_VERSION_MAJOR},${CMake_VERSION_MINOR},${CMake_RCVERSION_YEAR},${CMake_RCVERSION_MONTH_DAY})
- unset(CMake_RCVERSION_MONTH_DAY)
- unset(CMake_RCVERSION_YEAR)
-else()
- set(CMake_RCVERSION ${CMake_VERSION_MAJOR},${CMake_VERSION_MINOR},${CMake_VERSION_PATCH})
-endif()
-set(CMake_RCVERSION_STR ${CMake_VERSION})
diff --git a/Source/CMakeVersionSource.cmake b/Source/CMakeVersionSource.cmake
deleted file mode 100644
index 5ea1de3..0000000
--- a/Source/CMakeVersionSource.cmake
+++ /dev/null
@@ -1,30 +0,0 @@
-# Try to identify the current development source version.
-set(CMake_VERSION_SOURCE "")
-if(EXISTS ${CMake_SOURCE_DIR}/.git/HEAD)
- find_program(GIT_EXECUTABLE NAMES git git.cmd)
- mark_as_advanced(GIT_EXECUTABLE)
- if(GIT_EXECUTABLE)
- execute_process(
- COMMAND ${GIT_EXECUTABLE} rev-parse --verify -q --short=4 HEAD
- OUTPUT_VARIABLE head
- OUTPUT_STRIP_TRAILING_WHITESPACE
- WORKING_DIRECTORY ${CMake_SOURCE_DIR}
- )
- if(head)
- set(CMake_VERSION_SOURCE "g${head}")
- execute_process(
- COMMAND ${GIT_EXECUTABLE} update-index -q --refresh
- WORKING_DIRECTORY ${CMake_SOURCE_DIR}
- )
- execute_process(
- COMMAND ${GIT_EXECUTABLE} diff-index --name-only HEAD --
- OUTPUT_VARIABLE dirty
- OUTPUT_STRIP_TRAILING_WHITESPACE
- WORKING_DIRECTORY ${CMake_SOURCE_DIR}
- )
- if(dirty)
- set(CMake_VERSION_IS_DIRTY 1)
- endif()
- endif()
- endif()
-endif()
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 045d93d..fa64d79 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -604,7 +604,7 @@ std::string cmCPackWIXGenerator::GetRootFolderId() const
bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate()
{
- std::string wixTemplate = FindTemplate("WIX.template.in");
+ std::string wixTemplate = FindTemplate("Internal/CPack/WIX.template.in");
if (GetOption("CPACK_WIX_TEMPLATE") != 0) {
wixTemplate = GetOption("CPACK_WIX_TEMPLATE");
}
diff --git a/Source/CPack/cmCPackExternalGenerator.cxx b/Source/CPack/cmCPackExternalGenerator.cxx
index 9dc9853..b4c7a5a 100644
--- a/Source/CPack/cmCPackExternalGenerator.cxx
+++ b/Source/CPack/cmCPackExternalGenerator.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackExternalGenerator.h"
-#include "cmAlgorithms.h"
#include "cmCPackComponentGroup.h"
#include "cmCPackLog.h"
#include "cmMakefile.h"
@@ -17,6 +16,8 @@
#include <utility>
#include <vector>
+#include "cm_memory.hxx"
+
int cmCPackExternalGenerator::InitializeInternal()
{
this->SetOption("CPACK_EXTERNAL_KNOWN_VERSIONS", "1.0");
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 7e07ff4..512ac7a 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -7,7 +7,7 @@
#include "cmsys/RegularExpression.hxx"
#include <algorithm>
#include <cstring>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <utility>
#include "cmCPackComponentGroup.h"
@@ -235,7 +235,7 @@ int cmCPackGenerator::InstallProject()
return 0;
}
- // If the CPackConfig file sets CPACK_INSTALL_SCRIPT then run them
+ // If the CPackConfig file sets CPACK_INSTALL_SCRIPT(S) then run them
// as listed
if (!this->InstallProjectViaInstallScript(setDestDir,
tempInstallDirectory)) {
@@ -448,7 +448,19 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
int cmCPackGenerator::InstallProjectViaInstallScript(
bool setDestDir, const std::string& tempInstallDirectory)
{
- const char* cmakeScripts = this->GetOption("CPACK_INSTALL_SCRIPT");
+ const char* cmakeScripts = this->GetOption("CPACK_INSTALL_SCRIPTS");
+ {
+ const char* const cmakeScript = this->GetOption("CPACK_INSTALL_SCRIPT");
+ if (cmakeScript && cmakeScripts) {
+ cmCPackLogger(
+ cmCPackLog::LOG_WARNING,
+ "Both CPACK_INSTALL_SCRIPTS and CPACK_INSTALL_SCRIPT are set, "
+ "the latter will be ignored."
+ << std::endl);
+ } else if (cmakeScript && !cmakeScripts) {
+ cmakeScripts = cmakeScript;
+ }
+ }
if (cmakeScripts && *cmakeScripts) {
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"- Install scripts: " << cmakeScripts << std::endl);
@@ -747,7 +759,7 @@ int cmCPackGenerator::InstallCMakeProject(
if (this->GetOption("CPACK_INSTALL_PREFIX")) {
dir += this->GetOption("CPACK_INSTALL_PREFIX");
}
- mf.AddDefinition("CMAKE_INSTALL_PREFIX", dir.c_str());
+ mf.AddDefinition("CMAKE_INSTALL_PREFIX", dir);
cmCPackLogger(
cmCPackLog::LOG_DEBUG,
@@ -787,7 +799,7 @@ int cmCPackGenerator::InstallCMakeProject(
return 0;
}
} else {
- mf.AddDefinition("CMAKE_INSTALL_PREFIX", tempInstallDirectory.c_str());
+ mf.AddDefinition("CMAKE_INSTALL_PREFIX", tempInstallDirectory);
if (!cmsys::SystemTools::MakeDirectory(tempInstallDirectory,
default_dir_mode)) {
@@ -806,11 +818,11 @@ int cmCPackGenerator::InstallCMakeProject(
}
if (!buildConfig.empty()) {
- mf.AddDefinition("BUILD_TYPE", buildConfig.c_str());
+ mf.AddDefinition("BUILD_TYPE", buildConfig);
}
std::string installComponentLowerCase = cmSystemTools::LowerCase(component);
if (installComponentLowerCase != "all") {
- mf.AddDefinition("CMAKE_INSTALL_COMPONENT", component.c_str());
+ mf.AddDefinition("CMAKE_INSTALL_COMPONENT", component);
}
// strip on TRUE, ON, 1, one or several file names, but not on
@@ -851,9 +863,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 (mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")) {
- mf.AddDefinition("CPACK_ABSOLUTE_DESTINATION_FILES",
- mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES"));
+ if (const char* def = mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")) {
+ mf.AddDefinition("CPACK_ABSOLUTE_DESTINATION_FILES", def);
}
// Now rebuild the list of files after installation
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index e2020c5..87c36fa 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -36,7 +36,8 @@ int cmCPackNSISGenerator::PackageFiles()
{
// TODO: Fix nsis to force out file name
- std::string nsisInFileName = this->FindTemplate("NSIS.template.in");
+ std::string nsisInFileName =
+ this->FindTemplate("Internal/CPack/NSIS.template.in");
if (nsisInFileName.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPack error: Could not find NSIS installer template file."
@@ -44,7 +45,7 @@ int cmCPackNSISGenerator::PackageFiles()
return false;
}
std::string nsisInInstallOptions =
- this->FindTemplate("NSIS.InstallOptions.ini.in");
+ this->FindTemplate("Internal/CPack/NSIS.InstallOptions.ini.in");
if (nsisInInstallOptions.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPack error: Could not find NSIS installer options file."
diff --git a/Source/CPack/cmCPackNuGetGenerator.cxx b/Source/CPack/cmCPackNuGetGenerator.cxx
index 76f0699..19a3a0a 100644
--- a/Source/CPack/cmCPackNuGetGenerator.cxx
+++ b/Source/CPack/cmCPackNuGetGenerator.cxx
@@ -2,9 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackNuGetGenerator.h"
-#include "cmAlgorithms.h"
#include "cmCPackComponentGroup.h"
#include "cmCPackLog.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include <algorithm>
diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx
index 90e0afe..41470c9 100644
--- a/Source/CPack/cmCPackOSXX11Generator.cxx
+++ b/Source/CPack/cmCPackOSXX11Generator.cxx
@@ -245,7 +245,7 @@ bool cmCPackOSXX11Generator::CopyResourcePlistFile(
const std::string& name, const std::string& dir,
const char* outputFileName /* = 0 */, bool copyOnly /* = false */)
{
- std::string inFName = "CPack.";
+ std::string inFName = "Internal/CPack/CPack.";
inFName += name;
inFName += ".in";
std::string inFileName = this->FindTemplate(inFName.c_str());
diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx
index 8c22c65..d361921 100644
--- a/Source/CPack/cmCPackPKGGenerator.cxx
+++ b/Source/CPack/cmCPackPKGGenerator.cxx
@@ -48,7 +48,7 @@ std::string cmCPackPKGGenerator::GetPackageName(
void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile)
{
std::string distributionTemplate =
- this->FindTemplate("CPack.distribution.dist.in");
+ this->FindTemplate("Internal/CPack/CPack.distribution.dist.in");
if (distributionTemplate.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot find input file: " << distributionTemplate
@@ -305,7 +305,7 @@ bool cmCPackPKGGenerator::CopyResourcePlistFile(const std::string& name,
outName = name.c_str();
}
- std::string inFName = "CPack.";
+ std::string inFName = "Internal/CPack/CPack.";
inFName += name;
inFName += ".in";
std::string inFileName = this->FindTemplate(inFName.c_str());
diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx
index aba15d2..4666dc2 100644
--- a/Source/CPack/cmCPackSTGZGenerator.cxx
+++ b/Source/CPack/cmCPackSTGZGenerator.cxx
@@ -21,7 +21,8 @@ int cmCPackSTGZGenerator::InitializeInternal()
{
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0");
- std::string inFile = this->FindTemplate("CPack.STGZ_Header.sh.in");
+ std::string inFile =
+ this->FindTemplate("Internal/CPack/CPack.STGZ_Header.sh.in");
if (inFile.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot find template file: " << inFile << std::endl);
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 58b9e70..89c3b1c 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -5,7 +5,6 @@
#include "cmsys/Encoding.hxx"
#include <iostream>
#include <map>
-#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stddef.h>
#include <string>
@@ -29,19 +28,20 @@
#include "cmSystemTools.h"
#include "cmake.h"
-static const char* cmDocumentationName[][2] = {
+namespace {
+const char* cmDocumentationName[][2] = {
{ nullptr, " cpack - Packaging driver provided by CMake." },
{ nullptr, nullptr }
};
-static const char* cmDocumentationUsage[][2] = {
+const char* cmDocumentationUsage[][2] = {
// clang-format off
{ nullptr, " cpack [options]" },
{ nullptr, nullptr }
// clang-format on
};
-static const char* cmDocumentationOptions[][2] = {
+const char* cmDocumentationOptions[][2] = {
{ "-G <generators>", "Override/define CPACK_GENERATOR" },
{ "-C <Configuration>", "Specify the project configuration" },
{ "-D <var>=<value>", "Set a CPack variable." },
@@ -90,10 +90,11 @@ int cpackDefinitionArgument(const char* argument, const char* cValue,
return 1;
}
-static void cpackProgressCallback(const std::string& message, float /*unused*/)
+void cpackProgressCallback(const std::string& message, float /*unused*/)
{
std::cout << "-- " << message << std::endl;
}
+} // namespace
// this is CPack.
int main(int argc, char const* const* argv)
@@ -269,7 +270,7 @@ int main(int argc, char const* const* argv)
}
if (!cpackBuildConfig.empty()) {
- globalMF.AddDefinition("CPACK_BUILD_CONFIG", cpackBuildConfig.c_str());
+ globalMF.AddDefinition("CPACK_BUILD_CONFIG", cpackBuildConfig);
}
if (cmSystemTools::FileExists(cpackConfigFile)) {
@@ -291,24 +292,21 @@ int main(int argc, char const* const* argv)
}
if (!generator.empty()) {
- globalMF.AddDefinition("CPACK_GENERATOR", generator.c_str());
+ globalMF.AddDefinition("CPACK_GENERATOR", generator);
}
if (!cpackProjectName.empty()) {
- globalMF.AddDefinition("CPACK_PACKAGE_NAME", cpackProjectName.c_str());
+ globalMF.AddDefinition("CPACK_PACKAGE_NAME", cpackProjectName);
}
if (!cpackProjectVersion.empty()) {
- globalMF.AddDefinition("CPACK_PACKAGE_VERSION",
- cpackProjectVersion.c_str());
+ globalMF.AddDefinition("CPACK_PACKAGE_VERSION", cpackProjectVersion);
}
if (!cpackProjectVendor.empty()) {
- globalMF.AddDefinition("CPACK_PACKAGE_VENDOR",
- cpackProjectVendor.c_str());
+ globalMF.AddDefinition("CPACK_PACKAGE_VENDOR", cpackProjectVendor);
}
// if this is not empty it has been set on the command line
// go for it. Command line override values set in config file.
if (!cpackProjectDirectory.empty()) {
- globalMF.AddDefinition("CPACK_PACKAGE_DIRECTORY",
- cpackProjectDirectory.c_str());
+ globalMF.AddDefinition("CPACK_PACKAGE_DIRECTORY", cpackProjectDirectory);
}
// The value has not been set on the command line
else {
@@ -317,11 +315,11 @@ int main(int argc, char const* const* argv)
// use default value iff no value has been provided by the config file
if (!globalMF.IsSet("CPACK_PACKAGE_DIRECTORY")) {
globalMF.AddDefinition("CPACK_PACKAGE_DIRECTORY",
- cpackProjectDirectory.c_str());
+ cpackProjectDirectory);
}
}
for (auto const& cd : definitions.Map) {
- globalMF.AddDefinition(cd.first, cd.second.c_str());
+ globalMF.AddDefinition(cd.first, cd.second);
}
const char* cpackModulesPath = globalMF.GetDefinition("CPACK_MODULE_PATH");
@@ -425,7 +423,7 @@ int main(int argc, char const* const* argv)
std::ostringstream ostr;
ostr << projVersionMajor << "." << projVersionMinor << "."
<< projVersionPatch;
- mf->AddDefinition("CPACK_PACKAGE_VERSION", ostr.str().c_str());
+ mf->AddDefinition("CPACK_PACKAGE_VERSION", ostr.str());
}
int res = cpackGenerator->DoPackage();
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index 9ad9669..3aea1f4 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -76,6 +76,11 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
if (config) {
args.push_back("-DCMAKE_BUILD_TYPE:STRING=" + std::string(config));
}
+ if (!this->BuildMakeProgram.empty() &&
+ (this->BuildGenerator.find("Make") != std::string::npos ||
+ this->BuildGenerator.find("Ninja") != std::string::npos)) {
+ args.push_back("-DCMAKE_MAKE_PROGRAM:FILEPATH=" + this->BuildMakeProgram);
+ }
for (std::string const& opt : this->BuildOptions) {
args.push_back(opt);
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx
index 2eacaf1..e71eafe 100644
--- a/Source/CTest/cmCTestBuildCommand.cxx
+++ b/Source/CTest/cmCTestBuildCommand.cxx
@@ -156,15 +156,14 @@ bool cmCTestBuildCommand::InitialPass(std::vector<std::string> const& args,
if (this->Values[ctb_NUMBER_ERRORS] && *this->Values[ctb_NUMBER_ERRORS]) {
std::ostringstream str;
str << this->Handler->GetTotalErrors();
- this->Makefile->AddDefinition(this->Values[ctb_NUMBER_ERRORS],
- str.str().c_str());
+ this->Makefile->AddDefinition(this->Values[ctb_NUMBER_ERRORS], str.str());
}
if (this->Values[ctb_NUMBER_WARNINGS] &&
*this->Values[ctb_NUMBER_WARNINGS]) {
std::ostringstream str;
str << this->Handler->GetTotalWarnings();
this->Makefile->AddDefinition(this->Values[ctb_NUMBER_WARNINGS],
- str.str().c_str());
+ str.str());
}
return ret;
}
diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h
index 77b0549..a62c301 100644
--- a/Source/CTest/cmCTestBuildCommand.h
+++ b/Source/CTest/cmCTestBuildCommand.h
@@ -6,13 +6,16 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmCTestHandlerCommand.h"
+#include "cmCommand.h"
#include <string>
+#include <utility>
#include <vector>
+#include "cm_memory.hxx"
+
class cmCTestBuildHandler;
class cmCTestGenericHandler;
-class cmCommand;
class cmExecutionStatus;
class cmGlobalGenerator;
@@ -30,12 +33,12 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- cmCTestBuildCommand* ni = new cmCTestBuildCommand;
+ auto ni = cm::make_unique<cmCTestBuildCommand>();
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
- return ni;
+ return std::unique_ptr<cmCommand>(std::move(ni));
}
/**
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index c8e4fa1..407e9f8 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -9,6 +9,7 @@
#include "cmGeneratedFileStream.h"
#include "cmMakefile.h"
#include "cmProcessOutput.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
diff --git a/Source/CTest/cmCTestConfigureCommand.h b/Source/CTest/cmCTestConfigureCommand.h
index 0cbcbfa..4677c83 100644
--- a/Source/CTest/cmCTestConfigureCommand.h
+++ b/Source/CTest/cmCTestConfigureCommand.h
@@ -6,11 +6,14 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmCTestHandlerCommand.h"
+#include "cmCommand.h"
#include <string>
+#include <utility>
+
+#include "cm_memory.hxx"
class cmCTestGenericHandler;
-class cmCommand;
/** \class cmCTestConfigure
* \brief Run a ctest script
@@ -25,12 +28,12 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- cmCTestConfigureCommand* ni = new cmCTestConfigureCommand;
+ auto ni = cm::make_unique<cmCTestConfigureCommand>();
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
- return ni;
+ return std::unique_ptr<cmCommand>(std::move(ni));
}
/**
diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h
index 1ae2d86..08f31f7 100644
--- a/Source/CTest/cmCTestCoverageCommand.h
+++ b/Source/CTest/cmCTestCoverageCommand.h
@@ -6,12 +6,15 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmCTestHandlerCommand.h"
+#include "cmCommand.h"
#include <set>
#include <string>
+#include <utility>
+
+#include "cm_memory.hxx"
class cmCTestGenericHandler;
-class cmCommand;
/** \class cmCTestCoverage
* \brief Run a ctest script
@@ -26,12 +29,12 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- cmCTestCoverageCommand* ni = new cmCTestCoverageCommand;
+ auto ni = cm::make_unique<cmCTestCoverageCommand>();
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
- return ni;
+ return std::unique_ptr<cmCommand>(std::move(ni));
}
/**
diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
index 9425ece..84250cb 100644
--- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
+++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
@@ -6,11 +6,14 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmCTestCommand.h"
+#include "cmCommand.h"
#include <string>
+#include <utility>
#include <vector>
-class cmCommand;
+#include "cm_memory.hxx"
+
class cmExecutionStatus;
/** \class cmCTestEmptyBinaryDirectory
@@ -27,13 +30,12 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- cmCTestEmptyBinaryDirectoryCommand* ni =
- new cmCTestEmptyBinaryDirectoryCommand;
+ auto ni = cm::make_unique<cmCTestEmptyBinaryDirectoryCommand>();
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
- return ni;
+ return std::unique_ptr<cmCommand>(std::move(ni));
}
/**
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 9d9761c..093017c 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -10,11 +10,11 @@
#include <time.h>
#include <vector>
-#include "cmAlgorithms.h"
#include "cmCTest.h"
#include "cmCTestVC.h"
#include "cmProcessOutput.h"
#include "cmProcessTools.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
static unsigned int cmCTestGITVersion(unsigned int epic, unsigned int major,
diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx
index adf9553..8ceca08 100644
--- a/Source/CTest/cmCTestHandlerCommand.cxx
+++ b/Source/CTest/cmCTestHandlerCommand.cxx
@@ -4,6 +4,7 @@
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmSystemTools.h"
@@ -13,8 +14,6 @@
#include <sstream>
#include <stdlib.h>
-class cmExecutionStatus;
-
cmCTestHandlerCommand::cmCTestHandlerCommand()
{
const size_t INIT_SIZE = 100;
@@ -86,7 +85,7 @@ private:
}
bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& /*unused*/)
+ cmExecutionStatus& status)
{
// save error state and restore it if needed
SaveRestoreErrorState errorState;
@@ -113,20 +112,20 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
foundBadArgument = true;
}
}
- bool capureCMakeError = (this->Values[ct_CAPTURE_CMAKE_ERROR] &&
- *this->Values[ct_CAPTURE_CMAKE_ERROR]);
+ bool captureCMakeError = (this->Values[ct_CAPTURE_CMAKE_ERROR] &&
+ *this->Values[ct_CAPTURE_CMAKE_ERROR]);
// now that arguments are parsed check to see if there is a
// CAPTURE_CMAKE_ERROR specified let the errorState object know.
- if (capureCMakeError) {
+ if (captureCMakeError) {
errorState.CaptureCMakeError();
}
// if we found a bad argument then exit before running command
if (foundBadArgument) {
// store the cmake error
- if (capureCMakeError) {
+ if (captureCMakeError) {
this->Makefile->AddDefinition(this->Values[ct_CAPTURE_CMAKE_ERROR],
"-1");
- std::string const err = this->GetName() + " " + this->GetError();
+ std::string const err = this->GetName() + " " + status.GetError();
if (!cmSystemTools::FindLastString(err.c_str(), "unknown error.")) {
cmCTestLog(this->CTest, ERROR_MESSAGE, err << " error from command\n");
}
@@ -192,11 +191,11 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot instantiate test handler " << this->GetName()
<< std::endl);
- if (capureCMakeError) {
+ if (captureCMakeError) {
this->Makefile->AddDefinition(this->Values[ct_CAPTURE_CMAKE_ERROR],
"-1");
- const char* err = this->GetError();
- if (err && !cmSystemTools::FindLastString(err, "unknown error.")) {
+ std::string const& err = status.GetError();
+ if (!cmSystemTools::FindLastString(err.c_str(), "unknown error.")) {
cmCTestLog(this->CTest, ERROR_MESSAGE, err << " error from command\n");
}
return true;
@@ -216,11 +215,11 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
this->SetError("failed to change directory to " +
this->CTest->GetCTestConfiguration("BuildDirectory") +
" : " + std::strerror(workdir.GetLastResult()));
- if (capureCMakeError) {
+ if (captureCMakeError) {
this->Makefile->AddDefinition(this->Values[ct_CAPTURE_CMAKE_ERROR],
"-1");
cmCTestLog(this->CTest, ERROR_MESSAGE,
- this->GetName() << " " << this->GetError() << "\n");
+ this->GetName() << " " << status.GetError() << "\n");
// return success because failure is recorded in CAPTURE_CMAKE_ERROR
return true;
}
@@ -231,19 +230,18 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
if (this->Values[ct_RETURN_VALUE] && *this->Values[ct_RETURN_VALUE]) {
std::ostringstream str;
str << res;
- this->Makefile->AddDefinition(this->Values[ct_RETURN_VALUE],
- str.str().c_str());
+ this->Makefile->AddDefinition(this->Values[ct_RETURN_VALUE], str.str());
}
this->ProcessAdditionalValues(handler);
// log the error message if there was an error
- if (capureCMakeError) {
+ if (captureCMakeError) {
const char* returnString = "0";
if (cmSystemTools::GetErrorOccuredFlag()) {
returnString = "-1";
- const char* err = this->GetError();
+ std::string const& err = status.GetError();
// print out the error if it is not "unknown error" which means
// there was no message
- if (err && !cmSystemTools::FindLastString(err, "unknown error.")) {
+ if (!cmSystemTools::FindLastString(err.c_str(), "unknown error.")) {
cmCTestLog(this->CTest, ERROR_MESSAGE, err);
}
}
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index a96513e..237ca82 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -6,7 +6,6 @@
#include "cmsys/Process.h"
#include "cmsys/RegularExpression.hxx"
#include <iostream>
-#include <memory> // IWYU pragma: keep
#include <stdlib.h>
#include <string.h>
diff --git a/Source/CTest/cmCTestMemCheckCommand.cxx b/Source/CTest/cmCTestMemCheckCommand.cxx
index 7dad1ce..d7d42bf 100644
--- a/Source/CTest/cmCTestMemCheckCommand.cxx
+++ b/Source/CTest/cmCTestMemCheckCommand.cxx
@@ -3,7 +3,6 @@
#include "cmCTestMemCheckCommand.h"
#include <sstream>
-#include <string>
#include <vector>
#include "cmCTest.h"
@@ -47,7 +46,6 @@ void cmCTestMemCheckCommand::ProcessAdditionalValues(
if (this->Values[ctm_DEFECT_COUNT] && *this->Values[ctm_DEFECT_COUNT]) {
std::ostringstream str;
str << static_cast<cmCTestMemCheckHandler*>(handler)->GetDefectCount();
- this->Makefile->AddDefinition(this->Values[ctm_DEFECT_COUNT],
- str.str().c_str());
+ this->Makefile->AddDefinition(this->Values[ctm_DEFECT_COUNT], str.str());
}
}
diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h
index b6b3c40..837a687 100644
--- a/Source/CTest/cmCTestMemCheckCommand.h
+++ b/Source/CTest/cmCTestMemCheckCommand.h
@@ -5,10 +5,14 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <utility>
+
+#include "cm_memory.hxx"
+
#include "cmCTestTestCommand.h"
+#include "cmCommand.h"
class cmCTestGenericHandler;
-class cmCommand;
/** \class cmCTestMemCheck
* \brief Run a ctest script
@@ -23,12 +27,12 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- cmCTestMemCheckCommand* ni = new cmCTestMemCheckCommand;
+ auto ni = cm::make_unique<cmCTestMemCheckCommand>();
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
- return ni;
+ return std::unique_ptr<cmCommand>(std::move(ni));
}
protected:
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index ef63073..42534f7 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -29,11 +29,13 @@
#include <iostream>
#include <list>
#include <math.h>
+#include <memory>
#include <sstream>
#include <stack>
#include <stdlib.h>
#include <unordered_map>
#include <utility>
+#include <vector>
namespace cmsys {
class RegularExpression;
@@ -821,6 +823,11 @@ static Json::Value DumpCTestProperties(
"FAIL_REGULAR_EXPRESSION",
DumpRegExToJsonArray(testProperties.ErrorRegularExpressions)));
}
+ if (!testProperties.SkipRegularExpressions.empty()) {
+ properties.append(DumpCTestProperty(
+ "SKIP_REGULAR_EXPRESSION",
+ DumpRegExToJsonArray(testProperties.SkipRegularExpressions)));
+ }
if (!testProperties.FixturesCleanup.empty()) {
properties.append(DumpCTestProperty(
"FIXTURES_CLEANUP", DumpToJsonArray(testProperties.FixturesCleanup)));
diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h
index ba25c51..db2ac5e 100644
--- a/Source/CTest/cmCTestReadCustomFilesCommand.h
+++ b/Source/CTest/cmCTestReadCustomFilesCommand.h
@@ -6,11 +6,14 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmCTestCommand.h"
+#include "cmCommand.h"
#include <string>
+#include <utility>
#include <vector>
-class cmCommand;
+#include "cm_memory.hxx"
+
class cmExecutionStatus;
/** \class cmCTestReadCustomFiles
@@ -27,11 +30,11 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- cmCTestReadCustomFilesCommand* ni = new cmCTestReadCustomFilesCommand;
+ auto ni = cm::make_unique<cmCTestReadCustomFilesCommand>();
ni->CTest = this->CTest;
- return ni;
+ return std::unique_ptr<cmCommand>(std::move(ni));
}
/**
diff --git a/Source/CTest/cmCTestRunScriptCommand.cxx b/Source/CTest/cmCTestRunScriptCommand.cxx
index a7e47d3..c03cffd 100644
--- a/Source/CTest/cmCTestRunScriptCommand.cxx
+++ b/Source/CTest/cmCTestRunScriptCommand.cxx
@@ -43,7 +43,7 @@ bool cmCTestRunScriptCommand::InitialPass(std::vector<std::string> const& args,
args[i].c_str(), !np, &ret);
std::ostringstream str;
str << ret;
- this->Makefile->AddDefinition(returnVariable, str.str().c_str());
+ this->Makefile->AddDefinition(returnVariable, str.str());
}
}
return true;
diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h
index 9d8b4b5..6961f6e 100644
--- a/Source/CTest/cmCTestRunScriptCommand.h
+++ b/Source/CTest/cmCTestRunScriptCommand.h
@@ -6,11 +6,14 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmCTestCommand.h"
+#include "cmCommand.h"
#include <string>
+#include <utility>
#include <vector>
-class cmCommand;
+#include "cm_memory.hxx"
+
class cmExecutionStatus;
/** \class cmCTestRunScript
@@ -27,12 +30,12 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- cmCTestRunScriptCommand* ni = new cmCTestRunScriptCommand;
+ auto ni = cm::make_unique<cmCTestRunScriptCommand>();
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
- return ni;
+ return std::unique_ptr<cmCommand>(std::move(ni));
}
/**
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 31976b9..65cf646 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -11,7 +11,6 @@
#include "cmsys/RegularExpression.hxx"
#include <chrono>
-#include <cmAlgorithms.h>
#include <cstdint>
#include <cstring>
#include <iomanip>
@@ -20,6 +19,8 @@
#include <stdio.h>
#include <utility>
+#include "cm_memory.hxx"
+
cmCTestRunTest::cmCTestRunTest(cmCTestMultiProcessHandler& multiHandler)
: MultiTestHandler(multiHandler)
{
@@ -76,6 +77,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
}
std::int64_t retVal = this->TestProcess->GetExitValue();
bool forceFail = false;
+ bool forceSkip = false;
bool skipped = false;
bool outputTestErrorsToConsole = false;
if (!this->TestProperties->RequiredRegularExpressions.empty() &&
@@ -85,43 +87,64 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
if (pass.first.find(this->ProcessOutput)) {
found = true;
reason = "Required regular expression found.";
+ reason += " Regex=[";
+ reason += pass.second;
+ reason += "]";
break;
}
}
if (!found) {
reason = "Required regular expression not found.";
+ reason += " Regex=[";
+ for (auto& pass : this->TestProperties->RequiredRegularExpressions) {
+ reason += pass.second;
+ reason += "\n";
+ }
+ reason += "]";
forceFail = true;
}
- reason += "Regex=[";
- for (auto& pass : this->TestProperties->RequiredRegularExpressions) {
- reason += pass.second;
- reason += "\n";
- }
- reason += "]";
}
if (!this->TestProperties->ErrorRegularExpressions.empty() &&
this->FailedDependencies.empty()) {
- for (auto& pass : this->TestProperties->ErrorRegularExpressions) {
- if (pass.first.find(this->ProcessOutput)) {
+ for (auto& fail : this->TestProperties->ErrorRegularExpressions) {
+ if (fail.first.find(this->ProcessOutput)) {
reason = "Error regular expression found in output.";
reason += " Regex=[";
- reason += pass.second;
+ reason += fail.second;
reason += "]";
forceFail = true;
break;
}
}
}
+ if (!this->TestProperties->SkipRegularExpressions.empty() &&
+ this->FailedDependencies.empty()) {
+ for (auto& skip : this->TestProperties->SkipRegularExpressions) {
+ if (skip.first.find(this->ProcessOutput)) {
+ reason = "Skip regular expression found in output.";
+ reason += " Regex=[";
+ reason += skip.second;
+ reason += "]";
+ forceSkip = true;
+ break;
+ }
+ }
+ }
std::ostringstream outputStream;
if (res == cmProcess::State::Exited) {
bool success = !forceFail &&
(retVal == 0 ||
!this->TestProperties->RequiredRegularExpressions.empty());
- if (this->TestProperties->SkipReturnCode >= 0 &&
- this->TestProperties->SkipReturnCode == retVal) {
+ if ((this->TestProperties->SkipReturnCode >= 0 &&
+ this->TestProperties->SkipReturnCode == retVal) ||
+ forceSkip) {
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
std::ostringstream s;
- s << "SKIP_RETURN_CODE=" << this->TestProperties->SkipReturnCode;
+ if (forceSkip) {
+ s << "SKIP_REGULAR_EXPRESSION_MATCHED";
+ } else {
+ s << "SKIP_RETURN_CODE=" << this->TestProperties->SkipReturnCode;
+ }
this->TestResult.CompletionStatus = s.str();
cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Skipped ");
skipped = true;
diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h
index 38cc417..43dfe8e 100644
--- a/Source/CTest/cmCTestRunTest.h
+++ b/Source/CTest/cmCTestRunTest.h
@@ -5,6 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <memory>
#include <set>
#include <stddef.h>
#include <string>
@@ -12,7 +13,7 @@
#include "cmCTestTestHandler.h"
#include "cmDuration.h"
-#include "cmProcess.h" // IWYU pragma: keep (for unique_ptr)
+#include "cmProcess.h"
class cmCTest;
class cmCTestMultiProcessHandler;
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index a739f44..7a5b8d1 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -4,13 +4,8 @@
#include "cmsys/Directory.hxx"
#include "cmsys/Process.h"
-#include <map>
-#include <ratio>
-#include <sstream>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <utility>
+
+#include "cm_memory.hxx"
#include "cmCTest.h"
#include "cmCTestBuildCommand.h"
@@ -27,6 +22,7 @@
#include "cmCTestTestCommand.h"
#include "cmCTestUpdateCommand.h"
#include "cmCTestUploadCommand.h"
+#include "cmCommand.h"
#include "cmDuration.h"
#include "cmFunctionBlocker.h"
#include "cmGeneratedFileStream.h"
@@ -38,6 +34,15 @@
#include "cmSystemTools.h"
#include "cmake.h"
+#include <map>
+#include <memory>
+#include <ratio>
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <utility>
+
#ifdef _WIN32
# include <windows.h>
#else
@@ -163,16 +168,16 @@ void cmCTestScriptHandler::UpdateElapsedTime()
auto itime = cmDurationTo<unsigned int>(std::chrono::steady_clock::now() -
this->ScriptStartTime);
auto timeString = std::to_string(itime);
- this->Makefile->AddDefinition("CTEST_ELAPSED_TIME", timeString.c_str());
+ this->Makefile->AddDefinition("CTEST_ELAPSED_TIME", timeString);
}
}
-void cmCTestScriptHandler::AddCTestCommand(std::string const& name,
- cmCTestCommand* command)
+void cmCTestScriptHandler::AddCTestCommand(
+ std::string const& name, std::unique_ptr<cmCTestCommand> command)
{
command->CTest = this->CTest;
command->CTestScriptHandler = this;
- this->CMake->GetState()->AddBuiltinCommand(name, command);
+ this->CMake->GetState()->AddBuiltinCommand(name, std::move(command));
}
int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
@@ -295,21 +300,28 @@ void cmCTestScriptHandler::CreateCMake()
}
});
- this->AddCTestCommand("ctest_build", new cmCTestBuildCommand);
- this->AddCTestCommand("ctest_configure", new cmCTestConfigureCommand);
- this->AddCTestCommand("ctest_coverage", new cmCTestCoverageCommand);
+ this->AddCTestCommand("ctest_build", cm::make_unique<cmCTestBuildCommand>());
+ this->AddCTestCommand("ctest_configure",
+ cm::make_unique<cmCTestConfigureCommand>());
+ this->AddCTestCommand("ctest_coverage",
+ cm::make_unique<cmCTestCoverageCommand>());
this->AddCTestCommand("ctest_empty_binary_directory",
- new cmCTestEmptyBinaryDirectoryCommand);
- this->AddCTestCommand("ctest_memcheck", new cmCTestMemCheckCommand);
+ cm::make_unique<cmCTestEmptyBinaryDirectoryCommand>());
+ this->AddCTestCommand("ctest_memcheck",
+ cm::make_unique<cmCTestMemCheckCommand>());
this->AddCTestCommand("ctest_read_custom_files",
- new cmCTestReadCustomFilesCommand);
- this->AddCTestCommand("ctest_run_script", new cmCTestRunScriptCommand);
- this->AddCTestCommand("ctest_sleep", new cmCTestSleepCommand);
- this->AddCTestCommand("ctest_start", new cmCTestStartCommand);
- this->AddCTestCommand("ctest_submit", new cmCTestSubmitCommand);
- this->AddCTestCommand("ctest_test", new cmCTestTestCommand);
- this->AddCTestCommand("ctest_update", new cmCTestUpdateCommand);
- this->AddCTestCommand("ctest_upload", new cmCTestUploadCommand);
+ cm::make_unique<cmCTestReadCustomFilesCommand>());
+ this->AddCTestCommand("ctest_run_script",
+ cm::make_unique<cmCTestRunScriptCommand>());
+ this->AddCTestCommand("ctest_sleep", cm::make_unique<cmCTestSleepCommand>());
+ this->AddCTestCommand("ctest_start", cm::make_unique<cmCTestStartCommand>());
+ this->AddCTestCommand("ctest_submit",
+ cm::make_unique<cmCTestSubmitCommand>());
+ this->AddCTestCommand("ctest_test", cm::make_unique<cmCTestTestCommand>());
+ this->AddCTestCommand("ctest_update",
+ cm::make_unique<cmCTestUpdateCommand>());
+ this->AddCTestCommand("ctest_upload",
+ cm::make_unique<cmCTestUploadCommand>());
}
// this sets up some variables for the script to use, creates the required
@@ -340,21 +352,21 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
this->CreateCMake();
// set a variable with the path to the current script
- this->Makefile->AddDefinition(
- "CTEST_SCRIPT_DIRECTORY", cmSystemTools::GetFilenamePath(script).c_str());
- this->Makefile->AddDefinition(
- "CTEST_SCRIPT_NAME", cmSystemTools::GetFilenameName(script).c_str());
+ this->Makefile->AddDefinition("CTEST_SCRIPT_DIRECTORY",
+ cmSystemTools::GetFilenamePath(script));
+ this->Makefile->AddDefinition("CTEST_SCRIPT_NAME",
+ cmSystemTools::GetFilenameName(script));
this->Makefile->AddDefinition("CTEST_EXECUTABLE_NAME",
- cmSystemTools::GetCTestCommand().c_str());
+ cmSystemTools::GetCTestCommand());
this->Makefile->AddDefinition("CMAKE_EXECUTABLE_NAME",
- cmSystemTools::GetCMakeCommand().c_str());
- this->Makefile->AddDefinition("CTEST_RUN_CURRENT_SCRIPT", true);
+ cmSystemTools::GetCMakeCommand());
+ this->Makefile->AddDefinitionBool("CTEST_RUN_CURRENT_SCRIPT", true);
this->SetRunCurrentScript(true);
this->UpdateElapsedTime();
// add the script arg if defined
if (!script_arg.empty()) {
- this->Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg.c_str());
+ this->Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg);
}
#if defined(__CYGWIN__)
@@ -362,9 +374,11 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
#endif
// always add a function blocker to update the elapsed time
- cmCTestScriptFunctionBlocker* f = new cmCTestScriptFunctionBlocker();
- f->CTestScriptHandler = this;
- this->Makefile->AddFunctionBlocker(f);
+ {
+ auto fb = cm::make_unique<cmCTestScriptFunctionBlocker>();
+ fb->CTestScriptHandler = this;
+ this->Makefile->AddFunctionBlocker(std::move(fb));
+ }
/* Execute CTestScriptMode.cmake, which loads CMakeDetermineSystem and
CMakeSystemSpecificInformation, so
@@ -384,7 +398,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
const std::map<std::string, std::string>& defs =
this->CTest->GetDefinitions();
for (auto const& d : defs) {
- this->Makefile->AddDefinition(d.first, d.second.c_str());
+ this->Makefile->AddDefinition(d.first, d.second);
}
// finally read in the script
diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h
index d93b5f8..b2e8cbf 100644
--- a/Source/CTest/cmCTestScriptHandler.h
+++ b/Source/CTest/cmCTestScriptHandler.h
@@ -9,6 +9,7 @@
#include "cmDuration.h"
#include <chrono>
+#include <memory>
#include <string>
#include <vector>
@@ -131,7 +132,8 @@ private:
int RunConfigurationDashboard();
// Add ctest command
- void AddCTestCommand(std::string const& name, cmCTestCommand* command);
+ void AddCTestCommand(std::string const& name,
+ std::unique_ptr<cmCTestCommand> command);
// Try to remove the binary directory once
static bool TryToRemoveBinaryDirectoryOnce(const std::string& directoryPath);
diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h
index 5cd185a..7b17081 100644
--- a/Source/CTest/cmCTestSleepCommand.h
+++ b/Source/CTest/cmCTestSleepCommand.h
@@ -6,11 +6,14 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmCTestCommand.h"
+#include "cmCommand.h"
#include <string>
+#include <utility>
#include <vector>
-class cmCommand;
+#include "cm_memory.hxx"
+
class cmExecutionStatus;
/** \class cmCTestSleep
@@ -27,12 +30,12 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- cmCTestSleepCommand* ni = new cmCTestSleepCommand;
+ auto ni = cm::make_unique<cmCTestSleepCommand>();
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
- return ni;
+ return std::unique_ptr<cmCommand>(std::move(ni));
}
/**
diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h
index 542f27c..7c71f36 100644
--- a/Source/CTest/cmCTestStartCommand.h
+++ b/Source/CTest/cmCTestStartCommand.h
@@ -6,12 +6,15 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmCTestCommand.h"
+#include "cmCommand.h"
#include <iosfwd>
#include <string>
+#include <utility>
#include <vector>
-class cmCommand;
+#include "cm_memory.hxx"
+
class cmExecutionStatus;
/** \class cmCTestStart
@@ -27,14 +30,14 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- cmCTestStartCommand* ni = new cmCTestStartCommand;
+ auto ni = cm::make_unique<cmCTestStartCommand>();
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
ni->CreateNewTag = this->CreateNewTag;
ni->Quiet = this->Quiet;
- return ni;
+ return std::unique_ptr<cmCommand>(std::move(ni));
}
/**
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index afc3e67..58c0a1b 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -4,11 +4,15 @@
#include "cmCTest.h"
#include "cmCTestSubmitHandler.h"
+#include "cmCommand.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmSystemTools.h"
#include <sstream>
+#include <utility>
+
+#include "cm_memory.hxx"
class cmExecutionStatus;
@@ -27,12 +31,12 @@ cmCTestSubmitCommand::cmCTestSubmitCommand()
/**
* This is a virtual constructor for the command.
*/
-cmCommand* cmCTestSubmitCommand::Clone()
+std::unique_ptr<cmCommand> cmCTestSubmitCommand::Clone()
{
- cmCTestSubmitCommand* ni = new cmCTestSubmitCommand;
+ auto ni = cm::make_unique<cmCTestSubmitCommand>();
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
- return ni;
+ return std::unique_ptr<cmCommand>(std::move(ni));
}
cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
@@ -139,7 +143,7 @@ bool cmCTestSubmitCommand::InitialPass(std::vector<std::string> const& args,
if (this->Values[cts_BUILD_ID] && *this->Values[cts_BUILD_ID]) {
this->Makefile->AddDefinition(this->Values[cts_BUILD_ID],
- this->CTest->GetBuildID().c_str());
+ this->CTest->GetBuildID());
}
return ret;
diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h
index 1e27046..5bbcd39 100644
--- a/Source/CTest/cmCTestSubmitCommand.h
+++ b/Source/CTest/cmCTestSubmitCommand.h
@@ -8,12 +8,13 @@
#include "cmCTest.h"
#include "cmCTestHandlerCommand.h"
+#include <memory>
#include <set>
#include <string>
#include <vector>
-class cmCTestGenericHandler;
class cmCommand;
+class cmCTestGenericHandler;
class cmExecutionStatus;
/** \class cmCTestSubmit
@@ -26,7 +27,7 @@ class cmCTestSubmitCommand : public cmCTestHandlerCommand
{
public:
cmCTestSubmitCommand();
- cmCommand* Clone() override;
+ std::unique_ptr<cmCommand> Clone() override;
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 54c4bae..2c6ff83 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -19,6 +19,7 @@
#include "cmDuration.h"
#include "cmGeneratedFileStream.h"
#include "cmState.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmXMLParser.h"
#include "cmake.h"
diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h
index 11c0db9..d74136c 100644
--- a/Source/CTest/cmCTestTestCommand.h
+++ b/Source/CTest/cmCTestTestCommand.h
@@ -6,11 +6,14 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmCTestHandlerCommand.h"
+#include "cmCommand.h"
#include <string>
+#include <utility>
+
+#include "cm_memory.hxx"
class cmCTestGenericHandler;
-class cmCommand;
/** \class cmCTestTest
* \brief Run a ctest script
@@ -25,12 +28,12 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- cmCTestTestCommand* ni = new cmCTestTestCommand;
+ auto ni = cm::make_unique<cmCTestTestCommand>();
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
- return ni;
+ return std::unique_ptr<cmCommand>(std::move(ni));
}
/**
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 0ed56c8..67c24ca 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -11,14 +11,15 @@
#include <functional>
#include <iomanip>
#include <iterator>
-#include <memory> // IWYU pragma: keep
#include <set>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
+#include <utility>
+
+#include "cm_memory.hxx"
-#include "cmAlgorithms.h"
#include "cmCTest.h"
#include "cmCTestMultiProcessHandler.h"
#include "cmCommand.h"
@@ -28,6 +29,7 @@
#include "cmMakefile.h"
#include "cmState.h"
#include "cmStateSnapshot.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmWorkingDirectory.h"
#include "cmXMLWriter.h"
@@ -43,11 +45,11 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- cmCTestSubdirCommand* c = new cmCTestSubdirCommand;
+ auto c = cm::make_unique<cmCTestSubdirCommand>();
c->TestHandler = this->TestHandler;
- return c;
+ return std::unique_ptr<cmCommand>(std::move(c));
}
/**
@@ -122,11 +124,11 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- cmCTestAddSubdirectoryCommand* c = new cmCTestAddSubdirectoryCommand;
+ auto c = cm::make_unique<cmCTestAddSubdirectoryCommand>();
c->TestHandler = this->TestHandler;
- return c;
+ return std::unique_ptr<cmCommand>(std::move(c));
}
/**
@@ -187,11 +189,11 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- cmCTestAddTestCommand* c = new cmCTestAddTestCommand;
+ auto c = cm::make_unique<cmCTestAddTestCommand>();
c->TestHandler = this->TestHandler;
- return c;
+ return std::unique_ptr<cmCommand>(std::move(c));
}
/**
@@ -220,11 +222,11 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- cmCTestSetTestsPropertiesCommand* c = new cmCTestSetTestsPropertiesCommand;
+ auto c = cm::make_unique<cmCTestSetTestsPropertiesCommand>();
c->TestHandler = this->TestHandler;
- return c;
+ return std::unique_ptr<cmCommand>(std::move(c));
}
/**
@@ -249,12 +251,11 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- cmCTestSetDirectoryPropertiesCommand* c =
- new cmCTestSetDirectoryPropertiesCommand;
+ auto c = cm::make_unique<cmCTestSetDirectoryPropertiesCommand>();
c->TestHandler = this->TestHandler;
- return c;
+ return std::unique_ptr<cmCommand>(std::move(c));
}
/**
@@ -422,54 +423,11 @@ int cmCTestTestHandler::PostProcessHandler()
return 1;
}
-// clearly it would be nice if this were broken up into a few smaller
-// functions and commented...
int cmCTestTestHandler::ProcessHandler()
{
- // Update internal data structure from generic one
- this->SetTestsToRunInformation(this->GetOption("TestsToRunInformation"));
- this->SetUseUnion(cmSystemTools::IsOn(this->GetOption("UseUnion")));
- if (cmSystemTools::IsOn(this->GetOption("ScheduleRandom"))) {
- this->CTest->SetScheduleType("Random");
- }
- if (this->GetOption("ParallelLevel")) {
- this->CTest->SetParallelLevel(atoi(this->GetOption("ParallelLevel")));
- }
-
- const char* val;
- val = this->GetOption("LabelRegularExpression");
- if (val) {
- this->UseIncludeLabelRegExpFlag = true;
- this->IncludeLabelRegExp = val;
- }
- val = this->GetOption("ExcludeLabelRegularExpression");
- if (val) {
- this->UseExcludeLabelRegExpFlag = true;
- this->ExcludeLabelRegExp = val;
- }
- val = this->GetOption("IncludeRegularExpression");
- if (val) {
- this->UseIncludeRegExp();
- this->SetIncludeRegExp(val);
- }
- val = this->GetOption("ExcludeRegularExpression");
- if (val) {
- this->UseExcludeRegExp();
- this->SetExcludeRegExp(val);
- }
- val = this->GetOption("ExcludeFixtureRegularExpression");
- if (val) {
- this->ExcludeFixtureRegExp = val;
- }
- val = this->GetOption("ExcludeFixtureSetupRegularExpression");
- if (val) {
- this->ExcludeFixtureSetupRegExp = val;
- }
- val = this->GetOption("ExcludeFixtureCleanupRegularExpression");
- if (val) {
- this->ExcludeFixtureCleanupRegExp = val;
+ if (!this->ProcessOptions()) {
+ return -1;
}
- this->SetRerunFailed(cmSystemTools::IsOn(this->GetOption("RerunFailed")));
this->TestResults.clear();
@@ -489,7 +447,6 @@ int cmCTestTestHandler::ProcessHandler()
std::vector<std::string> passed;
std::vector<std::string> failed;
- int total;
// start the real time clock
auto clock_start = std::chrono::steady_clock::now();
@@ -498,9 +455,7 @@ int cmCTestTestHandler::ProcessHandler()
auto clock_finish = std::chrono::steady_clock::now();
- total = int(passed.size()) + int(failed.size());
-
- if (total == 0) {
+ if (passed.size() + failed.size() == 0) {
if (!this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels()) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"No tests were found!!!" << std::endl);
@@ -518,105 +473,192 @@ int cmCTestTestHandler::ProcessHandler()
}
}
- typedef std::set<cmCTestTestHandler::cmCTestTestResult,
- cmCTestTestResultLess>
- SetOfTests;
SetOfTests resultsSet(this->TestResults.begin(), this->TestResults.end());
std::vector<cmCTestTestHandler::cmCTestTestResult> disabledTests;
for (cmCTestTestResult const& ft : resultsSet) {
- if (cmHasLiteralPrefix(ft.CompletionStatus, "SKIP_RETURN_CODE=") ||
+ if (cmHasLiteralPrefix(ft.CompletionStatus, "SKIP_") ||
ft.CompletionStatus == "Disabled") {
disabledTests.push_back(ft);
}
}
- float percent = float(passed.size()) * 100.0f / float(total);
- if (!failed.empty() && percent > 99) {
- percent = 99;
- }
+ cmDuration durationInSecs = clock_finish - clock_start;
+ this->LogTestSummary(passed, failed, durationInSecs);
- std::string passColorCode;
- std::string failedColorCode;
- if (failed.empty()) {
- passColorCode = this->CTest->GetColorCode(cmCTest::Color::GREEN);
- } else {
- failedColorCode = this->CTest->GetColorCode(cmCTest::Color::RED);
- }
+ this->LogDisabledTests(disabledTests);
+
+ this->LogFailedTests(failed, resultsSet);
+ }
+
+ if (!this->GenerateXML()) {
+ return 1;
+ }
+
+ if (!this->PostProcessHandler()) {
+ this->LogFile = nullptr;
+ return -1;
+ }
+
+ if (!failed.empty()) {
+ this->LogFile = nullptr;
+ return -1;
+ }
+ this->LogFile = nullptr;
+ return 0;
+}
+
+bool cmCTestTestHandler::ProcessOptions()
+{
+ // Update internal data structure from generic one
+ this->SetTestsToRunInformation(this->GetOption("TestsToRunInformation"));
+ this->SetUseUnion(cmSystemTools::IsOn(this->GetOption("UseUnion")));
+ if (cmSystemTools::IsOn(this->GetOption("ScheduleRandom"))) {
+ this->CTest->SetScheduleType("Random");
+ }
+ if (this->GetOption("ParallelLevel")) {
+ this->CTest->SetParallelLevel(atoi(this->GetOption("ParallelLevel")));
+ }
+
+ const char* val;
+ val = this->GetOption("LabelRegularExpression");
+ if (val) {
+ this->UseIncludeLabelRegExpFlag = true;
+ this->IncludeLabelRegExp = val;
+ }
+ val = this->GetOption("ExcludeLabelRegularExpression");
+ if (val) {
+ this->UseExcludeLabelRegExpFlag = true;
+ this->ExcludeLabelRegExp = val;
+ }
+ val = this->GetOption("IncludeRegularExpression");
+ if (val) {
+ this->UseIncludeRegExp();
+ this->SetIncludeRegExp(val);
+ }
+ val = this->GetOption("ExcludeRegularExpression");
+ if (val) {
+ this->UseExcludeRegExp();
+ this->SetExcludeRegExp(val);
+ }
+ val = this->GetOption("ExcludeFixtureRegularExpression");
+ if (val) {
+ this->ExcludeFixtureRegExp = val;
+ }
+ val = this->GetOption("ExcludeFixtureSetupRegularExpression");
+ if (val) {
+ this->ExcludeFixtureSetupRegExp = val;
+ }
+ val = this->GetOption("ExcludeFixtureCleanupRegularExpression");
+ if (val) {
+ this->ExcludeFixtureCleanupRegExp = val;
+ }
+ this->SetRerunFailed(cmSystemTools::IsOn(this->GetOption("RerunFailed")));
+
+ return true;
+}
+
+void cmCTestTestHandler::LogTestSummary(const std::vector<std::string>& passed,
+ const std::vector<std::string>& failed,
+ const cmDuration& durationInSecs)
+{
+ std::size_t total = passed.size() + failed.size();
+
+ float percent = float(passed.size()) * 100.0f / float(total);
+ if (!failed.empty() && percent > 99) {
+ percent = 99;
+ }
+
+ std::string passColorCode;
+ std::string failedColorCode;
+ if (failed.empty()) {
+ passColorCode = this->CTest->GetColorCode(cmCTest::Color::GREEN);
+ } else {
+ failedColorCode = this->CTest->GetColorCode(cmCTest::Color::RED);
+ }
+ cmCTestLog(this->CTest, HANDLER_OUTPUT,
+ std::endl
+ << passColorCode << std::lround(percent) << "% tests passed"
+ << this->CTest->GetColorCode(cmCTest::Color::CLEAR_COLOR)
+ << ", " << failedColorCode << failed.size() << " tests failed"
+ << this->CTest->GetColorCode(cmCTest::Color::CLEAR_COLOR)
+ << " out of " << total << std::endl);
+ if ((!this->CTest->GetLabelsForSubprojects().empty() &&
+ this->CTest->GetSubprojectSummary())) {
+ this->PrintLabelOrSubprojectSummary(true);
+ }
+ if (this->CTest->GetLabelSummary()) {
+ this->PrintLabelOrSubprojectSummary(false);
+ }
+ char realBuf[1024];
+ sprintf(realBuf, "%6.2f sec", durationInSecs.count());
+ cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
+ "\nTotal Test time (real) = " << realBuf << "\n",
+ this->Quiet);
+}
+
+void cmCTestTestHandler::LogDisabledTests(
+ const std::vector<cmCTestTestResult>& disabledTests)
+{
+ if (!disabledTests.empty()) {
+ cmGeneratedFileStream ofs;
cmCTestLog(this->CTest, HANDLER_OUTPUT,
std::endl
- << passColorCode << std::lround(percent) << "% tests passed"
- << this->CTest->GetColorCode(cmCTest::Color::CLEAR_COLOR)
- << ", " << failedColorCode << failed.size() << " tests failed"
- << this->CTest->GetColorCode(cmCTest::Color::CLEAR_COLOR)
- << " out of " << total << std::endl);
- if ((!this->CTest->GetLabelsForSubprojects().empty() &&
- this->CTest->GetSubprojectSummary())) {
- this->PrintLabelOrSubprojectSummary(true);
- }
- if (this->CTest->GetLabelSummary()) {
- this->PrintLabelOrSubprojectSummary(false);
- }
- char realBuf[1024];
- cmDuration durationInSecs = clock_finish - clock_start;
- sprintf(realBuf, "%6.2f sec", durationInSecs.count());
- cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
- "\nTotal Test time (real) = " << realBuf << "\n",
- this->Quiet);
-
- if (!disabledTests.empty()) {
- cmGeneratedFileStream ofs;
- cmCTestLog(this->CTest, HANDLER_OUTPUT,
- std::endl
- << "The following tests did not run:" << std::endl);
- this->StartLogFile("TestsDisabled", ofs);
+ << "The following tests did not run:" << std::endl);
+ this->StartLogFile("TestsDisabled", ofs);
- const char* disabled_reason;
- cmCTestLog(this->CTest, HANDLER_OUTPUT,
- this->CTest->GetColorCode(cmCTest::Color::BLUE));
- for (cmCTestTestResult const& dt : disabledTests) {
- ofs << dt.TestCount << ":" << dt.Name << std::endl;
- if (dt.CompletionStatus == "Disabled") {
- disabled_reason = "Disabled";
- } else {
- disabled_reason = "Skipped";
- }
- cmCTestLog(this->CTest, HANDLER_OUTPUT,
- "\t" << std::setw(3) << dt.TestCount << " - " << dt.Name
- << " (" << disabled_reason << ")" << std::endl);
+ const char* disabled_reason;
+ cmCTestLog(this->CTest, HANDLER_OUTPUT,
+ this->CTest->GetColorCode(cmCTest::Color::BLUE));
+ for (cmCTestTestResult const& dt : disabledTests) {
+ ofs << dt.TestCount << ":" << dt.Name << std::endl;
+ if (dt.CompletionStatus == "Disabled") {
+ disabled_reason = "Disabled";
+ } else {
+ disabled_reason = "Skipped";
}
cmCTestLog(this->CTest, HANDLER_OUTPUT,
- this->CTest->GetColorCode(cmCTest::Color::CLEAR_COLOR));
+ "\t" << std::setw(3) << dt.TestCount << " - " << dt.Name
+ << " (" << disabled_reason << ")" << std::endl);
}
+ cmCTestLog(this->CTest, HANDLER_OUTPUT,
+ this->CTest->GetColorCode(cmCTest::Color::CLEAR_COLOR));
+ }
+}
- if (!failed.empty()) {
- cmGeneratedFileStream ofs;
- cmCTestLog(this->CTest, HANDLER_OUTPUT,
- std::endl
- << "The following tests FAILED:" << std::endl);
- this->StartLogFile("TestsFailed", ofs);
-
- for (cmCTestTestResult const& ft : resultsSet) {
- if (ft.Status != cmCTestTestHandler::COMPLETED &&
- !cmHasLiteralPrefix(ft.CompletionStatus, "SKIP_RETURN_CODE=") &&
- ft.CompletionStatus != "Disabled") {
- ofs << ft.TestCount << ":" << ft.Name << std::endl;
- auto testColor = cmCTest::Color::RED;
- if (this->GetTestStatus(ft) == "Not Run") {
- testColor = cmCTest::Color::YELLOW;
- }
- cmCTestLog(
- this->CTest, HANDLER_OUTPUT,
- "\t" << this->CTest->GetColorCode(testColor) << std::setw(3)
- << ft.TestCount << " - " << ft.Name << " ("
- << this->GetTestStatus(ft) << ")"
- << this->CTest->GetColorCode(cmCTest::Color::CLEAR_COLOR)
- << std::endl);
+void cmCTestTestHandler::LogFailedTests(const std::vector<std::string>& failed,
+ const SetOfTests& resultsSet)
+{
+ if (!failed.empty()) {
+ cmGeneratedFileStream ofs;
+ cmCTestLog(this->CTest, HANDLER_OUTPUT,
+ std::endl
+ << "The following tests FAILED:" << std::endl);
+ this->StartLogFile("TestsFailed", ofs);
+
+ for (cmCTestTestResult const& ft : resultsSet) {
+ if (ft.Status != cmCTestTestHandler::COMPLETED &&
+ !cmHasLiteralPrefix(ft.CompletionStatus, "SKIP_") &&
+ ft.CompletionStatus != "Disabled") {
+ ofs << ft.TestCount << ":" << ft.Name << std::endl;
+ auto testColor = cmCTest::Color::RED;
+ if (this->GetTestStatus(ft) == "Not Run") {
+ testColor = cmCTest::Color::YELLOW;
}
+ cmCTestLog(
+ this->CTest, HANDLER_OUTPUT,
+ "\t" << this->CTest->GetColorCode(testColor) << std::setw(3)
+ << ft.TestCount << " - " << ft.Name << " ("
+ << this->GetTestStatus(ft) << ")"
+ << this->CTest->GetColorCode(cmCTest::Color::CLEAR_COLOR)
+ << std::endl);
}
}
}
+}
+bool cmCTestTestHandler::GenerateXML()
+{
if (this->CTest->GetProduceXML()) {
cmGeneratedFileStream xmlfile;
if (!this->StartResultingXML(
@@ -627,23 +669,13 @@ int cmCTestTestHandler::ProcessHandler()
<< (this->MemCheck ? "memory check" : "testing")
<< " XML file" << std::endl);
this->LogFile = nullptr;
- return 1;
+ return false;
}
cmXMLWriter xml(xmlfile);
this->GenerateDartOutput(xml);
}
- if (!this->PostProcessHandler()) {
- this->LogFile = nullptr;
- return -1;
- }
-
- if (!failed.empty()) {
- this->LogFile = nullptr;
- return -1;
- }
- this->LogFile = nullptr;
- return 0;
+ return true;
}
void cmCTestTestHandler::PrintLabelOrSubprojectSummary(bool doSubProject)
@@ -1682,36 +1714,34 @@ void cmCTestTestHandler::GetListOfTests()
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm);
cmMakefile mf(&gg, cm.GetCurrentSnapshot());
- mf.AddDefinition("CTEST_CONFIGURATION_TYPE",
- this->CTest->GetConfigType().c_str());
+ mf.AddDefinition("CTEST_CONFIGURATION_TYPE", this->CTest->GetConfigType());
// Add handler for ADD_TEST
- cmCTestAddTestCommand* newCom1 = new cmCTestAddTestCommand;
+ auto newCom1 = cm::make_unique<cmCTestAddTestCommand>();
newCom1->TestHandler = this;
- cm.GetState()->AddBuiltinCommand("add_test", newCom1);
+ cm.GetState()->AddBuiltinCommand("add_test", std::move(newCom1));
// Add handler for SUBDIRS
- cmCTestSubdirCommand* newCom2 = new cmCTestSubdirCommand;
+ auto newCom2 = cm::make_unique<cmCTestSubdirCommand>();
newCom2->TestHandler = this;
- cm.GetState()->AddBuiltinCommand("subdirs", newCom2);
+ cm.GetState()->AddBuiltinCommand("subdirs", std::move(newCom2));
// Add handler for ADD_SUBDIRECTORY
- cmCTestAddSubdirectoryCommand* newCom3 = new cmCTestAddSubdirectoryCommand;
+ auto newCom3 = cm::make_unique<cmCTestAddSubdirectoryCommand>();
newCom3->TestHandler = this;
- cm.GetState()->AddBuiltinCommand("add_subdirectory", newCom3);
+ cm.GetState()->AddBuiltinCommand("add_subdirectory", std::move(newCom3));
// Add handler for SET_TESTS_PROPERTIES
- cmCTestSetTestsPropertiesCommand* newCom4 =
- new cmCTestSetTestsPropertiesCommand;
+ auto newCom4 = cm::make_unique<cmCTestSetTestsPropertiesCommand>();
newCom4->TestHandler = this;
- cm.GetState()->AddBuiltinCommand("set_tests_properties", newCom4);
+ cm.GetState()->AddBuiltinCommand("set_tests_properties", std::move(newCom4));
// Add handler for SET_DIRECTORY_PROPERTIES
cm.GetState()->RemoveBuiltinCommand("set_directory_properties");
- cmCTestSetDirectoryPropertiesCommand* newCom5 =
- new cmCTestSetDirectoryPropertiesCommand;
+ auto newCom5 = cm::make_unique<cmCTestSetDirectoryPropertiesCommand>();
newCom5->TestHandler = this;
- cm.GetState()->AddBuiltinCommand("set_directory_properties", newCom5);
+ cm.GetState()->AddBuiltinCommand("set_directory_properties",
+ std::move(newCom5));
const char* testFilename;
if (cmSystemTools::FileExists("CTestTestfile.cmake")) {
@@ -2229,6 +2259,13 @@ bool cmCTestTestHandler::SetTestsProperties(
rt.ErrorRegularExpressions.emplace_back(cr, cr);
}
}
+ if (key == "SKIP_REGULAR_EXPRESSION") {
+ std::vector<std::string> lval;
+ cmSystemTools::ExpandListArgument(val, lval);
+ for (std::string const& cr : lval) {
+ rt.SkipRegularExpressions.emplace_back(cr, cr);
+ }
+ }
if (key == "PROCESSORS") {
rt.Processors = atoi(val.c_str());
if (rt.Processors < 1) {
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 7f3f5e4..9345185 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -118,6 +118,8 @@ public:
std::vector<std::pair<cmsys::RegularExpression, std::string>>
RequiredRegularExpressions;
std::vector<std::pair<cmsys::RegularExpression, std::string>>
+ SkipRegularExpressions;
+ std::vector<std::pair<cmsys::RegularExpression, std::string>>
TimeoutRegularExpressions;
std::map<std::string, std::string> Measurements;
bool IsInBasedOnREOptions;
@@ -189,12 +191,25 @@ public:
typedef std::vector<cmCTestTestProperties> ListOfTests;
protected:
+ typedef std::set<cmCTestTestHandler::cmCTestTestResult,
+ cmCTestTestResultLess>
+ SetOfTests;
+
// compute a final test list
virtual int PreProcessHandler();
virtual int PostProcessHandler();
virtual void GenerateTestCommand(std::vector<std::string>& args, int test);
int ExecuteCommands(std::vector<std::string>& vec);
+ bool ProcessOptions();
+ void LogTestSummary(const std::vector<std::string>& passed,
+ const std::vector<std::string>& failed,
+ const cmDuration& durationInSecs);
+ void LogDisabledTests(const std::vector<cmCTestTestResult>& disabledTests);
+ void LogFailedTests(const std::vector<std::string>& failed,
+ const SetOfTests& resultsSet);
+ bool GenerateXML();
+
void WriteTestResultHeader(cmXMLWriter& xml,
cmCTestTestResult const& result);
void WriteTestResultFooter(cmXMLWriter& xml,
diff --git a/Source/CTest/cmCTestUpdateCommand.h b/Source/CTest/cmCTestUpdateCommand.h
index 3b2f3e1..55c4b80 100644
--- a/Source/CTest/cmCTestUpdateCommand.h
+++ b/Source/CTest/cmCTestUpdateCommand.h
@@ -6,11 +6,14 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmCTestHandlerCommand.h"
+#include "cmCommand.h"
#include <string>
+#include <utility>
+
+#include "cm_memory.hxx"
class cmCTestGenericHandler;
-class cmCommand;
/** \class cmCTestUpdate
* \brief Run a ctest script
@@ -25,12 +28,12 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- cmCTestUpdateCommand* ni = new cmCTestUpdateCommand;
+ auto ni = cm::make_unique<cmCTestUpdateCommand>();
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
- return ni;
+ return std::unique_ptr<cmCommand>(std::move(ni));
}
/**
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx
index 5cfc4a7..d80b5a5 100644
--- a/Source/CTest/cmCTestUpdateHandler.cxx
+++ b/Source/CTest/cmCTestUpdateHandler.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestUpdateHandler.h"
-#include "cmAlgorithms.h"
#include "cmCLocaleEnvironmentScope.h"
#include "cmCTest.h"
#include "cmCTestBZR.h"
@@ -18,9 +17,10 @@
#include "cmXMLWriter.h"
#include <chrono>
-#include <memory> // IWYU pragma: keep
#include <sstream>
+#include "cm_memory.hxx"
+
static const char* cmCTestUpdateHandlerUpdateStrings[] = {
"Unknown", "CVS", "SVN", "BZR", "GIT", "HG", "P4"
};
diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h
index 0d3b06e..2bb072f 100644
--- a/Source/CTest/cmCTestUploadCommand.h
+++ b/Source/CTest/cmCTestUploadCommand.h
@@ -6,12 +6,15 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmCTestHandlerCommand.h"
+#include "cmCommand.h"
#include <set>
#include <string>
+#include <utility>
+
+#include "cm_memory.hxx"
class cmCTestGenericHandler;
-class cmCommand;
/** \class cmCTestUpload
* \brief Run a ctest script
@@ -25,12 +28,12 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- cmCTestUploadCommand* ni = new cmCTestUploadCommand;
+ auto ni = cm::make_unique<cmCTestUploadCommand>();
ni->CTest = this->CTest;
ni->CTestScriptHandler = this->CTestScriptHandler;
- return ni;
+ return std::unique_ptr<cmCommand>(std::move(ni));
}
/**
diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx
index 0722753..881bf2d 100644
--- a/Source/CTest/cmParseGTMCoverage.cxx
+++ b/Source/CTest/cmParseGTMCoverage.cxx
@@ -1,8 +1,8 @@
#include "cmParseGTMCoverage.h"
-#include "cmAlgorithms.h"
#include "cmCTest.h"
#include "cmCTestCoverageHandler.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmsys/Directory.hxx"
diff --git a/Source/LexerParser/cmCommandArgumentParser.cxx b/Source/LexerParser/cmCommandArgumentParser.cxx
index b965b32..ae7fb42 100644
--- a/Source/LexerParser/cmCommandArgumentParser.cxx
+++ b/Source/LexerParser/cmCommandArgumentParser.cxx
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4. */
+/* A Bison parser, made by GNU Bison 3.3.2. */
/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
+ Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -40,11 +41,14 @@
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
+/* Undocumented macros, especially those whose name start with YY_,
+ are private implementation details. Do not rely on them. */
+
/* Identify Bison output. */
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "3.0.4"
+#define YYBISON_VERSION "3.3.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -67,8 +71,8 @@
#define yynerrs cmCommandArgument_yynerrs
-/* Copy the first part of user declarations. */
-#line 1 "cmCommandArgumentParser.y" /* yacc.c:339 */
+/* First part of user prologue. */
+#line 1 "cmCommandArgumentParser.y" /* yacc.c:337 */
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
@@ -130,13 +134,16 @@ static void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message);
# pragma GCC diagnostic ignored "-Wconversion"
#endif
-#line 134 "cmCommandArgumentParser.cxx" /* yacc.c:339 */
-
+#line 138 "cmCommandArgumentParser.cxx" /* yacc.c:337 */
# ifndef YY_NULLPTR
-# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULLPTR nullptr
+# if defined __cplusplus
+# if 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
# else
-# define YY_NULLPTR 0
+# define YY_NULLPTR ((void*)0)
# endif
# endif
@@ -201,9 +208,7 @@ int cmCommandArgument_yyparse (yyscan_t yyscanner);
#endif /* !YY_CMCOMMANDARGUMENT_YY_CMCOMMANDARGUMENTPARSERTOKENS_H_INCLUDED */
-/* Copy the second part of user declarations. */
-#line 207 "cmCommandArgumentParser.cxx" /* yacc.c:358 */
#ifdef short
# undef short
@@ -224,13 +229,13 @@ typedef signed char yytype_int8;
#ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 yytype_uint16;
#else
-typedef unsigned short int yytype_uint16;
+typedef unsigned short yytype_uint16;
#endif
#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16;
#else
-typedef short int yytype_int16;
+typedef short yytype_int16;
#endif
#ifndef YYSIZE_T
@@ -242,7 +247,7 @@ typedef short int yytype_int16;
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
-# define YYSIZE_T unsigned int
+# define YYSIZE_T unsigned
# endif
#endif
@@ -278,15 +283,6 @@ typedef short int yytype_int16;
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif
-#if !defined _Noreturn \
- && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-# define _Noreturn __declspec (noreturn)
-# else
-# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
-# endif
-#endif
-
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
@@ -294,7 +290,7 @@ typedef short int yytype_int16;
# define YYUSE(E) /* empty */
#endif
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
@@ -456,16 +452,16 @@ union yyalloc
/* YYNSTATES -- Number of states. */
#define YYNSTATES 33
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
- by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 269
+/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, with out-of-bounds checking. */
#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+ ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
- as returned by yylex, without out-of-bounds checking. */
+ as returned by yylex. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -513,7 +509,7 @@ static const yytype_uint8 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "cal_ENVCURLY", "cal_NCURLY",
- "cal_DCURLY", "\"$\"", "\"{\"", "\"}\"", "cal_NAME", R"("\\")",
+ "cal_DCURLY", "\"$\"", "\"{\"", "\"}\"", "cal_NAME", "\"\\\\\"",
"cal_SYMBOL", "\"@\"", "cal_ERROR", "cal_ATNAME", "$accept", "Start",
"GoalWithOptionalBackSlash", "Goal", "String", "OuterText", "Variable",
"EnvVarName", "MultipleIds", "ID", YY_NULLPTR
@@ -633,22 +629,22 @@ static const yytype_uint8 yyr2[] =
#define YYRECOVERING() (!!yyerrstatus)
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- YYPOPSTACK (yylen); \
- yystate = *yyssp; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (yyscanner, YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (0)
+#define YYBACKUP(Token, Value) \
+ do \
+ if (yychar == YYEMPTY) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ YYPOPSTACK (yylen); \
+ yystate = *yyssp; \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (yyscanner, YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+ while (0)
/* Error token number */
#define YYTERROR 1
@@ -688,38 +684,38 @@ do { \
} while (0)
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT. |
-`----------------------------------------*/
+/*-----------------------------------.
+| Print this symbol's value on YYO. |
+`-----------------------------------*/
static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
+yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
{
- FILE *yyo = yyoutput;
- YYUSE (yyo);
+ FILE *yyoutput = yyo;
+ YYUSE (yyoutput);
YYUSE (yyscanner);
if (!yyvaluep)
return;
# ifdef YYPRINT
if (yytype < YYNTOKENS)
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+ YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
# endif
YYUSE (yytype);
}
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
+/*---------------------------.
+| Print this symbol on YYO. |
+`---------------------------*/
static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
+yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
{
- YYFPRINTF (yyoutput, "%s %s (",
+ YYFPRINTF (yyo, "%s %s (",
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
- yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner);
- YYFPRINTF (yyoutput, ")");
+ yy_symbol_value_print (yyo, yytype, yyvaluep, yyscanner);
+ YYFPRINTF (yyo, ")");
}
/*------------------------------------------------------------------.
@@ -753,7 +749,7 @@ do { \
static void
yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, yyscan_t yyscanner)
{
- unsigned long int yylno = yyrline[yyrule];
+ unsigned long yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
@@ -764,7 +760,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, yyscan_t yysca
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr,
yystos[yyssp[yyi + 1 - yynrhs]],
- &(yyvsp[(yyi + 1) - (yynrhs)])
+ &yyvsp[(yyi + 1) - (yynrhs)]
, yyscanner);
YYFPRINTF (stderr, "\n");
}
@@ -868,7 +864,10 @@ yytnamerr (char *yyres, const char *yystr)
case '\\':
if (*++yyp != '\\')
goto do_not_strip_quotes;
- /* Fall through. */
+ else
+ goto append;
+
+ append:
default:
if (yyres)
yyres[yyn] = *yyp;
@@ -886,7 +885,7 @@ yytnamerr (char *yyres, const char *yystr)
if (! yyres)
return yystrlen (yystr);
- return yystpcpy (yyres, yystr) - yyres;
+ return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
}
# endif
@@ -964,10 +963,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+ yysize = yysize1;
+ else
return 2;
- yysize = yysize1;
}
}
}
@@ -979,6 +978,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
case N: \
yyformat = S; \
break
+ default: /* Avoid compiler warnings. */
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
@@ -990,9 +990,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+ yysize = yysize1;
+ else
return 2;
- yysize = yysize1;
}
if (*yymsg_alloc < yysize)
@@ -1123,23 +1124,31 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
yychar = YYEMPTY; /* Cause a token to be read. */
goto yysetstate;
+
/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
+| yynewstate -- push a new state, which is found in yystate. |
`------------------------------------------------------------*/
- yynewstate:
+yynewstate:
/* In all cases, when you get here, the value and location stacks
have just been pushed. So pushing a state here evens the stacks. */
yyssp++;
- yysetstate:
- *yyssp = yystate;
+
+/*--------------------------------------------------------------------.
+| yynewstate -- set current state (the top of the stack) to yystate. |
+`--------------------------------------------------------------------*/
+yysetstate:
+ *yyssp = (yytype_int16) yystate;
if (yyss + yystacksize - 1 <= yyssp)
+#if !defined yyoverflow && !defined YYSTACK_RELOCATE
+ goto yyexhaustedlab;
+#else
{
/* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
+ YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
-#ifdef yyoverflow
+# if defined yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
@@ -1155,14 +1164,10 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yystacksize);
-
yyss = yyss1;
yyvs = yyvs1;
}
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyexhaustedlab;
-# else
+# else /* defined YYSTACK_RELOCATE */
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab;
@@ -1178,22 +1183,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-# undef YYSTACK_RELOCATE
+# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
-#endif /* no yyoverflow */
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
+ (unsigned long) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
}
+#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -1202,11 +1207,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
goto yybackup;
+
/*-----------.
| yybackup. |
`-----------*/
yybackup:
-
/* Do appropriate processing given the current state. Read a
lookahead token if we need one and don't already have one. */
@@ -1279,7 +1284,7 @@ yydefault:
/*-----------------------------.
-| yyreduce -- Do a reduction. |
+| yyreduce -- do a reduction. |
`-----------------------------*/
yyreduce:
/* yyn is the number of a rule to reduce with. */
@@ -1300,192 +1305,192 @@ yyreduce:
switch (yyn)
{
case 2:
-#line 99 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 99 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = 0;
yyGetParser->SetResult((yyvsp[0].str));
}
-#line 1309 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1314 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 3:
-#line 105 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 105 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1317 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1322 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 4:
-#line 108 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 108 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str));
}
-#line 1325 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1330 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 5:
-#line 113 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 113 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = 0;
}
-#line 1333 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1338 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 6:
-#line 116 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 116 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str));
}
-#line 1341 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1346 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 7:
-#line 121 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 121 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1349 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1354 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 8:
-#line 124 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 124 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1357 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1362 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 9:
-#line 129 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 129 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1365 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1370 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 10:
-#line 132 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 132 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1373 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1378 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 11:
-#line 135 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 135 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1381 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1386 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 12:
-#line 138 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 138 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1389 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1394 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 13:
-#line 141 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 141 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1397 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1402 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 14:
-#line 144 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 144 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1405 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1410 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 15:
-#line 149 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 149 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[-2].str), (yyvsp[-1].str));
}
-#line 1413 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1418 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 16:
-#line 152 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 152 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[-2].str), (yyvsp[-1].str));
}
-#line 1421 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1426 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 17:
-#line 155 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 155 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = yyGetParser->ExpandVariable((yyvsp[-1].str));
}
-#line 1429 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1434 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 18:
-#line 158 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 158 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = yyGetParser->ExpandVariableForAt((yyvsp[0].str));
}
-#line 1437 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1442 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 19:
-#line 163 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 163 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1445 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1450 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 20:
-#line 166 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 166 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = (yyvsp[-1].str);
}
-#line 1453 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1458 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 21:
-#line 171 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 171 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = 0;
}
-#line 1461 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1466 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 22:
-#line 174 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 174 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str));
}
-#line 1469 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1474 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 23:
-#line 179 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 179 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1477 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1482 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
case 24:
-#line 182 "cmCommandArgumentParser.y" /* yacc.c:1646 */
+#line 182 "cmCommandArgumentParser.y" /* yacc.c:1652 */
{
(yyval.str) = (yyvsp[0].str);
}
-#line 1485 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1490 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
break;
-#line 1489 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */
+#line 1494 "cmCommandArgumentParser.cxx" /* yacc.c:1652 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -1510,14 +1515,13 @@ yyreduce:
/* Now 'shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
+ {
+ const int yylhs = yyr1[yyn] - YYNTOKENS;
+ const int yyi = yypgoto[yylhs] + *yyssp;
+ yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
+ ? yytable[yyi]
+ : yydefgoto[yylhs]);
+ }
goto yynewstate;
@@ -1601,12 +1605,10 @@ yyerrlab:
| yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
yyerrorlab:
-
- /* Pacify compilers like GCC when the user code never invokes
- YYERROR and the label yyerrorlab therefore never appears in user
- code. */
- if (/*CONSTCOND*/ 0)
- goto yyerrorlab;
+ /* Pacify compilers when the user code never invokes YYERROR and the
+ label yyerrorlab therefore never appears in user code. */
+ if (0)
+ YYERROR;
/* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
@@ -1669,6 +1671,7 @@ yyacceptlab:
yyresult = 0;
goto yyreturn;
+
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
@@ -1676,6 +1679,7 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
+
#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
@@ -1686,6 +1690,10 @@ yyexhaustedlab:
/* Fall through. */
#endif
+
+/*-----------------------------------------------------.
+| yyreturn -- parsing is finished, return the result. |
+`-----------------------------------------------------*/
yyreturn:
if (yychar != YYEMPTY)
{
@@ -1715,7 +1723,7 @@ yyreturn:
#endif
return yyresult;
}
-#line 187 "cmCommandArgumentParser.y" /* yacc.c:1906 */
+#line 187 "cmCommandArgumentParser.y" /* yacc.c:1918 */
/* End of grammar */
diff --git a/Source/LexerParser/cmCommandArgumentParserTokens.h b/Source/LexerParser/cmCommandArgumentParserTokens.h
index 3172182..56c9794 100644
--- a/Source/LexerParser/cmCommandArgumentParserTokens.h
+++ b/Source/LexerParser/cmCommandArgumentParserTokens.h
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4. */
+/* A Bison parser, made by GNU Bison 3.3.2. */
/* Bison interface for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
+ Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,6 +31,9 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
+/* Undocumented macros, especially those whose name start with YY_,
+ are private implementation details. Do not rely on them. */
+
#ifndef YY_CMCOMMANDARGUMENT_YY_CMCOMMANDARGUMENTPARSERTOKENS_H_INCLUDED
# define YY_CMCOMMANDARGUMENT_YY_CMCOMMANDARGUMENTPARSERTOKENS_H_INCLUDED
/* Debug traces. */
diff --git a/Source/LexerParser/cmDependsJavaParser.cxx b/Source/LexerParser/cmDependsJavaParser.cxx
index e83afa9..6c1fb2c 100644
--- a/Source/LexerParser/cmDependsJavaParser.cxx
+++ b/Source/LexerParser/cmDependsJavaParser.cxx
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4. */
+/* A Bison parser, made by GNU Bison 3.3.2. */
/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
+ Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -40,11 +41,14 @@
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
+/* Undocumented macros, especially those whose name start with YY_,
+ are private implementation details. Do not rely on them. */
+
/* Identify Bison output. */
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "3.0.4"
+#define YYBISON_VERSION "3.3.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -67,8 +71,8 @@
#define yynerrs cmDependsJava_yynerrs
-/* Copy the first part of user declarations. */
-#line 1 "cmDependsJavaParser.y" /* yacc.c:339 */
+/* First part of user prologue. */
+#line 1 "cmDependsJavaParser.y" /* yacc.c:337 */
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
@@ -119,13 +123,16 @@ static void cmDependsJava_yyerror(yyscan_t yyscanner, const char* message);
# pragma GCC diagnostic ignored "-Wconversion"
#endif
-#line 123 "cmDependsJavaParser.cxx" /* yacc.c:339 */
-
+#line 127 "cmDependsJavaParser.cxx" /* yacc.c:337 */
# ifndef YY_NULLPTR
-# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULLPTR nullptr
+# if defined __cplusplus
+# if 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
# else
-# define YY_NULLPTR 0
+# define YY_NULLPTR ((void*)0)
# endif
# endif
@@ -372,9 +379,7 @@ int cmDependsJava_yyparse (yyscan_t yyscanner);
#endif /* !YY_CMDEPENDSJAVA_YY_CMDEPENDSJAVAPARSERTOKENS_H_INCLUDED */
-/* Copy the second part of user declarations. */
-#line 378 "cmDependsJavaParser.cxx" /* yacc.c:358 */
#ifdef short
# undef short
@@ -395,13 +400,13 @@ typedef signed char yytype_int8;
#ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 yytype_uint16;
#else
-typedef unsigned short int yytype_uint16;
+typedef unsigned short yytype_uint16;
#endif
#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16;
#else
-typedef short int yytype_int16;
+typedef short yytype_int16;
#endif
#ifndef YYSIZE_T
@@ -413,7 +418,7 @@ typedef short int yytype_int16;
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
-# define YYSIZE_T unsigned int
+# define YYSIZE_T unsigned
# endif
#endif
@@ -449,15 +454,6 @@ typedef short int yytype_int16;
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif
-#if !defined _Noreturn \
- && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-# define _Noreturn __declspec (noreturn)
-# else
-# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
-# endif
-#endif
-
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
@@ -465,7 +461,7 @@ typedef short int yytype_int16;
# define YYUSE(E) /* empty */
#endif
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
@@ -627,16 +623,16 @@ union yyalloc
/* YYNSTATES -- Number of states. */
#define YYNSTATES 575
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
- by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 360
+/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, with out-of-bounds checking. */
#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+ ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
- as returned by yylex, without out-of-bounds checking. */
+ as returned by yylex. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -1618,22 +1614,22 @@ static const yytype_uint8 yyr2[] =
#define YYRECOVERING() (!!yyerrstatus)
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- YYPOPSTACK (yylen); \
- yystate = *yyssp; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (yyscanner, YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (0)
+#define YYBACKUP(Token, Value) \
+ do \
+ if (yychar == YYEMPTY) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ YYPOPSTACK (yylen); \
+ yystate = *yyssp; \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (yyscanner, YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+ while (0)
/* Error token number */
#define YYTERROR 1
@@ -1673,38 +1669,38 @@ do { \
} while (0)
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT. |
-`----------------------------------------*/
+/*-----------------------------------.
+| Print this symbol's value on YYO. |
+`-----------------------------------*/
static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
+yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
{
- FILE *yyo = yyoutput;
- YYUSE (yyo);
+ FILE *yyoutput = yyo;
+ YYUSE (yyoutput);
YYUSE (yyscanner);
if (!yyvaluep)
return;
# ifdef YYPRINT
if (yytype < YYNTOKENS)
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+ YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
# endif
YYUSE (yytype);
}
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
+/*---------------------------.
+| Print this symbol on YYO. |
+`---------------------------*/
static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
+yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
{
- YYFPRINTF (yyoutput, "%s %s (",
+ YYFPRINTF (yyo, "%s %s (",
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
- yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner);
- YYFPRINTF (yyoutput, ")");
+ yy_symbol_value_print (yyo, yytype, yyvaluep, yyscanner);
+ YYFPRINTF (yyo, ")");
}
/*------------------------------------------------------------------.
@@ -1738,7 +1734,7 @@ do { \
static void
yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, yyscan_t yyscanner)
{
- unsigned long int yylno = yyrline[yyrule];
+ unsigned long yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
@@ -1749,7 +1745,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, yyscan_t yysca
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr,
yystos[yyssp[yyi + 1 - yynrhs]],
- &(yyvsp[(yyi + 1) - (yynrhs)])
+ &yyvsp[(yyi + 1) - (yynrhs)]
, yyscanner);
YYFPRINTF (stderr, "\n");
}
@@ -1853,7 +1849,10 @@ yytnamerr (char *yyres, const char *yystr)
case '\\':
if (*++yyp != '\\')
goto do_not_strip_quotes;
- /* Fall through. */
+ else
+ goto append;
+
+ append:
default:
if (yyres)
yyres[yyn] = *yyp;
@@ -1871,7 +1870,7 @@ yytnamerr (char *yyres, const char *yystr)
if (! yyres)
return yystrlen (yystr);
- return yystpcpy (yyres, yystr) - yyres;
+ return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
}
# endif
@@ -1949,10 +1948,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+ yysize = yysize1;
+ else
return 2;
- yysize = yysize1;
}
}
}
@@ -1964,6 +1963,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
case N: \
yyformat = S; \
break
+ default: /* Avoid compiler warnings. */
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
@@ -1975,9 +1975,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+ yysize = yysize1;
+ else
return 2;
- yysize = yysize1;
}
if (*yymsg_alloc < yysize)
@@ -2108,23 +2109,31 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
yychar = YYEMPTY; /* Cause a token to be read. */
goto yysetstate;
+
/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
+| yynewstate -- push a new state, which is found in yystate. |
`------------------------------------------------------------*/
- yynewstate:
+yynewstate:
/* In all cases, when you get here, the value and location stacks
have just been pushed. So pushing a state here evens the stacks. */
yyssp++;
- yysetstate:
- *yyssp = yystate;
+
+/*--------------------------------------------------------------------.
+| yynewstate -- set current state (the top of the stack) to yystate. |
+`--------------------------------------------------------------------*/
+yysetstate:
+ *yyssp = (yytype_int16) yystate;
if (yyss + yystacksize - 1 <= yyssp)
+#if !defined yyoverflow && !defined YYSTACK_RELOCATE
+ goto yyexhaustedlab;
+#else
{
/* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
+ YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
-#ifdef yyoverflow
+# if defined yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
@@ -2140,14 +2149,10 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yystacksize);
-
yyss = yyss1;
yyvs = yyvs1;
}
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyexhaustedlab;
-# else
+# else /* defined YYSTACK_RELOCATE */
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab;
@@ -2163,22 +2168,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-# undef YYSTACK_RELOCATE
+# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
-#endif /* no yyoverflow */
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
+ (unsigned long) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
}
+#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -2187,11 +2192,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
goto yybackup;
+
/*-----------.
| yybackup. |
`-----------*/
yybackup:
-
/* Do appropriate processing given the current state. Read a
lookahead token if we need one and don't already have one. */
@@ -2264,7 +2269,7 @@ yydefault:
/*-----------------------------.
-| yyreduce -- Do a reduction. |
+| yyreduce -- do a reduction. |
`-----------------------------*/
yyreduce:
/* yyn is the number of a rule to reduce with. */
@@ -2285,214 +2290,214 @@ yyreduce:
switch (yyn)
{
case 2:
-#line 183 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 183 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2296 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2301 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 3:
-#line 192 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 192 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2307 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2312 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 4:
-#line 200 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 200 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2318 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2323 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 5:
-#line 208 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 208 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2329 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2334 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 6:
-#line 216 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 216 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2340 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2345 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 7:
-#line 224 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 224 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2351 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2356 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 8:
-#line 232 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 232 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2362 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2367 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 9:
-#line 241 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 241 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2373 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2378 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 10:
-#line 249 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 249 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2384 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2389 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 11:
-#line 258 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 258 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2395 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2400 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 12:
-#line 266 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 266 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2406 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2411 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 13:
-#line 275 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 275 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
}
-#line 2414 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2419 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 14:
-#line 280 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 280 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
}
-#line 2422 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2427 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 15:
-#line 285 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 285 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
}
-#line 2430 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2435 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 16:
-#line 290 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 290 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
}
-#line 2438 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2443 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 17:
-#line 295 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 295 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
}
-#line 2446 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2451 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 18:
-#line 300 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 300 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
}
-#line 2454 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2459 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 19:
-#line 305 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 305 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
}
-#line 2462 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2467 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 20:
-#line 310 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 310 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
}
-#line 2470 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2475 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 21:
-#line 316 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 316 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2481 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2486 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 22:
-#line 324 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 324 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2492 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2497 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 23:
-#line 333 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 333 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpStoreClass((yyvsp[0].str));
@@ -2500,44 +2505,44 @@ yyreduce:
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2504 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2509 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 24:
-#line 343 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 343 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2515 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2520 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 25:
-#line 352 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 352 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2526 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2531 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 26:
-#line 361 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 361 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2537 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2542 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 27:
-#line 369 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 369 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpStoreClass((yyvsp[-1].str));
@@ -2545,56 +2550,56 @@ yyreduce:
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2549 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2554 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 28:
-#line 379 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 379 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
(yyval.str) = (yyvsp[0].str);
}
-#line 2558 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2563 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 29:
-#line 385 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 385 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
(yyval.str) = (yyvsp[0].str);
}
-#line 2567 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2572 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 30:
-#line 392 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 392 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
(yyval.str) = (yyvsp[0].str);
}
-#line 2576 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2581 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 31:
-#line 399 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 399 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
(yyval.str) = (yyvsp[0].str);
}
-#line 2585 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2590 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 32:
-#line 405 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 405 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
(yyval.str) = (yyvsp[0].str);
}
-#line 2594 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2599 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 33:
-#line 412 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 412 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
yyGetParser->AddClassFound((yyvsp[-2].str));
@@ -2602,11 +2607,11 @@ yyreduce:
yyGetParser->DeallocateParserType(&((yyvsp[-2].str)));
(yyval.str) = const_cast<char*>(yyGetParser->GetCurrentCombine());
}
-#line 2606 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2611 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 34:
-#line 421 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 421 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpStoreClass((yyvsp[-2].str));
@@ -2615,11 +2620,11 @@ yyreduce:
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2619 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2624 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 35:
-#line 431 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 431 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpStoreClass((yyvsp[-2].str));
@@ -2628,118 +2633,118 @@ yyreduce:
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2632 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2637 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 36:
-#line 441 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 441 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2643 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2648 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 37:
-#line 450 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 450 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2654 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2659 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 38:
-#line 458 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 458 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2665 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2670 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 39:
-#line 467 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 467 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2676 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2681 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 40:
-#line 475 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 475 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2686 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2691 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 41:
-#line 482 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 482 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2697 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2702 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 42:
-#line 490 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 490 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2707 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2712 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 43:
-#line 497 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 497 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2718 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2723 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 44:
-#line 505 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 505 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2728 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2733 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 45:
-#line 512 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 512 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2739 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2744 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 46:
-#line 521 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 521 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
yyGetParser->SetCurrentPackage((yyvsp[-1].str));
@@ -2749,33 +2754,33 @@ yyreduce:
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2753 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2758 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 47:
-#line 533 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 533 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2764 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2769 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 48:
-#line 541 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 541 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2775 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2780 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 49:
-#line 550 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 550 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
yyGetParser->AddPackagesImport((yyvsp[-1].str));
@@ -2785,11 +2790,11 @@ yyreduce:
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2789 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2794 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 50:
-#line 562 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 562 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(5);
std::string str = (yyvsp[-3].str);
@@ -2800,77 +2805,77 @@ yyreduce:
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2804 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2809 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 51:
-#line 575 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 575 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2815 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2820 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 52:
-#line 583 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 583 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2826 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2831 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 53:
-#line 591 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 591 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2837 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2842 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 54:
-#line 600 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 600 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2848 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2853 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 55:
-#line 608 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 608 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2859 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2864 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 67:
-#line 623 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 623 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
yyGetParser->StartClass((yyvsp[0].str));
jpElementStart(3);
yyGetParser->DeallocateParserType(&((yyvsp[0].str)));
jpCheckEmpty(3);
}
-#line 2870 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2875 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 68:
-#line 633 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 633 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -2878,11 +2883,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
yyGetParser->EndClass();
}
-#line 2882 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2887 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 69:
-#line 642 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 642 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(2);
@@ -2890,11 +2895,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
yyGetParser->EndClass();
}
-#line 2894 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2899 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 70:
-#line 651 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 651 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -2902,11 +2907,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
yyGetParser->EndClass();
}
-#line 2906 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2911 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 71:
-#line 660 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 660 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -2914,226 +2919,226 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
yyGetParser->EndClass();
}
-#line 2918 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2923 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 72:
-#line 669 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 669 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2928 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2933 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 73:
-#line 676 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 676 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2939 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2944 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 74:
-#line 685 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 685 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2950 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2955 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 75:
-#line 694 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 694 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2961 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2966 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 76:
-#line 703 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 703 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2972 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2977 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 77:
-#line 711 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 711 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2983 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2988 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 78:
-#line 720 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 720 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 2994 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 2999 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 79:
-#line 728 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 728 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3004 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3009 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 80:
-#line 735 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 735 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3015 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3020 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 81:
-#line 744 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 744 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3026 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3031 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 82:
-#line 752 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 752 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3037 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3042 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 83:
-#line 760 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 760 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3048 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3053 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 84:
-#line 768 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 768 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3059 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3064 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 85:
-#line 777 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 777 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3070 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3075 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 86:
-#line 785 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 785 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3081 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3086 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 87:
-#line 794 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 794 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(4);
}
-#line 3089 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3094 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 88:
-#line 800 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 800 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3100 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3105 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 89:
-#line 808 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 808 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3111 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3116 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 90:
-#line 817 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 817 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3122 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3127 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 91:
-#line 825 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 825 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3133 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3138 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 92:
-#line 834 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 834 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
yyGetParser->DeallocateParserType(&((yyvsp[0].str)));
@@ -3141,77 +3146,77 @@ yyreduce:
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3145 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3150 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 93:
-#line 843 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 843 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3156 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3161 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 94:
-#line 852 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 852 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3167 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3172 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 95:
-#line 860 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 860 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3178 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3183 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 96:
-#line 869 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 869 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3189 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3194 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 97:
-#line 877 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 877 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3200 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3205 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 98:
-#line 885 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 885 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3211 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3216 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 99:
-#line 894 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 894 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -3219,11 +3224,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3223 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3228 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 100:
-#line 903 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 903 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -3231,22 +3236,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3235 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3240 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 101:
-#line 912 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 912 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3246 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3251 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 102:
-#line 920 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 920 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3254,11 +3259,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3258 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3263 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 103:
-#line 930 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 930 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(4);
yyGetParser->DeallocateParserType(&((yyvsp[-3].str)));
@@ -3267,40 +3272,40 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3271 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3276 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 104:
-#line 940 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 940 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
}
-#line 3280 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3285 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 105:
-#line 946 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 946 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3291 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3296 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 107:
-#line 957 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 957 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
}
-#line 3300 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3305 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 108:
-#line 963 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 963 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -3308,11 +3313,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3312 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3317 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 109:
-#line 973 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 973 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -3320,11 +3325,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3324 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3329 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 110:
-#line 983 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 983 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -3332,20 +3337,20 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3336 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3341 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 111:
-#line 993 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 993 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
}
-#line 3345 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3350 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 112:
-#line 999 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 999 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -3353,11 +3358,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3357 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3362 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 113:
-#line 1009 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1009 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3365,11 +3370,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3369 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3374 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 114:
-#line 1019 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1019 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -3377,11 +3382,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3381 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3386 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 115:
-#line 1029 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1029 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -3389,11 +3394,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3393 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3398 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 116:
-#line 1038 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1038 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(5);
jpCheckEmpty(5);
@@ -3401,11 +3406,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3405 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3410 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 117:
-#line 1048 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1048 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(4);
yyGetParser->DeallocateParserType(&((yyvsp[-3].str)));
@@ -3414,11 +3419,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3418 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3423 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 118:
-#line 1059 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1059 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -3426,22 +3431,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3430 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3435 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 119:
-#line 1068 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1068 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3441 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3446 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 120:
-#line 1076 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1076 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -3449,11 +3454,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3453 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3458 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 121:
-#line 1086 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1086 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(5);
jpCheckEmpty(5);
@@ -3461,11 +3466,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3465 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3470 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 122:
-#line 1095 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1095 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(5);
jpCheckEmpty(5);
@@ -3473,22 +3478,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3477 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3482 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 123:
-#line 1105 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1105 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
yyGetParser->StartClass((yyvsp[0].str));
jpElementStart(3);
yyGetParser->DeallocateParserType(&((yyvsp[0].str)));
jpCheckEmpty(3);
}
-#line 3488 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3493 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 124:
-#line 1114 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1114 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -3496,21 +3501,21 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
yyGetParser->EndClass();
}
-#line 3500 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3505 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 125:
-#line 1123 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1123 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3510 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3515 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 126:
-#line 1130 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1130 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3518,11 +3523,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3522 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3527 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 127:
-#line 1140 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1140 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -3530,11 +3535,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3534 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3539 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 128:
-#line 1149 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1149 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -3542,11 +3547,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3546 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3551 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 129:
-#line 1159 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1159 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -3554,33 +3559,33 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3558 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3563 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 130:
-#line 1168 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1168 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3569 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3574 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 131:
-#line 1176 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1176 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3580 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3585 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 132:
-#line 1185 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1185 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3588,11 +3593,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3592 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3597 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 133:
-#line 1194 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1194 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3600,11 +3605,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3604 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3609 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 134:
-#line 1203 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1203 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3612,22 +3617,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3616 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3621 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 135:
-#line 1212 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1212 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3627 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3632 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 136:
-#line 1220 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1220 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3635,22 +3640,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3639 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3644 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 137:
-#line 1229 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1229 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3650 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3655 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 138:
-#line 1238 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1238 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3658,11 +3663,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3662 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3667 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 139:
-#line 1248 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1248 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -3670,11 +3675,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3674 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3679 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 140:
-#line 1258 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1258 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3682,11 +3687,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3686 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3691 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 141:
-#line 1267 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1267 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -3694,11 +3699,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3698 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3703 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 142:
-#line 1277 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1277 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -3706,22 +3711,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3710 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3715 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 143:
-#line 1286 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1286 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3721 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3726 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 144:
-#line 1294 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1294 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3729,11 +3734,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3733 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3738 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 145:
-#line 1303 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1303 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -3741,11 +3746,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3745 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3750 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 146:
-#line 1313 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1313 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3753,11 +3758,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3757 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3762 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 147:
-#line 1322 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1322 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -3765,33 +3770,33 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3769 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3774 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 148:
-#line 1332 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1332 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(4);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3780 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3785 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 149:
-#line 1340 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1340 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 3791 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3796 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 150:
-#line 1348 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1348 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3799,11 +3804,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3803 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3808 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 151:
-#line 1358 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1358 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3811,11 +3816,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3815 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3820 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 152:
-#line 1367 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1367 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(2);
@@ -3823,11 +3828,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3827 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3832 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 153:
-#line 1377 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1377 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3835,11 +3840,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3839 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3844 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 154:
-#line 1386 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1386 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3847,11 +3852,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3851 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3856 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 155:
-#line 1395 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1395 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3859,11 +3864,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3863 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3868 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 156:
-#line 1405 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1405 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(2);
@@ -3871,11 +3876,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3875 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3880 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 157:
-#line 1415 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1415 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(3);
@@ -3883,11 +3888,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3887 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3892 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 158:
-#line 1424 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1424 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(2);
@@ -3895,11 +3900,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3899 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3904 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 159:
-#line 1434 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1434 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3907,11 +3912,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3911 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3916 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 160:
-#line 1443 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1443 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3919,11 +3924,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3923 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3928 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 161:
-#line 1452 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1452 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3931,11 +3936,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3935 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3940 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 162:
-#line 1461 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1461 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3943,11 +3948,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3947 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3952 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 163:
-#line 1470 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1470 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3955,11 +3960,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3959 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3964 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 164:
-#line 1479 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1479 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3967,11 +3972,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3971 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3976 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 165:
-#line 1489 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1489 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3979,11 +3984,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3983 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 3988 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 166:
-#line 1498 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1498 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -3991,11 +3996,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 3995 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4000 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 167:
-#line 1507 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1507 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4003,11 +4008,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4007 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4012 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 168:
-#line 1516 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1516 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4015,11 +4020,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4019 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4024 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 169:
-#line 1525 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1525 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4027,11 +4032,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4031 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4036 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 170:
-#line 1535 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1535 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4039,11 +4044,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4043 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4048 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 171:
-#line 1544 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1544 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4051,11 +4056,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4055 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4060 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 172:
-#line 1553 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1553 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4063,11 +4068,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4067 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4072 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 173:
-#line 1562 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1562 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4075,11 +4080,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4079 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4084 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 174:
-#line 1571 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1571 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4087,11 +4092,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4091 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4096 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 175:
-#line 1580 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1580 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4099,11 +4104,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4103 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4108 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 176:
-#line 1589 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1589 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4111,11 +4116,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4115 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4120 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 177:
-#line 1598 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1598 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4123,11 +4128,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4127 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4132 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 178:
-#line 1607 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1607 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4135,11 +4140,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4139 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4144 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 179:
-#line 1616 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1616 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4147,11 +4152,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4151 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4156 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 180:
-#line 1625 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1625 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4159,11 +4164,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4163 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4168 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 181:
-#line 1634 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1634 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4171,11 +4176,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4175 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4180 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 182:
-#line 1644 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1644 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4183,11 +4188,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4187 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4192 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 183:
-#line 1654 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1654 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
yyGetParser->DeallocateParserType(&((yyvsp[-2].str)));
@@ -4196,11 +4201,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4200 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4205 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 184:
-#line 1665 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1665 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -4208,11 +4213,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4212 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4217 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 185:
-#line 1675 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1675 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -4220,11 +4225,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4224 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4229 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 186:
-#line 1685 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1685 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4232,11 +4237,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4236 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4241 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 187:
-#line 1694 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1694 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4244,11 +4249,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4248 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4253 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 188:
-#line 1703 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1703 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4256,11 +4261,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4260 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4265 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 189:
-#line 1712 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1712 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4268,11 +4273,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4272 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4277 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 190:
-#line 1721 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1721 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4280,11 +4285,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4284 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4289 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 191:
-#line 1730 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1730 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4292,11 +4297,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4296 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4301 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 192:
-#line 1739 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1739 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4304,11 +4309,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4308 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4313 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 193:
-#line 1749 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1749 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(5);
jpCheckEmpty(5);
@@ -4316,11 +4321,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4320 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4325 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 194:
-#line 1759 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1759 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(7);
jpCheckEmpty(7);
@@ -4328,11 +4333,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4332 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4337 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 195:
-#line 1769 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1769 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(7);
jpCheckEmpty(7);
@@ -4340,40 +4345,40 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4344 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4349 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 196:
-#line 1779 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1779 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(5);
}
-#line 4353 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4358 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 197:
-#line 1786 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1786 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(4);
}
-#line 4362 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4367 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 198:
-#line 1792 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1792 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4373 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4378 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 199:
-#line 1800 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1800 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4381,22 +4386,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4385 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4390 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 200:
-#line 1809 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1809 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4396 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4401 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 201:
-#line 1817 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1817 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -4404,11 +4409,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4408 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4413 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 202:
-#line 1827 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1827 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -4416,11 +4421,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4420 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4425 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 203:
-#line 1837 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1837 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4428,11 +4433,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4432 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4437 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 204:
-#line 1846 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1846 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -4440,11 +4445,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4444 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4449 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 205:
-#line 1856 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1856 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -4452,11 +4457,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4456 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4461 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 206:
-#line 1865 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1865 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -4464,58 +4469,58 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4468 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4473 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 207:
-#line 1875 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1875 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(5);
}
-#line 4477 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4482 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 208:
-#line 1882 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1882 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(5);
}
-#line 4486 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4491 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 209:
-#line 1889 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1889 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(7);
}
-#line 4495 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4500 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 210:
-#line 1897 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1897 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(9);
}
-#line 4504 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4509 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 211:
-#line 1903 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1903 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4515 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4520 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 212:
-#line 1911 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1911 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4523,22 +4528,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4527 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4532 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 213:
-#line 1920 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1920 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4538 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4543 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 214:
-#line 1928 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1928 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4546,33 +4551,33 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4550 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4555 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 215:
-#line 1939 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1939 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(9);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4561 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4566 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 216:
-#line 1947 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1947 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4572 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4577 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 217:
-#line 1955 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1955 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4580,11 +4585,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4584 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4589 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 218:
-#line 1965 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1965 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4592,11 +4597,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4596 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4601 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 219:
-#line 1974 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1974 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4604,11 +4609,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4608 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4613 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 220:
-#line 1984 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1984 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4616,11 +4621,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4620 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4625 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 221:
-#line 1994 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 1994 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4628,11 +4633,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4632 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4637 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 222:
-#line 2003 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2003 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -4640,11 +4645,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4644 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4649 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 223:
-#line 2013 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2013 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -4652,11 +4657,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4656 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4661 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 224:
-#line 2022 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2022 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(5);
jpCheckEmpty(5);
@@ -4664,11 +4669,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4668 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4673 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 225:
-#line 2032 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2032 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
yyGetParser->DeallocateParserType(&((yyvsp[-1].str)));
@@ -4677,31 +4682,31 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4681 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4686 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 226:
-#line 2042 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2042 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4692 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4697 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 227:
-#line 2050 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2050 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
}
-#line 4701 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4706 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 228:
-#line 2057 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2057 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
yyGetParser->DeallocateParserType(&((yyvsp[-1].str)));
@@ -4710,11 +4715,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4714 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4719 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 229:
-#line 2068 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2068 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -4722,11 +4727,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4726 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4731 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 230:
-#line 2078 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2078 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -4734,11 +4739,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4738 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4743 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 231:
-#line 2088 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2088 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(5);
jpCheckEmpty(5);
@@ -4746,11 +4751,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4750 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4755 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 232:
-#line 2098 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2098 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -4758,11 +4763,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4762 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4767 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 233:
-#line 2107 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2107 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -4770,22 +4775,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4774 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4779 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 234:
-#line 2116 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2116 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4785 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4790 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 235:
-#line 2124 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2124 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4793,11 +4798,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4797 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4802 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 236:
-#line 2134 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2134 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4805,11 +4810,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4809 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4814 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 237:
-#line 2143 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2143 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -4817,20 +4822,20 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4821 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4826 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 238:
-#line 2153 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2153 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(5);
}
-#line 4830 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4835 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 239:
-#line 2160 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2160 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -4838,11 +4843,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4842 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4847 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 240:
-#line 2170 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2170 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4850,11 +4855,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4854 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4859 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 241:
-#line 2179 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2179 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4862,11 +4867,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4866 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4871 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 242:
-#line 2189 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2189 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4874,20 +4879,20 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4878 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4883 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 243:
-#line 2198 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2198 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
}
-#line 4887 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4892 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 244:
-#line 2204 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2204 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -4895,11 +4900,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4899 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4904 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 245:
-#line 2213 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2213 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4907,11 +4912,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4911 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4916 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 246:
-#line 2222 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2222 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4919,11 +4924,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4923 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4928 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 247:
-#line 2231 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2231 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4931,11 +4936,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4935 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4940 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 248:
-#line 2240 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2240 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4943,11 +4948,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4947 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4952 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 249:
-#line 2250 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2250 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(6);
jpCheckEmpty(6);
@@ -4955,22 +4960,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4959 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4964 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 250:
-#line 2259 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2259 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4970 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4975 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 251:
-#line 2267 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2267 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -4978,22 +4983,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 4982 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4987 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 252:
-#line 2276 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2276 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 4993 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 4998 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 253:
-#line 2284 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2284 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5001,11 +5006,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5005 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5010 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 254:
-#line 2294 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2294 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5013,11 +5018,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5017 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5022 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 255:
-#line 2303 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2303 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5025,11 +5030,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5029 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5034 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 256:
-#line 2313 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2313 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -5037,11 +5042,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5041 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5046 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 257:
-#line 2322 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2322 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -5049,11 +5054,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5053 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5058 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 258:
-#line 2331 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2331 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -5061,11 +5066,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5065 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5070 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 259:
-#line 2340 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2340 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -5073,22 +5078,22 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5077 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5082 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 260:
-#line 2349 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2349 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(0);
(yyval.str) = 0;
yyGetParser->SetCurrentCombine("");
}
-#line 5088 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5093 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 261:
-#line 2357 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2357 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5096,11 +5101,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5100 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5105 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 262:
-#line 2367 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2367 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5108,11 +5113,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5112 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5117 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 263:
-#line 2376 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2376 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -5120,11 +5125,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5124 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5129 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 264:
-#line 2386 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2386 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5132,29 +5137,29 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5136 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5141 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 265:
-#line 2396 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2396 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
}
-#line 5145 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5150 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 266:
-#line 2402 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2402 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
}
-#line 5154 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5159 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 267:
-#line 2409 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2409 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
yyGetParser->DeallocateParserType(&((yyvsp[0].str)));
@@ -5163,11 +5168,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5167 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5172 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 268:
-#line 2419 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2419 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
yyGetParser->DeallocateParserType(&((yyvsp[0].str)));
@@ -5176,11 +5181,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5180 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5185 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 269:
-#line 2429 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2429 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
yyGetParser->DeallocateParserType(&((yyvsp[0].str)));
@@ -5189,11 +5194,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5193 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5198 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 270:
-#line 2439 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2439 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
yyGetParser->DeallocateParserType(&((yyvsp[0].str)));
@@ -5202,11 +5207,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5206 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5211 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 271:
-#line 2450 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2450 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(4);
yyGetParser->DeallocateParserType(&((yyvsp[-3].str)));
@@ -5215,11 +5220,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5219 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5224 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 272:
-#line 2460 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2460 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(6);
yyGetParser->DeallocateParserType(&((yyvsp[-5].str)));
@@ -5229,11 +5234,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5233 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5238 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 273:
-#line 2471 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2471 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(6);
yyGetParser->DeallocateParserType(&((yyvsp[-3].str)));
@@ -5242,11 +5247,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5246 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5251 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 274:
-#line 2481 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2481 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(6);
yyGetParser->DeallocateParserType(&((yyvsp[-3].str)));
@@ -5255,11 +5260,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5259 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5264 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 275:
-#line 2492 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2492 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(4);
yyGetParser->DeallocateParserType(&((yyvsp[-3].str)));
@@ -5268,11 +5273,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5272 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5277 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 276:
-#line 2502 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2502 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -5280,11 +5285,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5284 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5289 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 277:
-#line 2512 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2512 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5292,11 +5297,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5296 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5301 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 278:
-#line 2521 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2521 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
yyGetParser->DeallocateParserType(&((yyvsp[0].str)));
@@ -5304,11 +5309,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5308 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5313 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 279:
-#line 2530 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2530 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5316,11 +5321,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5320 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5325 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 280:
-#line 2539 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2539 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5328,11 +5333,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5332 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5337 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 281:
-#line 2548 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2548 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5340,11 +5345,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5344 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5349 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 282:
-#line 2558 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2558 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -5352,11 +5357,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5356 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5361 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 283:
-#line 2568 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2568 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -5364,11 +5369,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5368 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5373 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 284:
-#line 2578 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2578 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5376,11 +5381,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5380 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5385 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 285:
-#line 2587 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2587 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5388,11 +5393,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5392 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5397 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 286:
-#line 2596 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2596 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -5400,11 +5405,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5404 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5409 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 287:
-#line 2605 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2605 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -5412,11 +5417,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5416 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5421 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 288:
-#line 2614 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2614 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5424,11 +5429,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5428 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5433 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 289:
-#line 2624 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2624 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -5436,11 +5441,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5440 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5445 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 290:
-#line 2634 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2634 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -5448,11 +5453,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5452 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5457 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 291:
-#line 2644 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2644 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5460,11 +5465,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5464 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5469 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 292:
-#line 2653 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2653 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -5472,11 +5477,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5476 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5481 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 293:
-#line 2662 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2662 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(2);
jpCheckEmpty(2);
@@ -5484,11 +5489,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5488 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5493 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 294:
-#line 2671 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2671 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5496,11 +5501,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5500 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5505 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 295:
-#line 2681 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2681 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(5);
jpCheckEmpty(5);
@@ -5508,11 +5513,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5512 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5517 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 296:
-#line 2690 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2690 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(4);
jpCheckEmpty(4);
@@ -5520,20 +5525,20 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5524 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5529 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 297:
-#line 2699 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2699 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(5);
}
-#line 5533 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5538 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 298:
-#line 2706 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2706 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5541,11 +5546,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5545 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5550 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 299:
-#line 2715 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2715 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5553,11 +5558,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5557 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5562 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 300:
-#line 2724 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2724 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5565,11 +5570,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5569 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5574 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 301:
-#line 2733 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2733 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5577,11 +5582,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5581 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5586 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 302:
-#line 2743 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2743 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5589,11 +5594,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5593 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5598 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 303:
-#line 2752 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2752 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5601,11 +5606,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5605 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5610 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 304:
-#line 2761 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2761 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5613,11 +5618,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5617 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5622 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 305:
-#line 2771 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2771 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5625,11 +5630,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5629 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5634 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 306:
-#line 2780 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2780 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5637,11 +5642,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5641 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5646 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 307:
-#line 2789 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2789 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5649,11 +5654,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5653 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5658 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 308:
-#line 2798 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2798 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5661,11 +5666,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5665 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5670 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 309:
-#line 2808 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2808 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5673,11 +5678,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5677 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5682 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 310:
-#line 2817 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2817 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5685,11 +5690,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5689 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5694 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 311:
-#line 2826 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2826 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5697,11 +5702,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5701 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5706 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 312:
-#line 2835 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2835 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5709,11 +5714,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5713 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5718 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 313:
-#line 2844 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2844 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5721,11 +5726,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5725 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5730 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 314:
-#line 2853 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2853 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5733,11 +5738,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5737 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5742 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 315:
-#line 2863 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2863 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5745,11 +5750,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5749 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5754 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 316:
-#line 2872 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2872 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5757,11 +5762,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5761 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5766 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 317:
-#line 2881 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2881 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5769,11 +5774,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5773 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5778 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 318:
-#line 2891 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2891 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5781,11 +5786,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5785 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5790 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 319:
-#line 2900 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2900 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5793,11 +5798,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5797 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5802 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 320:
-#line 2910 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2910 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5805,11 +5810,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5809 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5814 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 321:
-#line 2919 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2919 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5817,11 +5822,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5821 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5826 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 322:
-#line 2929 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2929 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5829,11 +5834,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5833 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5838 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 323:
-#line 2938 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2938 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5841,11 +5846,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5845 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5850 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 324:
-#line 2948 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2948 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5853,11 +5858,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5857 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5862 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 325:
-#line 2957 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2957 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5865,11 +5870,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5869 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5874 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 326:
-#line 2967 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2967 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5877,11 +5882,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5881 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5886 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 327:
-#line 2976 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2976 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5889,11 +5894,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5893 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5898 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 328:
-#line 2986 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2986 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5901,11 +5906,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5905 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5910 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 329:
-#line 2995 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 2995 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(5);
jpCheckEmpty(5);
@@ -5913,11 +5918,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5917 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5922 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 330:
-#line 3005 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3005 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5925,11 +5930,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5929 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5934 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 331:
-#line 3014 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3014 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5937,11 +5942,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5941 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5946 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 332:
-#line 3024 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3024 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpCheckEmpty(3);
@@ -5949,11 +5954,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5953 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5958 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 333:
-#line 3034 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3034 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
yyGetParser->DeallocateParserType(&((yyvsp[0].str)));
@@ -5962,11 +5967,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5966 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5971 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 334:
-#line 3044 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3044 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5974,11 +5979,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5978 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5983 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 335:
-#line 3053 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3053 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5986,11 +5991,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 5990 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 5995 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 336:
-#line 3063 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3063 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -5998,11 +6003,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6002 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6007 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 337:
-#line 3072 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3072 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6010,11 +6015,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6014 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6019 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 338:
-#line 3081 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3081 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6022,11 +6027,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6026 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6031 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 339:
-#line 3090 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3090 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6034,11 +6039,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6038 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6043 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 340:
-#line 3099 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3099 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6046,11 +6051,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6050 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6055 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 341:
-#line 3108 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3108 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6058,11 +6063,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6062 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6067 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 342:
-#line 3117 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3117 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6070,11 +6075,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6074 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6079 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 343:
-#line 3126 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3126 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6082,11 +6087,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6086 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6091 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 344:
-#line 3135 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3135 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6094,11 +6099,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6098 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6103 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 345:
-#line 3144 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3144 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6106,11 +6111,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6110 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6115 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 346:
-#line 3153 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3153 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6118,11 +6123,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6122 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6127 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 347:
-#line 3162 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3162 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6130,11 +6135,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6134 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6139 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 348:
-#line 3172 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3172 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6142,11 +6147,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6146 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6151 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 349:
-#line 3182 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3182 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6154,11 +6159,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6158 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6163 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 350:
-#line 3192 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3192 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(1);
jpCheckEmpty(1);
@@ -6166,11 +6171,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6170 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6175 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
case 351:
-#line 3201 "cmDependsJavaParser.y" /* yacc.c:1646 */
+#line 3201 "cmDependsJavaParser.y" /* yacc.c:1652 */
{
jpElementStart(3);
jpStoreClass((yyvsp[-2].str));
@@ -6179,11 +6184,11 @@ yyreduce:
yyGetParser->SetCurrentCombine("");
}
-#line 6183 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6188 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
break;
-#line 6187 "cmDependsJavaParser.cxx" /* yacc.c:1646 */
+#line 6192 "cmDependsJavaParser.cxx" /* yacc.c:1652 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -6208,14 +6213,13 @@ yyreduce:
/* Now 'shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
+ {
+ const int yylhs = yyr1[yyn] - YYNTOKENS;
+ const int yyi = yypgoto[yylhs] + *yyssp;
+ yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
+ ? yytable[yyi]
+ : yydefgoto[yylhs]);
+ }
goto yynewstate;
@@ -6299,12 +6303,10 @@ yyerrlab:
| yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
yyerrorlab:
-
- /* Pacify compilers like GCC when the user code never invokes
- YYERROR and the label yyerrorlab therefore never appears in user
- code. */
- if (/*CONSTCOND*/ 0)
- goto yyerrorlab;
+ /* Pacify compilers when the user code never invokes YYERROR and the
+ label yyerrorlab therefore never appears in user code. */
+ if (0)
+ YYERROR;
/* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
@@ -6367,6 +6369,7 @@ yyacceptlab:
yyresult = 0;
goto yyreturn;
+
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
@@ -6374,6 +6377,7 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
+
#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
@@ -6384,6 +6388,10 @@ yyexhaustedlab:
/* Fall through. */
#endif
+
+/*-----------------------------------------------------.
+| yyreturn -- parsing is finished, return the result. |
+`-----------------------------------------------------*/
yyreturn:
if (yychar != YYEMPTY)
{
@@ -6413,7 +6421,7 @@ yyreturn:
#endif
return yyresult;
}
-#line 3210 "cmDependsJavaParser.y" /* yacc.c:1906 */
+#line 3210 "cmDependsJavaParser.y" /* yacc.c:1918 */
/* End of grammar */
diff --git a/Source/LexerParser/cmDependsJavaParserTokens.h b/Source/LexerParser/cmDependsJavaParserTokens.h
index 7f18f1d..6bbc084 100644
--- a/Source/LexerParser/cmDependsJavaParserTokens.h
+++ b/Source/LexerParser/cmDependsJavaParserTokens.h
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4. */
+/* A Bison parser, made by GNU Bison 3.3.2. */
/* Bison interface for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
+ Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,6 +31,9 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
+/* Undocumented macros, especially those whose name start with YY_,
+ are private implementation details. Do not rely on them. */
+
#ifndef YY_CMDEPENDSJAVA_YY_CMDEPENDSJAVAPARSERTOKENS_H_INCLUDED
# define YY_CMDEPENDSJAVA_YY_CMDEPENDSJAVAPARSERTOKENS_H_INCLUDED
/* Debug traces. */
diff --git a/Source/LexerParser/cmExprParser.cxx b/Source/LexerParser/cmExprParser.cxx
index 73ece2b..8416e72 100644
--- a/Source/LexerParser/cmExprParser.cxx
+++ b/Source/LexerParser/cmExprParser.cxx
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4. */
+/* A Bison parser, made by GNU Bison 3.3.2. */
/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
+ Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -40,11 +41,14 @@
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
+/* Undocumented macros, especially those whose name start with YY_,
+ are private implementation details. Do not rely on them. */
+
/* Identify Bison output. */
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "3.0.4"
+#define YYBISON_VERSION "3.3.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -67,8 +71,8 @@
#define yynerrs cmExpr_yynerrs
-/* Copy the first part of user declarations. */
-#line 1 "cmExprParser.y" /* yacc.c:339 */
+/* First part of user prologue. */
+#line 1 "cmExprParser.y" /* yacc.c:337 */
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
@@ -112,13 +116,16 @@ static void cmExpr_yyerror(yyscan_t yyscanner, const char* message);
# pragma GCC diagnostic ignored "-Wconversion"
#endif
-#line 116 "cmExprParser.cxx" /* yacc.c:339 */
-
+#line 120 "cmExprParser.cxx" /* yacc.c:337 */
# ifndef YY_NULLPTR
-# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULLPTR nullptr
+# if defined __cplusplus
+# if 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
# else
-# define YY_NULLPTR 0
+# define YY_NULLPTR ((void*)0)
# endif
# endif
@@ -187,9 +194,7 @@ int cmExpr_yyparse (yyscan_t yyscanner);
#endif /* !YY_CMEXPR_YY_CMEXPRPARSERTOKENS_H_INCLUDED */
-/* Copy the second part of user declarations. */
-#line 193 "cmExprParser.cxx" /* yacc.c:358 */
#ifdef short
# undef short
@@ -210,13 +215,13 @@ typedef signed char yytype_int8;
#ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 yytype_uint16;
#else
-typedef unsigned short int yytype_uint16;
+typedef unsigned short yytype_uint16;
#endif
#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16;
#else
-typedef short int yytype_int16;
+typedef short yytype_int16;
#endif
#ifndef YYSIZE_T
@@ -228,7 +233,7 @@ typedef short int yytype_int16;
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
-# define YYSIZE_T unsigned int
+# define YYSIZE_T unsigned
# endif
#endif
@@ -264,15 +269,6 @@ typedef short int yytype_int16;
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif
-#if !defined _Noreturn \
- && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-# define _Noreturn __declspec (noreturn)
-# else
-# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
-# endif
-#endif
-
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
@@ -280,7 +276,7 @@ typedef short int yytype_int16;
# define YYUSE(E) /* empty */
#endif
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
@@ -429,29 +425,29 @@ union yyalloc
#endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 17
+#define YYFINAL 19
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 30
+#define YYLAST 34
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 17
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 10
/* YYNRULES -- Number of rules. */
-#define YYNRULES 23
+#define YYNRULES 24
/* YYNSTATES -- Number of states. */
-#define YYNSTATES 39
+#define YYNSTATES 41
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
- by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 271
+/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, with out-of-bounds checking. */
#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+ ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
- as returned by yylex, without out-of-bounds checking. */
+ as returned by yylex. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -490,7 +486,7 @@ static const yytype_uint8 yyrline[] =
{
0, 77, 77, 82, 85, 90, 93, 98, 101, 106,
109, 112, 117, 120, 123, 128, 131, 134, 140, 145,
- 148, 151, 156, 159
+ 148, 151, 154, 159, 162
};
#endif
@@ -517,10 +513,10 @@ static const yytype_uint16 yytoknum[] =
};
# endif
-#define YYPACT_NINF -8
+#define YYPACT_NINF -11
#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-8)))
+ (!!((Yystate) == (-11)))
#define YYTABLE_NINF -1
@@ -531,10 +527,11 @@ static const yytype_uint16 yytoknum[] =
STATE-NUM. */
static const yytype_int8 yypact[] =
{
- 0, 0, 0, 0, -8, 2, -7, -5, 8, 3,
- 10, 1, -8, -8, -8, -8, 6, -8, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, -8, -5,
- 8, 3, 10, 10, 1, 1, -8, -8, -8
+ 1, 1, 1, 1, 1, -11, 6, -10, -4, 9,
+ 4, 11, 2, -11, -11, -11, -11, 7, -11, -11,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ -11, -4, 9, 4, 11, 11, 2, 2, -11, -11,
+ -11
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@@ -542,22 +539,23 @@ static const yytype_int8 yypact[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 0, 0, 0, 22, 0, 2, 3, 5, 7,
- 9, 12, 15, 19, 20, 21, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 23, 4,
- 6, 8, 10, 11, 13, 14, 16, 17, 18
+ 0, 0, 0, 0, 0, 23, 0, 2, 3, 5,
+ 7, 9, 12, 15, 19, 20, 21, 0, 22, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 24, 4, 6, 8, 10, 11, 13, 14, 16, 17,
+ 18
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -8, -8, 12, 5, 11, 9, -2, 4, -1, -8
+ -11, -11, 22, 10, 8, 12, -3, -2, -1, -11
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 5, 6, 7, 8, 9, 10, 11, 12, 13
+ -1, 6, 7, 8, 9, 10, 11, 12, 13, 14
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@@ -565,28 +563,29 @@ static const yytype_int8 yydefgoto[] =
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_uint8 yytable[] =
{
- 14, 15, 17, 1, 2, 18, 25, 26, 27, 19,
- 3, 21, 22, 23, 24, 16, 4, 28, 18, 32,
- 33, 20, 0, 29, 36, 37, 38, 34, 35, 31,
- 30
+ 15, 16, 20, 18, 1, 2, 19, 27, 28, 29,
+ 21, 3, 23, 24, 25, 26, 4, 5, 30, 20,
+ 34, 35, 22, 36, 37, 17, 38, 39, 40, 32,
+ 31, 0, 0, 0, 33
};
static const yytype_int8 yycheck[] =
{
- 1, 2, 0, 3, 4, 12, 5, 6, 7, 14,
- 10, 8, 9, 3, 4, 3, 16, 11, 12, 21,
- 22, 13, -1, 18, 25, 26, 27, 23, 24, 20,
- 19
+ 1, 2, 12, 4, 3, 4, 0, 5, 6, 7,
+ 14, 10, 8, 9, 3, 4, 15, 16, 11, 12,
+ 23, 24, 13, 25, 26, 3, 27, 28, 29, 21,
+ 20, -1, -1, -1, 22
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 3, 4, 10, 16, 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 25, 25, 19, 0, 12, 14,
- 13, 8, 9, 3, 4, 5, 6, 7, 11, 20,
- 21, 22, 23, 23, 24, 24, 25, 25, 25
+ 0, 3, 4, 10, 15, 16, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 25, 25, 19, 25, 0,
+ 12, 14, 13, 8, 9, 3, 4, 5, 6, 7,
+ 11, 20, 21, 22, 23, 23, 24, 24, 25, 25,
+ 25
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
@@ -594,7 +593,7 @@ static const yytype_uint8 yyr1[] =
{
0, 17, 18, 19, 19, 20, 20, 21, 21, 22,
22, 22, 23, 23, 23, 24, 24, 24, 24, 25,
- 25, 25, 26, 26
+ 25, 25, 25, 26, 26
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
@@ -602,7 +601,7 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 1, 1, 3, 1, 3, 1, 3, 1,
3, 3, 1, 3, 3, 1, 3, 3, 3, 1,
- 2, 2, 1, 3
+ 2, 2, 2, 1, 3
};
@@ -618,22 +617,22 @@ static const yytype_uint8 yyr2[] =
#define YYRECOVERING() (!!yyerrstatus)
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- YYPOPSTACK (yylen); \
- yystate = *yyssp; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (yyscanner, YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (0)
+#define YYBACKUP(Token, Value) \
+ do \
+ if (yychar == YYEMPTY) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ YYPOPSTACK (yylen); \
+ yystate = *yyssp; \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (yyscanner, YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+ while (0)
/* Error token number */
#define YYTERROR 1
@@ -673,38 +672,38 @@ do { \
} while (0)
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT. |
-`----------------------------------------*/
+/*-----------------------------------.
+| Print this symbol's value on YYO. |
+`-----------------------------------*/
static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
+yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
{
- FILE *yyo = yyoutput;
- YYUSE (yyo);
+ FILE *yyoutput = yyo;
+ YYUSE (yyoutput);
YYUSE (yyscanner);
if (!yyvaluep)
return;
# ifdef YYPRINT
if (yytype < YYNTOKENS)
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+ YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
# endif
YYUSE (yytype);
}
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
+/*---------------------------.
+| Print this symbol on YYO. |
+`---------------------------*/
static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
+yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
{
- YYFPRINTF (yyoutput, "%s %s (",
+ YYFPRINTF (yyo, "%s %s (",
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
- yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner);
- YYFPRINTF (yyoutput, ")");
+ yy_symbol_value_print (yyo, yytype, yyvaluep, yyscanner);
+ YYFPRINTF (yyo, ")");
}
/*------------------------------------------------------------------.
@@ -738,7 +737,7 @@ do { \
static void
yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, yyscan_t yyscanner)
{
- unsigned long int yylno = yyrline[yyrule];
+ unsigned long yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
@@ -749,7 +748,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, yyscan_t yysca
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr,
yystos[yyssp[yyi + 1 - yynrhs]],
- &(yyvsp[(yyi + 1) - (yynrhs)])
+ &yyvsp[(yyi + 1) - (yynrhs)]
, yyscanner);
YYFPRINTF (stderr, "\n");
}
@@ -853,7 +852,10 @@ yytnamerr (char *yyres, const char *yystr)
case '\\':
if (*++yyp != '\\')
goto do_not_strip_quotes;
- /* Fall through. */
+ else
+ goto append;
+
+ append:
default:
if (yyres)
yyres[yyn] = *yyp;
@@ -871,7 +873,7 @@ yytnamerr (char *yyres, const char *yystr)
if (! yyres)
return yystrlen (yystr);
- return yystpcpy (yyres, yystr) - yyres;
+ return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
}
# endif
@@ -949,10 +951,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+ yysize = yysize1;
+ else
return 2;
- yysize = yysize1;
}
}
}
@@ -964,6 +966,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
case N: \
yyformat = S; \
break
+ default: /* Avoid compiler warnings. */
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
@@ -975,9 +978,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+ yysize = yysize1;
+ else
return 2;
- yysize = yysize1;
}
if (*yymsg_alloc < yysize)
@@ -1108,23 +1112,31 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
yychar = YYEMPTY; /* Cause a token to be read. */
goto yysetstate;
+
/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
+| yynewstate -- push a new state, which is found in yystate. |
`------------------------------------------------------------*/
- yynewstate:
+yynewstate:
/* In all cases, when you get here, the value and location stacks
have just been pushed. So pushing a state here evens the stacks. */
yyssp++;
- yysetstate:
- *yyssp = yystate;
+
+/*--------------------------------------------------------------------.
+| yynewstate -- set current state (the top of the stack) to yystate. |
+`--------------------------------------------------------------------*/
+yysetstate:
+ *yyssp = (yytype_int16) yystate;
if (yyss + yystacksize - 1 <= yyssp)
+#if !defined yyoverflow && !defined YYSTACK_RELOCATE
+ goto yyexhaustedlab;
+#else
{
/* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
+ YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
-#ifdef yyoverflow
+# if defined yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
@@ -1140,14 +1152,10 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yystacksize);
-
yyss = yyss1;
yyvs = yyvs1;
}
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyexhaustedlab;
-# else
+# else /* defined YYSTACK_RELOCATE */
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab;
@@ -1163,22 +1171,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-# undef YYSTACK_RELOCATE
+# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
-#endif /* no yyoverflow */
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
+ (unsigned long) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
}
+#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -1187,11 +1195,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
goto yybackup;
+
/*-----------.
| yybackup. |
`-----------*/
yybackup:
-
/* Do appropriate processing given the current state. Read a
lookahead token if we need one and don't already have one. */
@@ -1264,7 +1272,7 @@ yydefault:
/*-----------------------------.
-| yyreduce -- Do a reduction. |
+| yyreduce -- do a reduction. |
`-----------------------------*/
yyreduce:
/* yyn is the number of a rule to reduce with. */
@@ -1285,186 +1293,194 @@ yyreduce:
switch (yyn)
{
case 2:
-#line 77 "cmExprParser.y" /* yacc.c:1646 */
+#line 77 "cmExprParser.y" /* yacc.c:1652 */
{
cmExpr_yyget_extra(yyscanner)->SetResult((yyvsp[0].Number));
}
-#line 1293 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1301 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 3:
-#line 82 "cmExprParser.y" /* yacc.c:1646 */
+#line 82 "cmExprParser.y" /* yacc.c:1652 */
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1301 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1309 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 4:
-#line 85 "cmExprParser.y" /* yacc.c:1646 */
+#line 85 "cmExprParser.y" /* yacc.c:1652 */
{
(yyval.Number) = (yyvsp[-2].Number) | (yyvsp[0].Number);
}
-#line 1309 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1317 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 5:
-#line 90 "cmExprParser.y" /* yacc.c:1646 */
+#line 90 "cmExprParser.y" /* yacc.c:1652 */
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1317 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1325 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 6:
-#line 93 "cmExprParser.y" /* yacc.c:1646 */
+#line 93 "cmExprParser.y" /* yacc.c:1652 */
{
(yyval.Number) = (yyvsp[-2].Number) ^ (yyvsp[0].Number);
}
-#line 1325 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1333 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 7:
-#line 98 "cmExprParser.y" /* yacc.c:1646 */
+#line 98 "cmExprParser.y" /* yacc.c:1652 */
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1333 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1341 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 8:
-#line 101 "cmExprParser.y" /* yacc.c:1646 */
+#line 101 "cmExprParser.y" /* yacc.c:1652 */
{
(yyval.Number) = (yyvsp[-2].Number) & (yyvsp[0].Number);
}
-#line 1341 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1349 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 9:
-#line 106 "cmExprParser.y" /* yacc.c:1646 */
+#line 106 "cmExprParser.y" /* yacc.c:1652 */
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1349 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1357 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 10:
-#line 109 "cmExprParser.y" /* yacc.c:1646 */
+#line 109 "cmExprParser.y" /* yacc.c:1652 */
{
(yyval.Number) = (yyvsp[-2].Number) << (yyvsp[0].Number);
}
-#line 1357 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1365 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 11:
-#line 112 "cmExprParser.y" /* yacc.c:1646 */
+#line 112 "cmExprParser.y" /* yacc.c:1652 */
{
(yyval.Number) = (yyvsp[-2].Number) >> (yyvsp[0].Number);
}
-#line 1365 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1373 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 12:
-#line 117 "cmExprParser.y" /* yacc.c:1646 */
+#line 117 "cmExprParser.y" /* yacc.c:1652 */
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1373 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1381 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 13:
-#line 120 "cmExprParser.y" /* yacc.c:1646 */
+#line 120 "cmExprParser.y" /* yacc.c:1652 */
{
(yyval.Number) = (yyvsp[-2].Number) + (yyvsp[0].Number);
}
-#line 1381 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1389 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 14:
-#line 123 "cmExprParser.y" /* yacc.c:1646 */
+#line 123 "cmExprParser.y" /* yacc.c:1652 */
{
(yyval.Number) = (yyvsp[-2].Number) - (yyvsp[0].Number);
}
-#line 1389 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1397 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 15:
-#line 128 "cmExprParser.y" /* yacc.c:1646 */
+#line 128 "cmExprParser.y" /* yacc.c:1652 */
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1397 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1405 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 16:
-#line 131 "cmExprParser.y" /* yacc.c:1646 */
+#line 131 "cmExprParser.y" /* yacc.c:1652 */
{
(yyval.Number) = (yyvsp[-2].Number) * (yyvsp[0].Number);
}
-#line 1405 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1413 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 17:
-#line 134 "cmExprParser.y" /* yacc.c:1646 */
+#line 134 "cmExprParser.y" /* yacc.c:1652 */
{
if (yyvsp[0].Number == 0) {
throw std::overflow_error("divide by zero");
}
(yyval.Number) = (yyvsp[-2].Number) / (yyvsp[0].Number);
}
-#line 1416 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1424 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 18:
-#line 140 "cmExprParser.y" /* yacc.c:1646 */
+#line 140 "cmExprParser.y" /* yacc.c:1652 */
{
(yyval.Number) = (yyvsp[-2].Number) % (yyvsp[0].Number);
}
-#line 1424 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1432 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 19:
-#line 145 "cmExprParser.y" /* yacc.c:1646 */
+#line 145 "cmExprParser.y" /* yacc.c:1652 */
{
(yyval.Number) = (yyvsp[0].Number);
}
-#line 1432 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1440 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 20:
-#line 148 "cmExprParser.y" /* yacc.c:1646 */
+#line 148 "cmExprParser.y" /* yacc.c:1652 */
{
(yyval.Number) = + (yyvsp[0].Number);
}
-#line 1440 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1448 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 21:
-#line 151 "cmExprParser.y" /* yacc.c:1646 */
+#line 151 "cmExprParser.y" /* yacc.c:1652 */
{
(yyval.Number) = - (yyvsp[0].Number);
}
-#line 1448 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1456 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 22:
-#line 156 "cmExprParser.y" /* yacc.c:1646 */
+#line 154 "cmExprParser.y" /* yacc.c:1652 */
{
- (yyval.Number) = (yyvsp[0].Number);
+ (yyval.Number) = ~ (yyvsp[0].Number);
}
-#line 1456 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1464 "cmExprParser.cxx" /* yacc.c:1652 */
break;
case 23:
-#line 159 "cmExprParser.y" /* yacc.c:1646 */
+#line 159 "cmExprParser.y" /* yacc.c:1652 */
+ {
+ (yyval.Number) = (yyvsp[0].Number);
+ }
+#line 1472 "cmExprParser.cxx" /* yacc.c:1652 */
+ break;
+
+ case 24:
+#line 162 "cmExprParser.y" /* yacc.c:1652 */
{
(yyval.Number) = (yyvsp[-1].Number);
}
-#line 1464 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1480 "cmExprParser.cxx" /* yacc.c:1652 */
break;
-#line 1468 "cmExprParser.cxx" /* yacc.c:1646 */
+#line 1484 "cmExprParser.cxx" /* yacc.c:1652 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -1489,14 +1505,13 @@ yyreduce:
/* Now 'shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
+ {
+ const int yylhs = yyr1[yyn] - YYNTOKENS;
+ const int yyi = yypgoto[yylhs] + *yyssp;
+ yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
+ ? yytable[yyi]
+ : yydefgoto[yylhs]);
+ }
goto yynewstate;
@@ -1580,12 +1595,10 @@ yyerrlab:
| yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
yyerrorlab:
-
- /* Pacify compilers like GCC when the user code never invokes
- YYERROR and the label yyerrorlab therefore never appears in user
- code. */
- if (/*CONSTCOND*/ 0)
- goto yyerrorlab;
+ /* Pacify compilers when the user code never invokes YYERROR and the
+ label yyerrorlab therefore never appears in user code. */
+ if (0)
+ YYERROR;
/* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
@@ -1648,6 +1661,7 @@ yyacceptlab:
yyresult = 0;
goto yyreturn;
+
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
@@ -1655,6 +1669,7 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
+
#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
@@ -1665,6 +1680,10 @@ yyexhaustedlab:
/* Fall through. */
#endif
+
+/*-----------------------------------------------------.
+| yyreturn -- parsing is finished, return the result. |
+`-----------------------------------------------------*/
yyreturn:
if (yychar != YYEMPTY)
{
@@ -1694,7 +1713,7 @@ yyreturn:
#endif
return yyresult;
}
-#line 164 "cmExprParser.y" /* yacc.c:1906 */
+#line 167 "cmExprParser.y" /* yacc.c:1918 */
/* End of grammar */
diff --git a/Source/LexerParser/cmExprParser.y b/Source/LexerParser/cmExprParser.y
index 2137473..7ae2118 100644
--- a/Source/LexerParser/cmExprParser.y
+++ b/Source/LexerParser/cmExprParser.y
@@ -151,6 +151,9 @@ unary:
| exp_MINUS unary {
$<Number>$ = - $<Number>2;
}
+| exp_NOT unary {
+ $<Number>$ = ~ $<Number>2;
+ }
factor:
exp_NUMBER {
diff --git a/Source/LexerParser/cmExprParserTokens.h b/Source/LexerParser/cmExprParserTokens.h
index 84b2bbd..5ffd7c5 100644
--- a/Source/LexerParser/cmExprParserTokens.h
+++ b/Source/LexerParser/cmExprParserTokens.h
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4. */
+/* A Bison parser, made by GNU Bison 3.3.2. */
/* Bison interface for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
+ Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,6 +31,9 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
+/* Undocumented macros, especially those whose name start with YY_,
+ are private implementation details. Do not rely on them. */
+
#ifndef YY_CMEXPR_YY_CMEXPRPARSERTOKENS_H_INCLUDED
# define YY_CMEXPR_YY_CMEXPRPARSERTOKENS_H_INCLUDED
/* Debug traces. */
diff --git a/Source/LexerParser/cmFortranParser.cxx b/Source/LexerParser/cmFortranParser.cxx
index 015cab9..2ca7927 100644
--- a/Source/LexerParser/cmFortranParser.cxx
+++ b/Source/LexerParser/cmFortranParser.cxx
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4. */
+/* A Bison parser, made by GNU Bison 3.3.2. */
/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
+ Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -40,11 +41,14 @@
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
+/* Undocumented macros, especially those whose name start with YY_,
+ are private implementation details. Do not rely on them. */
+
/* Identify Bison output. */
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "3.0.4"
+#define YYBISON_VERSION "3.3.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -67,8 +71,8 @@
#define yynerrs cmFortran_yynerrs
-/* Copy the first part of user declarations. */
-#line 1 "cmFortranParser.y" /* yacc.c:339 */
+/* First part of user prologue. */
+#line 1 "cmFortranParser.y" /* yacc.c:337 */
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
@@ -131,13 +135,16 @@ static void cmFortran_yyerror(yyscan_t yyscanner, const char* message)
# pragma GCC diagnostic ignored "-Wconversion"
#endif
-#line 135 "cmFortranParser.cxx" /* yacc.c:339 */
-
+#line 139 "cmFortranParser.cxx" /* yacc.c:337 */
# ifndef YY_NULLPTR
-# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULLPTR nullptr
+# if defined __cplusplus
+# if 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
# else
-# define YY_NULLPTR 0
+# define YY_NULLPTR ((void*)0)
# endif
# endif
@@ -251,11 +258,11 @@ extern int cmFortran_yydebug;
union YYSTYPE
{
-#line 73 "cmFortranParser.y" /* yacc.c:355 */
+#line 73 "cmFortranParser.y" /* yacc.c:352 */
char* string;
-#line 259 "cmFortranParser.cxx" /* yacc.c:355 */
+#line 266 "cmFortranParser.cxx" /* yacc.c:352 */
};
typedef union YYSTYPE YYSTYPE;
@@ -269,9 +276,7 @@ int cmFortran_yyparse (yyscan_t yyscanner);
#endif /* !YY_CMFORTRAN_YY_CMFORTRANPARSERTOKENS_H_INCLUDED */
-/* Copy the second part of user declarations. */
-#line 275 "cmFortranParser.cxx" /* yacc.c:358 */
#ifdef short
# undef short
@@ -292,13 +297,13 @@ typedef signed char yytype_int8;
#ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 yytype_uint16;
#else
-typedef unsigned short int yytype_uint16;
+typedef unsigned short yytype_uint16;
#endif
#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16;
#else
-typedef short int yytype_int16;
+typedef short yytype_int16;
#endif
#ifndef YYSIZE_T
@@ -310,7 +315,7 @@ typedef short int yytype_int16;
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
-# define YYSIZE_T unsigned int
+# define YYSIZE_T unsigned
# endif
#endif
@@ -346,15 +351,6 @@ typedef short int yytype_int16;
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif
-#if !defined _Noreturn \
- && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-# define _Noreturn __declspec (noreturn)
-# else
-# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
-# endif
-#endif
-
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
@@ -362,7 +358,7 @@ typedef short int yytype_int16;
# define YYUSE(E) /* empty */
#endif
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
@@ -524,16 +520,16 @@ union yyalloc
/* YYNSTATES -- Number of states. */
#define YYNSTATES 126
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
- by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 295
+/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, with out-of-bounds checking. */
#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+ ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
- as returned by yylex, without out-of-bounds checking. */
+ as returned by yylex. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -863,22 +859,22 @@ static const yytype_uint8 yyr2[] =
#define YYRECOVERING() (!!yyerrstatus)
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- YYPOPSTACK (yylen); \
- yystate = *yyssp; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (yyscanner, YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (0)
+#define YYBACKUP(Token, Value) \
+ do \
+ if (yychar == YYEMPTY) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ YYPOPSTACK (yylen); \
+ yystate = *yyssp; \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (yyscanner, YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+ while (0)
/* Error token number */
#define YYTERROR 1
@@ -918,38 +914,38 @@ do { \
} while (0)
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT. |
-`----------------------------------------*/
+/*-----------------------------------.
+| Print this symbol's value on YYO. |
+`-----------------------------------*/
static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
+yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
{
- FILE *yyo = yyoutput;
- YYUSE (yyo);
+ FILE *yyoutput = yyo;
+ YYUSE (yyoutput);
YYUSE (yyscanner);
if (!yyvaluep)
return;
# ifdef YYPRINT
if (yytype < YYNTOKENS)
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+ YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
# endif
YYUSE (yytype);
}
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
+/*---------------------------.
+| Print this symbol on YYO. |
+`---------------------------*/
static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
+yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
{
- YYFPRINTF (yyoutput, "%s %s (",
+ YYFPRINTF (yyo, "%s %s (",
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
- yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner);
- YYFPRINTF (yyoutput, ")");
+ yy_symbol_value_print (yyo, yytype, yyvaluep, yyscanner);
+ YYFPRINTF (yyo, ")");
}
/*------------------------------------------------------------------.
@@ -983,7 +979,7 @@ do { \
static void
yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, yyscan_t yyscanner)
{
- unsigned long int yylno = yyrline[yyrule];
+ unsigned long yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
@@ -994,7 +990,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, yyscan_t yysca
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr,
yystos[yyssp[yyi + 1 - yynrhs]],
- &(yyvsp[(yyi + 1) - (yynrhs)])
+ &yyvsp[(yyi + 1) - (yynrhs)]
, yyscanner);
YYFPRINTF (stderr, "\n");
}
@@ -1098,7 +1094,10 @@ yytnamerr (char *yyres, const char *yystr)
case '\\':
if (*++yyp != '\\')
goto do_not_strip_quotes;
- /* Fall through. */
+ else
+ goto append;
+
+ append:
default:
if (yyres)
yyres[yyn] = *yyp;
@@ -1116,7 +1115,7 @@ yytnamerr (char *yyres, const char *yystr)
if (! yyres)
return yystrlen (yystr);
- return yystpcpy (yyres, yystr) - yyres;
+ return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
}
# endif
@@ -1194,10 +1193,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+ yysize = yysize1;
+ else
return 2;
- yysize = yysize1;
}
}
}
@@ -1209,6 +1208,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
case N: \
yyformat = S; \
break
+ default: /* Avoid compiler warnings. */
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
@@ -1220,9 +1220,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+ yysize = yysize1;
+ else
return 2;
- yysize = yysize1;
}
if (*yymsg_alloc < yysize)
@@ -1353,23 +1354,31 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
yychar = YYEMPTY; /* Cause a token to be read. */
goto yysetstate;
+
/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
+| yynewstate -- push a new state, which is found in yystate. |
`------------------------------------------------------------*/
- yynewstate:
+yynewstate:
/* In all cases, when you get here, the value and location stacks
have just been pushed. So pushing a state here evens the stacks. */
yyssp++;
- yysetstate:
- *yyssp = yystate;
+
+/*--------------------------------------------------------------------.
+| yynewstate -- set current state (the top of the stack) to yystate. |
+`--------------------------------------------------------------------*/
+yysetstate:
+ *yyssp = (yytype_int16) yystate;
if (yyss + yystacksize - 1 <= yyssp)
+#if !defined yyoverflow && !defined YYSTACK_RELOCATE
+ goto yyexhaustedlab;
+#else
{
/* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
+ YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
-#ifdef yyoverflow
+# if defined yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
@@ -1385,14 +1394,10 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yystacksize);
-
yyss = yyss1;
yyvs = yyvs1;
}
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyexhaustedlab;
-# else
+# else /* defined YYSTACK_RELOCATE */
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab;
@@ -1408,22 +1413,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-# undef YYSTACK_RELOCATE
+# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
-#endif /* no yyoverflow */
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
+ (unsigned long) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
}
+#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -1432,11 +1437,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
goto yybackup;
+
/*-----------.
| yybackup. |
`-----------*/
yybackup:
-
/* Do appropriate processing given the current state. Read a
lookahead token if we need one and don't already have one. */
@@ -1509,7 +1514,7 @@ yydefault:
/*-----------------------------.
-| yyreduce -- Do a reduction. |
+| yyreduce -- do a reduction. |
`-----------------------------*/
yyreduce:
/* yyn is the number of a rule to reduce with. */
@@ -1530,26 +1535,26 @@ yyreduce:
switch (yyn)
{
case 4:
-#line 104 "cmFortranParser.y" /* yacc.c:1646 */
+#line 104 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_SetInInterface(parser, true);
}
-#line 1539 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1544 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 5:
-#line 108 "cmFortranParser.y" /* yacc.c:1646 */
+#line 108 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUse(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1549 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1554 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 6:
-#line 113 "cmFortranParser.y" /* yacc.c:1646 */
+#line 113 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
if (cmsysString_strcasecmp((yyvsp[-2].string), "function") != 0 &&
@@ -1559,22 +1564,22 @@ yyreduce:
}
free((yyvsp[-2].string));
}
-#line 1563 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1568 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 7:
-#line 122 "cmFortranParser.y" /* yacc.c:1646 */
+#line 122 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleSubmodule(parser, (yyvsp[-4].string), (yyvsp[-2].string));
free((yyvsp[-4].string));
free((yyvsp[-2].string));
}
-#line 1574 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1579 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 8:
-#line 128 "cmFortranParser.y" /* yacc.c:1646 */
+#line 128 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleSubmoduleNested(parser, (yyvsp[-6].string), (yyvsp[-4].string), (yyvsp[-2].string));
@@ -1582,40 +1587,40 @@ yyreduce:
free((yyvsp[-4].string));
free((yyvsp[-2].string));
}
-#line 1586 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1591 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 9:
-#line 135 "cmFortranParser.y" /* yacc.c:1646 */
+#line 135 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_SetInInterface(parser, true);
free((yyvsp[-2].string));
}
-#line 1596 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1601 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 10:
-#line 140 "cmFortranParser.y" /* yacc.c:1646 */
+#line 140 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_SetInInterface(parser, false);
}
-#line 1605 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1610 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 11:
-#line 144 "cmFortranParser.y" /* yacc.c:1646 */
+#line 144 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUse(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1615 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1620 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 12:
-#line 149 "cmFortranParser.y" /* yacc.c:1646 */
+#line 149 "cmFortranParser.y" /* yacc.c:1652 */
{
if (cmsysString_strcasecmp((yyvsp[-4].string), "non_intrinsic") == 0) {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
@@ -1624,139 +1629,139 @@ yyreduce:
free((yyvsp[-4].string));
free((yyvsp[-2].string));
}
-#line 1628 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1633 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 13:
-#line 157 "cmFortranParser.y" /* yacc.c:1646 */
+#line 157 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleInclude(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1638 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1643 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 14:
-#line 162 "cmFortranParser.y" /* yacc.c:1646 */
+#line 162 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleLineDirective(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1648 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1653 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 15:
-#line 167 "cmFortranParser.y" /* yacc.c:1646 */
+#line 167 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleInclude(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1658 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1663 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 16:
-#line 172 "cmFortranParser.y" /* yacc.c:1646 */
+#line 172 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleInclude(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1668 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1673 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 17:
-#line 177 "cmFortranParser.y" /* yacc.c:1646 */
+#line 177 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleDefine(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1678 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1683 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 18:
-#line 182 "cmFortranParser.y" /* yacc.c:1646 */
+#line 182 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUndef(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1688 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1693 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 19:
-#line 187 "cmFortranParser.y" /* yacc.c:1646 */
+#line 187 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleIfdef(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1698 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1703 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 20:
-#line 192 "cmFortranParser.y" /* yacc.c:1646 */
+#line 192 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleIfndef(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
-#line 1708 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1713 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 21:
-#line 197 "cmFortranParser.y" /* yacc.c:1646 */
+#line 197 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleIf(parser);
}
-#line 1717 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1722 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 22:
-#line 201 "cmFortranParser.y" /* yacc.c:1646 */
+#line 201 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleElif(parser);
}
-#line 1726 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1731 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 23:
-#line 205 "cmFortranParser.y" /* yacc.c:1646 */
+#line 205 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleElse(parser);
}
-#line 1735 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1740 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 24:
-#line 209 "cmFortranParser.y" /* yacc.c:1646 */
+#line 209 "cmFortranParser.y" /* yacc.c:1652 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleEndif(parser);
}
-#line 1744 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1749 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 48:
-#line 231 "cmFortranParser.y" /* yacc.c:1646 */
+#line 231 "cmFortranParser.y" /* yacc.c:1652 */
{ free ((yyvsp[0].string)); }
-#line 1750 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1755 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
case 55:
-#line 238 "cmFortranParser.y" /* yacc.c:1646 */
+#line 238 "cmFortranParser.y" /* yacc.c:1652 */
{ free ((yyvsp[0].string)); }
-#line 1756 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1761 "cmFortranParser.cxx" /* yacc.c:1652 */
break;
-#line 1760 "cmFortranParser.cxx" /* yacc.c:1646 */
+#line 1765 "cmFortranParser.cxx" /* yacc.c:1652 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -1781,14 +1786,13 @@ yyreduce:
/* Now 'shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
+ {
+ const int yylhs = yyr1[yyn] - YYNTOKENS;
+ const int yyi = yypgoto[yylhs] + *yyssp;
+ yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
+ ? yytable[yyi]
+ : yydefgoto[yylhs]);
+ }
goto yynewstate;
@@ -1872,12 +1876,10 @@ yyerrlab:
| yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
yyerrorlab:
-
- /* Pacify compilers like GCC when the user code never invokes
- YYERROR and the label yyerrorlab therefore never appears in user
- code. */
- if (/*CONSTCOND*/ 0)
- goto yyerrorlab;
+ /* Pacify compilers when the user code never invokes YYERROR and the
+ label yyerrorlab therefore never appears in user code. */
+ if (0)
+ YYERROR;
/* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
@@ -1940,6 +1942,7 @@ yyacceptlab:
yyresult = 0;
goto yyreturn;
+
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
@@ -1947,6 +1950,7 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
+
#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
@@ -1957,6 +1961,10 @@ yyexhaustedlab:
/* Fall through. */
#endif
+
+/*-----------------------------------------------------.
+| yyreturn -- parsing is finished, return the result. |
+`-----------------------------------------------------*/
yyreturn:
if (yychar != YYEMPTY)
{
@@ -1986,6 +1994,6 @@ yyreturn:
#endif
return yyresult;
}
-#line 249 "cmFortranParser.y" /* yacc.c:1906 */
+#line 249 "cmFortranParser.y" /* yacc.c:1918 */
/* End of grammar */
diff --git a/Source/LexerParser/cmFortranParserTokens.h b/Source/LexerParser/cmFortranParserTokens.h
index 29c6d60..0da4c1c 100644
--- a/Source/LexerParser/cmFortranParserTokens.h
+++ b/Source/LexerParser/cmFortranParserTokens.h
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4. */
+/* A Bison parser, made by GNU Bison 3.3.2. */
/* Bison interface for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
+ Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,6 +31,9 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
+/* Undocumented macros, especially those whose name start with YY_,
+ are private implementation details. Do not rely on them. */
+
#ifndef YY_CMFORTRAN_YY_CMFORTRANPARSERTOKENS_H_INCLUDED
# define YY_CMFORTRAN_YY_CMFORTRANPARSERTOKENS_H_INCLUDED
/* Debug traces. */
@@ -130,11 +134,11 @@ extern int cmFortran_yydebug;
union YYSTYPE
{
-#line 73 "cmFortranParser.y" /* yacc.c:1909 */
+#line 73 "cmFortranParser.y" /* yacc.c:1921 */
char* string;
-#line 138 "cmFortranParserTokens.h" /* yacc.c:1909 */
+#line 142 "cmFortranParserTokens.h" /* yacc.c:1921 */
};
typedef union YYSTYPE YYSTYPE;
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index c9ebba8..287a482 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -6,6 +6,7 @@
#include "cmAlgorithms.h"
#include "cmDocumentation.h"
#include "cmDocumentationEntry.h"
+#include "cmStringAlgorithms.h"
#include "cmVersion.h"
#include "cmake.h"
#include "cmsys/CommandLineArguments.hxx"
diff --git a/Source/cmAddCompileDefinitionsCommand.h b/Source/cmAddCompileDefinitionsCommand.h
index e985dca..5f90ed9 100644
--- a/Source/cmAddCompileDefinitionsCommand.h
+++ b/Source/cmAddCompileDefinitionsCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -18,7 +20,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmAddCompileDefinitionsCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmAddCompileDefinitionsCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmAddCompileOptionsCommand.h b/Source/cmAddCompileOptionsCommand.h
index 3d53d09..b34b7fc 100644
--- a/Source/cmAddCompileOptionsCommand.h
+++ b/Source/cmAddCompileOptionsCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -18,7 +20,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmAddCompileOptionsCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmAddCompileOptionsCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index 0be3c85..6eb38bd 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -95,30 +95,29 @@ bool cmAddCustomCommandCommand::InitialPass(
MAKE_STATIC_KEYWORD(VERBATIM);
MAKE_STATIC_KEYWORD(WORKING_DIRECTORY);
#undef MAKE_STATIC_KEYWORD
- static std::unordered_set<std::string> keywords;
- if (keywords.empty()) {
- keywords.insert(keyAPPEND);
- keywords.insert(keyARGS);
- keywords.insert(keyBYPRODUCTS);
- keywords.insert(keyCOMMAND);
- keywords.insert(keyCOMMAND_EXPAND_LISTS);
- keywords.insert(keyCOMMENT);
- keywords.insert(keyDEPENDS);
- keywords.insert(keyDEPFILE);
- keywords.insert(keyIMPLICIT_DEPENDS);
- keywords.insert(keyJOB_POOL);
- keywords.insert(keyMAIN_DEPENDENCY);
- keywords.insert(keyOUTPUT);
- keywords.insert(keyOUTPUTS);
- keywords.insert(keyPOST_BUILD);
- keywords.insert(keyPRE_BUILD);
- keywords.insert(keyPRE_LINK);
- keywords.insert(keySOURCE);
- keywords.insert(keyTARGET);
- keywords.insert(keyUSES_TERMINAL);
- keywords.insert(keyVERBATIM);
- keywords.insert(keyWORKING_DIRECTORY);
- }
+ static std::unordered_set<std::string> const keywords{
+ keyAPPEND,
+ keyARGS,
+ keyBYPRODUCTS,
+ keyCOMMAND,
+ keyCOMMAND_EXPAND_LISTS,
+ keyCOMMENT,
+ keyDEPENDS,
+ keyDEPFILE,
+ keyIMPLICIT_DEPENDS,
+ keyJOB_POOL,
+ keyMAIN_DEPENDENCY,
+ keyOUTPUT,
+ keyOUTPUTS,
+ keyPOST_BUILD,
+ keyPRE_BUILD,
+ keyPRE_LINK,
+ keySOURCE,
+ keyTARGET,
+ keyUSES_TERMINAL,
+ keyVERBATIM,
+ keyWORKING_DIRECTORY
+ };
for (std::string const& copy : args) {
if (keywords.count(copy)) {
diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h
index 6af4f10..931aeab 100644
--- a/Source/cmAddCustomCommandCommand.h
+++ b/Source/cmAddCustomCommandCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -24,7 +26,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmAddCustomCommandCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmAddCustomCommandCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h
index 1a55116..db577bc 100644
--- a/Source/cmAddCustomTargetCommand.h
+++ b/Source/cmAddCustomTargetCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -25,7 +27,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmAddCustomTargetCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmAddCustomTargetCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h
index 7b75638..0e32c83 100644
--- a/Source/cmAddDefinitionsCommand.h
+++ b/Source/cmAddDefinitionsCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -24,7 +26,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmAddDefinitionsCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmAddDefinitionsCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h
index e10df71..ce912d3 100644
--- a/Source/cmAddDependenciesCommand.h
+++ b/Source/cmAddDependenciesCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -23,7 +25,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmAddDependenciesCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmAddDependenciesCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h
index bdf607d..ec57c3f 100644
--- a/Source/cmAddExecutableCommand.h
+++ b/Source/cmAddExecutableCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -24,7 +26,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmAddExecutableCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmAddExecutableCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h
index aa21261..56dab41 100644
--- a/Source/cmAddLibraryCommand.h
+++ b/Source/cmAddLibraryCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -24,7 +26,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmAddLibraryCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmAddLibraryCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmAddLinkOptionsCommand.h b/Source/cmAddLinkOptionsCommand.h
index 30fff00..8e46be6 100644
--- a/Source/cmAddLinkOptionsCommand.h
+++ b/Source/cmAddLinkOptionsCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -18,7 +20,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmAddLinkOptionsCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmAddLinkOptionsCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h
index 0ea4423..664334e 100644
--- a/Source/cmAddSubDirectoryCommand.h
+++ b/Source/cmAddSubDirectoryCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -25,7 +27,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmAddSubDirectoryCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmAddSubDirectoryCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx
index bf28702..b0c462b 100644
--- a/Source/cmAddTestCommand.cxx
+++ b/Source/cmAddTestCommand.cxx
@@ -58,6 +58,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
std::vector<std::string> configurations;
std::string working_directory;
std::vector<std::string> command;
+ bool command_expand_lists = false;
// Read the arguments.
enum Doing
@@ -88,6 +89,13 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
return false;
}
doing = DoingWorkingDirectory;
+ } else if (args[i] == "COMMAND_EXPAND_LISTS") {
+ if (command_expand_lists) {
+ this->SetError(" may be given at most one COMMAND_EXPAND_LISTS.");
+ return false;
+ }
+ command_expand_lists = true;
+ doing = DoingNone;
} else if (doing == DoingName) {
name = args[i];
doing = DoingNone;
@@ -134,6 +142,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
if (!working_directory.empty()) {
test->SetProperty("WORKING_DIRECTORY", working_directory.c_str());
}
+ test->SetCommandExpandLists(command_expand_lists);
this->Makefile->AddTestGenerator(new cmTestGenerator(test, configurations));
return true;
diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h
index bea3f3d..3d37d2b 100644
--- a/Source/cmAddTestCommand.h
+++ b/Source/cmAddTestCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -23,7 +25,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmAddTestCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmAddTestCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index d1e32b0..d7ea483 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -6,79 +6,14 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmRange.h"
-
#include "cm_kwiml.h"
#include <algorithm>
#include <functional>
#include <iterator>
-#include <memory>
-#include <sstream>
-#include <string.h>
-#include <string>
#include <unordered_set>
#include <utility>
#include <vector>
-inline bool cmHasLiteralPrefixImpl(const std::string& str1, const char* str2,
- size_t N)
-{
- return strncmp(str1.c_str(), str2, N) == 0;
-}
-
-inline bool cmHasLiteralPrefixImpl(const char* str1, const char* str2,
- size_t N)
-{
- return strncmp(str1, str2, N) == 0;
-}
-
-inline bool cmHasLiteralSuffixImpl(const std::string& str1, const char* str2,
- size_t N)
-{
- size_t len = str1.size();
- return len >= N && strcmp(str1.c_str() + len - N, str2) == 0;
-}
-
-inline bool cmHasLiteralSuffixImpl(const char* str1, const char* str2,
- size_t N)
-{
- size_t len = strlen(str1);
- return len >= N && strcmp(str1 + len - N, str2) == 0;
-}
-
-template <typename T, size_t N>
-bool cmHasLiteralPrefix(const T& str1, const char (&str2)[N])
-{
- return cmHasLiteralPrefixImpl(str1, str2, N - 1);
-}
-
-template <typename T, size_t N>
-bool cmHasLiteralSuffix(const T& str1, const char (&str2)[N])
-{
- return cmHasLiteralSuffixImpl(str1, str2, N - 1);
-}
-
-struct cmStrCmp
-{
- cmStrCmp(const char* test)
- : m_test(test)
- {
- }
- cmStrCmp(std::string test)
- : m_test(std::move(test))
- {
- }
-
- bool operator()(const std::string& input) const { return m_test == input; }
-
- bool operator()(const char* input) const
- {
- return strcmp(input, m_test.c_str()) == 0;
- }
-
-private:
- const std::string m_test;
-};
-
template <typename FwdIt>
FwdIt cmRotate(FwdIt first, FwdIt middle, FwdIt last)
{
@@ -158,8 +93,6 @@ private:
};
}
-typedef cmRange<std::vector<std::string>::const_iterator> cmStringRange;
-
class cmListFileBacktrace;
typedef cmRange<std::vector<cmListFileBacktrace>::const_iterator>
cmBacktraceRange;
@@ -184,31 +117,6 @@ void cmAppend(std::vector<T>& v, InputIt first, InputIt last)
}
template <typename Range>
-std::string cmJoin(Range const& r, const char* delimiter)
-{
- if (r.empty()) {
- return std::string();
- }
- std::ostringstream os;
- typedef typename Range::value_type ValueType;
- typedef typename Range::const_iterator InputIt;
- const InputIt first = r.begin();
- InputIt last = r.end();
- --last;
- std::copy(first, last, std::ostream_iterator<ValueType>(os, delimiter));
-
- os << *last;
-
- return os.str();
-}
-
-template <typename Range>
-std::string cmJoin(Range const& r, std::string const& delimiter)
-{
- return cmJoin(r, delimiter.c_str());
-}
-
-template <typename Range>
typename Range::const_iterator cmRemoveN(Range& r, size_t n)
{
return ContainerAlgorithms::RemoveN(r.begin(), r.end(), n);
@@ -286,23 +194,6 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r)
return cmRemoveDuplicates(r.begin(), r.end());
}
-template <typename Range>
-std::string cmWrap(std::string const& prefix, Range const& r,
- std::string const& suffix, std::string const& sep)
-{
- if (r.empty()) {
- return std::string();
- }
- return prefix + cmJoin(r, suffix + sep + prefix) + suffix;
-}
-
-template <typename Range>
-std::string cmWrap(char prefix, Range const& r, char suffix,
- std::string const& sep)
-{
- return cmWrap(std::string(1, prefix), r, std::string(1, suffix), sep);
-}
-
template <typename Range, typename T>
typename Range::const_iterator cmFindNot(Range const& r, T const& t)
{
@@ -315,45 +206,8 @@ std::reverse_iterator<Iter> cmMakeReverseIterator(Iter it)
return std::reverse_iterator<Iter>(it);
}
-inline bool cmHasPrefix(std::string const& str, std::string const& prefix)
-{
- if (str.size() < prefix.size()) {
- return false;
- }
- return str.compare(0, prefix.size(), prefix) == 0;
-}
-
-inline bool cmHasSuffix(const std::string& str, const std::string& suffix)
-{
- if (str.size() < suffix.size()) {
- return false;
- }
- return str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0;
-}
-
-inline void cmStripSuffixIfExists(std::string& str, const std::string& suffix)
-{
- if (cmHasSuffix(str, suffix)) {
- str.resize(str.size() - suffix.size());
- }
-}
-
namespace cm {
-#if defined(CMake_HAVE_CXX_MAKE_UNIQUE)
-
-using std::make_unique;
-
-#else
-
-template <typename T, typename... Args>
-std::unique_ptr<T> make_unique(Args&&... args)
-{
- return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
-}
-
-#endif
-
#if __cplusplus >= 201703L || defined(_MSVC_LANG) && _MSVC_LANG >= 201703L
using std::size;
diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx
index 106e7a7..45c6411 100644
--- a/Source/cmAuxSourceDirectoryCommand.cxx
+++ b/Source/cmAuxSourceDirectoryCommand.cxx
@@ -7,9 +7,9 @@
#include <stddef.h>
#include <utility>
-#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -74,6 +74,6 @@ bool cmAuxSourceDirectoryCommand::InitialPass(
sourceListValue += ";";
}
sourceListValue += cmJoin(files, ";");
- this->Makefile->AddDefinition(args[1], sourceListValue.c_str());
+ this->Makefile->AddDefinition(args[1], sourceListValue);
return true;
}
diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h
index 3742e3e..973a464 100644
--- a/Source/cmAuxSourceDirectoryCommand.h
+++ b/Source/cmAuxSourceDirectoryCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -27,7 +29,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmAuxSourceDirectoryCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmAuxSourceDirectoryCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmBinUtilsLinker.cxx b/Source/cmBinUtilsLinker.cxx
new file mode 100644
index 0000000..3dac85c
--- /dev/null
+++ b/Source/cmBinUtilsLinker.cxx
@@ -0,0 +1,15 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmBinUtilsLinker.h"
+#include "cmRuntimeDependencyArchive.h"
+
+cmBinUtilsLinker::cmBinUtilsLinker(cmRuntimeDependencyArchive* archive)
+ : Archive(archive)
+{
+}
+
+void cmBinUtilsLinker::SetError(const std::string& e)
+{
+ this->Archive->SetError(e);
+}
diff --git a/Source/cmBinUtilsLinker.h b/Source/cmBinUtilsLinker.h
new file mode 100644
index 0000000..29853a5
--- /dev/null
+++ b/Source/cmBinUtilsLinker.h
@@ -0,0 +1,30 @@
+/* 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
+
+#include "cmStateTypes.h"
+
+#include <string>
+
+class cmRuntimeDependencyArchive;
+
+class cmBinUtilsLinker
+{
+public:
+ cmBinUtilsLinker(cmRuntimeDependencyArchive* archive);
+ virtual ~cmBinUtilsLinker() = default;
+
+ virtual bool Prepare() { return true; }
+
+ virtual bool ScanDependencies(std::string const& file,
+ cmStateEnums::TargetType type) = 0;
+
+protected:
+ cmRuntimeDependencyArchive* Archive;
+
+ void SetError(const std::string& e);
+};
+
+#endif // cmBinUtilsLinker_h
diff --git a/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.cxx
new file mode 100644
index 0000000..40de592
--- /dev/null
+++ b/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.cxx
@@ -0,0 +1,18 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h"
+#include "cmRuntimeDependencyArchive.h"
+
+cmBinUtilsLinuxELFGetRuntimeDependenciesTool::
+ cmBinUtilsLinuxELFGetRuntimeDependenciesTool(
+ cmRuntimeDependencyArchive* archive)
+ : Archive(archive)
+{
+}
+
+void cmBinUtilsLinuxELFGetRuntimeDependenciesTool::SetError(
+ const std::string& error)
+{
+ this->Archive->SetError(error);
+}
diff --git a/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h b/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h
new file mode 100644
index 0000000..d514e7f
--- /dev/null
+++ b/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h
@@ -0,0 +1,30 @@
+/* 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
+
+#include <string>
+#include <vector>
+
+class cmRuntimeDependencyArchive;
+
+class cmBinUtilsLinuxELFGetRuntimeDependenciesTool
+{
+public:
+ cmBinUtilsLinuxELFGetRuntimeDependenciesTool(
+ cmRuntimeDependencyArchive* archive);
+ virtual ~cmBinUtilsLinuxELFGetRuntimeDependenciesTool() = default;
+
+ virtual bool GetFileInfo(std::string const& file,
+ std::vector<std::string>& needed,
+ std::vector<std::string>& rpaths,
+ std::vector<std::string>& runpaths) = 0;
+
+protected:
+ cmRuntimeDependencyArchive* Archive;
+
+ void SetError(const std::string& e);
+};
+
+#endif // cmBinUtilsLinuxELFGetRuntimeDependenciesTool_h
diff --git a/Source/cmBinUtilsLinuxELFLinker.cxx b/Source/cmBinUtilsLinuxELFLinker.cxx
new file mode 100644
index 0000000..86846cb
--- /dev/null
+++ b/Source/cmBinUtilsLinuxELFLinker.cxx
@@ -0,0 +1,178 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmBinUtilsLinuxELFLinker.h"
+
+#include "cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h"
+#include "cmLDConfigLDConfigTool.h"
+#include "cmMakefile.h"
+#include "cmMessageType.h"
+#include "cmRuntimeDependencyArchive.h"
+#include "cmSystemTools.h"
+
+#include <cmsys/RegularExpression.hxx>
+
+#include <sstream>
+
+#include "cm_memory.hxx"
+
+static std::string ReplaceOrigin(const std::string& rpath,
+ const std::string& origin)
+{
+ static const cmsys::RegularExpression originRegex(
+ "(\\$ORIGIN)([^a-zA-Z0-9_]|$)");
+ static const cmsys::RegularExpression originCurlyRegex("\\${ORIGIN}");
+
+ cmsys::RegularExpressionMatch match;
+ if (originRegex.find(rpath.c_str(), match)) {
+ std::string begin = rpath.substr(0, match.start(1));
+ std::string end = rpath.substr(match.end(1));
+ return begin + origin + end;
+ }
+ if (originCurlyRegex.find(rpath.c_str(), match)) {
+ std::string begin = rpath.substr(0, match.start());
+ std::string end = rpath.substr(match.end());
+ return begin + origin + end;
+ }
+ return rpath;
+}
+
+cmBinUtilsLinuxELFLinker::cmBinUtilsLinuxELFLinker(
+ cmRuntimeDependencyArchive* archive)
+ : cmBinUtilsLinker(archive)
+{
+}
+
+bool cmBinUtilsLinuxELFLinker::Prepare()
+{
+ std::string tool = this->Archive->GetGetRuntimeDependenciesTool();
+ if (tool.empty()) {
+ tool = "objdump";
+ }
+ if (tool == "objdump") {
+ this->Tool =
+ cm::make_unique<cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool>(
+ this->Archive);
+ } else {
+ std::ostringstream e;
+ e << "Invalid value for CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL: " << tool;
+ this->SetError(e.str());
+ return false;
+ }
+
+ std::string ldConfigTool =
+ this->Archive->GetMakefile()->GetSafeDefinition("CMAKE_LDCONFIG_TOOL");
+ if (ldConfigTool.empty()) {
+ ldConfigTool = "ldconfig";
+ }
+ if (ldConfigTool == "ldconfig") {
+ this->LDConfigTool =
+ cm::make_unique<cmLDConfigLDConfigTool>(this->Archive);
+ } else {
+ std::ostringstream e;
+ e << "Invalid value for CMAKE_LDCONFIG_TOOL: " << ldConfigTool;
+ this->SetError(e.str());
+ return false;
+ }
+
+ return true;
+}
+
+bool cmBinUtilsLinuxELFLinker::ScanDependencies(
+ std::string const& file, cmStateEnums::TargetType /* unused */)
+{
+ std::vector<std::string> parentRpaths;
+ return this->ScanDependencies(file, parentRpaths);
+}
+
+bool cmBinUtilsLinuxELFLinker::ScanDependencies(
+ std::string const& file, std::vector<std::string> const& parentRpaths)
+{
+ std::string origin = cmSystemTools::GetFilenamePath(file);
+ std::vector<std::string> needed;
+ std::vector<std::string> rpaths;
+ std::vector<std::string> runpaths;
+ if (!this->Tool->GetFileInfo(file, needed, rpaths, runpaths)) {
+ return false;
+ }
+ for (auto& runpath : runpaths) {
+ runpath = ReplaceOrigin(runpath, origin);
+ }
+ for (auto& rpath : rpaths) {
+ rpath = ReplaceOrigin(rpath, origin);
+ }
+
+ std::vector<std::string> searchPaths;
+ if (!runpaths.empty()) {
+ searchPaths = runpaths;
+ } else {
+ searchPaths = rpaths;
+ searchPaths.insert(searchPaths.end(), parentRpaths.begin(),
+ parentRpaths.end());
+ }
+
+ std::vector<std::string> ldConfigPaths;
+ if (!this->LDConfigTool->GetLDConfigPaths(ldConfigPaths)) {
+ return false;
+ }
+ searchPaths.insert(searchPaths.end(), ldConfigPaths.begin(),
+ ldConfigPaths.end());
+
+ for (auto const& dep : needed) {
+ if (!this->Archive->IsPreExcluded(dep)) {
+ std::string path;
+ bool resolved = false;
+ if (dep.find('/') != std::string::npos) {
+ this->SetError("Paths to dependencies are not supported");
+ return false;
+ }
+ if (!this->ResolveDependency(dep, searchPaths, path, resolved)) {
+ return false;
+ }
+ if (resolved) {
+ if (!this->Archive->IsPostExcluded(path)) {
+ bool unique;
+ this->Archive->AddResolvedPath(dep, path, unique);
+ if (unique && !this->ScanDependencies(path, rpaths)) {
+ return false;
+ }
+ }
+ } else {
+ this->Archive->AddUnresolvedPath(dep);
+ }
+ }
+ }
+
+ return true;
+}
+
+bool cmBinUtilsLinuxELFLinker::ResolveDependency(
+ std::string const& name, std::vector<std::string> const& searchPaths,
+ std::string& path, bool& resolved)
+{
+ for (auto const& searchPath : searchPaths) {
+ path = searchPath + '/' + name;
+ if (cmSystemTools::PathExists(path)) {
+ resolved = true;
+ return true;
+ }
+ }
+
+ for (auto const& searchPath : this->Archive->GetSearchDirectories()) {
+ path = searchPath + '/' + name;
+ if (cmSystemTools::PathExists(path)) {
+ std::ostringstream warning;
+ warning << "Dependency " << name << " found in search directory:\n "
+ << searchPath
+ << "\nSee file(GET_RUNTIME_DEPENDENCIES) documentation for "
+ << "more information.";
+ this->Archive->GetMakefile()->IssueMessage(MessageType::WARNING,
+ warning.str());
+ resolved = true;
+ return true;
+ }
+ }
+
+ resolved = false;
+ return true;
+}
diff --git a/Source/cmBinUtilsLinuxELFLinker.h b/Source/cmBinUtilsLinuxELFLinker.h
new file mode 100644
index 0000000..e209637
--- /dev/null
+++ b/Source/cmBinUtilsLinuxELFLinker.h
@@ -0,0 +1,44 @@
+/* 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
+
+#include "cmBinUtilsLinker.h"
+#include "cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h"
+#include "cmLDConfigTool.h"
+#include "cmStateTypes.h"
+
+#include <memory>
+#include <string>
+#include <vector>
+
+class cmRuntimeDependencyArchive;
+
+class cmBinUtilsLinuxELFLinker : public cmBinUtilsLinker
+{
+public:
+ cmBinUtilsLinuxELFLinker(cmRuntimeDependencyArchive* archive);
+
+ bool Prepare() override;
+
+ bool ScanDependencies(std::string const& file,
+ cmStateEnums::TargetType type) override;
+
+private:
+ std::unique_ptr<cmBinUtilsLinuxELFGetRuntimeDependenciesTool> Tool;
+ std::unique_ptr<cmLDConfigTool> LDConfigTool;
+ bool HaveLDConfigPaths = false;
+ std::vector<std::string> LDConfigPaths;
+
+ bool ScanDependencies(std::string const& file,
+ std::vector<std::string> const& parentRpaths);
+
+ bool ResolveDependency(std::string const& name,
+ std::vector<std::string> const& searchPaths,
+ std::string& path, bool& resolved);
+
+ bool GetLDConfigPaths();
+};
+
+#endif // cmBinUtilsLinuxELFLinker_h
diff --git a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx
new file mode 100644
index 0000000..3bf7bf8
--- /dev/null
+++ b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx
@@ -0,0 +1,84 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h"
+#include "cmRuntimeDependencyArchive.h"
+#include "cmSystemTools.h"
+#include "cmUVProcessChain.h"
+
+#include <cmsys/RegularExpression.hxx>
+
+#include <sstream>
+
+cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool::
+ cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool(
+ cmRuntimeDependencyArchive* archive)
+ : cmBinUtilsLinuxELFGetRuntimeDependenciesTool(archive)
+{
+}
+
+bool cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool::GetFileInfo(
+ std::string const& file, std::vector<std::string>& needed,
+ std::vector<std::string>& rpaths, std::vector<std::string>& runpaths)
+{
+ cmUVProcessChainBuilder builder;
+ builder.SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT);
+
+ std::vector<std::string> command;
+ if (!this->Archive->GetGetRuntimeDependenciesCommand("objdump", command)) {
+ this->SetError("Could not find objdump");
+ return false;
+ }
+ command.emplace_back("-p");
+ command.push_back(file);
+ builder.AddCommand(command);
+
+ auto process = builder.Start();
+ if (!process.Valid()) {
+ std::ostringstream e;
+ e << "Failed to start objdump process for:\n " << file;
+ this->SetError(e.str());
+ return false;
+ }
+
+ std::string line;
+ static const cmsys::RegularExpression neededRegex("^ *NEEDED *([^\n]*)$");
+ static const cmsys::RegularExpression rpathRegex("^ *RPATH *([^\n]*)$");
+ static const cmsys::RegularExpression runpathRegex("^ *RUNPATH *([^\n]*)$");
+ while (std::getline(*process.OutputStream(), line)) {
+ cmsys::RegularExpressionMatch match;
+ if (neededRegex.find(line.c_str(), match)) {
+ needed.push_back(match.match(1));
+ } else if (rpathRegex.find(line.c_str(), match)) {
+ std::vector<std::string> rpathSplit =
+ cmSystemTools::SplitString(match.match(1), ':');
+ rpaths.reserve(rpaths.size() + rpathSplit.size());
+ for (auto const& rpath : rpathSplit) {
+ rpaths.push_back(rpath);
+ }
+ } else if (runpathRegex.find(line.c_str(), match)) {
+ std::vector<std::string> runpathSplit =
+ cmSystemTools::SplitString(match.match(1), ':');
+ runpaths.reserve(runpaths.size() + runpathSplit.size());
+ for (auto const& runpath : runpathSplit) {
+ runpaths.push_back(runpath);
+ }
+ }
+ }
+
+ if (!process.Wait()) {
+ std::ostringstream e;
+ e << "Failed to wait on objdump process for:\n " << file;
+ this->SetError(e.str());
+ return false;
+ }
+ auto status = process.GetStatus();
+ if (!status[0] || status[0]->ExitStatus != 0) {
+ std::ostringstream e;
+ e << "Failed to run objdump on:\n " << file;
+ this->SetError(e.str());
+ return false;
+ }
+
+ return true;
+}
diff --git a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h
new file mode 100644
index 0000000..286337f
--- /dev/null
+++ b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.h
@@ -0,0 +1,26 @@
+/* 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
+
+#include "cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h"
+
+#include <string>
+#include <vector>
+
+class cmRuntimeDependencyArchive;
+
+class cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool
+ : public cmBinUtilsLinuxELFGetRuntimeDependenciesTool
+{
+public:
+ cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool(
+ cmRuntimeDependencyArchive* archive);
+
+ bool GetFileInfo(std::string const& file, std::vector<std::string>& needed,
+ std::vector<std::string>& rpaths,
+ std::vector<std::string>& runpaths) override;
+};
+
+#endif // cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool_h
diff --git a/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.cxx
new file mode 100644
index 0000000..a296a47
--- /dev/null
+++ b/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.cxx
@@ -0,0 +1,19 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h"
+
+#include "cmRuntimeDependencyArchive.h"
+
+cmBinUtilsMacOSMachOGetRuntimeDependenciesTool::
+ cmBinUtilsMacOSMachOGetRuntimeDependenciesTool(
+ cmRuntimeDependencyArchive* archive)
+ : Archive(archive)
+{
+}
+
+void cmBinUtilsMacOSMachOGetRuntimeDependenciesTool::SetError(
+ const std::string& error)
+{
+ this->Archive->SetError(error);
+}
diff --git a/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h b/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h
new file mode 100644
index 0000000..dbb2882
--- /dev/null
+++ b/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h
@@ -0,0 +1,29 @@
+/* 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
+
+#include <string>
+#include <vector>
+
+class cmRuntimeDependencyArchive;
+
+class cmBinUtilsMacOSMachOGetRuntimeDependenciesTool
+{
+public:
+ cmBinUtilsMacOSMachOGetRuntimeDependenciesTool(
+ cmRuntimeDependencyArchive* archive);
+ virtual ~cmBinUtilsMacOSMachOGetRuntimeDependenciesTool() = default;
+
+ virtual bool GetFileInfo(std::string const& file,
+ std::vector<std::string>& libs,
+ std::vector<std::string>& rpaths) = 0;
+
+protected:
+ cmRuntimeDependencyArchive* Archive;
+
+ void SetError(const std::string& error);
+};
+
+#endif // cmBinUtilsMacOSMachOGetRuntimeDependenciesTool_h
diff --git a/Source/cmBinUtilsMacOSMachOLinker.cxx b/Source/cmBinUtilsMacOSMachOLinker.cxx
new file mode 100644
index 0000000..0c73ac8
--- /dev/null
+++ b/Source/cmBinUtilsMacOSMachOLinker.cxx
@@ -0,0 +1,230 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmBinUtilsMacOSMachOLinker.h"
+
+#include "cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h"
+#include "cmRuntimeDependencyArchive.h"
+#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
+
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include "cm_memory.hxx"
+
+cmBinUtilsMacOSMachOLinker::cmBinUtilsMacOSMachOLinker(
+ cmRuntimeDependencyArchive* archive)
+ : cmBinUtilsLinker(archive)
+{
+}
+
+bool cmBinUtilsMacOSMachOLinker::Prepare()
+{
+ std::string tool = this->Archive->GetGetRuntimeDependenciesTool();
+ if (tool.empty()) {
+ tool = "otool";
+ }
+ if (tool == "otool") {
+ this->Tool =
+ cm::make_unique<cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool>(
+ this->Archive);
+ } else {
+ std::ostringstream e;
+ e << "Invalid value for CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL: " << tool;
+ this->SetError(e.str());
+ return false;
+ }
+
+ return true;
+}
+
+bool cmBinUtilsMacOSMachOLinker::ScanDependencies(
+ std::string const& file, cmStateEnums::TargetType type)
+{
+ std::string executableFile;
+ if (type == cmStateEnums::EXECUTABLE) {
+ executableFile = file;
+ } else {
+ executableFile = this->Archive->GetBundleExecutable();
+ }
+ std::string executablePath;
+ if (!executableFile.empty()) {
+ executablePath = cmSystemTools::GetFilenamePath(executableFile);
+ }
+ return this->ScanDependencies(file, executablePath);
+}
+
+bool cmBinUtilsMacOSMachOLinker::ScanDependencies(
+ std::string const& file, std::string const& executablePath)
+{
+ std::vector<std::string> libs, rpaths;
+ if (!this->Tool->GetFileInfo(file, libs, rpaths)) {
+ return false;
+ }
+
+ std::string loaderPath = cmSystemTools::GetFilenamePath(file);
+ return this->GetFileDependencies(libs, executablePath, loaderPath, rpaths);
+}
+
+bool cmBinUtilsMacOSMachOLinker::GetFileDependencies(
+ std::vector<std::string> const& names, std::string const& executablePath,
+ std::string const& loaderPath, std::vector<std::string> const& rpaths)
+{
+ for (std::string const& name : names) {
+ if (!this->Archive->IsPreExcluded(name)) {
+ std::string path;
+ bool resolved;
+ if (!this->ResolveDependency(name, executablePath, loaderPath, rpaths,
+ path, resolved)) {
+ return false;
+ }
+ if (resolved) {
+ if (!this->Archive->IsPostExcluded(path)) {
+ auto filename = cmSystemTools::GetFilenameName(path);
+ bool unique;
+ this->Archive->AddResolvedPath(filename, path, unique);
+ if (unique && !this->ScanDependencies(path, executablePath)) {
+ return false;
+ }
+ }
+ } else {
+ this->Archive->AddUnresolvedPath(name);
+ }
+ }
+ }
+
+ return true;
+}
+
+bool cmBinUtilsMacOSMachOLinker::ResolveDependency(
+ std::string const& name, std::string const& executablePath,
+ std::string const& loaderPath, std::vector<std::string> const& rpaths,
+ std::string& path, bool& resolved)
+{
+ resolved = false;
+ if (cmHasLiteralPrefix(name, "@rpath/")) {
+ if (!this->ResolveRPathDependency(name, executablePath, loaderPath, rpaths,
+ path, resolved)) {
+ return false;
+ }
+ } else if (cmHasLiteralPrefix(name, "@loader_path/")) {
+ if (!this->ResolveLoaderPathDependency(name, loaderPath, path, resolved)) {
+ return false;
+ }
+ } else if (cmHasLiteralPrefix(name, "@executable_path/")) {
+ if (!this->ResolveExecutablePathDependency(name, executablePath, path,
+ resolved)) {
+ return false;
+ }
+ } else {
+ resolved = true;
+ path = name;
+ }
+
+ if (resolved && !cmSystemTools::FileIsFullPath(path)) {
+ this->SetError("Resolved path is not absolute");
+ return false;
+ }
+
+ return true;
+}
+
+bool cmBinUtilsMacOSMachOLinker::ResolveExecutablePathDependency(
+ std::string const& name, std::string const& executablePath,
+ std::string& path, bool& resolved)
+{
+ if (executablePath.empty()) {
+ resolved = false;
+ return true;
+ }
+
+ // 16 is == "@executable_path".length()
+ path = name;
+ path.replace(0, 16, executablePath);
+
+ if (!cmSystemTools::PathExists(path)) {
+ resolved = false;
+ return true;
+ }
+
+ resolved = true;
+ return true;
+}
+
+bool cmBinUtilsMacOSMachOLinker::ResolveLoaderPathDependency(
+ std::string const& name, std::string const& loaderPath, std::string& path,
+ bool& resolved)
+{
+ if (loaderPath.empty()) {
+ resolved = false;
+ return true;
+ }
+
+ // 12 is "@loader_path".length();
+ path = name;
+ path.replace(0, 12, loaderPath);
+
+ if (!cmSystemTools::PathExists(path)) {
+ resolved = false;
+ return true;
+ }
+
+ resolved = true;
+ return true;
+}
+
+bool cmBinUtilsMacOSMachOLinker::ResolveRPathDependency(
+ std::string const& name, std::string const& executablePath,
+ std::string const& loaderPath, std::vector<std::string> const& rpaths,
+ std::string& path, bool& resolved)
+{
+ for (std::string const& rpath : rpaths) {
+ std::string searchFile = name;
+ searchFile.replace(0, 6, rpath);
+ if (cmHasLiteralPrefix(searchFile, "@loader_path/")) {
+ if (!this->ResolveLoaderPathDependency(searchFile, loaderPath, path,
+ resolved)) {
+ return false;
+ }
+ if (resolved) {
+ return true;
+ }
+ } else if (cmHasLiteralPrefix(searchFile, "@executable_path/")) {
+ if (!this->ResolveExecutablePathDependency(searchFile, executablePath,
+ path, resolved)) {
+ return false;
+ }
+ if (resolved) {
+ return true;
+ }
+ } else if (cmSystemTools::PathExists(searchFile)) {
+ /*
+ * paraphrasing @ben.boeckel:
+ * if /b/libB.dylib is supposed to be used,
+ * /a/libbB.dylib will be found first if it exists. CMake tries to
+ * sort rpath directories to avoid this, but sometimes there is no
+ * right answer.
+ *
+ * I believe it is possible to resolve this using otools -l
+ * then checking the LC_LOAD_DYLIB command whose name is
+ * equal to the value of search_file, UNLESS the build
+ * specifically sets the RPath to paths that will match
+ * duplicate libs; at this point can we just point to
+ * user error, or is there a reason why the advantages
+ * to this scenario outweigh its disadvantages?
+ *
+ * Also priority seems to be the order as passed in when compiled
+ * so as long as this method's resolution guarantees priority
+ * in that manner further checking should not be necessary?
+ */
+ path = searchFile;
+ resolved = true;
+ return true;
+ }
+ }
+
+ resolved = false;
+ return true;
+}
diff --git a/Source/cmBinUtilsMacOSMachOLinker.h b/Source/cmBinUtilsMacOSMachOLinker.h
new file mode 100644
index 0000000..f4f309d
--- /dev/null
+++ b/Source/cmBinUtilsMacOSMachOLinker.h
@@ -0,0 +1,59 @@
+/* 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
+
+#include "cmBinUtilsLinker.h"
+#include "cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h"
+#include "cmStateTypes.h"
+
+#include <memory>
+#include <string>
+#include <vector>
+
+class cmRuntimeDependencyArchive;
+
+class cmBinUtilsMacOSMachOLinker : public cmBinUtilsLinker
+{
+public:
+ cmBinUtilsMacOSMachOLinker(cmRuntimeDependencyArchive* archive);
+
+ bool Prepare() override;
+
+ bool ScanDependencies(std::string const& file,
+ cmStateEnums::TargetType type) override;
+
+private:
+ std::unique_ptr<cmBinUtilsMacOSMachOGetRuntimeDependenciesTool> Tool;
+
+ bool ScanDependencies(std::string const& file,
+ std::string const& executablePath);
+
+ bool GetFileDependencies(std::vector<std::string> const& names,
+ std::string const& executablePath,
+ std::string const& loaderPath,
+ std::vector<std::string> const& rpaths);
+
+ bool ResolveDependency(std::string const& name,
+ std::string const& executablePath,
+ std::string const& loaderPath,
+ std::vector<std::string> const& rpaths,
+ std::string& path, bool& resolved);
+
+ bool ResolveExecutablePathDependency(std::string const& name,
+ std::string const& executablePath,
+ std::string& path, bool& resolved);
+
+ bool ResolveLoaderPathDependency(std::string const& name,
+ std::string const& loaderPath,
+ std::string& path, bool& resolved);
+
+ bool ResolveRPathDependency(std::string const& name,
+ std::string const& executablePath,
+ std::string const& loaderPath,
+ std::vector<std::string> const& rpaths,
+ std::string& path, bool& resolved);
+};
+
+#endif // cmBinUtilsMacOSMachOLinker_h
diff --git a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx
new file mode 100644
index 0000000..bab2382
--- /dev/null
+++ b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx
@@ -0,0 +1,100 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h"
+
+#include "cmRuntimeDependencyArchive.h"
+#include "cmUVProcessChain.h"
+
+#include <cmsys/RegularExpression.hxx>
+
+#include <sstream>
+
+cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool::
+ cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool(
+ cmRuntimeDependencyArchive* archive)
+ : cmBinUtilsMacOSMachOGetRuntimeDependenciesTool(archive)
+{
+}
+
+bool cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool::GetFileInfo(
+ std::string const& file, std::vector<std::string>& libs,
+ std::vector<std::string>& rpaths)
+{
+ std::vector<std::string> command;
+ if (!this->Archive->GetGetRuntimeDependenciesCommand("otool", command)) {
+ this->SetError("Could not find otool");
+ return false;
+ }
+ command.emplace_back("-l");
+ command.emplace_back(file);
+
+ cmUVProcessChainBuilder builder;
+ builder.SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT)
+ .AddCommand(command);
+
+ auto process = builder.Start();
+ if (!process.Valid()) {
+ std::ostringstream e;
+ e << "Failed to start otool process for:\n " << file;
+ this->SetError(e.str());
+ return false;
+ }
+
+ std::string line;
+ static const cmsys::RegularExpression rpathRegex("^ *cmd LC_RPATH$");
+ static const cmsys::RegularExpression loadDylibRegex(
+ "^ *cmd LC_LOAD_DYLIB$");
+ static const cmsys::RegularExpression pathRegex(
+ "^ *path (.*) \\(offset [0-9]+\\)$");
+ static const cmsys::RegularExpression nameRegex(
+ "^ *name (.*) \\(offset [0-9]+\\)$");
+ while (std::getline(*process.OutputStream(), line)) {
+ cmsys::RegularExpressionMatch cmdMatch;
+ if (rpathRegex.find(line.c_str(), cmdMatch)) {
+ if (!std::getline(*process.OutputStream(), line) ||
+ !std::getline(*process.OutputStream(), line)) {
+ this->SetError("Invalid output from otool");
+ return false;
+ }
+
+ cmsys::RegularExpressionMatch pathMatch;
+ if (pathRegex.find(line.c_str(), pathMatch)) {
+ rpaths.push_back(pathMatch.match(1));
+ } else {
+ this->SetError("Invalid output from otool");
+ return false;
+ }
+ } else if (loadDylibRegex.find(line.c_str(), cmdMatch)) {
+ if (!std::getline(*process.OutputStream(), line) ||
+ !std::getline(*process.OutputStream(), line)) {
+ this->SetError("Invalid output from otool");
+ return false;
+ }
+
+ cmsys::RegularExpressionMatch nameMatch;
+ if (nameRegex.find(line.c_str(), nameMatch)) {
+ libs.push_back(nameMatch.match(1));
+ } else {
+ this->SetError("Invalid output from otool");
+ return false;
+ }
+ }
+ }
+
+ if (!process.Wait()) {
+ std::ostringstream e;
+ e << "Failed to wait on otool process for:\n " << file;
+ this->SetError(e.str());
+ return false;
+ }
+ auto status = process.GetStatus();
+ if (!status[0] || status[0]->ExitStatus != 0) {
+ std::ostringstream e;
+ e << "Failed to run otool on:\n " << file;
+ this->SetError(e.str());
+ return false;
+ }
+
+ return true;
+}
diff --git a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h
new file mode 100644
index 0000000..12bcbc1
--- /dev/null
+++ b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.h
@@ -0,0 +1,25 @@
+/* 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
+
+#include "cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h"
+
+#include <string>
+#include <vector>
+
+class cmRuntimeDependencyArchive;
+
+class cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool
+ : public cmBinUtilsMacOSMachOGetRuntimeDependenciesTool
+{
+public:
+ cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool(
+ cmRuntimeDependencyArchive* archive);
+
+ 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.cxx b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx
new file mode 100644
index 0000000..2b35e30
--- /dev/null
+++ b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx
@@ -0,0 +1,67 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h"
+#include "cmRuntimeDependencyArchive.h"
+#include "cmUVProcessChain.h"
+
+#include <cmsys/RegularExpression.hxx>
+
+#include <sstream>
+
+cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool::
+ cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool(
+ cmRuntimeDependencyArchive* archive)
+ : cmBinUtilsWindowsPEGetRuntimeDependenciesTool(archive)
+{
+}
+
+bool cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool::GetFileInfo(
+ const std::string& file, std::vector<std::string>& needed)
+{
+ cmUVProcessChainBuilder builder;
+ builder.SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT);
+
+ std::vector<std::string> command;
+ if (!this->Archive->GetGetRuntimeDependenciesCommand("dumpbin", command)) {
+ this->SetError("Could not find dumpbin");
+ return false;
+ }
+ command.emplace_back("/dependents");
+ command.push_back(file);
+ builder.AddCommand(command);
+
+ auto process = builder.Start();
+ if (!process.Valid()) {
+ std::ostringstream e;
+ e << "Failed to start dumpbin process for:\n " << file;
+ this->SetError(e.str());
+ return false;
+ }
+
+ std::string line;
+ static const cmsys::RegularExpression regex(
+ "^ ([^\n]*\\.[Dd][Ll][Ll])\r$");
+ while (std::getline(*process.OutputStream(), line)) {
+ cmsys::RegularExpressionMatch match;
+ if (regex.find(line.c_str(), match)) {
+ needed.push_back(match.match(1));
+ }
+ }
+
+ if (!process.Wait()) {
+ std::ostringstream e;
+ e << "Failed to wait on dumpbin process for:\n " << file;
+ this->SetError(e.str());
+ return false;
+ }
+ auto status = process.GetStatus();
+ if (!status[0] || status[0]->ExitStatus != 0) {
+ std::ostringstream e;
+ e << "Failed to run dumpbin on:\n " << file;
+ this->SetError(e.str());
+ return false;
+ }
+
+ return true;
+}
diff --git a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h
new file mode 100644
index 0000000..4c17f8d
--- /dev/null
+++ b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h
@@ -0,0 +1,25 @@
+/* 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
+
+#include "cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h"
+
+#include <string>
+#include <vector>
+
+class cmRuntimeDependencyArchive;
+
+class cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool
+ : public cmBinUtilsWindowsPEGetRuntimeDependenciesTool
+{
+public:
+ cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool(
+ cmRuntimeDependencyArchive* archive);
+
+ bool GetFileInfo(const std::string& file,
+ std::vector<std::string>& needed) override;
+};
+
+#endif // cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool_h
diff --git a/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.cxx
new file mode 100644
index 0000000..f5a4431
--- /dev/null
+++ b/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.cxx
@@ -0,0 +1,18 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h"
+#include "cmRuntimeDependencyArchive.h"
+
+cmBinUtilsWindowsPEGetRuntimeDependenciesTool::
+ cmBinUtilsWindowsPEGetRuntimeDependenciesTool(
+ cmRuntimeDependencyArchive* archive)
+ : Archive(archive)
+{
+}
+
+void cmBinUtilsWindowsPEGetRuntimeDependenciesTool::SetError(
+ const std::string& error)
+{
+ this->Archive->SetError(error);
+}
diff --git a/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h b/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h
new file mode 100644
index 0000000..e9e402b
--- /dev/null
+++ b/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h
@@ -0,0 +1,28 @@
+/* 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
+
+#include <string>
+#include <vector>
+
+class cmRuntimeDependencyArchive;
+
+class cmBinUtilsWindowsPEGetRuntimeDependenciesTool
+{
+public:
+ cmBinUtilsWindowsPEGetRuntimeDependenciesTool(
+ cmRuntimeDependencyArchive* archive);
+ virtual ~cmBinUtilsWindowsPEGetRuntimeDependenciesTool() = default;
+
+ virtual bool GetFileInfo(const std::string& file,
+ std::vector<std::string>& needed) = 0;
+
+protected:
+ cmRuntimeDependencyArchive* Archive;
+
+ void SetError(const std::string& error);
+};
+
+#endif // cmBinUtilsWindowsPEGetRuntimeDependenciesTool_h
diff --git a/Source/cmBinUtilsWindowsPELinker.cxx b/Source/cmBinUtilsWindowsPELinker.cxx
new file mode 100644
index 0000000..31602c4
--- /dev/null
+++ b/Source/cmBinUtilsWindowsPELinker.cxx
@@ -0,0 +1,122 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmBinUtilsWindowsPELinker.h"
+
+#include "cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h"
+#include "cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h"
+#include "cmRuntimeDependencyArchive.h"
+#include "cmSystemTools.h"
+
+#include <sstream>
+#include <vector>
+
+#include "cm_memory.hxx"
+
+#ifdef _WIN32
+# include <windows.h>
+#endif
+
+cmBinUtilsWindowsPELinker::cmBinUtilsWindowsPELinker(
+ cmRuntimeDependencyArchive* archive)
+ : cmBinUtilsLinker(archive)
+{
+}
+
+bool cmBinUtilsWindowsPELinker::Prepare()
+{
+ std::string tool = this->Archive->GetGetRuntimeDependenciesTool();
+ if (tool.empty()) {
+ std::vector<std::string> command;
+ if (this->Archive->GetGetRuntimeDependenciesCommand("dumpbin", command)) {
+ tool = "dumpbin";
+ } else {
+ tool = "objdump";
+ }
+ }
+ if (tool == "dumpbin") {
+ this->Tool =
+ cm::make_unique<cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool>(
+ this->Archive);
+ } else if (tool == "objdump") {
+ this->Tool =
+ cm::make_unique<cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool>(
+ this->Archive);
+ } else {
+ std::ostringstream e;
+ e << "Invalid value for CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL: " << tool;
+ this->SetError(e.str());
+ return false;
+ }
+
+ return true;
+}
+
+bool cmBinUtilsWindowsPELinker::ScanDependencies(
+ std::string const& file, cmStateEnums::TargetType /* unused */)
+{
+ std::vector<std::string> needed;
+ if (!this->Tool->GetFileInfo(file, needed)) {
+ return false;
+ }
+ for (auto& n : needed) {
+ n = cmSystemTools::LowerCase(n);
+ }
+ std::string origin = cmSystemTools::GetFilenamePath(file);
+
+ for (auto const& lib : needed) {
+ if (!this->Archive->IsPreExcluded(lib)) {
+ std::string path;
+ bool resolved = false;
+ if (!this->ResolveDependency(lib, origin, path, resolved)) {
+ return false;
+ }
+ if (resolved) {
+ if (!this->Archive->IsPostExcluded(path)) {
+ bool unique;
+ this->Archive->AddResolvedPath(lib, path, unique);
+ if (unique &&
+ !this->ScanDependencies(path, cmStateEnums::SHARED_LIBRARY)) {
+ return false;
+ }
+ }
+ } else {
+ this->Archive->AddUnresolvedPath(lib);
+ }
+ }
+ }
+
+ return true;
+}
+
+bool cmBinUtilsWindowsPELinker::ResolveDependency(std::string const& name,
+ std::string const& origin,
+ std::string& path,
+ bool& resolved)
+{
+ auto dirs = this->Archive->GetSearchDirectories();
+
+#ifdef _WIN32
+ char buf[MAX_PATH];
+ unsigned int len;
+ if ((len = GetWindowsDirectoryA(buf, MAX_PATH)) > 0) {
+ dirs.insert(dirs.begin(), std::string(buf, len));
+ }
+ if ((len = GetSystemDirectoryA(buf, MAX_PATH)) > 0) {
+ dirs.insert(dirs.begin(), std::string(buf, len));
+ }
+#endif
+
+ dirs.insert(dirs.begin(), origin);
+
+ for (auto const& searchPath : dirs) {
+ path = searchPath + '/' + name;
+ if (cmSystemTools::PathExists(path)) {
+ resolved = true;
+ return true;
+ }
+ }
+
+ resolved = false;
+ return true;
+}
diff --git a/Source/cmBinUtilsWindowsPELinker.h b/Source/cmBinUtilsWindowsPELinker.h
new file mode 100644
index 0000000..8d2bf4b
--- /dev/null
+++ b/Source/cmBinUtilsWindowsPELinker.h
@@ -0,0 +1,33 @@
+/* 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
+
+#include "cmBinUtilsLinker.h"
+#include "cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h"
+#include "cmStateTypes.h"
+
+#include <memory>
+#include <string>
+
+class cmRuntimeDependencyArchive;
+
+class cmBinUtilsWindowsPELinker : public cmBinUtilsLinker
+{
+public:
+ cmBinUtilsWindowsPELinker(cmRuntimeDependencyArchive* archive);
+
+ bool Prepare() override;
+
+ bool ScanDependencies(std::string const& file,
+ cmStateEnums::TargetType type) override;
+
+private:
+ std::unique_ptr<cmBinUtilsWindowsPEGetRuntimeDependenciesTool> Tool;
+
+ bool ResolveDependency(std::string const& name, std::string const& origin,
+ std::string& path, bool& resolved);
+};
+
+#endif // cmBinUtilsWindowsPELinker_h
diff --git a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx
new file mode 100644
index 0000000..1f27003
--- /dev/null
+++ b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx
@@ -0,0 +1,67 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h"
+#include "cmRuntimeDependencyArchive.h"
+#include "cmUVProcessChain.h"
+
+#include <cmsys/RegularExpression.hxx>
+
+#include <sstream>
+
+cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool::
+ cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool(
+ cmRuntimeDependencyArchive* archive)
+ : cmBinUtilsWindowsPEGetRuntimeDependenciesTool(archive)
+{
+}
+
+bool cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool::GetFileInfo(
+ const std::string& file, std::vector<std::string>& needed)
+{
+ cmUVProcessChainBuilder builder;
+ builder.SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT);
+
+ std::vector<std::string> command;
+ if (!this->Archive->GetGetRuntimeDependenciesCommand("objdump", command)) {
+ this->SetError("Could not find objdump");
+ return false;
+ }
+ command.emplace_back("-p");
+ command.push_back(file);
+ builder.AddCommand(command);
+
+ auto process = builder.Start();
+ if (!process.Valid()) {
+ std::ostringstream e;
+ e << "Failed to start objdump process for:\n " << file;
+ this->SetError(e.str());
+ return false;
+ }
+
+ std::string line;
+ static const cmsys::RegularExpression regex(
+ "^\t*DLL Name: ([^\n]*\\.[Dd][Ll][Ll])\r$");
+ while (std::getline(*process.OutputStream(), line)) {
+ cmsys::RegularExpressionMatch match;
+ if (regex.find(line.c_str(), match)) {
+ needed.push_back(match.match(1));
+ }
+ }
+
+ if (!process.Wait()) {
+ std::ostringstream e;
+ e << "Failed to wait on objdump process for:\n " << file;
+ this->SetError(e.str());
+ return false;
+ }
+ auto status = process.GetStatus();
+ if (!status[0] || status[0]->ExitStatus != 0) {
+ std::ostringstream e;
+ e << "Failed to run objdump on:\n " << file;
+ this->SetError(e.str());
+ return false;
+ }
+
+ return true;
+}
diff --git a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h
new file mode 100644
index 0000000..1d1a5b0
--- /dev/null
+++ b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h
@@ -0,0 +1,25 @@
+/* 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
+
+#include "cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h"
+
+#include <string>
+#include <vector>
+
+class cmRuntimeDependencyArchive;
+
+class cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool
+ : public cmBinUtilsWindowsPEGetRuntimeDependenciesTool
+{
+public:
+ cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool(
+ cmRuntimeDependencyArchive* archive);
+
+ 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 3b18567..e6f218e 100644
--- a/Source/cmBreakCommand.h
+++ b/Source/cmBreakCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -23,7 +25,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmBreakCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmBreakCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index 428a0b2..e9e1d49 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -92,7 +92,7 @@ bool cmBuildCommand::MainSignature(std::vector<std::string> const& args)
this->Makefile->GetGlobalGenerator()->GenerateCMakeBuildCommand(
target, configuration, "", this->Makefile->IgnoreErrorsCMP0061());
- this->Makefile->AddDefinition(variable, makecommand.c_str());
+ this->Makefile->AddDefinition(variable, makecommand);
return true;
}
diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h
index e0529a4..d373103 100644
--- a/Source/cmBuildCommand.h
+++ b/Source/cmBuildCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -23,7 +25,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmBuildCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmBuildCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h
index 4bb72d1..bd2d146 100644
--- a/Source/cmBuildNameCommand.h
+++ b/Source/cmBuildNameCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -15,7 +17,10 @@ class cmExecutionStatus;
class cmBuildNameCommand : public cmCommand
{
public:
- cmCommand* Clone() override { return new cmBuildNameCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmBuildNameCommand>();
+ }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
};
diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx
index 54f08bb..b4cd2a5 100644
--- a/Source/cmCMakeHostSystemInformationCommand.cxx
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -55,7 +55,7 @@ bool cmCMakeHostSystemInformationCommand::InitialPass(
result_list += value;
}
- this->Makefile->AddDefinition(variable, result_list.c_str());
+ this->Makefile->AddDefinition(variable, result_list);
return true;
}
diff --git a/Source/cmCMakeHostSystemInformationCommand.h b/Source/cmCMakeHostSystemInformationCommand.h
index b871641..8ea2d55 100644
--- a/Source/cmCMakeHostSystemInformationCommand.h
+++ b/Source/cmCMakeHostSystemInformationCommand.h
@@ -9,6 +9,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -28,9 +30,9 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- return new cmCMakeHostSystemInformationCommand;
+ return cm::make_unique<cmCMakeHostSystemInformationCommand>();
}
/**
diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx
index 4b4bca2..f2eae38 100644
--- a/Source/cmCMakeMinimumRequired.cxx
+++ b/Source/cmCMakeMinimumRequired.cxx
@@ -61,8 +61,7 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector<std::string> const& args,
}
// Save the required version string.
- this->Makefile->AddDefinition("CMAKE_MINIMUM_REQUIRED_VERSION",
- version_min.c_str());
+ this->Makefile->AddDefinition("CMAKE_MINIMUM_REQUIRED_VERSION", version_min);
// Get the current version number.
unsigned int current_major = cmVersion::GetMajorVersion();
diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h
index f9b61e1..3881133 100644
--- a/Source/cmCMakeMinimumRequired.h
+++ b/Source/cmCMakeMinimumRequired.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -23,7 +25,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmCMakeMinimumRequired; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmCMakeMinimumRequired>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx
index 8da5ef7..ce046fc 100644
--- a/Source/cmCMakePolicyCommand.cxx
+++ b/Source/cmCMakePolicyCommand.cxx
@@ -209,8 +209,7 @@ bool cmCMakePolicyCommand::HandleGetWarningMode(
}
// Lookup the policy warning.
- this->Makefile->AddDefinition(var,
- cmPolicies::GetPolicyWarning(pid).c_str());
+ this->Makefile->AddDefinition(var, cmPolicies::GetPolicyWarning(pid));
return true;
}
diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h
index cca1406..919402c 100644
--- a/Source/cmCMakePolicyCommand.h
+++ b/Source/cmCMakePolicyCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -24,7 +26,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmCMakePolicyCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmCMakePolicyCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index 255a8e6..80ca898 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -65,8 +65,10 @@ unsigned int CCONV cmGetMinorVersion(void*)
void CCONV cmAddDefinition(void* arg, const char* name, const char* value)
{
- cmMakefile* mf = static_cast<cmMakefile*>(arg);
- mf->AddDefinition(name, value);
+ if (value) {
+ cmMakefile* mf = static_cast<cmMakefile*>(arg);
+ mf->AddDefinition(name, value);
+ }
}
/* Add a definition to this makefile and the global cmake cache. */
@@ -421,7 +423,7 @@ int CCONV cmExecuteCommand(void* arg, const char* name, int numArgs,
// Assume all arguments are quoted.
lff.Arguments.emplace_back(args[i], cmListFileArgument::Quoted, 0);
}
- cmExecutionStatus status;
+ cmExecutionStatus status(*mf);
return mf->ExecuteCommand(lff, status);
}
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index d1226c3..610e9f9 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -15,7 +15,6 @@
#include <ctype.h>
#include <iostream>
#include <map>
-#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
@@ -30,6 +29,8 @@
# include <unistd.h> // IWYU pragma: keep
#endif
+#include "cm_memory.hxx"
+
#include "cmAlgorithms.h"
#include "cmCTestBuildAndTestHandler.h"
#include "cmCTestBuildHandler.h"
@@ -51,6 +52,7 @@
#include "cmState.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmVersion.h"
#include "cmVersionConfig.h"
@@ -1098,9 +1100,10 @@ int cmCTest::RunMakeCommand(const std::string& command, std::string& output,
cmProcessOutput processOutput(encoding);
std::string strdata;
cmCTestLog(this, HANDLER_PROGRESS_OUTPUT,
- " Each . represents " << tick_len << " bytes of output"
- << std::endl
- << " " << std::flush);
+ " Each . represents " << tick_len
+ << " bytes of output\n"
+ " "
+ << std::flush);
while (cmsysProcess_WaitForData(cp, &data, &length, nullptr)) {
processOutput.DecodeText(data, length, strdata);
for (char& cc : strdata) {
@@ -1115,8 +1118,7 @@ int cmCTest::RunMakeCommand(const std::string& command, std::string& output,
if (tick % tick_line_len == 0 && tick > 0) {
cmCTestLog(this, HANDLER_PROGRESS_OUTPUT,
" Size: " << int((double(output.size()) / 1024.0) + 1)
- << "K" << std::endl
- << " " << std::flush);
+ << "K\n " << std::flush);
}
}
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT,
@@ -1324,18 +1326,14 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output,
if (output) {
*output += outerr;
}
- cmCTestLog(this, HANDLER_VERBOSE_OUTPUT,
- outerr << std::endl
- << std::flush);
+ cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr << std::endl);
} else if (result == cmsysProcess_State_Error) {
std::string outerr = "\n*** ERROR executing: ";
outerr += cmsysProcess_GetErrorString(cp);
if (output) {
*output += outerr;
}
- cmCTestLog(this, HANDLER_VERBOSE_OUTPUT,
- outerr << std::endl
- << std::flush);
+ cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr << std::endl);
}
cmsysProcess_Delete(cp);
@@ -3077,11 +3075,11 @@ void cmCTest::Log(int logType, const char* file, int line, const char* msg,
} else {
*this->Impl->OutputLogFile << cmCTestStringLogType[logType];
}
- *this->Impl->OutputLogFile << "] " << std::endl << std::flush;
+ *this->Impl->OutputLogFile << "] " << std::endl;
}
*this->Impl->OutputLogFile << msg << std::flush;
if (logType != this->Impl->OutputLogFileLastTag) {
- *this->Impl->OutputLogFile << std::endl << std::flush;
+ *this->Impl->OutputLogFile << std::endl;
this->Impl->OutputLogFileLastTag = logType;
}
}
@@ -3194,7 +3192,7 @@ void cmCTest::OutputTestErrors(std::vector<char> const& process_output)
if (!process_output.empty()) {
test_outputs.append(process_output.data(), process_output.size());
}
- cmCTestLog(this, HANDLER_OUTPUT, test_outputs << std::endl << std::flush);
+ cmCTestLog(this, HANDLER_OUTPUT, test_outputs << std::endl);
}
bool cmCTest::CompressString(std::string& str)
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index d300c33..7f66378 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -10,7 +10,7 @@
#include <chrono>
#include <map>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <sstream>
#include <string>
#include <time.h>
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 358f095..e8fc350 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -620,7 +620,7 @@ bool cmCacheManager::CacheIterator::GetValueAsBool() const
std::vector<std::string> cmCacheManager::CacheEntry::GetPropertyList() const
{
- return this->Properties.GetPropertyList();
+ return this->Properties.GetKeys();
}
const char* cmCacheManager::CacheEntry::GetProperty(
diff --git a/Source/cmCommand.cxx b/Source/cmCommand.cxx
index d349c91..0c2734e 100644
--- a/Source/cmCommand.cxx
+++ b/Source/cmCommand.cxx
@@ -2,11 +2,19 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCommand.h"
+#include <utility>
+
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-class cmExecutionStatus;
struct cmListFileArgument;
+void cmCommand::SetExecutionStatus(cmExecutionStatus* status)
+{
+ this->Status = status;
+ this->Makefile = &status->GetMakefile();
+}
+
bool cmCommand::InvokeInitialPass(const std::vector<cmListFileArgument>& args,
cmExecutionStatus& status)
{
@@ -19,15 +27,33 @@ bool cmCommand::InvokeInitialPass(const std::vector<cmListFileArgument>& args,
return this->InitialPass(expandedArguments, status);
}
-const char* cmCommand::GetError()
+void cmCommand::SetError(const std::string& e)
{
- if (this->Error.empty()) {
- return "unknown error.";
- }
- return this->Error.c_str();
+ this->Status->SetError(e);
}
-void cmCommand::SetError(const std::string& e)
+cmLegacyCommandWrapper::cmLegacyCommandWrapper(std::unique_ptr<cmCommand> cmd)
+ : Command(std::move(cmd))
+{
+}
+
+cmLegacyCommandWrapper::cmLegacyCommandWrapper(
+ cmLegacyCommandWrapper const& other)
+ : Command(other.Command->Clone())
+{
+}
+
+cmLegacyCommandWrapper& cmLegacyCommandWrapper::operator=(
+ cmLegacyCommandWrapper const& other)
+{
+ this->Command = other.Command->Clone();
+ return *this;
+}
+
+bool cmLegacyCommandWrapper::operator()(
+ std::vector<cmListFileArgument> const& args, cmExecutionStatus& status) const
{
- this->Error = e;
+ auto cmd = this->Command->Clone();
+ cmd->SetExecutionStatus(&status);
+ return cmd->InvokeInitialPass(args, status);
}
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index 9ccd773..bcb178d 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -5,6 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <memory>
#include <string>
#include <vector>
@@ -41,16 +42,18 @@ public:
/**
* Specify the makefile.
*/
- void SetMakefile(cmMakefile* m) { this->Makefile = m; }
cmMakefile* GetMakefile() { return this->Makefile; }
+ void SetExecutionStatus(cmExecutionStatus* s);
+ cmExecutionStatus* GetExecutionStatus() { return this->Status; };
+
/**
* This is called by the cmMakefile when the command is first
* encountered in the CMakeLists.txt file. It expands the command's
* arguments and then invokes the InitialPass.
*/
- virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
- cmExecutionStatus& status);
+ bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
+ cmExecutionStatus& status);
/**
* This is called when the command is first encountered in
@@ -60,27 +63,9 @@ public:
cmExecutionStatus&) = 0;
/**
- * This is called at the end after all the information
- * specified by the command is accumulated. Most commands do
- * not implement this method. At this point, reading and
- * writing to the cache can be done.
- */
- virtual void FinalPass() {}
-
- /**
- * Does this command have a final pass? Query after InitialPass.
- */
- virtual bool HasFinalPass() const { return false; }
-
- /**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone() = 0;
-
- /**
- * Return the last error string.
- */
- const char* GetError();
+ virtual std::unique_ptr<cmCommand> Clone() = 0;
/**
* Set the error message
@@ -91,7 +76,25 @@ protected:
cmMakefile* Makefile = nullptr;
private:
- std::string Error;
+ cmExecutionStatus* Status = nullptr;
+};
+
+class cmLegacyCommandWrapper
+{
+public:
+ explicit cmLegacyCommandWrapper(std::unique_ptr<cmCommand> cmd);
+
+ cmLegacyCommandWrapper(cmLegacyCommandWrapper const& other);
+ cmLegacyCommandWrapper& operator=(cmLegacyCommandWrapper const& other);
+
+ cmLegacyCommandWrapper(cmLegacyCommandWrapper&&) = default;
+ cmLegacyCommandWrapper& operator=(cmLegacyCommandWrapper&&) = default;
+
+ bool operator()(std::vector<cmListFileArgument> const& args,
+ cmExecutionStatus& status) const;
+
+private:
+ std::unique_ptr<cmCommand> Command;
};
#endif
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 63c5397..f351ff8 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -1,5 +1,8 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cm_memory.hxx"
+
#include "cmCommands.h"
#include "cmPolicies.h"
#include "cmState.h"
@@ -17,6 +20,7 @@
#include "cmBuildCommand.h"
#include "cmCMakeMinimumRequired.h"
#include "cmCMakePolicyCommand.h"
+#include "cmCommand.h"
#include "cmConfigureFileCommand.h"
#include "cmContinueCommand.h"
#include "cmCreateTestSourceList.h"
@@ -112,52 +116,64 @@
void GetScriptingCommands(cmState* state)
{
- state->AddBuiltinCommand("break", new cmBreakCommand);
+ state->AddBuiltinCommand("break", cm::make_unique<cmBreakCommand>());
state->AddBuiltinCommand("cmake_minimum_required",
- new cmCMakeMinimumRequired);
- state->AddBuiltinCommand("cmake_policy", new cmCMakePolicyCommand);
- state->AddBuiltinCommand("configure_file", new cmConfigureFileCommand);
- state->AddBuiltinCommand("continue", new cmContinueCommand);
- state->AddBuiltinCommand("exec_program", new cmExecProgramCommand);
- state->AddBuiltinCommand("execute_process", new cmExecuteProcessCommand);
- state->AddBuiltinCommand("file", new cmFileCommand);
- state->AddBuiltinCommand("find_file", new cmFindFileCommand);
- state->AddBuiltinCommand("find_library", new cmFindLibraryCommand);
- state->AddBuiltinCommand("find_package", new cmFindPackageCommand);
- state->AddBuiltinCommand("find_path", new cmFindPathCommand);
- state->AddBuiltinCommand("find_program", new cmFindProgramCommand);
- state->AddBuiltinCommand("foreach", new cmForEachCommand);
- state->AddBuiltinCommand("function", new cmFunctionCommand);
+ cm::make_unique<cmCMakeMinimumRequired>());
+ state->AddBuiltinCommand("cmake_policy",
+ cm::make_unique<cmCMakePolicyCommand>());
+ state->AddBuiltinCommand("configure_file",
+ cm::make_unique<cmConfigureFileCommand>());
+ state->AddBuiltinCommand("continue", cm::make_unique<cmContinueCommand>());
+ state->AddBuiltinCommand("exec_program",
+ cm::make_unique<cmExecProgramCommand>());
+ state->AddBuiltinCommand("execute_process",
+ cm::make_unique<cmExecuteProcessCommand>());
+ state->AddBuiltinCommand("file", cm::make_unique<cmFileCommand>());
+ state->AddBuiltinCommand("find_file", cm::make_unique<cmFindFileCommand>());
+ state->AddBuiltinCommand("find_library",
+ cm::make_unique<cmFindLibraryCommand>());
+ state->AddBuiltinCommand("find_package",
+ cm::make_unique<cmFindPackageCommand>());
+ state->AddBuiltinCommand("find_path", cm::make_unique<cmFindPathCommand>());
+ state->AddBuiltinCommand("find_program",
+ cm::make_unique<cmFindProgramCommand>());
+ state->AddBuiltinCommand("foreach", cm::make_unique<cmForEachCommand>());
+ state->AddBuiltinCommand("function", cm::make_unique<cmFunctionCommand>());
state->AddBuiltinCommand("get_cmake_property",
- new cmGetCMakePropertyCommand);
+ cm::make_unique<cmGetCMakePropertyCommand>());
state->AddBuiltinCommand("get_directory_property",
- new cmGetDirectoryPropertyCommand);
+ cm::make_unique<cmGetDirectoryPropertyCommand>());
state->AddBuiltinCommand("get_filename_component",
- new cmGetFilenameComponentCommand);
- state->AddBuiltinCommand("get_property", new cmGetPropertyCommand);
- state->AddBuiltinCommand("if", new cmIfCommand);
- state->AddBuiltinCommand("include", new cmIncludeCommand);
- state->AddBuiltinCommand("include_guard", new cmIncludeGuardCommand);
- state->AddBuiltinCommand("list", new cmListCommand);
- state->AddBuiltinCommand("macro", new cmMacroCommand);
- state->AddBuiltinCommand("make_directory", new cmMakeDirectoryCommand);
- state->AddBuiltinCommand("mark_as_advanced", new cmMarkAsAdvancedCommand);
- state->AddBuiltinCommand("math", new cmMathCommand);
- state->AddBuiltinCommand("message", new cmMessageCommand);
- state->AddBuiltinCommand("option", new cmOptionCommand);
+ cm::make_unique<cmGetFilenameComponentCommand>());
+ state->AddBuiltinCommand("get_property",
+ cm::make_unique<cmGetPropertyCommand>());
+ state->AddBuiltinCommand("if", cmIfCommand);
+ state->AddBuiltinCommand("include", cm::make_unique<cmIncludeCommand>());
+ state->AddBuiltinCommand("include_guard",
+ cm::make_unique<cmIncludeGuardCommand>());
+ state->AddBuiltinCommand("list", cm::make_unique<cmListCommand>());
+ state->AddBuiltinCommand("macro", cm::make_unique<cmMacroCommand>());
+ state->AddBuiltinCommand("make_directory",
+ cm::make_unique<cmMakeDirectoryCommand>());
+ state->AddBuiltinCommand("mark_as_advanced",
+ cm::make_unique<cmMarkAsAdvancedCommand>());
+ state->AddBuiltinCommand("math", cm::make_unique<cmMathCommand>());
+ state->AddBuiltinCommand("message", cm::make_unique<cmMessageCommand>());
+ state->AddBuiltinCommand("option", cm::make_unique<cmOptionCommand>());
state->AddBuiltinCommand("cmake_parse_arguments",
- new cmParseArgumentsCommand);
- state->AddBuiltinCommand("return", new cmReturnCommand);
+ cm::make_unique<cmParseArgumentsCommand>());
+ state->AddBuiltinCommand("return", cmReturnCommand);
state->AddBuiltinCommand("separate_arguments",
- new cmSeparateArgumentsCommand);
- state->AddBuiltinCommand("set", new cmSetCommand);
+ cm::make_unique<cmSeparateArgumentsCommand>());
+ state->AddBuiltinCommand("set", cm::make_unique<cmSetCommand>());
state->AddBuiltinCommand("set_directory_properties",
- new cmSetDirectoryPropertiesCommand);
- state->AddBuiltinCommand("set_property", new cmSetPropertyCommand);
- state->AddBuiltinCommand("site_name", new cmSiteNameCommand);
- state->AddBuiltinCommand("string", new cmStringCommand);
- state->AddBuiltinCommand("unset", new cmUnsetCommand);
- state->AddBuiltinCommand("while", new cmWhileCommand);
+ cm::make_unique<cmSetDirectoryPropertiesCommand>());
+ state->AddBuiltinCommand("set_property",
+ cm::make_unique<cmSetPropertyCommand>());
+ state->AddBuiltinCommand("site_name", cm::make_unique<cmSiteNameCommand>());
+ state->AddBuiltinCommand("string", cm::make_unique<cmStringCommand>());
+ state->AddBuiltinCommand("unset", cm::make_unique<cmUnsetCommand>());
+ state->AddBuiltinCommand("while", cmWhileCommand);
state->AddUnexpectedCommand(
"else",
@@ -195,17 +211,21 @@ void GetScriptingCommands(cmState* state)
"match the opening WHILE command.");
#if defined(CMAKE_BUILD_WITH_CMAKE)
- state->AddBuiltinCommand("cmake_host_system_information",
- new cmCMakeHostSystemInformationCommand);
- state->AddBuiltinCommand("remove", new cmRemoveCommand);
- state->AddBuiltinCommand("variable_watch", new cmVariableWatchCommand);
- state->AddBuiltinCommand("write_file", new cmWriteFileCommand);
+ state->AddBuiltinCommand(
+ "cmake_host_system_information",
+ cm::make_unique<cmCMakeHostSystemInformationCommand>());
+ state->AddBuiltinCommand("remove", cm::make_unique<cmRemoveCommand>());
+ state->AddBuiltinCommand("variable_watch",
+ cm::make_unique<cmVariableWatchCommand>());
+ state->AddBuiltinCommand("write_file",
+ cm::make_unique<cmWriteFileCommand>());
state->AddDisallowedCommand(
- "build_name", new cmBuildNameCommand, cmPolicies::CMP0036,
+ "build_name", cm::make_unique<cmBuildNameCommand>(), cmPolicies::CMP0036,
"The build_name command should not be called; see CMP0036.");
state->AddDisallowedCommand(
- "use_mangled_mesa", new cmUseMangledMesaCommand, cmPolicies::CMP0030,
+ "use_mangled_mesa", cm::make_unique<cmUseMangledMesaCommand>(),
+ cmPolicies::CMP0030,
"The use_mangled_mesa command should not be called; see CMP0030.");
#endif
@@ -214,100 +234,130 @@ void GetScriptingCommands(cmState* state)
void GetProjectCommands(cmState* state)
{
state->AddBuiltinCommand("add_custom_command",
- new cmAddCustomCommandCommand);
- state->AddBuiltinCommand("add_custom_target", new cmAddCustomTargetCommand);
- state->AddBuiltinCommand("add_definitions", new cmAddDefinitionsCommand);
- state->AddBuiltinCommand("add_dependencies", new cmAddDependenciesCommand);
- state->AddBuiltinCommand("add_executable", new cmAddExecutableCommand);
- state->AddBuiltinCommand("add_library", new cmAddLibraryCommand);
- state->AddBuiltinCommand("add_subdirectory", new cmAddSubDirectoryCommand);
- state->AddBuiltinCommand("add_test", new cmAddTestCommand);
- state->AddBuiltinCommand("build_command", new cmBuildCommand);
+ cm::make_unique<cmAddCustomCommandCommand>());
+ state->AddBuiltinCommand("add_custom_target",
+ cm::make_unique<cmAddCustomTargetCommand>());
+ state->AddBuiltinCommand("add_definitions",
+ cm::make_unique<cmAddDefinitionsCommand>());
+ state->AddBuiltinCommand("add_dependencies",
+ cm::make_unique<cmAddDependenciesCommand>());
+ state->AddBuiltinCommand("add_executable",
+ cm::make_unique<cmAddExecutableCommand>());
+ state->AddBuiltinCommand("add_library",
+ cm::make_unique<cmAddLibraryCommand>());
+ state->AddBuiltinCommand("add_subdirectory",
+ cm::make_unique<cmAddSubDirectoryCommand>());
+ state->AddBuiltinCommand("add_test", cm::make_unique<cmAddTestCommand>());
+ state->AddBuiltinCommand("build_command", cm::make_unique<cmBuildCommand>());
state->AddBuiltinCommand("create_test_sourcelist",
- new cmCreateTestSourceList);
- state->AddBuiltinCommand("define_property", new cmDefinePropertyCommand);
- state->AddBuiltinCommand("enable_language", new cmEnableLanguageCommand);
- state->AddBuiltinCommand("enable_testing", new cmEnableTestingCommand);
+ cm::make_unique<cmCreateTestSourceList>());
+ state->AddBuiltinCommand("define_property",
+ cm::make_unique<cmDefinePropertyCommand>());
+ state->AddBuiltinCommand("enable_language",
+ cm::make_unique<cmEnableLanguageCommand>());
+ state->AddBuiltinCommand("enable_testing", cmEnableTestingCommand);
state->AddBuiltinCommand("get_source_file_property",
- new cmGetSourceFilePropertyCommand);
+ cm::make_unique<cmGetSourceFilePropertyCommand>());
state->AddBuiltinCommand("get_target_property",
- new cmGetTargetPropertyCommand);
- state->AddBuiltinCommand("get_test_property", new cmGetTestPropertyCommand);
+ cm::make_unique<cmGetTargetPropertyCommand>());
+ state->AddBuiltinCommand("get_test_property",
+ cm::make_unique<cmGetTestPropertyCommand>());
state->AddBuiltinCommand("include_directories",
- new cmIncludeDirectoryCommand);
- state->AddBuiltinCommand("include_regular_expression",
- new cmIncludeRegularExpressionCommand);
- state->AddBuiltinCommand("install", new cmInstallCommand);
- state->AddBuiltinCommand("install_files", new cmInstallFilesCommand);
- state->AddBuiltinCommand("install_targets", new cmInstallTargetsCommand);
- state->AddBuiltinCommand("link_directories", new cmLinkDirectoriesCommand);
- state->AddBuiltinCommand("project", new cmProjectCommand);
- state->AddBuiltinCommand("set_source_files_properties",
- new cmSetSourceFilesPropertiesCommand);
+ cm::make_unique<cmIncludeDirectoryCommand>());
+ state->AddBuiltinCommand(
+ "include_regular_expression",
+ cm::make_unique<cmIncludeRegularExpressionCommand>());
+ state->AddBuiltinCommand("install", cm::make_unique<cmInstallCommand>());
+ state->AddBuiltinCommand("install_files",
+ cm::make_unique<cmInstallFilesCommand>());
+ state->AddBuiltinCommand("install_targets",
+ cm::make_unique<cmInstallTargetsCommand>());
+ state->AddBuiltinCommand("link_directories",
+ cm::make_unique<cmLinkDirectoriesCommand>());
+ state->AddBuiltinCommand("project", cm::make_unique<cmProjectCommand>());
+ state->AddBuiltinCommand(
+ "set_source_files_properties",
+ cm::make_unique<cmSetSourceFilesPropertiesCommand>());
state->AddBuiltinCommand("set_target_properties",
- new cmSetTargetPropertiesCommand);
+ cm::make_unique<cmSetTargetPropertiesCommand>());
state->AddBuiltinCommand("set_tests_properties",
- new cmSetTestsPropertiesCommand);
- state->AddBuiltinCommand("subdirs", new cmSubdirCommand);
- state->AddBuiltinCommand("target_compile_definitions",
- new cmTargetCompileDefinitionsCommand);
+ cm::make_unique<cmSetTestsPropertiesCommand>());
+ state->AddBuiltinCommand("subdirs", cm::make_unique<cmSubdirCommand>());
+ state->AddBuiltinCommand(
+ "target_compile_definitions",
+ cm::make_unique<cmTargetCompileDefinitionsCommand>());
state->AddBuiltinCommand("target_compile_features",
- new cmTargetCompileFeaturesCommand);
+ cm::make_unique<cmTargetCompileFeaturesCommand>());
state->AddBuiltinCommand("target_compile_options",
- new cmTargetCompileOptionsCommand);
- state->AddBuiltinCommand("target_include_directories",
- new cmTargetIncludeDirectoriesCommand);
+ cm::make_unique<cmTargetCompileOptionsCommand>());
+ state->AddBuiltinCommand(
+ "target_include_directories",
+ cm::make_unique<cmTargetIncludeDirectoriesCommand>());
state->AddBuiltinCommand("target_link_libraries",
- new cmTargetLinkLibrariesCommand);
- state->AddBuiltinCommand("target_sources", new cmTargetSourcesCommand);
- state->AddBuiltinCommand("try_compile", new cmTryCompileCommand);
- state->AddBuiltinCommand("try_run", new cmTryRunCommand);
+ cm::make_unique<cmTargetLinkLibrariesCommand>());
+ state->AddBuiltinCommand("target_sources",
+ cm::make_unique<cmTargetSourcesCommand>());
+ state->AddBuiltinCommand("try_compile",
+ cm::make_unique<cmTryCompileCommand>());
+ state->AddBuiltinCommand("try_run", cm::make_unique<cmTryRunCommand>());
#if defined(CMAKE_BUILD_WITH_CMAKE)
state->AddBuiltinCommand("add_compile_definitions",
- new cmAddCompileDefinitionsCommand);
+ cm::make_unique<cmAddCompileDefinitionsCommand>());
state->AddBuiltinCommand("add_compile_options",
- new cmAddCompileOptionsCommand);
+ cm::make_unique<cmAddCompileOptionsCommand>());
state->AddBuiltinCommand("aux_source_directory",
- new cmAuxSourceDirectoryCommand);
- state->AddBuiltinCommand("export", new cmExportCommand);
- state->AddBuiltinCommand("fltk_wrap_ui", new cmFLTKWrapUICommand);
- state->AddBuiltinCommand("include_external_msproject",
- new cmIncludeExternalMSProjectCommand);
- state->AddBuiltinCommand("install_programs", new cmInstallProgramsCommand);
- state->AddBuiltinCommand("add_link_options", new cmAddLinkOptionsCommand);
- state->AddBuiltinCommand("link_libraries", new cmLinkLibrariesCommand);
+ cm::make_unique<cmAuxSourceDirectoryCommand>());
+ state->AddBuiltinCommand("export", cm::make_unique<cmExportCommand>());
+ state->AddBuiltinCommand("fltk_wrap_ui",
+ cm::make_unique<cmFLTKWrapUICommand>());
+ state->AddBuiltinCommand(
+ "include_external_msproject",
+ cm::make_unique<cmIncludeExternalMSProjectCommand>());
+ state->AddBuiltinCommand("install_programs",
+ cm::make_unique<cmInstallProgramsCommand>());
+ state->AddBuiltinCommand("add_link_options",
+ cm::make_unique<cmAddLinkOptionsCommand>());
+ state->AddBuiltinCommand("link_libraries",
+ cm::make_unique<cmLinkLibrariesCommand>());
state->AddBuiltinCommand("target_link_options",
- new cmTargetLinkOptionsCommand);
+ cm::make_unique<cmTargetLinkOptionsCommand>());
state->AddBuiltinCommand("target_link_directories",
- new cmTargetLinkDirectoriesCommand);
- state->AddBuiltinCommand("load_cache", new cmLoadCacheCommand);
- state->AddBuiltinCommand("qt_wrap_cpp", new cmQTWrapCPPCommand);
- state->AddBuiltinCommand("qt_wrap_ui", new cmQTWrapUICommand);
+ cm::make_unique<cmTargetLinkDirectoriesCommand>());
+ state->AddBuiltinCommand("load_cache",
+ cm::make_unique<cmLoadCacheCommand>());
+ state->AddBuiltinCommand("qt_wrap_cpp",
+ cm::make_unique<cmQTWrapCPPCommand>());
+ state->AddBuiltinCommand("qt_wrap_ui", cm::make_unique<cmQTWrapUICommand>());
state->AddBuiltinCommand("remove_definitions",
- new cmRemoveDefinitionsCommand);
- state->AddBuiltinCommand("source_group", new cmSourceGroupCommand);
+ cm::make_unique<cmRemoveDefinitionsCommand>());
+ state->AddBuiltinCommand("source_group",
+ cm::make_unique<cmSourceGroupCommand>());
state->AddDisallowedCommand(
- "export_library_dependencies", new cmExportLibraryDependenciesCommand,
- cmPolicies::CMP0033,
+ "export_library_dependencies",
+ cm::make_unique<cmExportLibraryDependenciesCommand>(), cmPolicies::CMP0033,
"The export_library_dependencies command should not be called; "
"see CMP0033.");
state->AddDisallowedCommand(
- "load_command", new cmLoadCommandCommand, cmPolicies::CMP0031,
+ "load_command", cm::make_unique<cmLoadCommandCommand>(),
+ cmPolicies::CMP0031,
"The load_command command should not be called; see CMP0031.");
state->AddDisallowedCommand(
- "output_required_files", new cmOutputRequiredFilesCommand,
+ "output_required_files", cm::make_unique<cmOutputRequiredFilesCommand>(),
cmPolicies::CMP0032,
"The output_required_files command should not be called; see CMP0032.");
state->AddDisallowedCommand(
- "subdir_depends", new cmSubdirDependsCommand, cmPolicies::CMP0029,
+ "subdir_depends", cm::make_unique<cmSubdirDependsCommand>(),
+ cmPolicies::CMP0029,
"The subdir_depends command should not be called; see CMP0029.");
state->AddDisallowedCommand(
- "utility_source", new cmUtilitySourceCommand, cmPolicies::CMP0034,
+ "utility_source", cm::make_unique<cmUtilitySourceCommand>(),
+ cmPolicies::CMP0034,
"The utility_source command should not be called; see CMP0034.");
state->AddDisallowedCommand(
- "variable_requires", new cmVariableRequiresCommand, cmPolicies::CMP0035,
+ "variable_requires", cm::make_unique<cmVariableRequiresCommand>(),
+ cmPolicies::CMP0035,
"The variable_requires command should not be called; see CMP0035.");
#endif
}
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 66250f3..61880c2 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -6,7 +6,6 @@
#include <sstream>
#include <utility>
-#include "cmAlgorithms.h"
#include "cmComputeLinkInformation.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalCommonGenerator.h"
@@ -17,6 +16,7 @@
#include "cmOutputConverter.h"
#include "cmSourceFile.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt)
: GeneratorTarget(gt)
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 186deb6..f8b78b4 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -11,6 +11,7 @@
#include "cmMakefile.h"
#include "cmRange.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmake.h"
@@ -23,6 +24,8 @@
#include <string.h>
#include <utility>
+#include "cm_memory.hxx"
+
/*
This file computes an ordered list of link items to use when linking a
@@ -202,7 +205,6 @@ cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target,
cmComputeLinkDepends::~cmComputeLinkDepends()
{
cmDeleteAll(this->InferredDependSets);
- delete this->CCG;
}
void cmComputeLinkDepends::SetOldLinkDirMode(bool b)
@@ -632,7 +634,8 @@ void cmComputeLinkDepends::OrderLinkEntires()
// the same order in which the items were originally discovered in
// the BFS. This should preserve the original order when no
// constraints disallow it.
- this->CCG = new cmComputeComponentGraph(this->EntryConstraintGraph);
+ this->CCG =
+ cm::make_unique<cmComputeComponentGraph>(this->EntryConstraintGraph);
// The component graph is guaranteed to be acyclic. Start a DFS
// from every entry to compute a topological order for the
diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h
index dfaaf8b..839c27a 100644
--- a/Source/cmComputeLinkDepends.h
+++ b/Source/cmComputeLinkDepends.h
@@ -10,6 +10,7 @@
#include "cmTargetLinkLibraryType.h"
#include <map>
+#include <memory>
#include <queue>
#include <set>
#include <string>
@@ -137,7 +138,7 @@ private:
std::set<int> Entries;
};
std::map<int, PendingComponent> PendingComponents;
- cmComputeComponentGraph* CCG;
+ std::unique_ptr<cmComputeComponentGraph> CCG;
std::vector<int> FinalLinkOrder;
void DisplayComponents();
void VisitComponent(unsigned int c);
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 44d8615..78cddf0 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmComputeLinkInformation.h"
-#include "cmAlgorithms.h"
#include "cmComputeLinkDepends.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
@@ -14,6 +13,7 @@
#include "cmPolicies.h"
#include "cmState.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmake.h"
@@ -268,10 +268,6 @@ cmComputeLinkInformation::cmComputeLinkInformation(
return;
}
- // Check whether we should use an import library for linking a target.
- this->UseImportLibrary =
- this->Makefile->IsDefinitionSet("CMAKE_IMPORT_LIBRARY_SUFFIX");
-
// Check whether we should skip dependencies on shared library files.
this->LinkDependsNoShared =
this->Target->GetPropertyAsBool("LINK_DEPENDS_NO_SHARED");
@@ -280,7 +276,7 @@ cmComputeLinkInformation::cmComputeLinkInformation(
// to use when creating a plugin (module) that obtains symbols from
// the program that will load it.
this->LoaderFlag = nullptr;
- if (!this->UseImportLibrary &&
+ if (!this->Target->IsDLLPlatform() &&
this->Target->GetType() == cmStateEnums::MODULE_LIBRARY) {
std::string loader_flag_var = "CMAKE_SHARED_MODULE_LOADER_";
loader_flag_var += this->LinkLanguage;
@@ -493,9 +489,7 @@ bool cmComputeLinkInformation::Compute()
std::set<cmGeneratorTarget const*> const& wrongItems =
cld.GetOldWrongConfigItems();
for (cmGeneratorTarget const* tgt : wrongItems) {
- bool implib = (this->UseImportLibrary &&
- (tgt->GetType() == cmStateEnums::SHARED_LIBRARY));
- cmStateEnums::ArtifactType artifact = implib
+ cmStateEnums::ArtifactType artifact = tgt->HasImportLibrary(this->Config)
? cmStateEnums::ImportLibraryArtifact
: cmStateEnums::RuntimeBinaryArtifact;
this->OldLinkDirItems.push_back(
@@ -578,7 +572,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
// Compute the proper name to use to link this library.
const std::string& config = this->Config;
bool impexe = (tgt && tgt->IsExecutableWithExports());
- if (impexe && !this->UseImportLibrary && !this->LoaderFlag) {
+ if (impexe && !tgt->HasImportLibrary(config) && !this->LoaderFlag) {
// Skip linking to executables on platforms with no import
// libraries or loader flags.
return;
@@ -592,7 +586,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
// platform. Add it now.
std::string linkItem;
linkItem = this->LoaderFlag;
- cmStateEnums::ArtifactType artifact = this->UseImportLibrary
+ cmStateEnums::ArtifactType artifact = tgt->HasImportLibrary(config)
? cmStateEnums::ImportLibraryArtifact
: cmStateEnums::RuntimeBinaryArtifact;
@@ -616,15 +610,21 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
// Its object-files should already have been extracted for linking.
} else {
// Decide whether to use an import library.
- bool implib =
- (this->UseImportLibrary &&
- (impexe || tgt->GetType() == cmStateEnums::SHARED_LIBRARY));
- cmStateEnums::ArtifactType artifact = implib
+ cmStateEnums::ArtifactType artifact = tgt->HasImportLibrary(config)
? cmStateEnums::ImportLibraryArtifact
: cmStateEnums::RuntimeBinaryArtifact;
// Pass the full path to the target file.
std::string lib = tgt->GetFullPath(config, artifact, true);
+ if (tgt->Target->IsAIX() && cmHasLiteralSuffix(lib, "-NOTFOUND") &&
+ artifact == cmStateEnums::ImportLibraryArtifact) {
+ // This is an imported executable on AIX that has ENABLE_EXPORTS
+ // but not IMPORTED_IMPLIB. CMake used to produce and accept such
+ // imported executables on AIX before we taught it to use linker
+ // import files. For compatibility, simply skip linking to this
+ // executable as we did before. It works with runtime linking.
+ return;
+ }
if (!this->LinkDependsNoShared ||
tgt->GetType() != cmStateEnums::SHARED_LIBRARY) {
this->Depends.push_back(lib);
@@ -694,7 +694,7 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
// linked will be able to find it.
std::string lib;
if (tgt) {
- cmStateEnums::ArtifactType artifact = this->UseImportLibrary
+ cmStateEnums::ArtifactType artifact = tgt->HasImportLibrary(this->Config)
? cmStateEnums::ImportLibraryArtifact
: cmStateEnums::RuntimeBinaryArtifact;
lib = tgt->GetFullPath(this->Config, artifact);
@@ -1695,7 +1695,7 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
(for_install ||
this->Target->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"));
bool use_install_rpath =
- (outputRuntime && this->Target->HaveInstallTreeRPATH() &&
+ (outputRuntime && this->Target->HaveInstallTreeRPATH(this->Config) &&
linking_for_install);
bool use_build_rpath =
(outputRuntime && this->Target->HaveBuildTreeRPATH(this->Config) &&
@@ -1715,15 +1715,17 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
// Construct the RPATH.
std::set<std::string> emitted;
if (use_install_rpath) {
- const char* install_rpath = this->Target->GetProperty("INSTALL_RPATH");
- cmCLI_ExpandListUnique(install_rpath, runtimeDirs, emitted);
+ std::string install_rpath;
+ this->Target->GetInstallRPATH(this->Config, install_rpath);
+ cmCLI_ExpandListUnique(install_rpath.c_str(), runtimeDirs, emitted);
}
if (use_build_rpath) {
// Add directories explicitly specified by user
- if (const char* build_rpath = this->Target->GetProperty("BUILD_RPATH")) {
+ std::string build_rpath;
+ if (this->Target->GetBuildRPATH(this->Config, build_rpath)) {
// This will not resolve entries to use $ORIGIN, the user is expected to
// do that if necessary.
- cmCLI_ExpandListUnique(build_rpath, runtimeDirs, emitted);
+ cmCLI_ExpandListUnique(build_rpath.c_str(), runtimeDirs, emitted);
}
}
if (use_build_rpath || use_link_rpath) {
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index 863639c..3be2c7f 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -179,7 +179,6 @@ private:
bool OldLinkDirMode;
bool OpenBSD;
bool LinkDependsNoShared;
- bool UseImportLibrary;
bool RuntimeUseChrpath;
bool NoSONameUsesPath;
bool LinkWithRuntimePath;
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index e7e91c1..5b88807 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -4,6 +4,7 @@
#include "cmsys/RegularExpression.hxx"
#include <algorithm>
+#include <functional>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
@@ -14,10 +15,10 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmState.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
-class cmCommand;
class cmTest;
static std::string const keyAND = "AND";
@@ -452,7 +453,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
}
// does a command exist
if (this->IsKeyword(keyCOMMAND, *arg) && argP1 != newArgs.end()) {
- cmCommand* command =
+ cmState::Command command =
this->Makefile.GetState()->GetCommand(argP1->c_str());
this->HandlePredicate(command != nullptr, reducible, arg, newArgs,
argP1, argP2);
diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h
index 5603c50..b3a99d7 100644
--- a/Source/cmConfigureFileCommand.h
+++ b/Source/cmConfigureFileCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
#include "cmNewLineStyle.h"
@@ -16,7 +18,10 @@ class cmExecutionStatus;
class cmConfigureFileCommand : public cmCommand
{
public:
- cmCommand* Clone() override { return new cmConfigureFileCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmConfigureFileCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmContinueCommand.h b/Source/cmContinueCommand.h
index d383d1d..a85010a 100644
--- a/Source/cmContinueCommand.h
+++ b/Source/cmContinueCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -23,7 +25,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmContinueCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmContinueCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index f12ef0b..d2a4148 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -9,7 +9,6 @@
#include <string.h>
#include <utility>
-#include "cmAlgorithms.h"
#include "cmExportTryCompileFileGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
@@ -17,6 +16,7 @@
#include "cmOutputConverter.h"
#include "cmPolicies.h"
#include "cmState.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmVersion.h"
@@ -932,7 +932,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
cmStateEnums::INTERNAL);
if (!outputVariable.empty()) {
- this->Makefile->AddDefinition(outputVariable, output.c_str());
+ this->Makefile->AddDefinition(outputVariable, output);
}
if (this->SrcFileSignature) {
@@ -961,8 +961,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
}
if (!copyFileError.empty()) {
- this->Makefile->AddDefinition(copyFileError,
- copyFileErrorMessage.c_str());
+ this->Makefile->AddDefinition(copyFileError, copyFileErrorMessage);
}
}
return res;
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx
index b78493f..427db72 100644
--- a/Source/cmCreateTestSourceList.cxx
+++ b/Source/cmCreateTestSourceList.cxx
@@ -125,16 +125,15 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args,
}
if (!extraInclude.empty()) {
this->Makefile->AddDefinition("CMAKE_TESTDRIVER_EXTRA_INCLUDES",
- extraInclude.c_str());
+ extraInclude);
}
if (!function.empty()) {
- this->Makefile->AddDefinition("CMAKE_TESTDRIVER_ARGVC_FUNCTION",
- function.c_str());
+ this->Makefile->AddDefinition("CMAKE_TESTDRIVER_ARGVC_FUNCTION", function);
}
this->Makefile->AddDefinition("CMAKE_FORWARD_DECLARE_TESTS",
- forwardDeclareCode.c_str());
+ forwardDeclareCode);
this->Makefile->AddDefinition("CMAKE_FUNCTION_TABLE_ENTIRES",
- functionMapCode.c_str());
+ functionMapCode);
bool res = true;
if (!this->Makefile->ConfigureFile(configFile, driver, false, true, false)) {
res = false;
@@ -154,6 +153,6 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args,
sourceListValue += *i;
}
- this->Makefile->AddDefinition(sourceList, sourceListValue.c_str());
+ this->Makefile->AddDefinition(sourceList, sourceListValue);
return res;
}
diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h
index 005b32c..5aa6af4 100644
--- a/Source/cmCreateTestSourceList.h
+++ b/Source/cmCreateTestSourceList.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -23,7 +25,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmCreateTestSourceList; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmCreateTestSourceList>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx
index d914eb1..5e919af 100644
--- a/Source/cmCryptoHash.cxx
+++ b/Source/cmCryptoHash.cxx
@@ -2,13 +2,13 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCryptoHash.h"
-#include "cmAlgorithms.h"
#include "cm_kwiml.h"
#include "cm_rhash.h"
#include "cmsys/FStream.hxx"
+
#include <string.h>
-#include <memory> // IWYU pragma: keep
+#include "cm_memory.hxx"
static unsigned int const cmCryptoHashAlgoToId[] = {
/* clang-format needs this comment to break after the opening brace */
diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h
index b712f09..c7d3377 100644
--- a/Source/cmCryptoHash.h
+++ b/Source/cmCryptoHash.h
@@ -5,7 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <stddef.h>
#include <string>
#include <vector>
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index fe228ff..758a69a 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -12,7 +12,7 @@
#include "cmStateTypes.h"
#include "cmSystemTools.h"
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <stddef.h>
#include <utility>
diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h
index a9c1856..36f97df 100644
--- a/Source/cmDefinePropertyCommand.h
+++ b/Source/cmDefinePropertyCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -15,7 +17,10 @@ class cmExecutionStatus;
class cmDefinePropertyCommand : public cmCommand
{
public:
- cmCommand* Clone() override { return new cmDefinePropertyCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmDefinePropertyCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index 5fafaf9..42e70d6 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -13,10 +13,12 @@ cmDefinitions::Def const& cmDefinitions::GetInternal(const std::string& key,
StackIter end, bool raise)
{
assert(begin != end);
- MapType::iterator i = begin->Map.find(key);
- if (i != begin->Map.end()) {
- i->second.Used = true;
- return i->second;
+ {
+ MapType::iterator it = begin->Map.find(key);
+ if (it != begin->Map.end()) {
+ it->second.Used = true;
+ return it->second;
+ }
}
StackIter it = begin;
++it;
@@ -27,14 +29,14 @@ cmDefinitions::Def const& cmDefinitions::GetInternal(const std::string& key,
if (!raise) {
return def;
}
- return begin->Map.insert(MapType::value_type(key, def)).first->second;
+ return begin->Map.emplace(key, def).first->second;
}
const std::string* cmDefinitions::Get(const std::string& key, StackIter begin,
StackIter end)
{
Def const& def = cmDefinitions::GetInternal(key, begin, end, false);
- return def.Exists ? &def : nullptr;
+ return def.Exists ? &def.Value : nullptr;
}
void cmDefinitions::Raise(const std::string& key, StackIter begin,
@@ -47,18 +49,21 @@ bool cmDefinitions::HasKey(const std::string& key, StackIter begin,
StackIter end)
{
for (StackIter it = begin; it != end; ++it) {
- MapType::const_iterator i = it->Map.find(key);
- if (i != it->Map.end()) {
+ if (it->Map.find(key) != it->Map.end()) {
return true;
}
}
return false;
}
-void cmDefinitions::Set(const std::string& key, const char* value)
+void cmDefinitions::Set(const std::string& key, cm::string_view value)
+{
+ this->Map[key] = Def(value);
+}
+
+void cmDefinitions::Unset(const std::string& key)
{
- Def def(value);
- this->Map[key] = def;
+ this->Map[key] = Def();
}
std::vector<std::string> cmDefinitions::UnusedKeys() const
@@ -98,8 +103,8 @@ cmDefinitions cmDefinitions::MakeClosure(StackIter begin, StackIter end)
std::vector<std::string> cmDefinitions::ClosureKeys(StackIter begin,
StackIter end)
{
- std::set<std::string> bound;
std::vector<std::string> defined;
+ std::set<std::string> bound;
for (StackIter it = begin; it != end; ++it) {
defined.reserve(defined.size() + it->Map.size());
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index 6c252be..4d8810a 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -5,12 +5,14 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include "cm_string_view.hxx"
+
+#include "cmLinkedTree.h"
+
#include <string>
#include <unordered_map>
#include <vector>
-#include "cmLinkedTree.h"
-
/** \class cmDefinitions
* \brief Store a scope of variable definitions for CMake language.
*
@@ -30,8 +32,11 @@ public:
static bool HasKey(const std::string& key, StackIter begin, StackIter end);
- /** Set (or unset if null) a value associated with a key. */
- void Set(const std::string& key, const char* value);
+ /** Set a value associated with a key. */
+ void Set(const std::string& key, cm::string_view value);
+
+ /** Unset a definition. */
+ void Unset(const std::string& key);
std::vector<std::string> UnusedKeys() const;
@@ -40,24 +45,17 @@ public:
static cmDefinitions MakeClosure(StackIter begin, StackIter end);
private:
- // String with existence boolean.
- struct Def : public std::string
+ /** String with existence boolean. */
+ struct Def
{
- private:
- typedef std::string std_string;
-
public:
Def() = default;
- Def(const char* v)
- : std_string(v ? v : "")
- , Exists(v ? true : false)
- {
- }
- Def(const std_string& v)
- : std_string(v)
+ Def(cm::string_view value)
+ : Value(value)
, Exists(true)
{
}
+ std::string Value;
bool Exists = false;
bool Used = false;
};
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index 178e18b..764ba30 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -9,7 +9,6 @@
#include <stdlib.h>
#include <utility>
-#include "cmAlgorithms.h"
#include "cmFortranParser.h" /* Interface to parser object. */
#include "cmGeneratedFileStream.h"
#include "cmLocalGenerator.h"
@@ -17,6 +16,7 @@
#include "cmOutputConverter.h"
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
// TODO: Test compiler for the case of the mod file. Some always
diff --git a/Source/cmDisallowedCommand.cxx b/Source/cmDisallowedCommand.cxx
index 418d98c..aa1f90b 100644
--- a/Source/cmDisallowedCommand.cxx
+++ b/Source/cmDisallowedCommand.cxx
@@ -24,8 +24,6 @@ bool cmDisallowedCommand::InitialPass(std::vector<std::string> const& args,
return true;
}
- this->Command->SetMakefile(this->GetMakefile());
- bool const ret = this->Command->InitialPass(args, status);
- this->SetError(this->Command->GetError());
- return ret;
+ this->Command->SetExecutionStatus(this->GetExecutionStatus());
+ return this->Command->InitialPass(args, status);
}
diff --git a/Source/cmDisallowedCommand.h b/Source/cmDisallowedCommand.h
index d85c00f..e07f255 100644
--- a/Source/cmDisallowedCommand.h
+++ b/Source/cmDisallowedCommand.h
@@ -6,8 +6,11 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <string>
+#include <utility>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
#include "cmPolicies.h"
@@ -16,31 +19,27 @@ class cmExecutionStatus;
class cmDisallowedCommand : public cmCommand
{
public:
- cmDisallowedCommand(cmCommand* command, cmPolicies::PolicyID policy,
- const char* message)
- : Command(command)
+ cmDisallowedCommand(std::unique_ptr<cmCommand> command,
+ cmPolicies::PolicyID policy, const char* message)
+ : Command(std::move(command))
, Policy(policy)
, Message(message)
{
}
- ~cmDisallowedCommand() override { delete this->Command; }
+ ~cmDisallowedCommand() override = default;
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- return new cmDisallowedCommand(this->Command->Clone(), this->Policy,
- this->Message);
+ return cm::make_unique<cmDisallowedCommand>(this->Command->Clone(),
+ this->Policy, this->Message);
}
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
- void FinalPass() override { this->Command->FinalPass(); }
-
- bool HasFinalPass() const override { return this->Command->HasFinalPass(); }
-
private:
- cmCommand* Command;
+ std::unique_ptr<cmCommand> Command;
cmPolicies::PolicyID Policy;
const char* Message;
};
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 2226463..096016d 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -4,9 +4,10 @@
#include "cmAlgorithms.h"
#include "cm_kwiml.h"
+#include "cm_memory.hxx"
#include "cmsys/FStream.hxx"
#include <map>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <sstream>
#include <stddef.h>
#include <utility>
@@ -109,10 +110,10 @@ public:
};
// Construct and take ownership of the file stream object.
- cmELFInternal(cmELF* external, std::unique_ptr<cmsys::ifstream>& fin,
+ cmELFInternal(cmELF* external, std::unique_ptr<std::istream> fin,
ByteOrderType order)
: External(external)
- , Stream(*fin.release())
+ , Stream(std::move(fin))
, ByteOrder(order)
, ELFType(cmELF::FileTypeInvalid)
{
@@ -132,7 +133,7 @@ public:
}
// Destruct and delete the file stream object.
- virtual ~cmELFInternal() { delete &this->Stream; }
+ virtual ~cmELFInternal() = default;
// Forward to the per-class implementation.
virtual unsigned int GetNumberOfSections() const = 0;
@@ -171,7 +172,7 @@ protected:
cmELF* External;
// The stream from which to read.
- std::istream& Stream;
+ std::unique_ptr<std::istream> Stream;
// The byte order of the ELF file.
ByteOrderType ByteOrder;
@@ -233,7 +234,7 @@ public:
typedef typename Types::tagtype tagtype;
// Construct with a stream and byte swap indicator.
- cmELFInternalImpl(cmELF* external, std::unique_ptr<cmsys::ifstream>& fin,
+ cmELFInternalImpl(cmELF* external, std::unique_ptr<std::istream> fin,
ByteOrderType order);
// Return the number of sections as specified by the ELF header.
@@ -352,7 +353,7 @@ private:
bool Read(ELF_Ehdr& x)
{
// Read the header from the file.
- if (!this->Stream.read(reinterpret_cast<char*>(&x), sizeof(x))) {
+ if (!this->Stream->read(reinterpret_cast<char*>(&x), sizeof(x))) {
return false;
}
@@ -382,26 +383,26 @@ private:
}
bool Read(ELF_Shdr& x)
{
- if (this->Stream.read(reinterpret_cast<char*>(&x), sizeof(x)) &&
+ if (this->Stream->read(reinterpret_cast<char*>(&x), sizeof(x)) &&
this->NeedSwap) {
ByteSwap(x);
}
- return !this->Stream.fail();
+ return !this->Stream->fail();
}
bool Read(ELF_Dyn& x)
{
- if (this->Stream.read(reinterpret_cast<char*>(&x), sizeof(x)) &&
+ if (this->Stream->read(reinterpret_cast<char*>(&x), sizeof(x)) &&
this->NeedSwap) {
ByteSwap(x);
}
- return !this->Stream.fail();
+ return !this->Stream->fail();
}
bool LoadSectionHeader(ELF_Half i)
{
// Read the section header from the file.
- this->Stream.seekg(this->ELFHeader.e_shoff +
- this->ELFHeader.e_shentsize * i);
+ this->Stream->seekg(this->ELFHeader.e_shoff +
+ this->ELFHeader.e_shentsize * i);
if (!this->Read(this->SectionHeaders[i])) {
return false;
}
@@ -426,9 +427,10 @@ private:
};
template <class Types>
-cmELFInternalImpl<Types>::cmELFInternalImpl(
- cmELF* external, std::unique_ptr<cmsys::ifstream>& fin, ByteOrderType order)
- : cmELFInternal(external, fin, order)
+cmELFInternalImpl<Types>::cmELFInternalImpl(cmELF* external,
+ std::unique_ptr<std::istream> fin,
+ ByteOrderType order)
+ : cmELFInternal(external, std::move(fin), order)
{
// Read the main header.
if (!this->Read(this->ELFHeader)) {
@@ -510,7 +512,7 @@ bool cmELFInternalImpl<Types>::LoadDynamicSection()
// Read each entry.
for (int j = 0; j < n; ++j) {
// Seek to the beginning of the section entry.
- this->Stream.seekg(sec.sh_offset + sec.sh_entsize * j);
+ this->Stream->seekg(sec.sh_offset + sec.sh_entsize * j);
ELF_Dyn& dyn = this->DynamicSectionEntries[j];
// Try reading the entry.
@@ -630,7 +632,7 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
unsigned long first = static_cast<unsigned long>(dyn.d_un.d_val);
unsigned long last = first;
unsigned long end = static_cast<unsigned long>(strtab.sh_size);
- this->Stream.seekg(strtab.sh_offset + first);
+ this->Stream->seekg(strtab.sh_offset + first);
// Read the string. It may be followed by more than one NULL
// terminator. Count the total size of the region allocated to
@@ -639,7 +641,7 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
// assumption.
bool terminated = false;
char c;
- while (last != end && this->Stream.get(c) && !(terminated && c)) {
+ while (last != end && this->Stream->get(c) && !(terminated && c)) {
++last;
if (c) {
se.Value += c;
@@ -649,7 +651,7 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
}
// Make sure the whole value was read.
- if (!this->Stream) {
+ if (!(*this->Stream)) {
this->SetErrorMessage("Dynamic section specifies unreadable RPATH.");
se.Value = "";
return nullptr;
@@ -679,10 +681,9 @@ const long cmELF::TagMipsRldMapRel = 0;
#endif
cmELF::cmELF(const char* fname)
- : Internal(nullptr)
{
// Try to open the file.
- std::unique_ptr<cmsys::ifstream> fin(new cmsys::ifstream(fname));
+ auto fin = cm::make_unique<cmsys::ifstream>(fname);
// Quit now if the file could not be opened.
if (!fin || !*fin) {
@@ -725,12 +726,14 @@ cmELF::cmELF(const char* fname)
// parser implementation.
if (ident[EI_CLASS] == ELFCLASS32) {
// 32-bit ELF
- this->Internal = new cmELFInternalImpl<cmELFTypes32>(this, fin, order);
+ this->Internal = cm::make_unique<cmELFInternalImpl<cmELFTypes32>>(
+ this, std::move(fin), order);
}
#ifndef _SCO_DS
else if (ident[EI_CLASS] == ELFCLASS64) {
// 64-bit ELF
- this->Internal = new cmELFInternalImpl<cmELFTypes64>(this, fin, order);
+ this->Internal = cm::make_unique<cmELFInternalImpl<cmELFTypes64>>(
+ this, std::move(fin), order);
}
#endif
else {
@@ -739,10 +742,7 @@ cmELF::cmELF(const char* fname)
}
}
-cmELF::~cmELF()
-{
- delete this->Internal;
-}
+cmELF::~cmELF() = default;
bool cmELF::Valid() const
{
diff --git a/Source/cmELF.h b/Source/cmELF.h
index 987f0c3..afef654 100644
--- a/Source/cmELF.h
+++ b/Source/cmELF.h
@@ -6,6 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <iosfwd>
+#include <memory>
#include <string>
#include <utility>
#include <vector>
@@ -108,7 +109,7 @@ public:
private:
friend class cmELFInternal;
bool Valid() const;
- cmELFInternal* Internal;
+ std::unique_ptr<cmELFInternal> Internal;
std::string ErrorMessage;
};
diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h
index 97645a9..dc43e34 100644
--- a/Source/cmEnableLanguageCommand.h
+++ b/Source/cmEnableLanguageCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -26,7 +28,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmEnableLanguageCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmEnableLanguageCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmEnableTestingCommand.cxx b/Source/cmEnableTestingCommand.cxx
index 6a64450..89212c8 100644
--- a/Source/cmEnableTestingCommand.cxx
+++ b/Source/cmEnableTestingCommand.cxx
@@ -2,15 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmEnableTestingCommand.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-class cmExecutionStatus;
-
-// we do this in the final pass so that we now the subdirs have all
-// been defined
-bool cmEnableTestingCommand::InitialPass(std::vector<std::string> const&,
- cmExecutionStatus&)
+bool cmEnableTestingCommand(std::vector<std::string> const&,
+ cmExecutionStatus& status)
{
- this->Makefile->AddDefinition("CMAKE_TESTING_ENABLED", "1");
+ status.GetMakefile().AddDefinition("CMAKE_TESTING_ENABLED", "1");
return true;
}
diff --git a/Source/cmEnableTestingCommand.h b/Source/cmEnableTestingCommand.h
index 88a17b9..e4593f2 100644
--- a/Source/cmEnableTestingCommand.h
+++ b/Source/cmEnableTestingCommand.h
@@ -8,11 +8,9 @@
#include <string>
#include <vector>
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmEnableTestingCommand
+/**
* \brief Enable testing for this directory and below.
*
* Produce the output testfile. This produces a file in the build directory
@@ -25,20 +23,7 @@ class cmExecutionStatus;
* Note that CTest expects to find this file in the build directory root;
* therefore, this command should be in the source directory root too.
*/
-class cmEnableTestingCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- cmCommand* Clone() override { return new cmEnableTestingCommand; }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const&,
- cmExecutionStatus&) override;
-};
+bool cmEnableTestingCommand(std::vector<std::string> const&,
+ cmExecutionStatus&);
#endif
diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx
index 4b559e7..bc1d173 100644
--- a/Source/cmExecProgramCommand.cxx
+++ b/Source/cmExecProgramCommand.cxx
@@ -103,7 +103,7 @@ bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args,
}
std::string coutput = std::string(output, first, last - first + 1);
- this->Makefile->AddDefinition(output_variable, coutput.c_str());
+ this->Makefile->AddDefinition(output_variable, coutput);
}
if (!return_variable.empty()) {
diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h
index ae0fa9b..70f833a 100644
--- a/Source/cmExecProgramCommand.h
+++ b/Source/cmExecProgramCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
#include "cmProcessOutput.h"
@@ -27,7 +29,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmExecProgramCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmExecProgramCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index 494afbb..465f4b3 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -4,16 +4,19 @@
#include "cm_static_string_view.hxx"
#include "cmsys/Process.h"
+
#include <algorithm>
#include <ctype.h> /* isspace */
#include <iostream>
#include <stdio.h>
+#include <vector>
#include "cmAlgorithms.h"
#include "cmArgumentParser.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmProcessOutput.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
class cmExecutionStatus;
@@ -330,7 +333,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
}
}
this->Makefile->AddDefinition(arguments.ResultsVariable,
- cmJoin(res, ";").c_str());
+ cmJoin(res, ";"));
} break;
case cmsysProcess_State_Exception:
this->Makefile->AddDefinition(arguments.ResultsVariable,
diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h
index b415deb..1d5445f 100644
--- a/Source/cmExecuteProcessCommand.h
+++ b/Source/cmExecuteProcessCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -24,7 +26,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmExecuteProcessCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmExecuteProcessCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h
index 56199dd..bcacc2f 100644
--- a/Source/cmExecutionStatus.h
+++ b/Source/cmExecutionStatus.h
@@ -3,6 +3,11 @@
#ifndef cmExecutionStatus_h
#define cmExecutionStatus_h
+#include <cmConfigure.h> // IWYU pragma: keep
+#include <string>
+
+class cmMakefile;
+
/** \class cmExecutionStatus
* \brief Superclass for all command status classes
*
@@ -11,14 +16,26 @@
class cmExecutionStatus
{
public:
+ cmExecutionStatus(cmMakefile& makefile)
+ : Makefile(makefile)
+ , Error("unknown error.")
+ {
+ }
+
void Clear()
{
+ this->Error = "unknown error.";
this->ReturnInvoked = false;
this->BreakInvoked = false;
this->ContinueInvoked = false;
this->NestedError = false;
}
+ cmMakefile& GetMakefile() { return this->Makefile; }
+
+ void SetError(std::string const& e) { this->Error = e; }
+ std::string const& GetError() const { return this->Error; }
+
void SetReturnInvoked() { this->ReturnInvoked = true; }
bool GetReturnInvoked() const { return this->ReturnInvoked; }
@@ -32,6 +49,8 @@ public:
bool GetNestedError() const { return this->NestedError; }
private:
+ cmMakefile& Makefile;
+ std::string Error;
bool ReturnInvoked = false;
bool BreakInvoked = false;
bool ContinueInvoked = false;
diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx
index ced27c9..5edf7ca 100644
--- a/Source/cmExportBuildAndroidMKGenerator.cxx
+++ b/Source/cmExportBuildAndroidMKGenerator.cxx
@@ -3,17 +3,16 @@
#include "cmExportBuildAndroidMKGenerator.h"
#include <algorithm>
-#include <memory> // IWYU pragma: keep
#include <sstream>
#include <utility>
-#include "cmAlgorithms.h"
#include "cmGeneratorTarget.h"
#include "cmLinkItem.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 012355b..33806f2 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExportBuildFileGenerator.h"
-#include "cmAlgorithms.h"
#include "cmExportSet.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
@@ -12,7 +11,7 @@
#include "cmMessageType.h"
#include "cmPolicies.h"
#include "cmStateTypes.h"
-#include "cmSystemTools.h"
+#include "cmStringAlgorithms.h"
#include "cmTarget.h"
#include "cmTargetExport.h"
#include "cmake.h"
@@ -45,6 +44,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
std::string expectedTargets;
std::string sep;
std::vector<std::string> targets;
+ bool generatedInterfaceRequired = false;
this->GetTargets(targets);
for (std::string const& tei : targets) {
cmGeneratorTarget* te = this->LG->FindGeneratorTargetToUse(tei);
@@ -60,11 +60,13 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
this->LG->GetMakefile()->GetBacktrace());
return false;
}
- if (this->GetExportTargetType(te) == cmStateEnums::INTERFACE_LIBRARY) {
- this->GenerateRequiredCMakeVersion(os, "3.0.0");
- }
+ generatedInterfaceRequired |=
+ this->GetExportTargetType(te) == cmStateEnums::INTERFACE_LIBRARY;
}
+ if (generatedInterfaceRequired) {
+ this->GenerateRequiredCMakeVersion(os, "3.0.0");
+ }
this->GenerateExpectedTargetsCode(os, expectedTargets);
}
@@ -234,14 +236,15 @@ void cmExportBuildFileGenerator::SetImportLocationProperty(
}
// Add the import library for windows DLLs.
- if (target->HasImportLibrary(config) &&
- mf->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")) {
+ if (target->HasImportLibrary(config)) {
std::string prop = "IMPORTED_IMPLIB";
prop += suffix;
std::string value =
target->GetFullPath(config, cmStateEnums::ImportLibraryArtifact);
- target->GetImplibGNUtoMS(config, value, value,
- "${CMAKE_IMPORT_LIBRARY_SUFFIX}");
+ if (mf->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")) {
+ target->GetImplibGNUtoMS(config, value, value,
+ "${CMAKE_IMPORT_LIBRARY_SUFFIX}");
+ }
properties[prop] = value;
}
}
@@ -256,11 +259,11 @@ void cmExportBuildFileGenerator::HandleMissingTarget(
const std::string name = dependee->GetName();
cmGlobalGenerator* gg =
dependee->GetLocalGenerator()->GetGlobalGenerator();
- std::vector<std::string> namespaces = this->FindNamespaces(gg, name);
+ auto exportInfo = this->FindBuildExportInfo(gg, name);
+ std::vector<std::string> const& exportFiles = exportInfo.first;
- int targetOccurrences = static_cast<int>(namespaces.size());
- if (targetOccurrences == 1) {
- std::string missingTarget = namespaces[0];
+ if (exportFiles.size() == 1) {
+ std::string missingTarget = exportInfo.second;
missingTarget += dependee->GetExportName();
link_libs += missingTarget;
@@ -269,7 +272,7 @@ void cmExportBuildFileGenerator::HandleMissingTarget(
}
// We are not appending, so all exported targets should be
// known here. This is probably user-error.
- this->ComplainAboutMissingTarget(depender, dependee, targetOccurrences);
+ this->ComplainAboutMissingTarget(depender, dependee, exportFiles);
}
// Assume the target will be exported by another command.
// Append it with the export namespace.
@@ -289,10 +292,12 @@ void cmExportBuildFileGenerator::GetTargets(
targets = this->Targets;
}
-std::vector<std::string> cmExportBuildFileGenerator::FindNamespaces(
- cmGlobalGenerator* gg, const std::string& name)
+std::pair<std::vector<std::string>, std::string>
+cmExportBuildFileGenerator::FindBuildExportInfo(cmGlobalGenerator* gg,
+ const std::string& name)
{
- std::vector<std::string> namespaces;
+ std::vector<std::string> exportFiles;
+ std::string ns;
std::map<std::string, cmExportBuildFileGenerator*>& exportSets =
gg->GetBuildExportSets();
@@ -302,31 +307,31 @@ std::vector<std::string> cmExportBuildFileGenerator::FindNamespaces(
std::vector<std::string> targets;
exportSet->GetTargets(targets);
if (std::find(targets.begin(), targets.end(), name) != targets.end()) {
- namespaces.push_back(exportSet->GetNamespace());
+ exportFiles.push_back(exp.first);
+ ns = exportSet->GetNamespace();
}
}
- return namespaces;
+ return std::make_pair(exportFiles, ns);
}
void cmExportBuildFileGenerator::ComplainAboutMissingTarget(
- cmGeneratorTarget* depender, cmGeneratorTarget* dependee, int occurrences)
+ cmGeneratorTarget* depender, cmGeneratorTarget* dependee,
+ std::vector<std::string> const& exportFiles)
{
- if (cmSystemTools::GetErrorOccuredFlag()) {
- return;
- }
-
std::ostringstream e;
e << "export called with target \"" << depender->GetName()
<< "\" which requires target \"" << dependee->GetName() << "\" ";
- if (occurrences == 0) {
- e << "that is not in the export set.\n";
+ if (exportFiles.empty()) {
+ e << "that is not in any export set.";
} else {
- e << "that is not in this export set, but " << occurrences
- << " times in others.\n";
+ e << "that is not in this export set, but in multiple other export sets: "
+ << cmJoin(exportFiles, ", ") << ".\n";
+ e << "An exported target cannot depend upon another target which is "
+ "exported multiple times. Consider consolidating the exports of the "
+ "\""
+ << dependee->GetName() << "\" target to a single export.";
}
- e << "If the required target is not easy to reference in this call, "
- << "consider using the APPEND option with multiple separate calls.";
this->LG->GetGlobalGenerator()->GetCMakeInstance()->IssueMessage(
MessageType::FATAL_ERROR, e.str(),
diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h
index 0a1e755..e5b6597 100644
--- a/Source/cmExportBuildFileGenerator.h
+++ b/Source/cmExportBuildFileGenerator.h
@@ -11,6 +11,7 @@
#include <iosfwd>
#include <string>
+#include <utility>
#include <vector>
class cmExportSet;
@@ -64,7 +65,7 @@ protected:
void ComplainAboutMissingTarget(cmGeneratorTarget* depender,
cmGeneratorTarget* dependee,
- int occurrences);
+ std::vector<std::string> const& namespaces);
/** Fill in properties indicating built file locations. */
void SetImportLocationProperty(const std::string& config,
@@ -75,8 +76,8 @@ protected:
std::string InstallNameDir(cmGeneratorTarget* target,
const std::string& config) override;
- std::vector<std::string> FindNamespaces(cmGlobalGenerator* gg,
- const std::string& name);
+ std::pair<std::vector<std::string>, std::string> FindBuildExportInfo(
+ cmGlobalGenerator* gg, const std::string& name);
std::vector<std::string> Targets;
cmExportSet* ExportSet;
diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h
index 99f9932..50463af 100644
--- a/Source/cmExportCommand.h
+++ b/Source/cmExportCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -18,7 +20,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmExportCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmExportCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index a12e0c4..8fd2947 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExportFileGenerator.h"
-#include "cmAlgorithms.h"
#include "cmComputeLinkInformation.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
@@ -12,20 +11,21 @@
#include "cmMessageType.h"
#include "cmOutputConverter.h"
#include "cmPolicies.h"
-#include "cmProperty.h"
#include "cmPropertyMap.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetExport.h"
#include "cmsys/FStream.hxx"
#include <assert.h>
-#include <memory> // IWYU pragma: keep
#include <sstream>
#include <string.h>
#include <utility>
+#include "cm_memory.hxx"
+
static std::string cmExportFileGeneratorEscape(std::string const& str)
{
// Escape a property value for writing into a .cmake file.
@@ -1205,12 +1205,9 @@ bool cmExportFileGenerator::PopulateExportProperties(
std::string& errorMessage)
{
auto& targetProperties = gte->Target->GetProperties();
- const auto& exportProperties = targetProperties.find("EXPORT_PROPERTIES");
- if (exportProperties != targetProperties.end()) {
- std::vector<std::string> propsToExport;
- cmSystemTools::ExpandListArgument(exportProperties->second.GetValue(),
- propsToExport);
- for (auto& prop : propsToExport) {
+ if (const char* exportProperties =
+ targetProperties.GetPropertyValue("EXPORT_PROPERTIES")) {
+ for (auto& prop : cmSystemTools::ExpandedListArgument(exportProperties)) {
/* Black list reserved properties */
if (cmSystemTools::StringStartsWith(prop, "IMPORTED_") ||
cmSystemTools::StringStartsWith(prop, "INTERFACE_")) {
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index f8bc0ab..ab4a62b 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExportInstallFileGenerator.h"
-#include "cmAlgorithms.h"
#include "cmExportSet.h"
#include "cmExportSetMap.h"
#include "cmGeneratedFileStream.h"
@@ -15,6 +14,7 @@
#include "cmMakefile.h"
#include "cmPolicies.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetExport.h"
diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx
index b60a053..8f2fff5 100644
--- a/Source/cmExportLibraryDependenciesCommand.cxx
+++ b/Source/cmExportLibraryDependenciesCommand.cxx
@@ -4,10 +4,10 @@
#include "cmsys/FStream.hxx"
#include <map>
-#include <memory> // IWYU pragma: keep
#include <utility>
-#include "cmAlgorithms.h"
+#include "cm_memory.hxx"
+
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
@@ -19,57 +19,31 @@
class cmExecutionStatus;
-bool cmExportLibraryDependenciesCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
-{
- if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
- return false;
- }
-
- // store the arguments for the final pass
- this->Filename = args[0];
- this->Append = false;
- if (args.size() > 1) {
- if (args[1] == "APPEND") {
- this->Append = true;
- }
- }
- return true;
-}
-
-void cmExportLibraryDependenciesCommand::FinalPass()
-{
- // export_library_dependencies() shouldn't modify anything
- // ensure this by calling a const method
- this->ConstFinalPass();
-}
-
-void cmExportLibraryDependenciesCommand::ConstFinalPass() const
+static void FinalAction(cmMakefile& makefile, std::string const& filename,
+ bool append)
{
// Use copy-if-different if not appending.
std::unique_ptr<cmsys::ofstream> foutPtr;
- if (this->Append) {
+ if (append) {
const auto openmodeApp = std::ios::app;
- foutPtr =
- cm::make_unique<cmsys::ofstream>(this->Filename.c_str(), openmodeApp);
+ foutPtr = cm::make_unique<cmsys::ofstream>(filename.c_str(), openmodeApp);
} else {
std::unique_ptr<cmGeneratedFileStream> ap(
- new cmGeneratedFileStream(this->Filename, true));
+ new cmGeneratedFileStream(filename, true));
ap->SetCopyIfDifferent(true);
foutPtr = std::move(ap);
}
std::ostream& fout = *foutPtr;
if (!fout) {
- cmSystemTools::Error("Error Writing " + this->Filename);
+ cmSystemTools::Error("Error Writing " + filename);
cmSystemTools::ReportLastSystemError("");
return;
}
// Collect dependency information about all library targets built in
// the project.
- cmake* cm = this->Makefile->GetCMakeInstance();
+ cmake* cm = makefile.GetCMakeInstance();
cmGlobalGenerator* global = cm->GetGlobalGenerator();
const std::vector<cmMakefile*>& locals = global->GetMakefiles();
std::map<std::string, std::string> libDepsOld;
@@ -166,3 +140,20 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
}
fout << "endif()\n";
}
+
+bool cmExportLibraryDependenciesCommand::InitialPass(
+ std::vector<std::string> const& args, cmExecutionStatus&)
+{
+ if (args.empty()) {
+ this->SetError("called with incorrect number of arguments");
+ return false;
+ }
+
+ std::string const& filename = args[0];
+ bool const append = args.size() > 1 && args[1] == "APPEND";
+ this->Makefile->AddFinalAction([filename, append](cmMakefile& makefile) {
+ FinalAction(makefile, filename, append);
+ });
+
+ return true;
+}
diff --git a/Source/cmExportLibraryDependenciesCommand.h b/Source/cmExportLibraryDependenciesCommand.h
index 8414866..4817162 100644
--- a/Source/cmExportLibraryDependenciesCommand.h
+++ b/Source/cmExportLibraryDependenciesCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -15,20 +17,12 @@ class cmExecutionStatus;
class cmExportLibraryDependenciesCommand : public cmCommand
{
public:
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- return new cmExportLibraryDependenciesCommand;
+ return cm::make_unique<cmExportLibraryDependenciesCommand>();
}
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
-
- void FinalPass() override;
- bool HasFinalPass() const override { return true; }
-
-private:
- std::string Filename;
- bool Append = false;
- void ConstFinalPass() const;
};
#endif
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index c169032..a3c9802 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -13,7 +13,7 @@
#include "cmTarget.h"
#include <map>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <utility>
cmExportTryCompileFileGenerator::cmExportTryCompileFileGenerator(
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index 6fe8c14..30b3f0d 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -217,22 +217,21 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles(
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY: {
+ cmake const* cm = makefile->GetCMakeInstance();
std::vector<cmSourceFile*> sources;
gt->GetSourceFiles(sources,
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for (cmSourceFile* s : sources) {
+ std::string const& fullPath = s->GetFullPath();
+ std::string const& extLower =
+ cmSystemTools::LowerCase(s->GetExtension());
// check whether it is a source or a include file
// then put it accordingly into one of the two containers
- switch (cmSystemTools::GetFileFormat(s->GetExtension())) {
- case cmSystemTools::C_FILE_FORMAT:
- case cmSystemTools::CXX_FILE_FORMAT:
- case cmSystemTools::CUDA_FILE_FORMAT:
- case cmSystemTools::FORTRAN_FILE_FORMAT: {
- cFiles[s->GetFullPath()] = s;
- } break;
- default: {
- otherFiles.insert(s->GetFullPath());
- }
+ if (cm->IsSourceExtension(extLower) || cm->IsCudaExtension(extLower) ||
+ cm->IsFortranExtension(extLower)) {
+ cFiles[fullPath] = s;
+ } else {
+ otherFiles.insert(fullPath);
}
}
}
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index aece3bc..06709f1 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -44,6 +44,8 @@ void AppendDictionary(cmXMLWriter& xml, const char* key, T const& value)
cmExtraEclipseCDT4Generator::cmExtraEclipseCDT4Generator()
{
+ this->IsOutOfSourceBuild = false;
+ this->GenerateSourceProject = false;
this->SupportsVirtualFolders = true;
this->GenerateLinkedResources = true;
this->SupportsGmakeErrorParser = true;
@@ -164,6 +166,29 @@ void cmExtraEclipseCDT4Generator::Generate()
// create a .cproject file
this->CreateCProjectFile();
+
+ // create resource settings
+ this->CreateSettingsResourcePrefsFile();
+}
+
+void cmExtraEclipseCDT4Generator::CreateSettingsResourcePrefsFile()
+{
+ cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0];
+ cmMakefile* mf = lg->GetMakefile();
+
+ const std::string filename =
+ this->HomeOutputDirectory + "/.settings/org.eclipse.core.resources.prefs";
+
+ cmGeneratedFileStream fout(filename);
+ if (!fout) {
+ return;
+ }
+
+ fout << "eclipse.preferences.version=1" << std::endl;
+ const char* encoding = mf->GetDefinition("CMAKE_ECLIPSE_RESOURCE_ENCODING");
+ if (encoding) {
+ fout << "encoding/<project>=" << encoding << std::endl;
+ }
}
void cmExtraEclipseCDT4Generator::CreateSourceProjectFile()
diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h
index 5136660..ef038d9 100644
--- a/Source/cmExtraEclipseCDT4Generator.h
+++ b/Source/cmExtraEclipseCDT4Generator.h
@@ -43,6 +43,9 @@ private:
// create .project file in the source tree
void CreateSourceProjectFile();
+ // create .settings/org.eclipse.core.resources.prefs
+ void CreateSettingsResourcePrefsFile();
+
// create .project file
void CreateProjectFile();
diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index 89629c7..b7a2b27 100644
--- a/Source/cmFLTKWrapUICommand.cxx
+++ b/Source/cmFLTKWrapUICommand.cxx
@@ -13,6 +13,23 @@
class cmExecutionStatus;
class cmTarget;
+static void FinalAction(cmMakefile& makefile, std::string const& name)
+{
+ // people should add the srcs to the target themselves, but the old command
+ // didn't support that, so check and see if they added the files in and if
+ // they didn;t then print a warning and add then anyhow
+ cmTarget* target = makefile.FindLocalNonAliasTarget(name);
+ if (!target) {
+ std::string msg =
+ "FLTK_WRAP_UI was called with a target that was never created: ";
+ msg += name;
+ msg += ". The problem was found while processing the source directory: ";
+ msg += makefile.GetCurrentSourceDirectory();
+ msg += ". This FLTK_WRAP_UI call will be ignored.";
+ cmSystemTools::Message(msg, "Warning");
+ }
+}
+
// cmFLTKWrapUICommand
bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
@@ -27,8 +44,8 @@ bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args,
std::string const& fluid_exe =
this->Makefile->GetRequiredDefinition("FLTK_FLUID_EXECUTABLE");
- // get parameter for the command
- this->Target = args[0]; // Target that will use the generated files
+ // Target that will use the generated files
+ std::string const& target = args[0];
// get the list of GUI files from which .cxx and .h will be generated
std::string outputDirectory = this->Makefile->GetCurrentBinaryDirectory();
@@ -41,6 +58,9 @@ bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args,
this->Makefile->AddIncludeDirectories(outputDirectories);
}
+ // List of produced files.
+ std::vector<cmSourceFile*> generatedSourcesClasses;
+
for (std::string const& arg : cmMakeRange(args).advance(1)) {
cmSourceFile* curr = this->Makefile->GetSource(arg);
// if we should use the source GUI
@@ -84,40 +104,24 @@ bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args,
cmSourceFile* sf = this->Makefile->GetSource(cxxres);
sf->AddDepend(hname);
sf->AddDepend(origname);
- this->GeneratedSourcesClasses.push_back(sf);
+ generatedSourcesClasses.push_back(sf);
}
}
// create the variable with the list of sources in it
- size_t lastHeadersClass = this->GeneratedSourcesClasses.size();
+ size_t lastHeadersClass = generatedSourcesClasses.size();
std::string sourceListValue;
for (size_t classNum = 0; classNum < lastHeadersClass; classNum++) {
if (classNum) {
sourceListValue += ";";
}
- sourceListValue += this->GeneratedSourcesClasses[classNum]->GetFullPath();
+ sourceListValue += generatedSourcesClasses[classNum]->GetFullPath();
}
- std::string varName = this->Target;
- varName += "_FLTK_UI_SRCS";
- this->Makefile->AddDefinition(varName, sourceListValue.c_str());
- return true;
-}
+ std::string const varName = target + "_FLTK_UI_SRCS";
+ this->Makefile->AddDefinition(varName, sourceListValue);
-void cmFLTKWrapUICommand::FinalPass()
-{
- // people should add the srcs to the target themselves, but the old command
- // didn't support that, so check and see if they added the files in and if
- // they didn;t then print a warning and add then anyhow
- cmTarget* target = this->Makefile->FindLocalNonAliasTarget(this->Target);
- if (!target) {
- std::string msg =
- "FLTK_WRAP_UI was called with a target that was never created: ";
- msg += this->Target;
- msg += ". The problem was found while processing the source directory: ";
- msg += this->Makefile->GetCurrentSourceDirectory();
- msg += ". This FLTK_WRAP_UI call will be ignored.";
- cmSystemTools::Message(msg, "Warning");
- return;
- }
+ this->Makefile->AddFinalAction(
+ [target](cmMakefile& makefile) { FinalAction(makefile, target); });
+ return true;
}
diff --git a/Source/cmFLTKWrapUICommand.h b/Source/cmFLTKWrapUICommand.h
index 044755e..ea8d401 100644
--- a/Source/cmFLTKWrapUICommand.h
+++ b/Source/cmFLTKWrapUICommand.h
@@ -8,10 +8,11 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
-class cmSourceFile;
/** \class cmFLTKWrapUICommand
* \brief Create .h and .cxx files rules for FLTK user interfaces files
@@ -25,7 +26,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmFLTKWrapUICommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmFLTKWrapUICommand>();
+ }
/**
* This is called when the command is first encountered in
@@ -33,27 +37,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
-
- /**
- * This is called at the end after all the information
- * specified by the command is accumulated. Most commands do
- * not implement this method. At this point, reading and
- * writing to the cache can be done.
- */
- void FinalPass() override;
- bool HasFinalPass() const override { return true; }
-
-private:
- /**
- * List of produced files.
- */
- std::vector<cmSourceFile*> GeneratedSourcesClasses;
-
- /**
- * List of Fluid files that provide the source
- * generating .cxx and .h files
- */
- std::string Target;
};
#endif
diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx
index ba42669..aa84396 100644
--- a/Source/cmFileAPI.cxx
+++ b/Source/cmFileAPI.cxx
@@ -2,12 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFileAPI.h"
-#include "cmAlgorithms.h"
#include "cmCryptoHash.h"
#include "cmFileAPICMakeFiles.h"
#include "cmFileAPICache.h"
#include "cmFileAPICodemodel.h"
#include "cmGlobalGenerator.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTimestamp.h"
#include "cmake.h"
diff --git a/Source/cmFileAPI.h b/Source/cmFileAPI.h
index 602efa8..aa5a42f 100644
--- a/Source/cmFileAPI.h
+++ b/Source/cmFileAPI.h
@@ -10,7 +10,7 @@
#include "cm_jsoncpp_writer.h"
#include <map>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <string>
#include <unordered_set>
#include <vector>
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 0fb166a..7b916cd 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -31,6 +31,7 @@
#include <algorithm>
#include <cassert>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <unordered_map>
@@ -1075,17 +1076,16 @@ Json::Value Target::DumpArtifacts()
}
// Add Windows-specific artifacts produced by the linker.
+ if (this->GT->HasImportLibrary(this->Config)) {
+ Json::Value artifact = Json::objectValue;
+ artifact["path"] =
+ RelativeIfUnder(this->TopBuild,
+ this->GT->GetFullPath(
+ this->Config, cmStateEnums::ImportLibraryArtifact));
+ artifacts.append(std::move(artifact)); // NOLINT(*)
+ }
if (this->GT->IsDLLPlatform() &&
this->GT->GetType() != cmStateEnums::STATIC_LIBRARY) {
- if (this->GT->GetType() == cmStateEnums::SHARED_LIBRARY ||
- this->GT->IsExecutableWithExports()) {
- Json::Value artifact = Json::objectValue;
- artifact["path"] =
- RelativeIfUnder(this->TopBuild,
- this->GT->GetFullPath(
- this->Config, cmStateEnums::ImportLibraryArtifact));
- artifacts.append(std::move(artifact)); // NOLINT(*)
- }
cmGeneratorTarget::OutputInfo const* output =
this->GT->GetOutputInfo(this->Config);
if (output && !output->PdbDir.empty()) {
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 7a3954e..22f0d1f 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -12,13 +12,16 @@
#include <assert.h>
#include <cmath>
#include <ctype.h>
-#include <memory> // IWYU pragma: keep
+#include <map>
+#include <set>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <utility>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmAlgorithms.h"
#include "cmArgumentParser.h"
#include "cmCryptoHash.h"
@@ -34,6 +37,9 @@
#include "cmMessageType.h"
#include "cmPolicies.h"
#include "cmRange.h"
+#include "cmRuntimeDependencyArchive.h"
+#include "cmState.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTimestamp.h"
#include "cm_sys_stat.h"
@@ -184,6 +190,9 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args,
if (subCommand == "CREATE_LINK") {
return this->HandleCreateLinkCommand(args);
}
+ if (subCommand == "GET_RUNTIME_DEPENDENCIES") {
+ return this->HandleGetRuntimeDependenciesCommand(args);
+ }
std::string e = "does not recognize sub-command " + subCommand;
this->SetError(e);
@@ -357,7 +366,7 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args)
}
}
}
- this->Makefile->AddDefinition(variable, output.c_str());
+ this->Makefile->AddDefinition(variable, output);
return true;
}
@@ -375,7 +384,7 @@ bool cmFileCommand::HandleHashCommand(std::vector<std::string> const& args)
if (hash) {
std::string out = hash->HashFile(args[1]);
if (!out.empty()) {
- this->Makefile->AddDefinition(args[2], out.c_str());
+ this->Makefile->AddDefinition(args[2], out);
return true;
}
std::ostringstream e;
@@ -743,7 +752,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
}
// Save the output in a makefile variable.
- this->Makefile->AddDefinition(outVar, output.c_str());
+ this->Makefile->AddDefinition(outVar, output);
return true;
}
@@ -930,7 +939,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
std::sort(files.begin(), files.end());
files.erase(std::unique(files.begin(), files.end()), files.end());
- this->Makefile->AddDefinition(variable, cmJoin(files, ";").c_str());
+ this->Makefile->AddDefinition(variable, cmJoin(files, ";"));
return true;
}
@@ -1063,6 +1072,7 @@ bool cmFileCommand::HandleRPathChangeCommand(
std::string file;
const char* oldRPath = nullptr;
const char* newRPath = nullptr;
+ bool removeEnvironmentRPath = false;
enum Doing
{
DoingNone,
@@ -1078,6 +1088,8 @@ bool cmFileCommand::HandleRPathChangeCommand(
doing = DoingNew;
} else if (args[i] == "FILE") {
doing = DoingFile;
+ } else if (args[i] == "INSTALL_REMOVE_ENVIRONMENT_RPATH") {
+ removeEnvironmentRPath = true;
} else if (doing == DoingFile) {
file = args[i];
doing = DoingNone;
@@ -1116,7 +1128,9 @@ bool cmFileCommand::HandleRPathChangeCommand(
cmFileTimes const ft(file);
std::string emsg;
bool changed;
- if (!cmSystemTools::ChangeRPath(file, oldRPath, newRPath, &emsg, &changed)) {
+
+ if (!cmSystemTools::ChangeRPath(file, oldRPath, newRPath,
+ removeEnvironmentRPath, &emsg, &changed)) {
std::ostringstream e;
/* clang-format off */
e << "RPATH_CHANGE could not write new RPATH:\n"
@@ -1290,14 +1304,14 @@ bool cmFileCommand::HandleReadElfCommand(std::vector<std::string> const& args)
if (cmELF::StringEntry const* se_rpath = elf.GetRPath()) {
std::string rpath(se_rpath->Value);
std::replace(rpath.begin(), rpath.end(), ':', ';');
- this->Makefile->AddDefinition(arguments.RPath, rpath.c_str());
+ this->Makefile->AddDefinition(arguments.RPath, rpath);
}
}
if (!arguments.RunPath.empty()) {
if (cmELF::StringEntry const* se_runpath = elf.GetRunPath()) {
std::string runpath(se_runpath->Value);
std::replace(runpath.begin(), runpath.end(), ':', ';');
- this->Makefile->AddDefinition(arguments.RunPath, runpath.c_str());
+ this->Makefile->AddDefinition(arguments.RunPath, runpath);
}
}
@@ -1308,7 +1322,7 @@ bool cmFileCommand::HandleReadElfCommand(std::vector<std::string> const& args)
this->SetError(error);
return false;
}
- this->Makefile->AddDefinition(arguments.Error, error.c_str());
+ this->Makefile->AddDefinition(arguments.Error, error);
return true;
#endif
}
@@ -1346,7 +1360,7 @@ bool cmFileCommand::HandleRelativePathCommand(
}
std::string res = cmSystemTools::RelativePath(directoryName, fileName);
- this->Makefile->AddDefinition(outVar, res.c_str());
+ this->Makefile->AddDefinition(outVar, res);
return true;
}
@@ -1452,7 +1466,7 @@ bool cmFileCommand::HandleCMakePathCommand(
std::string value = cmJoin(
cmMakeRange(path).transform(nativePath ? ToNativePath : ToCMakePath), ";");
- this->Makefile->AddDefinition(args[2], value.c_str());
+ this->Makefile->AddDefinition(args[2], value);
return true;
}
@@ -1792,7 +1806,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
if (!statusVar.empty()) {
std::ostringstream result;
result << 0 << ";\"" << msg;
- this->Makefile->AddDefinition(statusVar, result.str().c_str());
+ this->Makefile->AddDefinition(statusVar, result.str());
}
return true;
}
@@ -1941,7 +1955,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
std::ostringstream result;
result << static_cast<int>(res) << ";\"" << ::curl_easy_strerror(res)
<< "\"";
- this->Makefile->AddDefinition(statusVar, result.str().c_str());
+ this->Makefile->AddDefinition(statusVar, result.str());
}
::curl_global_cleanup();
@@ -1973,7 +1987,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
std::string status = "1;HASH mismatch: "
"expected: " +
expectedHash + " actual: " + actualHash;
- this->Makefile->AddDefinition(statusVar, status.c_str());
+ this->Makefile->AddDefinition(statusVar, status);
}
this->SetError(oss.str());
@@ -2228,7 +2242,7 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
std::ostringstream result;
result << static_cast<int>(res) << ";\"" << ::curl_easy_strerror(res)
<< "\"";
- this->Makefile->AddDefinition(statusVar, result.str().c_str());
+ this->Makefile->AddDefinition(statusVar, result.str());
}
::curl_global_cleanup();
@@ -2253,7 +2267,7 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
log += "\n";
}
- this->Makefile->AddDefinition(logVar, log.c_str());
+ this->Makefile->AddDefinition(logVar, log);
}
return true;
@@ -2471,7 +2485,7 @@ bool cmFileCommand::HandleLockCommand(std::vector<std::string> const& args)
}
if (!resultVariable.empty()) {
- this->Makefile->AddDefinition(resultVariable, result.c_str());
+ this->Makefile->AddDefinition(resultVariable, result);
}
return true;
@@ -2520,7 +2534,7 @@ bool cmFileCommand::HandleTimestampCommand(
cmTimestamp timestamp;
std::string result =
timestamp.FileModificationTime(filename.c_str(), formatString, utcFlag);
- this->Makefile->AddDefinition(outputVariable, result.c_str());
+ this->Makefile->AddDefinition(outputVariable, result);
return true;
}
@@ -2548,8 +2562,7 @@ bool cmFileCommand::HandleSizeCommand(std::vector<std::string> const& args)
}
this->Makefile->AddDefinition(
- outputVariable,
- std::to_string(cmSystemTools::FileLength(filename)).c_str());
+ outputVariable, std::to_string(cmSystemTools::FileLength(filename)));
return true;
}
@@ -2576,7 +2589,7 @@ bool cmFileCommand::HandleReadSymlinkCommand(
return false;
}
- this->Makefile->AddDefinition(outputVariable, result.c_str());
+ this->Makefile->AddDefinition(outputVariable, result);
return true;
}
@@ -2622,7 +2635,7 @@ bool cmFileCommand::HandleCreateLinkCommand(
if (fileName == newFileName) {
result = "CREATE_LINK cannot use same file and newfile";
if (!arguments.Result.empty()) {
- this->Makefile->AddDefinition(arguments.Result, result.c_str());
+ this->Makefile->AddDefinition(arguments.Result, result);
return true;
}
this->SetError(result);
@@ -2633,7 +2646,7 @@ bool cmFileCommand::HandleCreateLinkCommand(
if (!arguments.Symbolic && !cmSystemTools::FileExists(fileName)) {
result = "Cannot hard link \'" + fileName + "\' as it does not exist.";
if (!arguments.Result.empty()) {
- this->Makefile->AddDefinition(arguments.Result, result.c_str());
+ this->Makefile->AddDefinition(arguments.Result, result);
return true;
}
this->SetError(result);
@@ -2650,7 +2663,7 @@ bool cmFileCommand::HandleCreateLinkCommand(
<< cmSystemTools::GetLastSystemError() << "\n";
if (!arguments.Result.empty()) {
- this->Makefile->AddDefinition(arguments.Result, e.str().c_str());
+ this->Makefile->AddDefinition(arguments.Result, e.str());
return true;
}
this->SetError(e.str());
@@ -2685,8 +2698,174 @@ bool cmFileCommand::HandleCreateLinkCommand(
}
if (!arguments.Result.empty()) {
- this->Makefile->AddDefinition(arguments.Result, result.c_str());
+ this->Makefile->AddDefinition(arguments.Result, result);
+ }
+
+ return true;
+}
+
+bool cmFileCommand::HandleGetRuntimeDependenciesCommand(
+ std::vector<std::string> const& args)
+{
+ static const std::set<std::string> supportedPlatforms = { "Windows", "Linux",
+ "Darwin" };
+ std::string platform =
+ this->Makefile->GetSafeDefinition("CMAKE_HOST_SYSTEM_NAME");
+ if (!supportedPlatforms.count(platform)) {
+ std::ostringstream e;
+ e << "GET_RUNTIME_DEPENDENCIES is not supported on system \"" << platform
+ << "\"";
+ this->SetError(e.str());
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+ }
+
+ if (this->Makefile->GetState()->GetMode() == cmState::Project) {
+ this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING,
+ "You have used file(GET_RUNTIME_DEPENDENCIES)"
+ " in project mode. This is probably not what "
+ "you intended to do. Instead, please consider"
+ " using it in an install(CODE) or "
+ "install(SCRIPT) command. For example:"
+ "\n install(CODE [["
+ "\n file(GET_RUNTIME_DEPENDENCIES"
+ "\n # ..."
+ "\n )"
+ "\n ]])");
+ }
+
+ struct Arguments
+ {
+ std::string ResolvedDependenciesVar;
+ std::string UnresolvedDependenciesVar;
+ std::string ConflictingDependenciesPrefix;
+ std::string BundleExecutable;
+ std::vector<std::string> Executables;
+ std::vector<std::string> Libraries;
+ std::vector<std::string> Directories;
+ std::vector<std::string> Modules;
+ std::vector<std::string> PreIncludeRegexes;
+ std::vector<std::string> PreExcludeRegexes;
+ std::vector<std::string> PostIncludeRegexes;
+ std::vector<std::string> PostExcludeRegexes;
+ };
+
+ static auto const parser =
+ cmArgumentParser<Arguments>{}
+ .Bind("RESOLVED_DEPENDENCIES_VAR"_s, &Arguments::ResolvedDependenciesVar)
+ .Bind("UNRESOLVED_DEPENDENCIES_VAR"_s,
+ &Arguments::UnresolvedDependenciesVar)
+ .Bind("CONFLICTING_DEPENDENCIES_PREFIX"_s,
+ &Arguments::ConflictingDependenciesPrefix)
+ .Bind("BUNDLE_EXECUTABLE"_s, &Arguments::BundleExecutable)
+ .Bind("EXECUTABLES"_s, &Arguments::Executables)
+ .Bind("LIBRARIES"_s, &Arguments::Libraries)
+ .Bind("MODULES"_s, &Arguments::Modules)
+ .Bind("DIRECTORIES"_s, &Arguments::Directories)
+ .Bind("PRE_INCLUDE_REGEXES"_s, &Arguments::PreIncludeRegexes)
+ .Bind("PRE_EXCLUDE_REGEXES"_s, &Arguments::PreExcludeRegexes)
+ .Bind("POST_INCLUDE_REGEXES"_s, &Arguments::PostIncludeRegexes)
+ .Bind("POST_EXCLUDE_REGEXES"_s, &Arguments::PostExcludeRegexes);
+
+ std::vector<std::string> unrecognizedArguments;
+ std::vector<std::string> keywordsMissingValues;
+ auto parsedArgs =
+ parser.Parse(cmMakeRange(args).advance(1), &unrecognizedArguments,
+ &keywordsMissingValues);
+ auto argIt = unrecognizedArguments.begin();
+ if (argIt != unrecognizedArguments.end()) {
+ std::ostringstream e;
+ e << "Unrecognized argument: \"" << *argIt << "\"";
+ this->SetError(e.str());
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+ }
+ argIt = keywordsMissingValues.begin();
+ if (argIt != keywordsMissingValues.end()) {
+ std::ostringstream e;
+ e << "Keyword missing value: " << *argIt;
+ this->SetError(e.str());
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+ }
+
+ cmRuntimeDependencyArchive archive(
+ this, parsedArgs.Directories, parsedArgs.BundleExecutable,
+ parsedArgs.PreIncludeRegexes, parsedArgs.PreExcludeRegexes,
+ parsedArgs.PostIncludeRegexes, parsedArgs.PostExcludeRegexes);
+ if (!archive.Prepare()) {
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+ }
+
+ if (!archive.GetRuntimeDependencies(
+ parsedArgs.Executables, parsedArgs.Libraries, parsedArgs.Modules)) {
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+ }
+
+ std::vector<std::string> deps, unresolvedDeps, conflictingDeps;
+ for (auto const& val : archive.GetResolvedPaths()) {
+ bool unique = true;
+ auto it = val.second.begin();
+ assert(it != val.second.end());
+ auto const& firstPath = *it;
+ while (++it != val.second.end()) {
+ if (!cmSystemTools::SameFile(firstPath, *it)) {
+ unique = false;
+ break;
+ }
+ }
+
+ if (unique) {
+ deps.push_back(firstPath);
+ } else if (!parsedArgs.ConflictingDependenciesPrefix.empty()) {
+ conflictingDeps.push_back(val.first);
+ std::vector<std::string> paths;
+ paths.insert(paths.begin(), val.second.begin(), val.second.end());
+ std::string varName =
+ parsedArgs.ConflictingDependenciesPrefix + "_" + val.first;
+ std::string pathsStr = cmJoin(paths, ";");
+ this->Makefile->AddDefinition(varName, pathsStr);
+ } else {
+ std::ostringstream e;
+ e << "Multiple conflicting paths found for " << val.first << ":";
+ for (auto const& path : val.second) {
+ e << "\n " << path;
+ }
+ this->SetError(e.str());
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+ }
+ }
+ if (!archive.GetUnresolvedPaths().empty()) {
+ if (!parsedArgs.UnresolvedDependenciesVar.empty()) {
+ unresolvedDeps.insert(unresolvedDeps.begin(),
+ archive.GetUnresolvedPaths().begin(),
+ archive.GetUnresolvedPaths().end());
+ } else {
+ auto it = archive.GetUnresolvedPaths().begin();
+ assert(it != archive.GetUnresolvedPaths().end());
+ std::ostringstream e;
+ e << "Could not resolve file " << *it;
+ this->SetError(e.str());
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+ }
}
+ if (!parsedArgs.ResolvedDependenciesVar.empty()) {
+ std::string val = cmJoin(deps, ";");
+ this->Makefile->AddDefinition(parsedArgs.ResolvedDependenciesVar, val);
+ }
+ if (!parsedArgs.UnresolvedDependenciesVar.empty()) {
+ std::string val = cmJoin(unresolvedDeps, ";");
+ this->Makefile->AddDefinition(parsedArgs.UnresolvedDependenciesVar, val);
+ }
+ if (!parsedArgs.ConflictingDependenciesPrefix.empty()) {
+ std::string val = cmJoin(conflictingDeps, ";");
+ this->Makefile->AddDefinition(
+ parsedArgs.ConflictingDependenciesPrefix + "_FILENAMES", val);
+ }
return true;
}
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index 12c5115..d4b980e 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -22,7 +24,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmFileCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmFileCommand>();
+ }
/**
* This is called when the command is first encountered in
@@ -62,6 +67,8 @@ protected:
bool HandleSizeCommand(std::vector<std::string> const& args);
bool HandleReadSymlinkCommand(std::vector<std::string> const& args);
bool HandleCreateLinkCommand(std::vector<std::string> const& args);
+ bool HandleGetRuntimeDependenciesCommand(
+ std::vector<std::string> const& args);
private:
void AddEvaluationFile(const std::string& inputName,
diff --git a/Source/cmFileCopier.cxx b/Source/cmFileCopier.cxx
index 49e8cd5..4f1a158 100644
--- a/Source/cmFileCopier.cxx
+++ b/Source/cmFileCopier.cxx
@@ -174,11 +174,8 @@ bool cmFileCopier::GetDefaultDirectoryPermissions(mode_t** mode)
cmSystemTools::ExpandListArgument(default_dir_install_permissions, items);
for (const auto& arg : items) {
if (!this->CheckPermissions(arg, **mode)) {
- std::ostringstream e;
- e << this->FileCommand->GetError()
- << " Set with CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS "
- "variable.";
- this->FileCommand->SetError(e.str());
+ this->FileCommand->SetError(
+ " Set with CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS variable.");
return false;
}
}
diff --git a/Source/cmFileInstaller.cxx b/Source/cmFileInstaller.cxx
index d4f76fd..9378439 100644
--- a/Source/cmFileInstaller.cxx
+++ b/Source/cmFileInstaller.cxx
@@ -38,7 +38,7 @@ cmFileInstaller::~cmFileInstaller()
{
// Save the updated install manifest.
this->Makefile->AddDefinition("CMAKE_INSTALL_MANIFEST_FILES",
- this->Manifest.c_str());
+ this->Manifest);
}
void cmFileInstaller::ManifestAppend(std::string const& file)
diff --git a/Source/cmFileTimes.cxx b/Source/cmFileTimes.cxx
index fd4f679..3824e9b 100644
--- a/Source/cmFileTimes.cxx
+++ b/Source/cmFileTimes.cxx
@@ -2,11 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFileTimes.h"
-#include "cmAlgorithms.h"
#include "cm_sys_stat.h"
#include <utility>
+#include "cm_memory.hxx"
+
#if defined(_WIN32)
# include "cmSystemTools.h"
# include <windows.h>
diff --git a/Source/cmFileTimes.h b/Source/cmFileTimes.h
index cbf0fe2..191d89e 100644
--- a/Source/cmFileTimes.h
+++ b/Source/cmFileTimes.h
@@ -5,7 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <string>
/** \class cmFileTimes
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index e590802..b1ccc83 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -13,6 +13,7 @@
#include "cmSearchPath.h"
#include "cmState.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
cmFindBase::cmFindBase()
@@ -67,6 +68,9 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
}
this->AlreadyInCache = false;
+ // Find what search path locations have been enabled/disable
+ this->SelectDefaultSearchModes();
+
// Find the current root path mode.
this->SelectDefaultRootPathMode();
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 954558f..a5937a0 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -3,6 +3,7 @@
#include "cmFindCommon.h"
#include <algorithm>
+#include <array>
#include <string.h>
#include <utility>
@@ -144,6 +145,26 @@ void cmFindCommon::SelectDefaultMacMode()
}
}
+void cmFindCommon::SelectDefaultSearchModes()
+{
+ const std::array<std::pair<bool&, std::string>, 5> search_paths = {
+ { { this->NoPackageRootPath, "CMAKE_FIND_USE_PACKAGE_ROOT_PATH" },
+ { this->NoCMakePath, "CMAKE_FIND_USE_CMAKE_PATH" },
+ { this->NoCMakeEnvironmentPath,
+ "CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH" },
+ { this->NoSystemEnvironmentPath,
+ "CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH" },
+ { this->NoCMakeSystemPath, "CMAKE_FIND_USE_CMAKE_SYSTEM_PATH" } }
+ };
+
+ for (auto& path : search_paths) {
+ const char* def = this->Makefile->GetDefinition(path.second);
+ if (def) {
+ path.first = !cmSystemTools::IsOn(def);
+ }
+ }
+}
+
void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
{
#if 0
diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h
index 89ff174..d95eeb1 100644
--- a/Source/cmFindCommon.h
+++ b/Source/cmFindCommon.h
@@ -90,6 +90,9 @@ protected:
/** Compute the current default bundle/framework search policy. */
void SelectDefaultMacMode();
+ /** Compute the current default search modes based on global variables. */
+ void SelectDefaultSearchModes();
+
// Path arguments prior to path manipulation routines
std::vector<std::string> UserHintsArgs;
std::vector<std::string> UserGuessArgs;
diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h
index 4309449..152b505 100644
--- a/Source/cmFindFileCommand.h
+++ b/Source/cmFindFileCommand.h
@@ -5,9 +5,10 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include "cmFindPathCommand.h"
+#include "cm_memory.hxx"
-class cmCommand;
+#include "cmCommand.h"
+#include "cmFindPathCommand.h"
/** \class cmFindFileCommand
* \brief Define a command to search for an executable program.
@@ -24,7 +25,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmFindFileCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmFindFileCommand>();
+ }
};
#endif
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index fb8a700..af17d60 100644
--- a/Source/cmFindLibraryCommand.h
+++ b/Source/cmFindLibraryCommand.h
@@ -8,9 +8,11 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
+#include "cmCommand.h"
#include "cmFindBase.h"
-class cmCommand;
class cmExecutionStatus;
/** \class cmFindLibraryCommand
@@ -27,7 +29,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmFindLibraryCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmFindLibraryCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 1d4a8ed..04fbbad 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -13,12 +13,13 @@
#include <deque>
#include <functional>
#include <iterator>
-#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <utility>
+#include "cm_memory.hxx"
+
#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -27,6 +28,7 @@
#include "cmSearchPath.h"
#include "cmState.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmVersion.h"
#if defined(__HAIKU__)
@@ -188,7 +190,12 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
}
// Check if User Package Registry should be disabled
- if (this->Makefile->IsOn("CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY")) {
+ // The `CMAKE_FIND_USE_PACKAGE_REGISTRY` has
+ // priority over the deprecated CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY
+ if (const char* def =
+ this->Makefile->GetDefinition("CMAKE_FIND_USE_PACKAGE_REGISTRY")) {
+ this->NoUserRegistry = !cmSystemTools::IsOn(def);
+ } else if (this->Makefile->IsOn("CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY")) {
this->NoUserRegistry = true;
}
@@ -219,6 +226,9 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
this->SortDirection = strcmp(sd, "ASC") == 0 ? Asc : Dec;
}
+ // Find what search path locations have been enabled/disable
+ this->SelectDefaultSearchModes();
+
// Find the current root path mode.
this->SelectDefaultRootPathMode();
@@ -669,7 +679,9 @@ void cmFindPackageCommand::AddFindDefinition(const std::string& var,
} else {
this->OriginalDefs[var].exists = false;
}
- this->Makefile->AddDefinition(var, val);
+ if (val) {
+ this->Makefile->AddDefinition(var, val);
+ }
}
void cmFindPackageCommand::RestoreFindDefinitions()
@@ -677,7 +689,7 @@ void cmFindPackageCommand::RestoreFindDefinitions()
for (auto const& i : this->OriginalDefs) {
OriginalDef const& od = i.second;
if (od.exists) {
- this->Makefile->AddDefinition(i.first, od.value.c_str());
+ this->Makefile->AddDefinition(i.first, od.value);
} else {
this->Makefile->RemoveDefinition(i.first);
}
@@ -732,12 +744,6 @@ bool cmFindPackageCommand::HandlePackageMode(
{
this->ConsideredConfigs.clear();
- // Support old capitalization behavior.
- std::string upperDir = cmSystemTools::UpperCase(this->Name);
- std::string upperFound = cmSystemTools::UpperCase(this->Name);
- upperDir += "_DIR";
- upperFound += "_FOUND";
-
// Try to find the config file.
const char* def = this->Makefile->GetDefinition(this->Variable);
@@ -957,7 +963,7 @@ bool cmFindPackageCommand::HandlePackageMode(
std::string fileVar = this->Name;
fileVar += "_CONFIG";
if (found) {
- this->Makefile->AddDefinition(fileVar, this->FileFound.c_str());
+ this->Makefile->AddDefinition(fileVar, this->FileFound);
} else {
this->Makefile->RemoveDefinition(fileVar);
}
@@ -979,11 +985,9 @@ bool cmFindPackageCommand::HandlePackageMode(
sep = ";";
}
- this->Makefile->AddDefinition(consideredConfigsVar,
- consideredConfigFiles.c_str());
+ this->Makefile->AddDefinition(consideredConfigsVar, consideredConfigFiles);
- this->Makefile->AddDefinition(consideredVersionsVar,
- consideredVersions.c_str());
+ this->Makefile->AddDefinition(consideredVersionsVar, consideredVersions);
return result;
}
@@ -1612,8 +1616,8 @@ bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file,
this->Makefile->RemoveDefinition("PACKAGE_VERSION_EXACT");
// Set the input variables.
- this->Makefile->AddDefinition("PACKAGE_FIND_NAME", this->Name.c_str());
- this->Makefile->AddDefinition("PACKAGE_FIND_VERSION", this->Version.c_str());
+ this->Makefile->AddDefinition("PACKAGE_FIND_NAME", this->Name);
+ this->Makefile->AddDefinition("PACKAGE_FIND_VERSION", this->Version);
char buf[64];
sprintf(buf, "%u", this->VersionMajor);
this->Makefile->AddDefinition("PACKAGE_FIND_VERSION_MAJOR", buf);
@@ -1690,7 +1694,7 @@ void cmFindPackageCommand::StoreVersionFound()
if (this->VersionFound.empty()) {
this->Makefile->RemoveDefinition(ver);
} else {
- this->Makefile->AddDefinition(ver, this->VersionFound.c_str());
+ this->Makefile->AddDefinition(ver, this->VersionFound);
}
// Store the version components.
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index 316ca0f..f6645ae 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -3,6 +3,7 @@
#ifndef cmFindPackageCommand_h
#define cmFindPackageCommand_h
+#include "cmCommand.h"
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmPolicies.h"
@@ -14,6 +15,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
// IWYU insists we should forward-declare instead of including <functional>,
// but we cannot forward-declare reliably because some C++ standard libraries
// put the template in an inline namespace.
@@ -27,7 +30,6 @@ namespace std {
#include "cmFindCommon.h"
-class cmCommand;
class cmExecutionStatus;
class cmSearchPath;
@@ -65,7 +67,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmFindPackageCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmFindPackageCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h
index cb0db4c..89e2cef 100644
--- a/Source/cmFindPathCommand.h
+++ b/Source/cmFindPathCommand.h
@@ -8,9 +8,11 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
+#include "cmCommand.h"
#include "cmFindBase.h"
-class cmCommand;
class cmExecutionStatus;
/** \class cmFindPathCommand
@@ -27,7 +29,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmFindPathCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmFindPathCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h
index 147936c..40e455e 100644
--- a/Source/cmFindProgramCommand.h
+++ b/Source/cmFindProgramCommand.h
@@ -8,9 +8,11 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
+#include "cmCommand.h"
#include "cmFindBase.h"
-class cmCommand;
class cmExecutionStatus;
/** \class cmFindProgramCommand
@@ -28,7 +30,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmFindProgramCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmFindProgramCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index 08003eb..06dce2c 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -2,12 +2,13 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmForEachCommand.h"
-#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
+#include <utility>
+
+#include "cm_memory.hxx"
-#include "cmAlgorithms.h"
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -52,21 +53,21 @@ bool cmForEachFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
for (std::string const& arg : cmMakeRange(this->Args).advance(1)) {
// set the variable to the loop value
- mf.AddDefinition(this->Args[0], arg.c_str());
+ mf.AddDefinition(this->Args[0], arg);
// Invoke all the functions that were collected in the block.
- cmExecutionStatus status;
+ cmExecutionStatus status(mf);
for (cmListFileFunction const& func : this->Functions) {
status.Clear();
mf.ExecuteCommand(func, status);
if (status.GetReturnInvoked()) {
inStatus.SetReturnInvoked();
// restore the variable to its prior value
- mf.AddDefinition(this->Args[0], oldDef.c_str());
+ mf.AddDefinition(this->Args[0], oldDef);
return true;
}
if (status.GetBreakInvoked()) {
// restore the variable to its prior value
- mf.AddDefinition(this->Args[0], oldDef.c_str());
+ mf.AddDefinition(this->Args[0], oldDef);
return true;
}
if (status.GetContinueInvoked()) {
@@ -79,7 +80,7 @@ bool cmForEachFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
}
// restore the variable to its prior value
- mf.AddDefinition(this->Args[0], oldDef.c_str());
+ mf.AddDefinition(this->Args[0], oldDef);
return true;
}
// close out a nested foreach
@@ -121,7 +122,7 @@ bool cmForEachCommand::InitialPass(std::vector<std::string> const& args,
}
// create a function blocker
- auto f = cm::make_unique<cmForEachFunctionBlocker>(this->Makefile);
+ auto fb = cm::make_unique<cmForEachFunctionBlocker>(this->Makefile);
if (args.size() > 1) {
if (args[1] == "RANGE") {
int start = 0;
@@ -168,23 +169,22 @@ bool cmForEachCommand::InitialPass(std::vector<std::string> const& args,
break;
}
}
- f->Args = range;
+ fb->Args = range;
} else {
- f->Args = args;
+ fb->Args = args;
}
} else {
- f->Args = args;
+ fb->Args = args;
}
- this->Makefile->AddFunctionBlocker(f.release());
+ this->Makefile->AddFunctionBlocker(std::move(fb));
return true;
}
bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args)
{
- std::unique_ptr<cmForEachFunctionBlocker> f(
- new cmForEachFunctionBlocker(this->Makefile));
- f->Args.push_back(args[0]);
+ auto fb = cm::make_unique<cmForEachFunctionBlocker>(this->Makefile);
+ fb->Args.push_back(args[0]);
enum Doing
{
@@ -195,7 +195,7 @@ bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args)
Doing doing = DoingNone;
for (unsigned int i = 2; i < args.size(); ++i) {
if (doing == DoingItems) {
- f->Args.push_back(args[i]);
+ fb->Args.push_back(args[i]);
} else if (args[i] == "LISTS") {
doing = DoingLists;
} else if (args[i] == "ITEMS") {
@@ -203,7 +203,7 @@ bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args)
} else if (doing == DoingLists) {
const char* value = this->Makefile->GetDefinition(args[i]);
if (value && *value) {
- cmSystemTools::ExpandListArgument(value, f->Args, true);
+ cmSystemTools::ExpandListArgument(value, fb->Args, true);
}
} else {
std::ostringstream e;
@@ -214,7 +214,7 @@ bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args)
}
}
- this->Makefile->AddFunctionBlocker(f.release()); // TODO: pass unique_ptr
+ this->Makefile->AddFunctionBlocker(std::move(fb));
return true;
}
diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h
index 5131a4f..cd112b8 100644
--- a/Source/cmForEachCommand.h
+++ b/Source/cmForEachCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
#include "cmFunctionBlocker.h"
#include "cmListFileCache.h"
@@ -39,7 +41,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmForEachCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmForEachCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 9067a5f..2809cf7 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -3,6 +3,7 @@
#include "cmFunctionCommand.h"
#include <sstream>
+#include <utility>
#include "cmAlgorithms.h"
#include "cmExecutionStatus.h"
@@ -10,37 +11,18 @@
#include "cmPolicies.h"
#include "cmRange.h"
#include "cmState.h"
+#include "cmStringAlgorithms.h"
// define the class for function commands
-class cmFunctionHelperCommand : public cmCommand
+class cmFunctionHelperCommand
{
public:
/**
- * This is a virtual constructor for the command.
- */
- cmCommand* Clone() override
- {
- cmFunctionHelperCommand* newC = new cmFunctionHelperCommand;
- // we must copy when we clone
- newC->Args = this->Args;
- newC->Functions = this->Functions;
- newC->Policies = this->Policies;
- newC->FilePath = this->FilePath;
- return newC;
- }
-
- /**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
- cmExecutionStatus&) override;
-
- bool InitialPass(std::vector<std::string> const&,
- cmExecutionStatus&) override
- {
- return false;
- }
+ bool operator()(std::vector<cmListFileArgument> const& args,
+ cmExecutionStatus& inStatus) const;
std::vector<std::string> Args;
std::vector<cmListFileFunction> Functions;
@@ -48,12 +30,15 @@ public:
std::string FilePath;
};
-bool cmFunctionHelperCommand::InvokeInitialPass(
- const std::vector<cmListFileArgument>& args, cmExecutionStatus& inStatus)
+bool cmFunctionHelperCommand::operator()(
+ std::vector<cmListFileArgument> const& args,
+ cmExecutionStatus& inStatus) const
{
+ cmMakefile& makefile = inStatus.GetMakefile();
+
// Expand the argument list to the function.
std::vector<std::string> expandedArgs;
- this->Makefile->ExpandArguments(args, expandedArgs);
+ makefile.ExpandArguments(args, expandedArgs);
// make sure the number of arguments passed is at least the number
// required by the signature
@@ -61,30 +46,30 @@ bool cmFunctionHelperCommand::InvokeInitialPass(
std::string errorMsg =
"Function invoked with incorrect arguments for function named: ";
errorMsg += this->Args[0];
- this->SetError(errorMsg);
+ inStatus.SetError(errorMsg);
return false;
}
- cmMakefile::FunctionPushPop functionScope(this->Makefile, this->FilePath,
+ cmMakefile::FunctionPushPop functionScope(&makefile, this->FilePath,
this->Policies);
// set the value of argc
std::ostringstream strStream;
strStream << expandedArgs.size();
- this->Makefile->AddDefinition("ARGC", strStream.str().c_str());
- this->Makefile->MarkVariableAsUsed("ARGC");
+ makefile.AddDefinition("ARGC", strStream.str());
+ makefile.MarkVariableAsUsed("ARGC");
// set the values for ARGV0 ARGV1 ...
for (unsigned int t = 0; t < expandedArgs.size(); ++t) {
std::ostringstream tmpStream;
tmpStream << "ARGV" << t;
- this->Makefile->AddDefinition(tmpStream.str(), expandedArgs[t].c_str());
- this->Makefile->MarkVariableAsUsed(tmpStream.str());
+ makefile.AddDefinition(tmpStream.str(), expandedArgs[t]);
+ makefile.MarkVariableAsUsed(tmpStream.str());
}
// define the formal arguments
for (unsigned int j = 1; j < this->Args.size(); ++j) {
- this->Makefile->AddDefinition(this->Args[j], expandedArgs[j - 1].c_str());
+ makefile.AddDefinition(this->Args[j], expandedArgs[j - 1]);
}
// define ARGV and ARGN
@@ -92,17 +77,16 @@ bool cmFunctionHelperCommand::InvokeInitialPass(
std::vector<std::string>::const_iterator eit =
expandedArgs.begin() + (this->Args.size() - 1);
std::string argnDef = cmJoin(cmMakeRange(eit, expandedArgs.end()), ";");
- this->Makefile->AddDefinition("ARGV", argvDef.c_str());
- this->Makefile->MarkVariableAsUsed("ARGV");
- this->Makefile->AddDefinition("ARGN", argnDef.c_str());
- this->Makefile->MarkVariableAsUsed("ARGN");
+ makefile.AddDefinition("ARGV", argvDef);
+ makefile.MarkVariableAsUsed("ARGV");
+ makefile.AddDefinition("ARGN", argnDef);
+ makefile.MarkVariableAsUsed("ARGN");
// Invoke all the functions that were collected in the block.
// for each function
for (cmListFileFunction const& func : this->Functions) {
- cmExecutionStatus status;
- if (!this->Makefile->ExecuteCommand(func, status) ||
- status.GetNestedError()) {
+ cmExecutionStatus status(makefile);
+ if (!makefile.ExecuteCommand(func, status) || status.GetNestedError()) {
// The error message should have already included the call stack
// so we do not need to report an error here.
functionScope.Quiet();
@@ -129,12 +113,12 @@ bool cmFunctionFunctionBlocker::IsFunctionBlocked(
// if this is the endfunction for this function then execute
if (!this->Depth) {
// create a new command and add it to cmake
- cmFunctionHelperCommand* f = new cmFunctionHelperCommand();
- f->Args = this->Args;
- f->Functions = this->Functions;
- f->FilePath = this->GetStartingContext().FilePath;
- mf.RecordPolicies(f->Policies);
- mf.GetState()->AddScriptedCommand(this->Args[0], f);
+ cmFunctionHelperCommand f;
+ f.Args = this->Args;
+ f.Functions = this->Functions;
+ f.FilePath = this->GetStartingContext().FilePath;
+ mf.RecordPolicies(f.Policies);
+ mf.GetState()->AddScriptedCommand(this->Args[0], std::move(f));
// remove the function blocker now that the function is defined
mf.RemoveFunctionBlocker(this, lff);
return true;
@@ -176,8 +160,10 @@ bool cmFunctionCommand::InitialPass(std::vector<std::string> const& args,
}
// create a function blocker
- cmFunctionFunctionBlocker* f = new cmFunctionFunctionBlocker();
- cmAppend(f->Args, args);
- this->Makefile->AddFunctionBlocker(f);
+ {
+ auto fb = cm::make_unique<cmFunctionFunctionBlocker>();
+ cmAppend(fb->Args, args);
+ this->Makefile->AddFunctionBlocker(std::move(fb));
+ }
return true;
}
diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h
index 8b37df0..449a180 100644
--- a/Source/cmFunctionCommand.h
+++ b/Source/cmFunctionCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
#include "cmFunctionBlocker.h"
#include "cmListFileCache.h"
@@ -34,7 +36,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmFunctionCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmFunctionCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 175a26d..4d3a005 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -3,7 +3,7 @@
#include "cmGeneratorExpression.h"
#include "cmsys/RegularExpression.hxx"
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <utility>
#include "assert.h"
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index fd36c4b..ef76651 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -8,7 +8,7 @@
#include "cmListFileCache.h"
#include <map>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <set>
#include <string>
#include <utility>
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index 728f2a4..df2227f 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -2,12 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGeneratorExpressionDAGChecker.h"
-#include "cmAlgorithms.h"
#include "cmGeneratorExpressionContext.h"
#include "cmGeneratorExpressionEvaluator.h"
#include "cmGeneratorTarget.h"
#include "cmLocalGenerator.h"
#include "cmMessageType.h"
+#include "cmStringAlgorithms.h"
#include "cmake.h"
#include <sstream>
@@ -68,9 +68,7 @@ void cmGeneratorExpressionDAGChecker::Initialize()
return;
}
}
- const_cast<cmGeneratorExpressionDAGChecker*>(top)
- ->Seen[this->Target]
- .insert(this->Property);
+ top->Seen[this->Target].insert(this->Property);
}
}
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index e1fba5e..6d7d6ef 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -88,7 +88,7 @@ private:
const cmGeneratorExpressionDAGChecker* const Parent;
cmGeneratorTarget const* Target;
const std::string Property;
- std::map<cmGeneratorTarget const*, std::set<std::string>> Seen;
+ mutable std::map<cmGeneratorTarget const*, std::set<std::string>> Seen;
const GeneratorExpressionContent* const Content;
const cmListFileBacktrace Backtrace;
Result CheckResult;
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index 326cb0e..11c2dcc 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -3,7 +3,7 @@
#include "cmGeneratorExpressionEvaluationFile.h"
#include "cmsys/FStream.hxx"
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <sstream>
#include <utility>
diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h
index 89a2390..06ebeac 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.h
+++ b/Source/cmGeneratorExpressionEvaluationFile.h
@@ -6,7 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <map>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <string>
#include <vector>
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index a60c75c..14dc7b8 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -19,6 +19,7 @@
#include "cmState.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cm_static_string_view.hxx"
@@ -33,7 +34,7 @@
#include <errno.h>
#include <iterator>
#include <map>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <set>
#include <sstream>
#include <stdlib.h>
@@ -1038,45 +1039,38 @@ static const struct CompileLanguageAndIdNode : public cmGeneratorExpressionNode
}
} languageAndIdNode;
-#define TRANSITIVE_PROPERTY_NAME(PROPERTY) , "INTERFACE_" #PROPERTY
-
-static const char* targetPropertyTransitiveWhitelist[] = {
- nullptr CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_NAME)
-};
-
-#undef TRANSITIVE_PROPERTY_NAME
-
-template <typename T>
std::string getLinkedTargetsContent(
- std::vector<T> const& libraries, cmGeneratorTarget const* target,
- cmGeneratorTarget const* headTarget, cmGeneratorExpressionContext* context,
- cmGeneratorExpressionDAGChecker* dagChecker,
- const std::string& interfacePropertyName)
-{
- std::string linkedTargetsContent;
- std::string sep;
- std::string depString;
- for (T const& l : libraries) {
- // Broken code can have a target in its own link interface.
- // Don't follow such link interface entries so as not to create a
- // self-referencing loop.
- if (l.Target && l.Target != target) {
- std::string uniqueName =
- target->GetGlobalGenerator()->IndexGeneratorTargetUniquely(l.Target);
- depString += sep + "$<TARGET_PROPERTY:" + std::move(uniqueName) + "," +
- interfacePropertyName + ">";
- sep = ";";
- }
- }
- if (!depString.empty()) {
- linkedTargetsContent =
- cmGeneratorExpressionNode::EvaluateDependentExpression(
- depString, target->GetLocalGenerator(), context, headTarget, target,
- dagChecker);
- }
- linkedTargetsContent =
- cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent);
- return linkedTargetsContent;
+ cmGeneratorTarget const* target, std::string const& prop,
+ cmGeneratorExpressionContext* context,
+ cmGeneratorExpressionDAGChecker* dagChecker)
+{
+ std::string result;
+ if (cmLinkImplementationLibraries const* impl =
+ target->GetLinkImplementationLibraries(context->Config)) {
+ for (cmLinkImplItem const& lib : impl->Libraries) {
+ if (lib.Target) {
+ // Pretend $<TARGET_PROPERTY:lib.Target,prop> appeared in our
+ // caller's property and hand-evaluate it as if it were compiled.
+ // Create a context as cmCompiledGeneratorExpression::Evaluate does.
+ cmGeneratorExpressionContext libContext(
+ target->GetLocalGenerator(), context->Config, context->Quiet, target,
+ target, context->EvaluateForBuildsystem, lib.Backtrace,
+ context->Language);
+ std::string libResult =
+ lib.Target->EvaluateInterfaceProperty(prop, &libContext, dagChecker);
+ if (!libResult.empty()) {
+ if (result.empty()) {
+ result = std::move(libResult);
+ } else {
+ result.reserve(result.size() + 1 + libResult.size());
+ result += ";";
+ result += libResult;
+ }
+ }
+ }
+ }
+ }
+ return result;
}
static const struct TargetPropertyNode : public cmGeneratorExpressionNode
@@ -1205,44 +1199,37 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
return target->GetLinkerLanguage(context->Config);
}
- cmGeneratorExpressionDAGChecker dagChecker(
- context->Backtrace, target, propertyName, content, dagCheckerParent);
+ std::string interfacePropertyName;
+ bool isInterfaceProperty = false;
- switch (dagChecker.Check()) {
- case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
- dagChecker.ReportError(context, content->GetOriginalExpression());
- return std::string();
- case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE:
- // No error. We just skip cyclic references.
- return std::string();
- case cmGeneratorExpressionDAGChecker::ALREADY_SEEN:
- for (size_t i = 1; i < cm::size(targetPropertyTransitiveWhitelist);
- ++i) {
- if (targetPropertyTransitiveWhitelist[i] == propertyName) {
- // No error. We're not going to find anything new here.
- return std::string();
- }
- }
- case cmGeneratorExpressionDAGChecker::DAG:
- break;
- }
+#define POPULATE_INTERFACE_PROPERTY_NAME(prop) \
+ if (propertyName == #prop) { \
+ interfacePropertyName = "INTERFACE_" #prop; \
+ } else if (propertyName == "INTERFACE_" #prop) { \
+ interfacePropertyName = "INTERFACE_" #prop; \
+ isInterfaceProperty = true; \
+ } else
- std::string prop;
- bool haveProp = false;
- if (const char* p = target->GetProperty(propertyName)) {
- prop = p;
- haveProp = true;
+ CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(POPULATE_INTERFACE_PROPERTY_NAME)
+ // Note that the above macro terminates with an else
+ /* else */ if (cmHasLiteralPrefix(propertyName, "COMPILE_DEFINITIONS_")) {
+ cmPolicies::PolicyStatus polSt =
+ context->LG->GetPolicyStatus(cmPolicies::CMP0043);
+ if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) {
+ interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS";
+ }
}
+#undef POPULATE_INTERFACE_PROPERTY_NAME
+
+ bool evaluatingLinkLibraries = false;
if (dagCheckerParent) {
if (dagCheckerParent->EvaluatingGenexExpression() ||
dagCheckerParent->EvaluatingPICExpression()) {
// No check required.
} else if (dagCheckerParent->EvaluatingLinkLibraries()) {
-#define TRANSITIVE_PROPERTY_COMPARE(PROPERTY) \
- (#PROPERTY == propertyName || "INTERFACE_" #PROPERTY == propertyName) ||
- if (CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(
- TRANSITIVE_PROPERTY_COMPARE) false) { // NOLINT(*)
+ evaluatingLinkLibraries = true;
+ if (!interfacePropertyName.empty()) {
reportError(
context, content->GetOriginalExpression(),
"$<TARGET_PROPERTY:...> expression in link libraries "
@@ -1250,69 +1237,47 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
"over the link libraries, creating a recursion.");
return std::string();
}
-#undef TRANSITIVE_PROPERTY_COMPARE
-
- if (!haveProp) {
- return std::string();
- }
} else {
#define ASSERT_TRANSITIVE_PROPERTY_METHOD(METHOD) dagCheckerParent->METHOD() ||
-
assert(CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(
ASSERT_TRANSITIVE_PROPERTY_METHOD) false); // NOLINT(clang-tidy)
#undef ASSERT_TRANSITIVE_PROPERTY_METHOD
}
}
- std::string linkedTargetsContent;
-
- std::string interfacePropertyName;
- bool isInterfaceProperty = false;
+ if (isInterfaceProperty) {
+ return target->EvaluateInterfaceProperty(propertyName, context,
+ dagCheckerParent);
+ }
-#define POPULATE_INTERFACE_PROPERTY_NAME(prop) \
- if (propertyName == #prop) { \
- interfacePropertyName = "INTERFACE_" #prop; \
- } else if (propertyName == "INTERFACE_" #prop) { \
- interfacePropertyName = "INTERFACE_" #prop; \
- isInterfaceProperty = true; \
- } else
+ cmGeneratorExpressionDAGChecker dagChecker(
+ context->Backtrace, target, propertyName, content, dagCheckerParent);
- CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(POPULATE_INTERFACE_PROPERTY_NAME)
- // Note that the above macro terminates with an else
- /* else */ if (cmHasLiteralPrefix(propertyName, "COMPILE_DEFINITIONS_")) {
- cmPolicies::PolicyStatus polSt =
- context->LG->GetPolicyStatus(cmPolicies::CMP0043);
- if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) {
- interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS";
- }
+ switch (dagChecker.Check()) {
+ case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
+ dagChecker.ReportError(context, content->GetOriginalExpression());
+ return std::string();
+ case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE:
+ // No error. We just skip cyclic references.
+ return std::string();
+ case cmGeneratorExpressionDAGChecker::ALREADY_SEEN:
+ // We handle transitive properties above. For non-transitive
+ // properties we accept repeats anyway.
+ case cmGeneratorExpressionDAGChecker::DAG:
+ break;
}
-#undef POPULATE_INTERFACE_PROPERTY_NAME
- cmGeneratorTarget const* headTarget =
- context->HeadTarget && isInterfaceProperty ? context->HeadTarget
- : target;
- if (isInterfaceProperty) {
- if (cmLinkInterfaceLibraries const* iface =
- target->GetLinkInterfaceLibraries(context->Config, headTarget,
- true)) {
- linkedTargetsContent =
- getLinkedTargetsContent(iface->Libraries, target, headTarget,
- context, &dagChecker, interfacePropertyName);
- }
- } else if (!interfacePropertyName.empty()) {
- if (cmLinkImplementationLibraries const* impl =
- target->GetLinkImplementationLibraries(context->Config)) {
- linkedTargetsContent =
- getLinkedTargetsContent(impl->Libraries, target, target, context,
- &dagChecker, interfacePropertyName);
- }
+ std::string result;
+ bool haveProp = false;
+ if (const char* p = target->GetProperty(propertyName)) {
+ result = p;
+ haveProp = true;
+ } else if (evaluatingLinkLibraries) {
+ return std::string();
}
- if (!haveProp) {
- if (target->IsImported() ||
- target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
- return linkedTargetsContent;
- }
+ if (!haveProp && !target->IsImported() &&
+ target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
if (target->IsLinkInterfaceDependentBoolProperty(propertyName,
context->Config)) {
context->HadContextSensitiveCondition = true;
@@ -1345,8 +1310,6 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
context->Config);
return propContent ? propContent : "";
}
-
- return linkedTargetsContent;
}
if (!target->IsImported() && dagCheckerParent &&
@@ -1368,15 +1331,17 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
return propContent ? propContent : "";
}
}
+
if (!interfacePropertyName.empty()) {
- std::string result = this->EvaluateDependentExpression(
- prop, context->LG, context, headTarget, target, &dagChecker);
+ result = this->EvaluateDependentExpression(result, context->LG, context,
+ target, target, &dagChecker);
+ std::string linkedTargetsContent = getLinkedTargetsContent(
+ target, interfacePropertyName, context, &dagChecker);
if (!linkedTargetsContent.empty()) {
result += (result.empty() ? "" : ";") + linkedTargetsContent;
}
- return result;
}
- return prop;
+ return result;
}
} targetPropertyNode;
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 036a07d..38f34ac 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -7,7 +7,7 @@
#include <assert.h>
#include <errno.h>
#include <iterator>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <queue>
#include <sstream>
#include <stdio.h>
@@ -22,7 +22,9 @@
#include "cmCustomCommandGenerator.h"
#include "cmCustomCommandLines.h"
#include "cmGeneratorExpression.h"
+#include "cmGeneratorExpressionContext.h"
#include "cmGeneratorExpressionDAGChecker.h"
+#include "cmGeneratorExpressionNode.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
@@ -32,6 +34,7 @@
#include "cmSourceFile.h"
#include "cmSourceFileLocation.h"
#include "cmState.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetLinkLibraryType.h"
@@ -92,9 +95,6 @@ public:
virtual bool GetHadContextSensitiveCondition() const { return false; }
cmLinkImplItem const& LinkImplItem;
-
-private:
- cmListFileBacktrace Backtrace;
};
cmLinkImplItem cmGeneratorTarget::TargetPropertyEntry::NoLinkImplItem;
@@ -209,6 +209,63 @@ void CreatePropertyGeneratorExpressions(
}
}
+namespace {
+// Represent a target property entry after evaluating generator expressions
+// and splitting up lists.
+struct EvaluatedTargetPropertyEntry
+{
+ EvaluatedTargetPropertyEntry(cmLinkImplItem const& item,
+ cmListFileBacktrace bt)
+ : LinkImplItem(item)
+ , Backtrace(std::move(bt))
+ {
+ }
+
+ // Move-only.
+ EvaluatedTargetPropertyEntry(EvaluatedTargetPropertyEntry&&) = default;
+ EvaluatedTargetPropertyEntry(EvaluatedTargetPropertyEntry const&) = delete;
+ EvaluatedTargetPropertyEntry& operator=(EvaluatedTargetPropertyEntry&&) =
+ delete;
+ EvaluatedTargetPropertyEntry& operator=(
+ EvaluatedTargetPropertyEntry const&) = delete;
+
+ cmLinkImplItem const& LinkImplItem;
+ cmListFileBacktrace Backtrace;
+ std::vector<std::string> Values;
+ bool ContextDependent = false;
+};
+
+EvaluatedTargetPropertyEntry EvaluateTargetPropertyEntry(
+ cmGeneratorTarget const* thisTarget, std::string const& config,
+ std::string const& lang, cmGeneratorExpressionDAGChecker* dagChecker,
+ cmGeneratorTarget::TargetPropertyEntry* entry)
+{
+ EvaluatedTargetPropertyEntry ee(entry->LinkImplItem, entry->GetBacktrace());
+ cmSystemTools::ExpandListArgument(
+ entry->Evaluate(thisTarget->GetLocalGenerator(), config, false, thisTarget,
+ dagChecker, lang),
+ ee.Values);
+ if (entry->GetHadContextSensitiveCondition()) {
+ ee.ContextDependent = true;
+ }
+ return ee;
+}
+
+std::vector<EvaluatedTargetPropertyEntry> EvaluateTargetPropertyEntries(
+ cmGeneratorTarget const* thisTarget, std::string const& config,
+ std::string const& lang, cmGeneratorExpressionDAGChecker* dagChecker,
+ std::vector<cmGeneratorTarget::TargetPropertyEntry*> const& in)
+{
+ std::vector<EvaluatedTargetPropertyEntry> out;
+ out.reserve(in.size());
+ for (cmGeneratorTarget::TargetPropertyEntry* entry : in) {
+ out.emplace_back(EvaluateTargetPropertyEntry(thisTarget, config, lang,
+ dagChecker, entry));
+ }
+ return out;
+}
+}
+
cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
: Target(t)
, FortranModuleDirectoryCreated(false)
@@ -259,9 +316,6 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
t->GetSourceBacktraces(),
this->SourceEntries, true);
- this->DLLPlatform =
- !this->Makefile->GetSafeDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX").empty();
-
this->PolicyMap = t->GetPolicyMap();
}
@@ -468,7 +522,7 @@ std::string cmGeneratorTarget::GetFilePrefix(
const std::string& config, cmStateEnums::ArtifactType artifact) const
{
if (this->IsImported()) {
- const char* prefix = this->GetFilePrefixInternal(artifact);
+ const char* prefix = this->GetFilePrefixInternal(config, artifact);
return prefix ? prefix : std::string();
}
@@ -481,7 +535,7 @@ std::string cmGeneratorTarget::GetFileSuffix(
const std::string& config, cmStateEnums::ArtifactType artifact) const
{
if (this->IsImported()) {
- const char* suffix = this->GetFileSuffixInternal(artifact);
+ const char* suffix = this->GetFileSuffixInternal(config, artifact);
return suffix ? suffix : std::string();
}
@@ -508,7 +562,8 @@ std::string cmGeneratorTarget::GetFilePostfix(const std::string& config) const
}
const char* cmGeneratorTarget::GetFilePrefixInternal(
- cmStateEnums::ArtifactType artifact, const std::string& language) const
+ std::string const& config, cmStateEnums::ArtifactType artifact,
+ const std::string& language) const
{
// no prefix for non-main target types.
if (this->GetType() != cmStateEnums::STATIC_LIBRARY &&
@@ -523,8 +578,7 @@ const char* cmGeneratorTarget::GetFilePrefixInternal(
// Return an empty prefix for the import library if this platform
// does not support import libraries.
- if (isImportedLibraryArtifact &&
- !this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")) {
+ if (isImportedLibraryArtifact && !this->NeedImportLibraryName(config)) {
return nullptr;
}
@@ -558,7 +612,8 @@ const char* cmGeneratorTarget::GetFilePrefixInternal(
return targetPrefix;
}
const char* cmGeneratorTarget::GetFileSuffixInternal(
- cmStateEnums::ArtifactType artifact, const std::string& language) const
+ std::string const& config, cmStateEnums::ArtifactType artifact,
+ const std::string& language) const
{
// no suffix for non-main target types.
if (this->GetType() != cmStateEnums::STATIC_LIBRARY &&
@@ -573,8 +628,7 @@ const char* cmGeneratorTarget::GetFileSuffixInternal(
// Return an empty suffix for the import library if this platform
// does not support import libraries.
- if (isImportedLibraryArtifact &&
- !this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")) {
+ if (isImportedLibraryArtifact && !this->NeedImportLibraryName(config)) {
return nullptr;
}
@@ -657,12 +711,14 @@ std::vector<cmSourceFile*> const* cmGeneratorTarget::GetSourceDepends(
return nullptr;
}
-static void handleSystemIncludesDep(
- cmLocalGenerator* lg, cmGeneratorTarget const* depTgt,
- const std::string& config, cmGeneratorTarget const* headTarget,
- cmGeneratorExpressionDAGChecker* dagChecker,
- std::vector<std::string>& result, bool excludeImported,
- std::string const& language)
+namespace {
+void handleSystemIncludesDep(cmLocalGenerator* lg,
+ cmGeneratorTarget const* depTgt,
+ const std::string& config,
+ cmGeneratorTarget const* headTarget,
+ cmGeneratorExpressionDAGChecker* dagChecker,
+ std::vector<std::string>& result,
+ bool excludeImported, std::string const& language)
{
if (const char* dirs =
depTgt->GetProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES")) {
@@ -685,6 +741,7 @@ static void handleSystemIncludesDep(
result);
}
}
+}
/* clang-format off */
#define IMPLEMENT_VISIT(KIND) \
@@ -1087,77 +1144,205 @@ bool cmGeneratorTarget::GetPropertyAsBool(const std::string& prop) const
return this->Target->GetPropertyAsBool(prop);
}
-static void AddInterfaceEntries(
- cmGeneratorTarget const* thisTarget, std::string const& config,
- std::string const& prop,
- std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries)
+bool cmGeneratorTarget::MaybeHaveInterfaceProperty(
+ std::string const& prop, cmGeneratorExpressionContext* context) const
+{
+ std::string const key = prop + '@' + context->Config;
+ auto i = this->MaybeInterfacePropertyExists.find(key);
+ if (i == this->MaybeInterfacePropertyExists.end()) {
+ // Insert an entry now in case there is a cycle.
+ i = this->MaybeInterfacePropertyExists.emplace(key, false).first;
+ bool& maybeInterfaceProp = i->second;
+
+ // If this target itself has a non-empty property value, we are done.
+ const char* p = this->GetProperty(prop);
+ maybeInterfaceProp = p && *p;
+
+ // Otherwise, recurse to interface dependencies.
+ if (!maybeInterfaceProp) {
+ cmGeneratorTarget const* headTarget =
+ context->HeadTarget ? context->HeadTarget : this;
+ if (cmLinkInterfaceLibraries const* iface =
+ this->GetLinkInterfaceLibraries(context->Config, headTarget,
+ true)) {
+ if (iface->HadHeadSensitiveCondition) {
+ // With a different head target we may get to a library with
+ // this interface property.
+ maybeInterfaceProp = true;
+ } else {
+ // The transitive interface libraries do not depend on the
+ // head target, so we can follow them.
+ for (cmLinkItem const& lib : iface->Libraries) {
+ if (lib.Target &&
+ lib.Target->MaybeHaveInterfaceProperty(prop, context)) {
+ maybeInterfaceProp = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ return i->second;
+}
+
+std::string cmGeneratorTarget::EvaluateInterfaceProperty(
+ std::string const& prop, cmGeneratorExpressionContext* context,
+ cmGeneratorExpressionDAGChecker* dagCheckerParent) const
+{
+ std::string result;
+
+ // If the property does not appear transitively at all, we are done.
+ if (!this->MaybeHaveInterfaceProperty(prop, context)) {
+ return result;
+ }
+
+ // Evaluate $<TARGET_PROPERTY:this,prop> as if it were compiled. This is
+ // a subset of TargetPropertyNode::Evaluate without stringify/parse steps
+ // but sufficient for transitive interface properties.
+ cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace, this, prop,
+ nullptr, dagCheckerParent);
+ switch (dagChecker.Check()) {
+ case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
+ dagChecker.ReportError(
+ context, "$<TARGET_PROPERTY:" + this->GetName() + "," + prop + ">");
+ return result;
+ case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE:
+ // No error. We just skip cyclic references.
+ return result;
+ case cmGeneratorExpressionDAGChecker::ALREADY_SEEN:
+ // No error. We have already seen this transitive property.
+ return result;
+ case cmGeneratorExpressionDAGChecker::DAG:
+ break;
+ }
+
+ cmGeneratorTarget const* headTarget =
+ context->HeadTarget ? context->HeadTarget : this;
+
+ if (const char* p = this->GetProperty(prop)) {
+ result = cmGeneratorExpressionNode::EvaluateDependentExpression(
+ p, context->LG, context, headTarget, this, &dagChecker);
+ }
+
+ if (cmLinkInterfaceLibraries const* iface =
+ this->GetLinkInterfaceLibraries(context->Config, headTarget, true)) {
+ for (cmLinkItem const& lib : iface->Libraries) {
+ // Broken code can have a target in its own link interface.
+ // Don't follow such link interface entries so as not to create a
+ // self-referencing loop.
+ if (lib.Target && lib.Target != this) {
+ // Pretend $<TARGET_PROPERTY:lib.Target,prop> appeared in the
+ // above property and hand-evaluate it as if it were compiled.
+ // Create a context as cmCompiledGeneratorExpression::Evaluate does.
+ cmGeneratorExpressionContext libContext(
+ context->LG, context->Config, context->Quiet, headTarget, this,
+ context->EvaluateForBuildsystem, context->Backtrace,
+ context->Language);
+ std::string libResult = cmGeneratorExpression::StripEmptyListElements(
+ lib.Target->EvaluateInterfaceProperty(prop, &libContext,
+ &dagChecker));
+ if (!libResult.empty()) {
+ if (result.empty()) {
+ result = std::move(libResult);
+ } else {
+ result.reserve(result.size() + 1 + libResult.size());
+ result += ";";
+ result += libResult;
+ }
+ }
+ context->HadContextSensitiveCondition =
+ context->HadContextSensitiveCondition ||
+ libContext.HadContextSensitiveCondition;
+ context->HadHeadSensitiveCondition =
+ context->HadHeadSensitiveCondition ||
+ libContext.HadHeadSensitiveCondition;
+ }
+ }
+ }
+
+ return result;
+}
+
+namespace {
+void AddInterfaceEntries(cmGeneratorTarget const* headTarget,
+ std::string const& config, std::string const& prop,
+ std::string const& lang,
+ cmGeneratorExpressionDAGChecker* dagChecker,
+ std::vector<EvaluatedTargetPropertyEntry>& entries)
{
if (cmLinkImplementationLibraries const* impl =
- thisTarget->GetLinkImplementationLibraries(config)) {
+ headTarget->GetLinkImplementationLibraries(config)) {
for (cmLinkImplItem const& lib : impl->Libraries) {
if (lib.Target) {
- std::string uniqueName =
- thisTarget->GetGlobalGenerator()->IndexGeneratorTargetUniquely(
- lib.Target);
- std::string genex =
- "$<TARGET_PROPERTY:" + std::move(uniqueName) + "," + prop + ">";
- cmGeneratorExpression ge(lib.Backtrace);
- std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex);
- cge->SetEvaluateForBuildsystem(true);
- entries.push_back(new TargetPropertyEntryGenex(std::move(cge), lib));
+ EvaluatedTargetPropertyEntry ee(lib, lib.Backtrace);
+ // Pretend $<TARGET_PROPERTY:lib.Target,prop> appeared in our
+ // caller's property and hand-evaluate it as if it were compiled.
+ // Create a context as cmCompiledGeneratorExpression::Evaluate does.
+ cmGeneratorExpressionContext context(
+ headTarget->GetLocalGenerator(), config, false, headTarget,
+ headTarget, true, lib.Backtrace, lang);
+ cmSystemTools::ExpandListArgument(
+ lib.Target->EvaluateInterfaceProperty(prop, &context, dagChecker),
+ ee.Values);
+ ee.ContextDependent = context.HadContextSensitiveCondition;
+ entries.emplace_back(std::move(ee));
}
}
}
}
-static void AddObjectEntries(
- cmGeneratorTarget const* thisTarget, std::string const& config,
- std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries)
+void AddObjectEntries(cmGeneratorTarget const* headTarget,
+ std::string const& config,
+ cmGeneratorExpressionDAGChecker* dagChecker,
+ std::vector<EvaluatedTargetPropertyEntry>& entries)
{
if (cmLinkImplementationLibraries const* impl =
- thisTarget->GetLinkImplementationLibraries(config)) {
+ headTarget->GetLinkImplementationLibraries(config)) {
for (cmLinkImplItem const& lib : impl->Libraries) {
if (lib.Target &&
lib.Target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
std::string uniqueName =
- thisTarget->GetGlobalGenerator()->IndexGeneratorTargetUniquely(
+ headTarget->GetGlobalGenerator()->IndexGeneratorTargetUniquely(
lib.Target);
std::string genex = "$<TARGET_OBJECTS:" + std::move(uniqueName) + ">";
cmGeneratorExpression ge(lib.Backtrace);
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex);
cge->SetEvaluateForBuildsystem(true);
- entries.push_back(new TargetPropertyEntryGenex(std::move(cge), lib));
+
+ EvaluatedTargetPropertyEntry ee(lib, lib.Backtrace);
+ cmSystemTools::ExpandListArgument(
+ cge->Evaluate(headTarget->GetLocalGenerator(), config, false,
+ headTarget, dagChecker),
+ ee.Values);
+ if (cge->GetHadContextSensitiveCondition()) {
+ ee.ContextDependent = true;
+ }
+ entries.emplace_back(std::move(ee));
}
}
}
}
-static bool processSources(
- cmGeneratorTarget const* tgt,
- const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<BT<std::string>>& srcs,
- std::unordered_set<std::string>& uniqueSrcs,
- cmGeneratorExpressionDAGChecker* dagChecker, std::string const& config,
- bool debugSources)
+bool processSources(cmGeneratorTarget const* tgt,
+ std::vector<EvaluatedTargetPropertyEntry>& entries,
+ std::vector<BT<std::string>>& srcs,
+ std::unordered_set<std::string>& uniqueSrcs,
+ bool debugSources)
{
cmMakefile* mf = tgt->Target->GetMakefile();
bool contextDependent = false;
- for (cmGeneratorTarget::TargetPropertyEntry* entry : entries) {
- cmLinkImplItem const& item = entry->LinkImplItem;
- std::string const& targetName = item.AsStr();
- std::vector<std::string> entrySources;
- cmSystemTools::ExpandListArgument(entry->Evaluate(tgt->GetLocalGenerator(),
- config, false, tgt, tgt,
- dagChecker),
- entrySources);
-
- if (entry->GetHadContextSensitiveCondition()) {
+ for (EvaluatedTargetPropertyEntry& entry : entries) {
+ if (entry.ContextDependent) {
contextDependent = true;
}
- for (std::string& src : entrySources) {
+ cmLinkImplItem const& item = entry.LinkImplItem;
+ std::string const& targetName = item.AsStr();
+
+ for (std::string& src : entry.Values) {
cmSourceFile* sf = mf->GetOrCreateSource(src);
std::string e;
std::string fullPath = sf->GetFullPath(&e);
@@ -1186,9 +1371,9 @@ static bool processSources(
src = fullPath;
}
std::string usedSources;
- for (std::string const& src : entrySources) {
+ for (std::string const& src : entry.Values) {
if (uniqueSrcs.insert(src).second) {
- srcs.emplace_back(src, entry->GetBacktrace());
+ srcs.emplace_back(src, entry.Backtrace);
if (debugSources) {
usedSources += " * " + src + "\n";
}
@@ -1199,11 +1384,12 @@ static bool processSources(
MessageType::LOG,
std::string("Used sources for target ") + tgt->GetName() + ":\n" +
usedSources,
- entry->GetBacktrace());
+ entry.Backtrace);
}
}
return contextDependent;
}
+}
std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
std::string const& config) const
@@ -1251,28 +1437,28 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
cmGeneratorExpressionDAGChecker dagChecker(this, "SOURCES", nullptr,
nullptr);
+ std::vector<EvaluatedTargetPropertyEntry> entries =
+ EvaluateTargetPropertyEntries(this, config, std::string(), &dagChecker,
+ this->SourceEntries);
+
std::unordered_set<std::string> uniqueSrcs;
bool contextDependentDirectSources =
- processSources(this, this->SourceEntries, files, uniqueSrcs, &dagChecker,
- config, debugSources);
+ processSources(this, entries, files, uniqueSrcs, debugSources);
// Collect INTERFACE_SOURCES of all direct link-dependencies.
- std::vector<cmGeneratorTarget::TargetPropertyEntry*>
- linkInterfaceSourcesEntries;
- AddInterfaceEntries(this, config, "INTERFACE_SOURCES",
- linkInterfaceSourcesEntries);
+ std::vector<EvaluatedTargetPropertyEntry> linkInterfaceSourcesEntries;
+ AddInterfaceEntries(this, config, "INTERFACE_SOURCES", std::string(),
+ &dagChecker, linkInterfaceSourcesEntries);
std::vector<std::string>::size_type numFilesBefore = files.size();
- bool contextDependentInterfaceSources =
- processSources(this, linkInterfaceSourcesEntries, files, uniqueSrcs,
- &dagChecker, config, debugSources);
+ bool contextDependentInterfaceSources = processSources(
+ this, linkInterfaceSourcesEntries, files, uniqueSrcs, debugSources);
// Collect TARGET_OBJECTS of direct object link-dependencies.
- std::vector<cmGeneratorTarget::TargetPropertyEntry*> linkObjectsEntries;
- AddObjectEntries(this, config, linkObjectsEntries);
+ std::vector<EvaluatedTargetPropertyEntry> linkObjectsEntries;
+ AddObjectEntries(this, config, &dagChecker, linkObjectsEntries);
std::vector<std::string>::size_type numFilesBefore2 = files.size();
bool contextDependentObjects =
- processSources(this, linkObjectsEntries, files, uniqueSrcs, &dagChecker,
- config, debugSources);
+ processSources(this, linkObjectsEntries, files, uniqueSrcs, debugSources);
if (!contextDependentDirectSources &&
!(contextDependentInterfaceSources && numFilesBefore < files.size()) &&
@@ -1280,8 +1466,6 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
this->LinkImplementationLanguageIsContextDependent = false;
}
- cmDeleteAll(linkInterfaceSourcesEntries);
- cmDeleteAll(linkObjectsEntries);
return files;
}
@@ -1612,7 +1796,7 @@ bool cmGeneratorTarget::NeedRelinkBeforeInstall(
// will likely change between the build tree and install tree and
// this target must be relinked.
bool have_rpath =
- this->HaveBuildTreeRPATH(config) || this->HaveInstallTreeRPATH();
+ this->HaveBuildTreeRPATH(config) || this->HaveInstallTreeRPATH(config);
bool is_ninja =
this->LocalGenerator->GetGlobalGenerator()->GetName() == "Ninja";
@@ -1858,16 +2042,17 @@ std::string cmGeneratorTarget::GetSOName(const std::string& config) const
return this->GetLibraryNames(config).SharedObject;
}
-static bool shouldAddFullLevel(cmGeneratorTarget::BundleDirectoryLevel level)
+namespace {
+bool shouldAddFullLevel(cmGeneratorTarget::BundleDirectoryLevel level)
{
return level == cmGeneratorTarget::FullLevel;
}
-static bool shouldAddContentLevel(
- cmGeneratorTarget::BundleDirectoryLevel level)
+bool shouldAddContentLevel(cmGeneratorTarget::BundleDirectoryLevel level)
{
return level == cmGeneratorTarget::ContentLevel || shouldAddFullLevel(level);
}
+}
std::string cmGeneratorTarget::GetAppBundleDirectory(
const std::string& config, BundleDirectoryLevel level) const
@@ -2357,7 +2542,7 @@ void cmGeneratorTarget::ComputeModuleDefinitionInfo(
bool cmGeneratorTarget::IsDLLPlatform() const
{
- return this->DLLPlatform;
+ return this->Target->IsDLLPlatform();
}
void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string>& result,
@@ -2757,33 +2942,35 @@ std::string cmGeneratorTarget::GetCreateRuleVariable(
case cmStateEnums::MODULE_LIBRARY:
return "CMAKE_" + lang + "_CREATE_SHARED_MODULE";
case cmStateEnums::EXECUTABLE:
+ if (this->IsExecutableWithExports()) {
+ std::string linkExeWithExports =
+ "CMAKE_" + lang + "_LINK_EXECUTABLE_WITH_EXPORTS";
+ if (this->Makefile->IsDefinitionSet(linkExeWithExports)) {
+ return linkExeWithExports;
+ }
+ }
return "CMAKE_" + lang + "_LINK_EXECUTABLE";
default:
break;
}
return "";
}
-static void processIncludeDirectories(
+
+namespace {
+void processIncludeDirectories(
cmGeneratorTarget const* tgt,
- const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
+ std::vector<EvaluatedTargetPropertyEntry>& entries,
std::vector<BT<std::string>>& includes,
- std::unordered_set<std::string>& uniqueIncludes,
- cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
- bool debugIncludes, const std::string& language)
+ std::unordered_set<std::string>& uniqueIncludes, bool debugIncludes)
{
- for (cmGeneratorTarget::TargetPropertyEntry* entry : entries) {
- cmLinkImplItem const& item = entry->LinkImplItem;
+ for (EvaluatedTargetPropertyEntry& entry : entries) {
+ cmLinkImplItem const& item = entry.LinkImplItem;
std::string const& targetName = item.AsStr();
bool const fromImported = item.Target && item.Target->IsImported();
bool const checkCMP0027 = item.FromGenex;
- std::vector<std::string> entryIncludes;
- cmSystemTools::ExpandListArgument(entry->Evaluate(tgt->GetLocalGenerator(),
- config, false, tgt,
- dagChecker, language),
- entryIncludes);
std::string usedIncludes;
- for (std::string& entryInclude : entryIncludes) {
+ for (std::string& entryInclude : entry.Values) {
if (fromImported && !cmSystemTools::FileExists(entryInclude)) {
std::ostringstream e;
MessageType messageType = MessageType::FATAL_ERROR;
@@ -2855,12 +3042,11 @@ static void processIncludeDirectories(
if (!cmSystemTools::IsOff(entryInclude)) {
cmSystemTools::ConvertToUnixSlashes(entryInclude);
}
- std::string inc = entryInclude;
- if (uniqueIncludes.insert(inc).second) {
- includes.emplace_back(inc, entry->GetBacktrace());
+ if (uniqueIncludes.insert(entryInclude).second) {
+ includes.emplace_back(entryInclude, entry.Backtrace);
if (debugIncludes) {
- usedIncludes += " * " + inc + "\n";
+ usedIncludes += " * " + entryInclude + "\n";
}
}
}
@@ -2869,10 +3055,11 @@ static void processIncludeDirectories(
MessageType::LOG,
std::string("Used includes for target ") + tgt->GetName() + ":\n" +
usedIncludes,
- entry->GetBacktrace());
+ entry.Backtrace);
}
}
}
+}
std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
const std::string& config, const std::string& lang) const
@@ -2898,14 +3085,12 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
this->DebugIncludesDone = true;
}
- processIncludeDirectories(this, this->IncludeDirectoriesEntries, includes,
- uniqueIncludes, &dagChecker, config, debugIncludes,
- lang);
+ std::vector<EvaluatedTargetPropertyEntry> entries =
+ EvaluateTargetPropertyEntries(this, config, lang, &dagChecker,
+ this->IncludeDirectoriesEntries);
- std::vector<cmGeneratorTarget::TargetPropertyEntry*>
- linkInterfaceIncludeDirectoriesEntries;
- AddInterfaceEntries(this, config, "INTERFACE_INCLUDE_DIRECTORIES",
- linkInterfaceIncludeDirectoriesEntries);
+ AddInterfaceEntries(this, config, "INTERFACE_INCLUDE_DIRECTORIES", lang,
+ &dagChecker, entries);
if (this->Makefile->IsOn("APPLE")) {
cmLinkImplementationLibraries const* impl =
@@ -2921,16 +3106,14 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
libDir = frameworkCheck.match(1);
- linkInterfaceIncludeDirectoriesEntries.push_back(
- CreateTargetPropertyEntry(libDir));
+ EvaluatedTargetPropertyEntry ee(lib, cmListFileBacktrace());
+ ee.Values.emplace_back(std::move(libDir));
+ entries.emplace_back(std::move(ee));
}
}
- processIncludeDirectories(this, linkInterfaceIncludeDirectoriesEntries,
- includes, uniqueIncludes, &dagChecker, config,
- debugIncludes, lang);
-
- cmDeleteAll(linkInterfaceIncludeDirectoriesEntries);
+ processIncludeDirectories(this, entries, includes, uniqueIncludes,
+ debugIncludes);
return includes;
}
@@ -2941,33 +3124,26 @@ enum class OptionsParse
Shell
};
-static void processOptionsInternal(
- cmGeneratorTarget const* tgt,
- const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<BT<std::string>>& options,
- std::unordered_set<std::string>& uniqueOptions,
- cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
- bool debugOptions, const char* logName, std::string const& language,
- OptionsParse parse)
-{
- for (cmGeneratorTarget::TargetPropertyEntry* entry : entries) {
- std::vector<std::string> entryOptions;
- cmSystemTools::ExpandListArgument(entry->Evaluate(tgt->GetLocalGenerator(),
- config, false, tgt,
- dagChecker, language),
- entryOptions);
+namespace {
+void processOptions(cmGeneratorTarget const* tgt,
+ std::vector<EvaluatedTargetPropertyEntry> const& entries,
+ std::vector<BT<std::string>>& options,
+ std::unordered_set<std::string>& uniqueOptions,
+ bool debugOptions, const char* logName, OptionsParse parse)
+{
+ for (EvaluatedTargetPropertyEntry const& entry : entries) {
std::string usedOptions;
- for (std::string const& opt : entryOptions) {
+ for (std::string const& opt : entry.Values) {
if (uniqueOptions.insert(opt).second) {
if (parse == OptionsParse::Shell &&
cmHasLiteralPrefix(opt, "SHELL:")) {
std::vector<std::string> tmp;
cmSystemTools::ParseUnixCommandLine(opt.c_str() + 6, tmp);
for (std::string& o : tmp) {
- options.emplace_back(std::move(o), entry->GetBacktrace());
+ options.emplace_back(std::move(o), entry.Backtrace);
}
} else {
- options.emplace_back(opt, entry->GetBacktrace());
+ options.emplace_back(opt, entry.Backtrace);
}
if (debugOptions) {
usedOptions += " * " + opt + "\n";
@@ -2979,22 +3155,10 @@ static void processOptionsInternal(
MessageType::LOG,
std::string("Used ") + logName + std::string(" for target ") +
tgt->GetName() + ":\n" + usedOptions,
- entry->GetBacktrace());
+ entry.Backtrace);
}
}
}
-
-static void processCompileOptions(
- cmGeneratorTarget const* tgt,
- const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<BT<std::string>>& options,
- std::unordered_set<std::string>& uniqueOptions,
- cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
- bool debugOptions, std::string const& language)
-{
- processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker,
- config, debugOptions, "compile options", language,
- OptionsParse::Shell);
}
void cmGeneratorTarget::GetCompileOptions(std::vector<std::string>& result,
@@ -3032,37 +3196,19 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileOptions(
this->DebugCompileOptionsDone = true;
}
- processCompileOptions(this, this->CompileOptionsEntries, result,
- uniqueOptions, &dagChecker, config, debugOptions,
- language);
-
- std::vector<cmGeneratorTarget::TargetPropertyEntry*>
- linkInterfaceCompileOptionsEntries;
+ std::vector<EvaluatedTargetPropertyEntry> entries =
+ EvaluateTargetPropertyEntries(this, config, language, &dagChecker,
+ this->CompileOptionsEntries);
- AddInterfaceEntries(this, config, "INTERFACE_COMPILE_OPTIONS",
- linkInterfaceCompileOptionsEntries);
+ AddInterfaceEntries(this, config, "INTERFACE_COMPILE_OPTIONS", language,
+ &dagChecker, entries);
- processCompileOptions(this, linkInterfaceCompileOptionsEntries, result,
- uniqueOptions, &dagChecker, config, debugOptions,
- language);
+ processOptions(this, entries, result, uniqueOptions, debugOptions,
+ "compile options", OptionsParse::Shell);
- cmDeleteAll(linkInterfaceCompileOptionsEntries);
return result;
}
-static void processCompileFeatures(
- cmGeneratorTarget const* tgt,
- const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<BT<std::string>>& options,
- std::unordered_set<std::string>& uniqueOptions,
- cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
- bool debugOptions)
-{
- processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker,
- config, debugOptions, "compile features",
- std::string(), OptionsParse::None);
-}
-
void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string>& result,
const std::string& config) const
{
@@ -3097,34 +3243,19 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileFeatures(
this->DebugCompileFeaturesDone = true;
}
- processCompileFeatures(this, this->CompileFeaturesEntries, result,
- uniqueFeatures, &dagChecker, config, debugFeatures);
+ std::vector<EvaluatedTargetPropertyEntry> entries =
+ EvaluateTargetPropertyEntries(this, config, std::string(), &dagChecker,
+ this->CompileFeaturesEntries);
- std::vector<cmGeneratorTarget::TargetPropertyEntry*>
- linkInterfaceCompileFeaturesEntries;
AddInterfaceEntries(this, config, "INTERFACE_COMPILE_FEATURES",
- linkInterfaceCompileFeaturesEntries);
+ std::string(), &dagChecker, entries);
- processCompileFeatures(this, linkInterfaceCompileFeaturesEntries, result,
- uniqueFeatures, &dagChecker, config, debugFeatures);
+ processOptions(this, entries, result, uniqueFeatures, debugFeatures,
+ "compile features", OptionsParse::None);
- cmDeleteAll(linkInterfaceCompileFeaturesEntries);
return result;
}
-static void processCompileDefinitions(
- cmGeneratorTarget const* tgt,
- const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<BT<std::string>>& options,
- std::unordered_set<std::string>& uniqueOptions,
- cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
- bool debugOptions, std::string const& language)
-{
- processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker,
- config, debugOptions, "compile definitions", language,
- OptionsParse::None);
-}
-
void cmGeneratorTarget::GetCompileDefinitions(
std::vector<std::string>& result, const std::string& config,
const std::string& language) const
@@ -3161,14 +3292,13 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
this->DebugCompileDefinitionsDone = true;
}
- processCompileDefinitions(this, this->CompileDefinitionsEntries, list,
- uniqueOptions, &dagChecker, config, debugDefines,
- language);
+ std::vector<EvaluatedTargetPropertyEntry> entries =
+ EvaluateTargetPropertyEntries(this, config, language, &dagChecker,
+ this->CompileDefinitionsEntries);
+
+ AddInterfaceEntries(this, config, "INTERFACE_COMPILE_DEFINITIONS", language,
+ &dagChecker, entries);
- std::vector<cmGeneratorTarget::TargetPropertyEntry*>
- linkInterfaceCompileDefinitionsEntries;
- AddInterfaceEntries(this, config, "INTERFACE_COMPILE_DEFINITIONS",
- linkInterfaceCompileDefinitionsEntries);
if (!config.empty()) {
std::string configPropName =
"COMPILE_DEFINITIONS_" + cmSystemTools::UpperCase(config);
@@ -3183,8 +3313,10 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
CM_FALLTHROUGH;
}
case cmPolicies::OLD: {
- linkInterfaceCompileDefinitionsEntries.push_back(
+ std::unique_ptr<TargetPropertyEntry> entry(
CreateTargetPropertyEntry(configProp));
+ entries.emplace_back(EvaluateTargetPropertyEntry(
+ this, config, language, &dagChecker, entry.get()));
} break;
case cmPolicies::NEW:
case cmPolicies::REQUIRED_ALWAYS:
@@ -3194,29 +3326,12 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
}
}
- processCompileDefinitions(this, linkInterfaceCompileDefinitionsEntries, list,
- uniqueOptions, &dagChecker, config, debugDefines,
- language);
+ processOptions(this, entries, list, uniqueOptions, debugDefines,
+ "compile definitions", OptionsParse::None);
- cmDeleteAll(linkInterfaceCompileDefinitionsEntries);
return list;
}
-namespace {
-void processLinkOptions(
- cmGeneratorTarget const* tgt,
- const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<BT<std::string>>& options,
- std::unordered_set<std::string>& uniqueOptions,
- cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
- bool debugOptions, std::string const& language)
-{
- processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker,
- config, debugOptions, "link options", language,
- OptionsParse::Shell);
-}
-}
-
void cmGeneratorTarget::GetLinkOptions(std::vector<std::string>& result,
const std::string& config,
const std::string& language) const
@@ -3252,20 +3367,15 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
this->DebugLinkOptionsDone = true;
}
- processLinkOptions(this, this->LinkOptionsEntries, result, uniqueOptions,
- &dagChecker, config, debugOptions, language);
-
- std::vector<cmGeneratorTarget::TargetPropertyEntry*>
- linkInterfaceLinkOptionsEntries;
-
- AddInterfaceEntries(this, config, "INTERFACE_LINK_OPTIONS",
- linkInterfaceLinkOptionsEntries);
+ std::vector<EvaluatedTargetPropertyEntry> entries =
+ EvaluateTargetPropertyEntries(this, config, language, &dagChecker,
+ this->LinkOptionsEntries);
- processLinkOptions(this, linkInterfaceLinkOptionsEntries, result,
- uniqueOptions, &dagChecker, config, debugOptions,
- language);
+ AddInterfaceEntries(this, config, "INTERFACE_LINK_OPTIONS", language,
+ &dagChecker, entries);
- cmDeleteAll(linkInterfaceLinkOptionsEntries);
+ processOptions(this, entries, result, uniqueOptions, debugOptions,
+ "link options", OptionsParse::Shell);
// Last step: replace "LINKER:" prefixed elements by
// actual linker wrapper
@@ -3371,21 +3481,6 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
return result;
}
-namespace {
-void processStaticLibraryLinkOptions(
- cmGeneratorTarget const* tgt,
- const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<BT<std::string>>& options,
- std::unordered_set<std::string>& uniqueOptions,
- cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
- std::string const& language)
-{
- processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker,
- config, false, "static library link options",
- language, OptionsParse::Shell);
-}
-}
-
void cmGeneratorTarget::GetStaticLibraryLinkOptions(
std::vector<std::string>& result, const std::string& config,
const std::string& language) const
@@ -3402,47 +3497,41 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetStaticLibraryLinkOptions(
std::string const& config, std::string const& language) const
{
std::vector<BT<std::string>> result;
- std::vector<cmGeneratorTarget::TargetPropertyEntry*> entries;
std::unordered_set<std::string> uniqueOptions;
cmGeneratorExpressionDAGChecker dagChecker(this, "STATIC_LIBRARY_OPTIONS",
nullptr, nullptr);
+ std::vector<EvaluatedTargetPropertyEntry> entries;
if (const char* linkOptions = this->GetProperty("STATIC_LIBRARY_OPTIONS")) {
std::vector<std::string> options;
cmSystemTools::ExpandListArgument(linkOptions, options);
for (const auto& option : options) {
- entries.push_back(CreateTargetPropertyEntry(option));
+ std::unique_ptr<TargetPropertyEntry> entry(
+ CreateTargetPropertyEntry(option));
+ entries.emplace_back(EvaluateTargetPropertyEntry(
+ this, config, language, &dagChecker, entry.get()));
}
}
- processStaticLibraryLinkOptions(this, entries, result, uniqueOptions,
- &dagChecker, config, language);
+ processOptions(this, entries, result, uniqueOptions, false,
+ "static library link options", OptionsParse::Shell);
- cmDeleteAll(entries);
return result;
}
namespace {
-void processLinkDirectories(
- cmGeneratorTarget const* tgt,
- const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<BT<std::string>>& directories,
- std::unordered_set<std::string>& uniqueDirectories,
- cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
- bool debugDirectories, std::string const& language)
-{
- for (cmGeneratorTarget::TargetPropertyEntry* entry : entries) {
- cmLinkImplItem const& item = entry->LinkImplItem;
+void processLinkDirectories(cmGeneratorTarget const* tgt,
+ std::vector<EvaluatedTargetPropertyEntry>& entries,
+ std::vector<BT<std::string>>& directories,
+ std::unordered_set<std::string>& uniqueDirectories,
+ bool debugDirectories)
+{
+ for (EvaluatedTargetPropertyEntry& entry : entries) {
+ cmLinkImplItem const& item = entry.LinkImplItem;
std::string const& targetName = item.AsStr();
- std::vector<std::string> entryDirectories;
- cmSystemTools::ExpandListArgument(entry->Evaluate(tgt->GetLocalGenerator(),
- config, false, tgt,
- dagChecker, language),
- entryDirectories);
-
std::string usedDirectories;
- for (std::string& entryDirectory : entryDirectories) {
+ for (std::string& entryDirectory : entry.Values) {
if (!cmSystemTools::FileIsFullPath(entryDirectory)) {
std::ostringstream e;
bool noMessage = false;
@@ -3495,7 +3584,7 @@ void processLinkDirectories(
MessageType::LOG,
std::string("Used link directories for target ") + tgt->GetName() +
":\n" + usedDirectories,
- entry->GetBacktrace());
+ entry.Backtrace);
}
}
}
@@ -3537,39 +3626,19 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDirectories(
this->DebugLinkDirectoriesDone = true;
}
- processLinkDirectories(this, this->LinkDirectoriesEntries, result,
- uniqueDirectories, &dagChecker, config,
- debugDirectories, language);
+ std::vector<EvaluatedTargetPropertyEntry> entries =
+ EvaluateTargetPropertyEntries(this, config, language, &dagChecker,
+ this->LinkDirectoriesEntries);
- std::vector<cmGeneratorTarget::TargetPropertyEntry*>
- linkInterfaceLinkDirectoriesEntries;
+ AddInterfaceEntries(this, config, "INTERFACE_LINK_DIRECTORIES", language,
+ &dagChecker, entries);
- AddInterfaceEntries(this, config, "INTERFACE_LINK_DIRECTORIES",
- linkInterfaceLinkDirectoriesEntries);
+ processLinkDirectories(this, entries, result, uniqueDirectories,
+ debugDirectories);
- processLinkDirectories(this, linkInterfaceLinkDirectoriesEntries, result,
- uniqueDirectories, &dagChecker, config,
- debugDirectories, language);
-
- cmDeleteAll(linkInterfaceLinkDirectoriesEntries);
return result;
}
-namespace {
-void processLinkDepends(
- cmGeneratorTarget const* tgt,
- const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<BT<std::string>>& options,
- std::unordered_set<std::string>& uniqueOptions,
- cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
- std::string const& language)
-{
- processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker,
- config, false, "link depends", language,
- OptionsParse::None);
-}
-}
-
void cmGeneratorTarget::GetLinkDepends(std::vector<std::string>& result,
const std::string& config,
const std::string& language) const
@@ -3585,24 +3654,27 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDepends(
std::string const& config, std::string const& language) const
{
std::vector<BT<std::string>> result;
- std::vector<cmGeneratorTarget::TargetPropertyEntry*> linkDependsEntries;
std::unordered_set<std::string> uniqueOptions;
cmGeneratorExpressionDAGChecker dagChecker(this, "LINK_DEPENDS", nullptr,
nullptr);
+ std::vector<EvaluatedTargetPropertyEntry> entries;
if (const char* linkDepends = this->GetProperty("LINK_DEPENDS")) {
std::vector<std::string> depends;
cmSystemTools::ExpandListArgument(linkDepends, depends);
for (const auto& depend : depends) {
- linkDependsEntries.push_back(CreateTargetPropertyEntry(depend));
+ std::unique_ptr<TargetPropertyEntry> entry(
+ CreateTargetPropertyEntry(depend));
+ entries.emplace_back(EvaluateTargetPropertyEntry(
+ this, config, language, &dagChecker, entry.get()));
}
}
- AddInterfaceEntries(this, config, "INTERFACE_LINK_DEPENDS",
- linkDependsEntries);
- processLinkDepends(this, linkDependsEntries, result, uniqueOptions,
- &dagChecker, config, language);
+ AddInterfaceEntries(this, config, "INTERFACE_LINK_DEPENDS", language,
+ &dagChecker, entries);
+
+ processOptions(this, entries, result, uniqueOptions, false, "link depends",
+ OptionsParse::None);
- cmDeleteAll(linkDependsEntries);
return result;
}
@@ -3924,8 +3996,7 @@ void cmGeneratorTarget::GetFullNameInternal(
// Return an empty name for the import library if this platform
// does not support import libraries.
- if (isImportedLibraryArtifact &&
- !this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")) {
+ if (isImportedLibraryArtifact && !this->NeedImportLibraryName(config)) {
outPrefix.clear();
outBase.clear();
outSuffix.clear();
@@ -3934,8 +4005,8 @@ void cmGeneratorTarget::GetFullNameInternal(
// retrieve prefix and suffix
std::string ll = this->GetLinkerLanguage(config);
- const char* targetPrefix = this->GetFilePrefixInternal(artifact, ll);
- const char* targetSuffix = this->GetFileSuffixInternal(artifact, ll);
+ const char* targetPrefix = this->GetFilePrefixInternal(config, artifact, ll);
+ const char* targetSuffix = this->GetFileSuffixInternal(config, artifact, ll);
// The implib option is only allowed for shared libraries, module
// libraries, and executables.
@@ -4343,8 +4414,9 @@ void checkPropertyConsistency(cmGeneratorTarget const* depender,
}
}
-static std::string intersect(const std::set<std::string>& s1,
- const std::set<std::string>& s2)
+namespace {
+std::string intersect(const std::set<std::string>& s1,
+ const std::set<std::string>& s2)
{
std::set<std::string> intersect;
std::set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(),
@@ -4355,9 +4427,9 @@ static std::string intersect(const std::set<std::string>& s1,
return "";
}
-static std::string intersect(const std::set<std::string>& s1,
- const std::set<std::string>& s2,
- const std::set<std::string>& s3)
+std::string intersect(const std::set<std::string>& s1,
+ const std::set<std::string>& s2,
+ const std::set<std::string>& s3)
{
std::string result;
result = intersect(s1, s2);
@@ -4371,10 +4443,10 @@ static std::string intersect(const std::set<std::string>& s1,
return intersect(s2, s3);
}
-static std::string intersect(const std::set<std::string>& s1,
- const std::set<std::string>& s2,
- const std::set<std::string>& s3,
- const std::set<std::string>& s4)
+std::string intersect(const std::set<std::string>& s1,
+ const std::set<std::string>& s2,
+ const std::set<std::string>& s3,
+ const std::set<std::string>& s4)
{
std::string result;
result = intersect(s1, s2);
@@ -4391,6 +4463,7 @@ static std::string intersect(const std::set<std::string>& s1,
}
return intersect(s2, s3, s4);
}
+}
void cmGeneratorTarget::CheckPropertyCompatibility(
cmComputeLinkInformation* info, const std::string& config) const
@@ -5032,13 +5105,7 @@ void cmGeneratorTarget::ComputeVersionedName(std::string& vName,
std::vector<std::string> cmGeneratorTarget::GetPropertyKeys() const
{
- cmPropertyMap const& propsObject = this->Target->GetProperties();
- std::vector<std::string> props;
- props.reserve(propsObject.size());
- for (auto const& it : propsObject) {
- props.push_back(it.first);
- }
- return props;
+ return this->Target->GetProperties().GetKeys();
}
void cmGeneratorTarget::ReportPropertyOrigin(
@@ -5485,13 +5552,41 @@ bool cmGeneratorTarget::ComputePDBOutputDir(const std::string& kind,
return true;
}
-bool cmGeneratorTarget::HaveInstallTreeRPATH() const
+bool cmGeneratorTarget::HaveInstallTreeRPATH(const std::string& config) const
{
- const char* install_rpath = this->GetProperty("INSTALL_RPATH");
- return (install_rpath && *install_rpath) &&
+ std::string install_rpath;
+ this->GetInstallRPATH(config, install_rpath);
+ return !install_rpath.empty() &&
!this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH");
}
+bool cmGeneratorTarget::GetBuildRPATH(const std::string& config,
+ std::string& rpath) const
+{
+ return this->GetRPATH(config, "BUILD_RPATH", rpath);
+}
+
+bool cmGeneratorTarget::GetInstallRPATH(const std::string& config,
+ std::string& rpath) const
+{
+ return this->GetRPATH(config, "INSTALL_RPATH", rpath);
+}
+
+bool cmGeneratorTarget::GetRPATH(const std::string& config,
+ const std::string& prop,
+ std::string& rpath) const
+{
+ const char* value = this->GetProperty(prop);
+ if (!value) {
+ return false;
+ }
+
+ cmGeneratorExpression ge;
+ rpath = ge.Parse(value)->Evaluate(this->LocalGenerator, config);
+
+ return true;
+}
+
void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
const std::string& config, cmOptionalLinkInterface& iface,
cmGeneratorTarget const* headTarget, bool usage_requirements_only) const
@@ -6091,7 +6186,8 @@ bool cmGeneratorTarget::HaveBuildTreeRPATH(const std::string& config) const
if (this->GetPropertyAsBool("SKIP_BUILD_RPATH")) {
return false;
}
- if (this->GetProperty("BUILD_RPATH")) {
+ std::string build_rpath;
+ if (this->GetBuildRPATH(config, build_rpath)) {
return true;
}
if (cmLinkImplementationLibraries const* impl =
@@ -6337,7 +6433,18 @@ bool cmGeneratorTarget::HasImportLibrary(std::string const& config) const
this->IsExecutableWithExports()) &&
// Assemblies which have only managed code do not have
// import libraries.
- this->GetManagedType(config) != ManagedType::Managed);
+ this->GetManagedType(config) != ManagedType::Managed) ||
+ (this->Target->IsAIX() && this->IsExecutableWithExports());
+}
+
+bool cmGeneratorTarget::NeedImportLibraryName(std::string const& config) const
+{
+ return this->HasImportLibrary(config) ||
+ // On DLL platforms we always generate the import library name
+ // just in case the sources have export markup.
+ (this->IsDLLPlatform() &&
+ (this->GetType() == cmStateEnums::EXECUTABLE ||
+ this->GetType() == cmStateEnums::MODULE_LIBRARY));
}
std::string cmGeneratorTarget::GetSupportDirectory() const
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 0e0ee6a..3874738 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -14,6 +14,7 @@
#include <set>
#include <stddef.h>
#include <string>
+#include <unordered_map>
#include <utility>
#include <vector>
@@ -25,6 +26,9 @@ class cmMakefile;
class cmSourceFile;
class cmTarget;
+struct cmGeneratorExpressionContext;
+struct cmGeneratorExpressionDAGChecker;
+
class cmGeneratorTarget
{
public:
@@ -674,7 +678,14 @@ public:
class TargetPropertyEntry;
- bool HaveInstallTreeRPATH() const;
+ std::string EvaluateInterfaceProperty(
+ std::string const& prop, cmGeneratorExpressionContext* context,
+ cmGeneratorExpressionDAGChecker* dagCheckerParent) const;
+
+ bool HaveInstallTreeRPATH(const std::string& config) const;
+
+ bool GetBuildRPATH(const std::string& config, std::string& rpath) const;
+ bool GetInstallRPATH(const std::string& config, std::string& rpath) const;
/** Whether this library has \@rpath and platform supports it. */
bool HasMacOSXRpathInstallNameDir(const std::string& config) const;
@@ -740,9 +751,13 @@ private:
mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
- const char* GetFilePrefixInternal(cmStateEnums::ArtifactType artifact,
+ bool NeedImportLibraryName(std::string const& config) const;
+
+ const char* GetFilePrefixInternal(std::string const& config,
+ cmStateEnums::ArtifactType artifact,
const std::string& language = "") const;
- const char* GetFileSuffixInternal(cmStateEnums::ArtifactType artifact,
+ const char* GetFileSuffixInternal(std::string const& config,
+ cmStateEnums::ArtifactType artifact,
const std::string& language = "") const;
std::string GetFullNameInternal(const std::string& config,
@@ -842,6 +857,10 @@ private:
mutable std::vector<AllConfigSource> AllConfigSources;
void ComputeAllConfigSources() const;
+ mutable std::unordered_map<std::string, bool> MaybeInterfacePropertyExists;
+ bool MaybeHaveInterfaceProperty(std::string const& prop,
+ cmGeneratorExpressionContext* context) const;
+
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
std::vector<TargetPropertyEntry*> CompileFeaturesEntries;
@@ -906,13 +925,15 @@ private:
mutable bool DebugSourcesDone;
mutable bool LinkImplementationLanguageIsContextDependent;
mutable bool UtilityItemsDone;
- bool DLLPlatform;
bool ComputePDBOutputDir(const std::string& kind, const std::string& config,
std::string& out) const;
ManagedType CheckManagedType(std::string const& propval) const;
+ bool GetRPATH(const std::string& config, const std::string& prop,
+ std::string& rpath) const;
+
public:
const std::vector<const cmGeneratorTarget*>& GetLinkImplementationClosure(
const std::string& config) const;
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index fc82fee..38fee28 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -4,10 +4,10 @@
#include <set>
-#include "cmAlgorithms.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmState.h"
+#include "cmStringAlgorithms.h"
class cmExecutionStatus;
@@ -46,7 +46,7 @@ bool cmGetCMakePropertyCommand::InitialPass(
}
}
- this->Makefile->AddDefinition(variable, output.c_str());
+ this->Makefile->AddDefinition(variable, output);
return true;
}
diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h
index 1f29c78..7790a6b 100644
--- a/Source/cmGetCMakePropertyCommand.h
+++ b/Source/cmGetCMakePropertyCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -15,7 +17,10 @@ class cmExecutionStatus;
class cmGetCMakePropertyCommand : public cmCommand
{
public:
- cmCommand* Clone() override { return new cmGetCMakePropertyCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmGetCMakePropertyCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx
index a92eb71..98ccb0a 100644
--- a/Source/cmGetDirectoryPropertyCommand.cxx
+++ b/Source/cmGetDirectoryPropertyCommand.cxx
@@ -66,7 +66,7 @@ bool cmGetDirectoryPropertyCommand::InitialPass(
return false;
}
std::string const& output = dir->GetSafeDefinition(*i);
- this->Makefile->AddDefinition(variable, output.c_str());
+ this->Makefile->AddDefinition(variable, output);
return true;
}
@@ -97,9 +97,5 @@ bool cmGetDirectoryPropertyCommand::InitialPass(
void cmGetDirectoryPropertyCommand::StoreResult(std::string const& variable,
const char* prop)
{
- if (prop) {
- this->Makefile->AddDefinition(variable, prop);
- return;
- }
- this->Makefile->AddDefinition(variable, "");
+ this->Makefile->AddDefinition(variable, prop ? prop : "");
}
diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h
index 02ea056..63a198a 100644
--- a/Source/cmGetDirectoryPropertyCommand.h
+++ b/Source/cmGetDirectoryPropertyCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -15,7 +17,10 @@ class cmExecutionStatus;
class cmGetDirectoryPropertyCommand : public cmCommand
{
public:
- cmCommand* Clone() override { return new cmGetDirectoryPropertyCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmGetDirectoryPropertyCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx
index 163b4c8..fc82535 100644
--- a/Source/cmGetFilenameComponentCommand.cxx
+++ b/Source/cmGetFilenameComponentCommand.cxx
@@ -128,9 +128,9 @@ bool cmGetFilenameComponentCommand::InitialPass(
args[2] == "PATH" ? cmStateEnums::FILEPATH : cmStateEnums::STRING);
} else {
if (!programArgs.empty() && !storeArgs.empty()) {
- this->Makefile->AddDefinition(storeArgs, programArgs.c_str());
+ this->Makefile->AddDefinition(storeArgs, programArgs);
}
- this->Makefile->AddDefinition(args.front(), result.c_str());
+ this->Makefile->AddDefinition(args.front(), result);
}
return true;
diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h
index 8c26655..1780b96 100644
--- a/Source/cmGetFilenameComponentCommand.h
+++ b/Source/cmGetFilenameComponentCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -24,7 +26,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmGetFilenameComponentCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmGetFilenameComponentCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 039f439..de462ed 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -121,7 +121,7 @@ bool cmGetPropertyCommand::InitialPass(std::vector<std::string> const& args,
} else {
output = "NOTFOUND";
}
- this->Makefile->AddDefinition(this->Variable, output.c_str());
+ this->Makefile->AddDefinition(this->Variable, output);
} else if (this->InfoType == OutFullDoc) {
// Lookup full documentation.
std::string output;
@@ -132,7 +132,7 @@ bool cmGetPropertyCommand::InitialPass(std::vector<std::string> const& args,
} else {
output = "NOTFOUND";
}
- this->Makefile->AddDefinition(this->Variable, output.c_str());
+ this->Makefile->AddDefinition(this->Variable, output);
} else if (this->InfoType == OutDefined) {
// Lookup if the property is defined
if (this->Makefile->GetState()->GetPropertyDefinition(this->PropertyName,
diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h
index c3f653e..50e4014 100644
--- a/Source/cmGetPropertyCommand.h
+++ b/Source/cmGetPropertyCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -17,7 +19,10 @@ class cmGetPropertyCommand : public cmCommand
public:
cmGetPropertyCommand();
- cmCommand* Clone() override { return new cmGetPropertyCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmGetPropertyCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx
index 75879a5..a16076d 100644
--- a/Source/cmGetSourceFilePropertyCommand.cxx
+++ b/Source/cmGetSourceFilePropertyCommand.cxx
@@ -25,7 +25,7 @@ bool cmGetSourceFilePropertyCommand::InitialPass(
}
if (sf) {
if (args[2] == "LANGUAGE") {
- this->Makefile->AddDefinition(var, sf->GetLanguage().c_str());
+ this->Makefile->AddDefinition(var, sf->GetLanguage());
return true;
}
const char* prop = nullptr;
diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h
index 43bc330..387a7f4 100644
--- a/Source/cmGetSourceFilePropertyCommand.h
+++ b/Source/cmGetSourceFilePropertyCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -15,7 +17,10 @@ class cmExecutionStatus;
class cmGetSourceFilePropertyCommand : public cmCommand
{
public:
- cmCommand* Clone() override { return new cmGetSourceFilePropertyCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmGetSourceFilePropertyCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index fc0e9c6..07aaf02 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -75,9 +75,9 @@ bool cmGetTargetPropertyCommand::InitialPass(
}
}
if (prop_exists) {
- this->Makefile->AddDefinition(var, prop.c_str());
+ this->Makefile->AddDefinition(var, prop);
return true;
}
- this->Makefile->AddDefinition(var, (var + "-NOTFOUND").c_str());
+ this->Makefile->AddDefinition(var, var + "-NOTFOUND");
return true;
}
diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h
index 63ee5fd..1a53195 100644
--- a/Source/cmGetTargetPropertyCommand.h
+++ b/Source/cmGetTargetPropertyCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -15,7 +17,10 @@ class cmExecutionStatus;
class cmGetTargetPropertyCommand : public cmCommand
{
public:
- cmCommand* Clone() override { return new cmGetTargetPropertyCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmGetTargetPropertyCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h
index 4a74f59..a53a7f7 100644
--- a/Source/cmGetTestPropertyCommand.h
+++ b/Source/cmGetTestPropertyCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -15,7 +17,10 @@ class cmExecutionStatus;
class cmGetTestPropertyCommand : public cmCommand
{
public:
- cmCommand* Clone() override { return new cmGetTestPropertyCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmGetTestPropertyCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index b80da72..997595b 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -22,9 +22,11 @@
#include "cmTarget.h"
#include <algorithm>
+#include <memory>
#include <ostream>
#include <set>
#include <utility>
+#include <vector>
cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target)
: GeneratorTarget(target)
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 4eba4ff..88da5eb 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -92,7 +92,6 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm)
// how long to let try compiles run
this->TryCompileTimeout = cmDuration::zero();
- this->ExtraGenerator = nullptr;
this->CurrentConfigureMakefile = nullptr;
this->TryCompileOuterMakefile = nullptr;
@@ -113,7 +112,6 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm)
cmGlobalGenerator::~cmGlobalGenerator()
{
this->ClearGeneratorMembers();
- delete this->ExtraGenerator;
}
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -339,15 +337,16 @@ bool cmGlobalGenerator::CheckTargetsForType() const
bool failed = false;
for (cmLocalGenerator* generator : this->LocalGenerators) {
for (cmGeneratorTarget* target : generator->GetGeneratorTargets()) {
- std::vector<std::string> configs;
- target->Makefile->GetConfigurations(configs);
- if (configs.empty()) {
- configs.emplace_back();
- }
+ if (target->GetType() == cmStateEnums::EXECUTABLE &&
+ target->GetPropertyAsBool("WIN32_EXECUTABLE")) {
+ std::vector<std::string> configs;
+ target->Makefile->GetConfigurations(configs);
+ if (configs.empty()) {
+ configs.emplace_back();
+ }
- for (std::string const& config : configs) {
- if (target->GetLinkerLanguage(config) == "Swift") {
- if (target->GetPropertyAsBool("WIN32_EXECUTABLE")) {
+ for (std::string const& config : configs) {
+ if (target->GetLinkerLanguage(config) == "Swift") {
this->GetCMakeInstance()->IssueMessage(
MessageType::FATAL_ERROR,
"WIN32_EXECUTABLE property is not supported on Swift "
@@ -513,7 +512,7 @@ void cmGlobalGenerator::EnableLanguage(
bool fatalError = false;
- mf->AddDefinition("RUN_CONFIGURE", true);
+ mf->AddDefinitionBool("RUN_CONFIGURE", true);
std::string rootBin = this->CMakeInstance->GetHomeOutputDirectory();
rootBin += "/CMakeFiles";
@@ -527,7 +526,7 @@ void cmGlobalGenerator::EnableLanguage(
rootBin += cmVersion::GetCMakeVersion();
// set the dir for parent files so they can be used by modules
- mf->AddDefinition("CMAKE_PLATFORM_INFO_DIR", rootBin.c_str());
+ mf->AddDefinition("CMAKE_PLATFORM_INFO_DIR", rootBin);
if (!this->CMakeInstance->GetIsInTryCompile()) {
// Keep a mark in the cache to indicate that we've initialized the
@@ -587,8 +586,7 @@ void cmGlobalGenerator::EnableLanguage(
windowsVersionString << osviex.dwMajorVersion << "."
<< osviex.dwMinorVersion << "."
<< osviex.dwBuildNumber;
- mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION",
- windowsVersionString.str().c_str());
+ mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION", windowsVersionString.str());
#endif
// Read the DetermineSystem file
std::string systemFile = mf->GetModulesFile("CMakeDetermineSystem.cmake");
@@ -1499,7 +1497,7 @@ void cmGlobalGenerator::Generate()
this->WriteSummary();
- if (this->ExtraGenerator != nullptr) {
+ if (this->ExtraGenerator) {
this->ExtraGenerator->Generate();
}
@@ -2721,8 +2719,8 @@ bool cmGlobalGenerator::IsReservedTarget(std::string const& name)
void cmGlobalGenerator::SetExternalMakefileProjectGenerator(
cmExternalMakefileProjectGenerator* extraGenerator)
{
- this->ExtraGenerator = extraGenerator;
- if (this->ExtraGenerator != nullptr) {
+ this->ExtraGenerator.reset(extraGenerator);
+ if (this->ExtraGenerator) {
this->ExtraGenerator->SetGlobalGenerator(this);
}
}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index db96489..ea40ebc 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -7,6 +7,7 @@
#include <iosfwd>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <unordered_map>
@@ -18,6 +19,7 @@
#include "cmDuration.h"
#include "cmExportSetMap.h"
#include "cmStateSnapshot.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetDepend.h"
@@ -618,7 +620,7 @@ private:
void ComputeBuildFileGenerators();
- cmExternalMakefileProjectGenerator* ExtraGenerator;
+ std::unique_ptr<cmExternalMakefileProjectGenerator> ExtraGenerator;
// track files replaced during a Generate
std::vector<std::string> FilesReplacedDuringGenerate;
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index b69dea0..7cfbea6 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -111,7 +111,7 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", gbuild.c_str(),
"build program to use", cmStateEnums::INTERNAL, true);
- mf->AddDefinition("CMAKE_SYSTEM_VERSION", tsp.c_str());
+ mf->AddDefinition("CMAKE_SYSTEM_VERSION", tsp);
return true;
}
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx
index 7b58389..483d4ab 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.cxx
+++ b/Source/cmGlobalMSYSMakefileGenerator.cxx
@@ -69,9 +69,9 @@ void cmGlobalMSYSMakefileGenerator::EnableLanguage(
rc = trc;
}
mf->AddDefinition("MSYS", "1");
- mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str());
- mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str());
- mf->AddDefinition("CMAKE_GENERATOR_RC", rc.c_str());
+ mf->AddDefinition("CMAKE_GENERATOR_CC", gcc);
+ mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx);
+ mf->AddDefinition("CMAKE_GENERATOR_RC", rc);
this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
if (!mf->IsSet("CMAKE_AR") && !this->CMakeInstance->GetIsInTryCompile() &&
diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx
index e218b4b..d9fc505 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.cxx
+++ b/Source/cmGlobalMinGWMakefileGenerator.cxx
@@ -44,9 +44,9 @@ void cmGlobalMinGWMakefileGenerator::EnableLanguage(
if (!trc.empty()) {
rc = trc;
}
- mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str());
- mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str());
- mf->AddDefinition("CMAKE_GENERATOR_RC", rc.c_str());
+ mf->AddDefinition("CMAKE_GENERATOR_CC", gcc);
+ mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx);
+ mf->AddDefinition("CMAKE_GENERATOR_RC", rc);
this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
}
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 2d52356..bad715d 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -9,10 +9,11 @@
#include <algorithm>
#include <ctype.h>
#include <iterator>
-#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
+#include "cm_memory.hxx"
+
#include "cmAlgorithms.h"
#include "cmDocumentationEntry.h"
#include "cmFortranParser.h"
@@ -31,6 +32,7 @@
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetDepend.h"
@@ -638,7 +640,9 @@ void cmGlobalNinjaGenerator::EnableLanguage(
(mf->GetSafeDefinition("CMAKE_C_COMPILER_ID") == "GNU") ||
(mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID") == "GNU") ||
(mf->GetSafeDefinition("CMAKE_C_COMPILER_ID") == "Clang") ||
- (mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID") == "Clang")))) {
+ (mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID") == "Clang") ||
+ (mf->GetSafeDefinition("CMAKE_C_COMPILER_ID") == "QCC") ||
+ (mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID") == "QCC")))) {
this->UsingGCCOnWindows = true;
}
#endif
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 15dd404..99afc1d 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -7,7 +7,7 @@
#include <iosfwd>
#include <map>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <set>
#include <string>
#include <unordered_map>
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index aa584ad..35af0e1 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -7,6 +7,8 @@
#include <sstream>
#include <utility>
+#include "cm_memory.hxx"
+
#include "cmAlgorithms.h"
#include "cmDocumentationEntry.h"
#include "cmGeneratedFileStream.h"
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 55374a4..4a3cadd 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -445,7 +445,7 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf)
this->DefaultPlatformName = "Tegra-Android";
this->DefaultPlatformToolset = "Default";
this->NsightTegraVersion = v;
- mf->AddDefinition("CMAKE_VS_NsightTegra_VERSION", v.c_str());
+ mf->AddDefinition("CMAKE_VS_NsightTegra_VERSION", v);
}
return true;
@@ -659,8 +659,7 @@ bool cmGlobalVisualStudio10Generator::FindMakeProgram(cmMakefile* mf)
if (!this->cmGlobalVisualStudio8Generator::FindMakeProgram(mf)) {
return false;
}
- mf->AddDefinition("CMAKE_VS_MSBUILD_COMMAND",
- this->GetMSBuildCommand().c_str());
+ mf->AddDefinition("CMAKE_VS_MSBUILD_COMMAND", this->GetMSBuildCommand());
return true;
}
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index 6509b56..cd48474 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -182,7 +182,7 @@ void cmGlobalVisualStudio14Generator::SetWindowsTargetPlatformVersion(
mf->DisplayStatus(e.str(), -1);
}
mf->AddDefinition("CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION",
- this->WindowsTargetPlatformVersion.c_str());
+ this->WindowsTargetPlatformVersion);
}
bool cmGlobalVisualStudio14Generator::SelectWindowsStoreToolset(
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 8764ee4..8401efb 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -121,8 +121,7 @@ bool cmGlobalVisualStudio7Generator::FindMakeProgram(cmMakefile* mf)
if (!this->cmGlobalVisualStudioGenerator::FindMakeProgram(mf)) {
return false;
}
- mf->AddDefinition("CMAKE_VS_DEVENV_COMMAND",
- this->GetDevEnvCommand().c_str());
+ mf->AddDefinition("CMAKE_VS_DEVENV_COMMAND", this->GetDevEnvCommand());
return true;
}
@@ -268,7 +267,7 @@ bool cmGlobalVisualStudio7Generator::SetSystemName(std::string const& s,
cmMakefile* mf)
{
mf->AddDefinition("CMAKE_VS_INTEL_Fortran_PROJECT_VERSION",
- this->GetIntelProjectVersion().c_str());
+ this->GetIntelProjectVersion());
return this->cmGlobalVisualStudioGenerator::SetSystemName(s, mf);
}
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 85ddc85..cc6e421 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -54,8 +54,7 @@ void cmGlobalVisualStudio8Generator::EnableLanguage(
void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf)
{
if (this->TargetsWindowsCE()) {
- mf->AddDefinition("CMAKE_VS_WINCE_VERSION",
- this->WindowsCEVersion.c_str());
+ mf->AddDefinition("CMAKE_VS_WINCE_VERSION", this->WindowsCEVersion);
}
}
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index cd0355f..ba541a9 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -57,7 +57,7 @@ void cmGlobalVisualStudioGenerator::EnableLanguage(
std::vector<std::string> const& lang, cmMakefile* mf, bool optional)
{
mf->AddDefinition("CMAKE_VS_PLATFORM_NAME_DEFAULT",
- this->DefaultPlatformName.c_str());
+ this->DefaultPlatformName);
this->cmGlobalGenerator::EnableLanguage(lang, mf, optional);
}
@@ -69,7 +69,7 @@ bool cmGlobalVisualStudioGenerator::SetGeneratorPlatform(std::string const& p,
} else if (this->GetPlatformName() == "Itanium") {
mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE");
}
- mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName().c_str());
+ mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName());
return this->cmGlobalGenerator::SetGeneratorPlatform(p, mf);
}
@@ -488,7 +488,7 @@ bool cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf)
// directly instead of needing a helper module to do it, so we
// do not actually need to put CMAKE_MAKE_PROGRAM into the cache.
if (cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) {
- mf->AddDefinition("CMAKE_MAKE_PROGRAM", this->GetVSMakeProgram().c_str());
+ mf->AddDefinition("CMAKE_MAKE_PROGRAM", this->GetVSMakeProgram());
}
return true;
}
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 7c2bcd3..8f4ae62 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -5,11 +5,12 @@
#include "cmsys/RegularExpression.hxx"
#include <assert.h>
#include <iomanip>
-#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
#include <string.h>
+#include "cm_memory.hxx"
+
#include "cmAlgorithms.h"
#include "cmComputeLinkInformation.h"
#include "cmCustomCommand.h"
@@ -240,8 +241,7 @@ bool cmGlobalXCodeGenerator::FindMakeProgram(cmMakefile* mf)
// directly instead of needing a helper module to do it, so we
// do not actually need to put CMAKE_MAKE_PROGRAM into the cache.
if (cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) {
- mf->AddDefinition("CMAKE_MAKE_PROGRAM",
- this->GetXcodeBuildCommand().c_str());
+ mf->AddDefinition("CMAKE_MAKE_PROGRAM", this->GetXcodeBuildCommand());
}
return true;
}
@@ -282,8 +282,7 @@ bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts,
}
this->GeneratorToolset = ts;
if (!this->GeneratorToolset.empty()) {
- mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET",
- this->GeneratorToolset.c_str());
+ mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET", this->GeneratorToolset);
}
return true;
}
@@ -292,7 +291,7 @@ void cmGlobalXCodeGenerator::EnableLanguage(
std::vector<std::string> const& lang, cmMakefile* mf, bool optional)
{
mf->AddDefinition("XCODE", "1");
- mf->AddDefinition("XCODE_VERSION", this->VersionString.c_str());
+ mf->AddDefinition("XCODE_VERSION", this->VersionString);
if (!mf->GetDefinition("CMAKE_CONFIGURATION_TYPES")) {
mf->AddCacheDefinition(
"CMAKE_CONFIGURATION_TYPES", "Debug;Release;MinSizeRel;RelWithDebInfo",
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index a75d8a9..9befb78 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -4,7 +4,7 @@
#include <cstddef>
#include <iostream>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <sstream>
#include <utility>
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index d1f8f58..385022c 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmIfCommand.h"
+#include "cm_memory.hxx"
+
#include "cmConditionEvaluator.h"
#include "cmExecutionStatus.h"
#include "cmExpandedCommandArgument.h"
@@ -11,7 +13,8 @@
#include "cmSystemTools.h"
#include "cmake.h"
-#include <memory> // IWYU pragma: keep
+#include <string>
+#include <utility>
static std::string cmIfCommandError(
std::vector<cmExpandedCommandArgument> const& args)
@@ -45,7 +48,7 @@ bool cmIfFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
}
// execute the functions for the true parts of the if statement
- cmExecutionStatus status;
+ cmExecutionStatus status(mf);
int scopeDepth = 0;
for (cmListFileFunction const& func : this->Functions) {
// keep track of scope depth
@@ -174,19 +177,19 @@ bool cmIfFunctionBlocker::ShouldRemove(const cmListFileFunction& lff,
}
//=========================================================================
-bool cmIfCommand::InvokeInitialPass(
- const std::vector<cmListFileArgument>& args, cmExecutionStatus&)
+bool cmIfCommand(std::vector<cmListFileArgument> const& args,
+ cmExecutionStatus& inStatus)
{
+ cmMakefile& makefile = inStatus.GetMakefile();
std::string errorString;
std::vector<cmExpandedCommandArgument> expandedArguments;
- this->Makefile->ExpandArguments(args, expandedArguments);
+ makefile.ExpandArguments(args, expandedArguments);
MessageType status;
cmConditionEvaluator conditionEvaluator(
- *(this->Makefile), this->Makefile->GetExecutionContext(),
- this->Makefile->GetBacktrace());
+ makefile, makefile.GetExecutionContext(), makefile.GetBacktrace());
bool isTrue =
conditionEvaluator.IsTrue(expandedArguments, errorString, status);
@@ -195,22 +198,24 @@ bool cmIfCommand::InvokeInitialPass(
std::string err = "if " + cmIfCommandError(expandedArguments);
err += errorString;
if (status == MessageType::FATAL_ERROR) {
- this->Makefile->IssueMessage(MessageType::FATAL_ERROR, err);
+ makefile.IssueMessage(MessageType::FATAL_ERROR, err);
cmSystemTools::SetFatalErrorOccured();
return true;
}
- this->Makefile->IssueMessage(status, err);
+ makefile.IssueMessage(status, err);
}
- cmIfFunctionBlocker* f = new cmIfFunctionBlocker();
- // if is isn't true block the commands
- f->ScopeDepth = 1;
- f->IsBlocking = !isTrue;
- if (isTrue) {
- f->HasRun = true;
+ {
+ auto fb = cm::make_unique<cmIfFunctionBlocker>();
+ // if is isn't true block the commands
+ fb->ScopeDepth = 1;
+ fb->IsBlocking = !isTrue;
+ if (isTrue) {
+ fb->HasRun = true;
+ }
+ fb->Args = args;
+ makefile.AddFunctionBlocker(std::move(fb));
}
- f->Args = args;
- this->Makefile->AddFunctionBlocker(f);
return true;
}
diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h
index d34ed02..775e609 100644
--- a/Source/cmIfCommand.h
+++ b/Source/cmIfCommand.h
@@ -5,15 +5,12 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include <string>
#include <vector>
-#include "cmCommand.h"
#include "cmFunctionBlocker.h"
#include "cmListFileCache.h"
class cmExecutionStatus;
-class cmExpandedCommandArgument;
class cmMakefile;
class cmIfFunctionBlocker : public cmFunctionBlocker
@@ -32,34 +29,7 @@ public:
};
/// Starts an if block
-class cmIfCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- cmCommand* Clone() override { return new cmIfCommand; }
-
- /**
- * This overrides the default InvokeInitialPass implementation.
- * It records the arguments before expansion.
- */
- bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
- cmExecutionStatus&) override;
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const&,
- cmExecutionStatus&) override
- {
- return false;
- }
-
- // Filter the given variable definition based on policy CMP0054.
- static const char* GetDefinitionIfUnquoted(
- const cmMakefile* mf, cmExpandedCommandArgument const& argument);
-};
+bool cmIfCommand(std::vector<cmListFileArgument> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h
index 3b843b2..94d3fbd 100644
--- a/Source/cmIncludeCommand.h
+++ b/Source/cmIncludeCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -24,7 +26,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmIncludeCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmIncludeCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h
index 01d98db..4df94eb 100644
--- a/Source/cmIncludeDirectoryCommand.h
+++ b/Source/cmIncludeDirectoryCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -24,7 +26,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmIncludeDirectoryCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmIncludeDirectoryCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h
index 945acdc..9f76576 100644
--- a/Source/cmIncludeExternalMSProjectCommand.h
+++ b/Source/cmIncludeExternalMSProjectCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -25,7 +27,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmIncludeExternalMSProjectCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmIncludeExternalMSProjectCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmIncludeGuardCommand.cxx b/Source/cmIncludeGuardCommand.cxx
index 505b07c..3b126b0 100644
--- a/Source/cmIncludeGuardCommand.cxx
+++ b/Source/cmIncludeGuardCommand.cxx
@@ -85,7 +85,7 @@ bool cmIncludeGuardCommand::InitialPass(std::vector<std::string> const& args,
status.SetReturnInvoked();
return true;
}
- mf->AddDefinition(includeGuardVar, true);
+ mf->AddDefinitionBool(includeGuardVar, true);
break;
case DIRECTORY:
if (CheckIncludeGuardIsSet(mf, includeGuardVar)) {
diff --git a/Source/cmIncludeGuardCommand.h b/Source/cmIncludeGuardCommand.h
index eaad9b8..4306c4c 100644
--- a/Source/cmIncludeGuardCommand.h
+++ b/Source/cmIncludeGuardCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -24,7 +26,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmIncludeGuardCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmIncludeGuardCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h
index 8da991d..1723c8b 100644
--- a/Source/cmIncludeRegularExpressionCommand.h
+++ b/Source/cmIncludeRegularExpressionCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -24,7 +26,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmIncludeRegularExpressionCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmIncludeRegularExpressionCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index dba4bbb..aca7268 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -9,7 +9,6 @@
#include <stddef.h>
#include <utility>
-#include "cmAlgorithms.h"
#include "cmArgumentParser.h"
#include "cmExportSet.h"
#include "cmExportSetMap.h"
@@ -27,6 +26,7 @@
#include "cmMessageType.h"
#include "cmPolicies.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetExport.h"
@@ -389,10 +389,6 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
return true;
}
- // Check whether this is a DLL platform.
- bool dll_platform =
- !this->Makefile->GetSafeDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX").empty();
-
for (std::string const& tgt : targetList) {
if (this->Makefile->IsAlias(tgt)) {
@@ -472,7 +468,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
// Shared libraries are handled differently on DLL and non-DLL
// platforms. All windows platforms are DLL platforms including
// cygwin. Currently no other platform is a DLL platform.
- if (dll_platform) {
+ if (target.IsDLLPlatform()) {
// When in namelink only mode skip all libraries on Windows.
if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) {
continue;
@@ -641,7 +637,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
// On DLL platforms an executable may also have an import
// library. Install it to the archive destination if it
// exists.
- if (dll_platform && !archiveArgs.GetDestination().empty() &&
+ if ((target.IsDLLPlatform() || target.IsAIX()) &&
+ !archiveArgs.GetDestination().empty() &&
target.IsExecutableWithExports()) {
// The import library uses the ARCHIVE properties.
archiveGenerator = CreateInstallTargetGenerator(
diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h
index 202c438..28bf443 100644
--- a/Source/cmInstallCommand.h
+++ b/Source/cmInstallCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -25,7 +27,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmInstallCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmInstallCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
index 14288f6..c8ebc8c 100644
--- a/Source/cmInstallDirectoryGenerator.cxx
+++ b/Source/cmInstallDirectoryGenerator.cxx
@@ -8,7 +8,7 @@
#include "cmMakefile.h"
#include "cmSystemTools.h"
-#include <memory> // IWYU pragma: keep
+#include <memory>
cmInstallDirectoryGenerator::cmInstallDirectoryGenerator(
std::vector<std::string> const& dirs, const char* dest,
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index efbcb67..4522669 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallFilesCommand.h"
-#include "cmAlgorithms.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmInstallFilesGenerator.h"
@@ -13,7 +12,13 @@
class cmExecutionStatus;
-// cmExecutableCommand
+static std::string FindInstallSource(cmMakefile& makefile, const char* name);
+static void CreateInstallGenerator(cmMakefile& makefile,
+ std::string const& dest,
+ std::vector<std::string> const& files);
+static void FinalAction(cmMakefile& makefile, std::string const& dest,
+ std::vector<std::string> const& args);
+
bool cmInstallFilesCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
@@ -25,18 +30,20 @@ bool cmInstallFilesCommand::InitialPass(std::vector<std::string> const& args,
// Enable the install target.
this->Makefile->GetGlobalGenerator()->EnableInstallTarget();
- this->Destination = args[0];
+ std::string const& dest = args[0];
if ((args.size() > 1) && (args[1] == "FILES")) {
- this->IsFilesForm = true;
+ std::vector<std::string> files;
for (std::string const& arg : cmMakeRange(args).advance(2)) {
// Find the source location for each file listed.
- this->Files.push_back(this->FindInstallSource(arg.c_str()));
+ files.push_back(FindInstallSource(*this->Makefile, arg.c_str()));
}
- this->CreateInstallGenerator();
+ CreateInstallGenerator(*this->Makefile, dest, files);
} else {
- this->IsFilesForm = false;
- cmAppend(this->FinalArgs, args.begin() + 1, args.end());
+ std::vector<std::string> finalArgs(args.begin() + 1, args.end());
+ this->Makefile->AddFinalAction([dest, finalArgs](cmMakefile& makefile) {
+ FinalAction(makefile, dest, finalArgs);
+ });
}
this->Makefile->GetGlobalGenerator()->AddInstallComponent(
@@ -45,23 +52,20 @@ bool cmInstallFilesCommand::InitialPass(std::vector<std::string> const& args,
return true;
}
-void cmInstallFilesCommand::FinalPass()
+static void FinalAction(cmMakefile& makefile, std::string const& dest,
+ std::vector<std::string> const& args)
{
- // No final pass for "FILES" form of arguments.
- if (this->IsFilesForm) {
- return;
- }
-
std::string testf;
- std::string const& ext = this->FinalArgs[0];
+ std::string const& ext = args[0];
+ std::vector<std::string> installFiles;
// two different options
- if (this->FinalArgs.size() > 1) {
+ if (args.size() > 1) {
// now put the files into the list
- std::vector<std::string>::iterator s = this->FinalArgs.begin();
+ std::vector<std::string>::const_iterator s = args.begin();
++s;
// for each argument, get the files
- for (; s != this->FinalArgs.end(); ++s) {
+ for (; s != args.end(); ++s) {
// replace any variables
std::string const& temps = *s;
if (!cmSystemTools::GetFilenamePath(temps).empty()) {
@@ -72,30 +76,31 @@ void cmInstallFilesCommand::FinalPass()
}
// add to the result
- this->Files.push_back(this->FindInstallSource(testf.c_str()));
+ installFiles.push_back(FindInstallSource(makefile, testf.c_str()));
}
} else // reg exp list
{
std::vector<std::string> files;
- std::string const& regex = this->FinalArgs[0];
- cmSystemTools::Glob(this->Makefile->GetCurrentSourceDirectory(), regex,
- files);
+ std::string const& regex = args[0];
+ cmSystemTools::Glob(makefile.GetCurrentSourceDirectory(), regex, files);
std::vector<std::string>::iterator s = files.begin();
// for each argument, get the files
for (; s != files.end(); ++s) {
- this->Files.push_back(this->FindInstallSource(s->c_str()));
+ installFiles.push_back(FindInstallSource(makefile, s->c_str()));
}
}
- this->CreateInstallGenerator();
+ CreateInstallGenerator(makefile, dest, installFiles);
}
-void cmInstallFilesCommand::CreateInstallGenerator() const
+static void CreateInstallGenerator(cmMakefile& makefile,
+ std::string const& dest,
+ std::vector<std::string> const& files)
{
// Construct the destination. This command always installs under
// the prefix. We skip the leading slash given by the user.
- std::string destination = this->Destination.substr(1);
+ std::string destination = dest.substr(1);
cmSystemTools::ConvertToUnixSlashes(destination);
if (destination.empty()) {
destination = ".";
@@ -106,12 +111,12 @@ void cmInstallFilesCommand::CreateInstallGenerator() const
const char* no_rename = "";
bool no_exclude_from_all = false;
std::string no_component =
- this->Makefile->GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
+ makefile.GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
std::vector<std::string> no_configurations;
cmInstallGenerator::MessageLevel message =
- cmInstallGenerator::SelectMessageLevel(this->Makefile);
- this->Makefile->AddInstallGenerator(new cmInstallFilesGenerator(
- this->Files, destination.c_str(), false, no_permissions, no_configurations,
+ cmInstallGenerator::SelectMessageLevel(&makefile);
+ makefile.AddInstallGenerator(new cmInstallFilesGenerator(
+ files, destination.c_str(), false, no_permissions, no_configurations,
no_component.c_str(), message, no_exclude_from_all, no_rename));
}
@@ -121,7 +126,7 @@ void cmInstallFilesCommand::CreateInstallGenerator() const
* present in the build tree. If a full path is given, it is just
* returned.
*/
-std::string cmInstallFilesCommand::FindInstallSource(const char* name) const
+static std::string FindInstallSource(cmMakefile& makefile, const char* name)
{
if (cmSystemTools::FileIsFullPath(name) ||
cmGeneratorExpression::Find(name) == 0) {
@@ -130,10 +135,10 @@ std::string cmInstallFilesCommand::FindInstallSource(const char* name) const
}
// This is a relative path.
- std::string tb = this->Makefile->GetCurrentBinaryDirectory();
+ std::string tb = makefile.GetCurrentBinaryDirectory();
tb += "/";
tb += name;
- std::string ts = this->Makefile->GetCurrentSourceDirectory();
+ std::string ts = makefile.GetCurrentSourceDirectory();
ts += "/";
ts += name;
diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h
index a52f45e..f9b84fd 100644
--- a/Source/cmInstallFilesCommand.h
+++ b/Source/cmInstallFilesCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -24,7 +26,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmInstallFilesCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmInstallFilesCommand>();
+ }
/**
* This is called when the command is first encountered in
@@ -32,25 +37,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
-
- /**
- * This is called at the end after all the information
- * specified by the command is accumulated. Most commands do
- * not implement this method. At this point, reading and
- * writing to the cache can be done.
- */
- void FinalPass() override;
- bool HasFinalPass() const override { return !this->IsFilesForm; }
-
-protected:
- void CreateInstallGenerator() const;
- std::string FindInstallSource(const char* name) const;
-
-private:
- std::vector<std::string> FinalArgs;
- bool IsFilesForm = false;
- std::string Destination;
- std::vector<std::string> Files;
};
#endif
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index 2ed9f73..e8e82cc 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -6,7 +6,7 @@
#include "cmInstallType.h"
#include "cmSystemTools.h"
-#include <memory> // IWYU pragma: keep
+#include <memory>
class cmLocalGenerator;
diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx
index a58f875..6ec02e7 100644
--- a/Source/cmInstallProgramsCommand.cxx
+++ b/Source/cmInstallProgramsCommand.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallProgramsCommand.h"
-#include "cmAlgorithms.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmInstallFilesGenerator.h"
@@ -12,6 +11,10 @@
class cmExecutionStatus;
+static void FinalAction(cmMakefile& makefile, std::string const& dest,
+ std::vector<std::string> const& args);
+static std::string FindInstallSource(cmMakefile& makefile, const char* name);
+
// cmExecutableCommand
bool cmInstallProgramsCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
@@ -24,51 +27,55 @@ bool cmInstallProgramsCommand::InitialPass(
// Enable the install target.
this->Makefile->GetGlobalGenerator()->EnableInstallTarget();
- this->Destination = args[0];
-
- cmAppend(this->FinalArgs, args.begin() + 1, args.end());
-
this->Makefile->GetGlobalGenerator()->AddInstallComponent(
this->Makefile->GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
+ std::string const& dest = args[0];
+ std::vector<std::string> const finalArgs(args.begin() + 1, args.end());
+ this->Makefile->AddFinalAction([dest, finalArgs](cmMakefile& makefile) {
+ FinalAction(makefile, dest, finalArgs);
+ });
return true;
}
-void cmInstallProgramsCommand::FinalPass()
+static void FinalAction(cmMakefile& makefile, std::string const& dest,
+ std::vector<std::string> const& args)
{
bool files_mode = false;
- if (!this->FinalArgs.empty() && this->FinalArgs[0] == "FILES") {
+ if (!args.empty() && args[0] == "FILES") {
files_mode = true;
}
+ std::vector<std::string> files;
+
// two different options
- if (this->FinalArgs.size() > 1 || files_mode) {
+ if (args.size() > 1 || files_mode) {
// for each argument, get the programs
- std::vector<std::string>::iterator s = this->FinalArgs.begin();
+ std::vector<std::string>::const_iterator s = args.begin();
if (files_mode) {
// Skip the FILES argument in files mode.
++s;
}
- for (; s != this->FinalArgs.end(); ++s) {
+ for (; s != args.end(); ++s) {
// add to the result
- this->Files.push_back(this->FindInstallSource(s->c_str()));
+ files.push_back(FindInstallSource(makefile, s->c_str()));
}
} else // reg exp list
{
std::vector<std::string> programs;
- cmSystemTools::Glob(this->Makefile->GetCurrentSourceDirectory(),
- this->FinalArgs[0], programs);
+ cmSystemTools::Glob(makefile.GetCurrentSourceDirectory(), args[0],
+ programs);
std::vector<std::string>::iterator s = programs.begin();
// for each argument, get the programs
for (; s != programs.end(); ++s) {
- this->Files.push_back(this->FindInstallSource(s->c_str()));
+ files.push_back(FindInstallSource(makefile, s->c_str()));
}
}
// Construct the destination. This command always installs under
// the prefix. We skip the leading slash given by the user.
- std::string destination = this->Destination.substr(1);
+ std::string destination = dest.substr(1);
cmSystemTools::ConvertToUnixSlashes(destination);
if (destination.empty()) {
destination = ".";
@@ -79,12 +86,12 @@ void cmInstallProgramsCommand::FinalPass()
const char* no_rename = "";
bool no_exclude_from_all = false;
std::string no_component =
- this->Makefile->GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
+ makefile.GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
std::vector<std::string> no_configurations;
cmInstallGenerator::MessageLevel message =
- cmInstallGenerator::SelectMessageLevel(this->Makefile);
- this->Makefile->AddInstallGenerator(new cmInstallFilesGenerator(
- this->Files, destination.c_str(), true, no_permissions, no_configurations,
+ cmInstallGenerator::SelectMessageLevel(&makefile);
+ makefile.AddInstallGenerator(new cmInstallFilesGenerator(
+ files, destination.c_str(), true, no_permissions, no_configurations,
no_component.c_str(), message, no_exclude_from_all, no_rename));
}
@@ -94,7 +101,7 @@ void cmInstallProgramsCommand::FinalPass()
* present in the build tree. If a full path is given, it is just
* returned.
*/
-std::string cmInstallProgramsCommand::FindInstallSource(const char* name) const
+static std::string FindInstallSource(cmMakefile& makefile, const char* name)
{
if (cmSystemTools::FileIsFullPath(name) ||
cmGeneratorExpression::Find(name) == 0) {
@@ -103,10 +110,10 @@ std::string cmInstallProgramsCommand::FindInstallSource(const char* name) const
}
// This is a relative path.
- std::string tb = this->Makefile->GetCurrentBinaryDirectory();
+ std::string tb = makefile.GetCurrentBinaryDirectory();
tb += "/";
tb += name;
- std::string ts = this->Makefile->GetCurrentSourceDirectory();
+ std::string ts = makefile.GetCurrentSourceDirectory();
ts += "/";
ts += name;
diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h
index 5c705eb..ccd621d 100644
--- a/Source/cmInstallProgramsCommand.h
+++ b/Source/cmInstallProgramsCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -24,7 +26,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmInstallProgramsCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmInstallProgramsCommand>();
+ }
/**
* This is called when the command is first encountered in
@@ -32,24 +37,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
-
- /**
- * This is called at the end after all the information
- * specified by the command is accumulated. Most commands do
- * not implement this method. At this point, reading and
- * writing to the cache can be done.
- */
- void FinalPass() override;
-
- bool HasFinalPass() const override { return true; }
-
-protected:
- std::string FindInstallSource(const char* name) const;
-
-private:
- std::vector<std::string> FinalArgs;
- std::string Destination;
- std::vector<std::string> Files;
};
#endif
diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx
index 5832d27..b7b7817 100644
--- a/Source/cmInstallScriptGenerator.cxx
+++ b/Source/cmInstallScriptGenerator.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallScriptGenerator.h"
+#include <memory>
#include <ostream>
#include <vector>
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 7c5a55b..a61239e 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -4,6 +4,7 @@
#include <assert.h>
#include <map>
+#include <memory>
#include <set>
#include <sstream>
#include <utility>
@@ -16,6 +17,8 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmOutputConverter.h"
+#include "cmPolicies.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
@@ -632,17 +635,34 @@ void cmInstallTargetGenerator::AddRPathCheckRule(
return;
}
- // Get the install RPATH from the link information.
- std::string newRpath = cli->GetChrpathString();
-
// Write a rule to remove the installed file if its rpath is not the
// new rpath. This is needed for existing build/install trees when
// the installed rpath changes but the file is not rebuilt.
- /* clang-format off */
os << indent << "file(RPATH_CHECK\n"
- << indent << " FILE \"" << toDestDirPath << "\"\n"
- << indent << " RPATH \"" << newRpath << "\")\n";
- /* clang-format on */
+ << indent << " FILE \"" << toDestDirPath << "\"\n";
+
+ // CMP0095: ``RPATH`` entries are properly escaped in the intermediary
+ // CMake install script.
+ switch (this->Target->GetPolicyStatusCMP0095()) {
+ case cmPolicies::WARN:
+ // No author warning needed here, we warn later in
+ // cmInstallTargetGenerator::AddChrpathPatchRule().
+ CM_FALLTHROUGH;
+ case cmPolicies::OLD: {
+ // Get the install RPATH from the link information.
+ std::string newRpath = cli->GetChrpathString();
+ os << indent << " RPATH \"" << newRpath << "\")\n";
+ break;
+ }
+ default: {
+ // Get the install RPATH from the link information and
+ // escape any CMake syntax in the install RPATH.
+ std::string escapedNewRpath =
+ cmOutputConverter::EscapeForCMake(cli->GetChrpathString());
+ os << indent << " RPATH " << escapedNewRpath << ")\n";
+ break;
+ }
+ }
}
void cmInstallTargetGenerator::AddChrpathPatchRule(
@@ -731,11 +751,34 @@ void cmInstallTargetGenerator::AddChrpathPatchRule(
return;
}
+ // Escape any CMake syntax in the RPATHs.
+ std::string escapedOldRpath = cmOutputConverter::EscapeForCMake(oldRpath);
+ std::string escapedNewRpath = cmOutputConverter::EscapeForCMake(newRpath);
+
// Write a rule to run chrpath to set the install-tree RPATH
os << indent << "file(RPATH_CHANGE\n"
<< indent << " FILE \"" << toDestDirPath << "\"\n"
- << indent << " OLD_RPATH \"" << oldRpath << "\"\n"
- << indent << " NEW_RPATH \"" << newRpath << "\")\n";
+ << indent << " OLD_RPATH " << escapedOldRpath << "\n";
+
+ // CMP0095: ``RPATH`` entries are properly escaped in the intermediary
+ // CMake install script.
+ switch (this->Target->GetPolicyStatusCMP0095()) {
+ case cmPolicies::WARN:
+ this->IssueCMP0095Warning(newRpath);
+ CM_FALLTHROUGH;
+ case cmPolicies::OLD:
+ os << indent << " NEW_RPATH \"" << newRpath << "\"";
+ break;
+ default:
+ os << indent << " NEW_RPATH " << escapedNewRpath;
+ break;
+ }
+
+ if (this->Target->GetPropertyAsBool("INSTALL_REMOVE_ENVIRONMENT_RPATH")) {
+ os << "\n" << indent << " INSTALL_REMOVE_ENVIRONMENT_RPATH)\n";
+ } else {
+ os << indent << ")\n";
+ }
}
}
@@ -838,3 +881,26 @@ void cmInstallTargetGenerator::AddUniversalInstallRule(
<< "\"" << this->Target->Target->GetName() << "\" "
<< "\"" << toDestDirPath << "\")\n";
}
+
+void cmInstallTargetGenerator::IssueCMP0095Warning(
+ const std::string& unescapedRpath)
+{
+ // Reduce warning noise to cases where used RPATHs may actually be affected
+ // by CMP0095. This filter is meant to skip warnings in cases when
+ // non-curly-braces syntax (e.g. $ORIGIN) or no keyword is used which has
+ // worked already before CMP0095. We intend to issue a warning in all cases
+ // with curly-braces syntax, even if the workaround of double-escaping is in
+ // place, since we deprecate the need for it with CMP0095.
+ const bool potentially_affected(unescapedRpath.find("${") !=
+ std::string::npos);
+
+ if (potentially_affected) {
+ std::ostringstream w;
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0095) << "\n";
+ w << "RPATH entries for target '" << this->Target->GetName() << "' "
+ << "will not be escaped in the intermediary "
+ << "cmake_install.cmake script.";
+ this->Target->GetGlobalGenerator()->GetCMakeInstance()->IssueMessage(
+ MessageType::AUTHOR_WARNING, w.str(), this->GetBacktrace());
+ }
+}
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index ed3ab52..9ccad63 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/Source/cmInstallTargetGenerator.h
@@ -104,6 +104,7 @@ protected:
const std::string& toDestDirPath);
void AddUniversalInstallRule(std::ostream& os, Indent indent,
const std::string& toDestDirPath);
+ void IssueCMP0095Warning(const std::string& unescapedRpath);
std::string TargetName;
cmGeneratorTarget* Target;
diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h
index 9950fb7..55e69ba 100644
--- a/Source/cmInstallTargetsCommand.h
+++ b/Source/cmInstallTargetsCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -25,7 +27,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmInstallTargetsCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmInstallTargetsCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h
index b7d602e..eb827be 100644
--- a/Source/cmInstalledFile.h
+++ b/Source/cmInstalledFile.h
@@ -8,7 +8,7 @@
#include "cmGeneratorExpression.h"
#include <map>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <string>
#include <vector>
diff --git a/Source/cmJsonObjects.cxx b/Source/cmJsonObjects.cxx
index 636a8e1..2423faf 100644
--- a/Source/cmJsonObjects.cxx
+++ b/Source/cmJsonObjects.cxx
@@ -14,7 +14,6 @@
#include "cmLinkLineComputer.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
-#include "cmProperty.h"
#include "cmPropertyMap.h"
#include "cmSourceFile.h"
#include "cmState.h"
@@ -32,6 +31,7 @@
#include <functional>
#include <limits>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <unordered_map>
@@ -363,12 +363,12 @@ static Json::Value DumpCTestInfo(cmLocalGenerator* lg, cmTest* testInfo,
// Build up the list of properties that may have been specified
Json::Value properties = Json::arrayValue;
- for (auto& prop : testInfo->GetProperties()) {
+ for (auto& prop : testInfo->GetProperties().GetList()) {
Json::Value entry = Json::objectValue;
entry[kKEY_KEY] = prop.first;
// Remove config variables from the value too.
- auto cge_value = ge.Parse(prop.second.GetValue());
+ auto cge_value = ge.Parse(prop.second);
const std::string& processed_value = cge_value->Evaluate(lg, config);
entry[kVALUE_KEY] = processed_value;
properties.append(entry);
@@ -516,9 +516,11 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
Json::Value artifacts = Json::arrayValue;
artifacts.append(
target->GetFullPath(config, cmStateEnums::RuntimeBinaryArtifact));
- if (target->IsDLLPlatform()) {
+ if (target->HasImportLibrary(config)) {
artifacts.append(
target->GetFullPath(config, cmStateEnums::ImportLibraryArtifact));
+ }
+ if (target->IsDLLPlatform()) {
const cmGeneratorTarget::OutputInfo* output =
target->GetOutputInfo(config);
if (output && !output->PdbDir.empty()) {
diff --git a/Source/cmLDConfigLDConfigTool.cxx b/Source/cmLDConfigLDConfigTool.cxx
new file mode 100644
index 0000000..586ea96
--- /dev/null
+++ b/Source/cmLDConfigLDConfigTool.cxx
@@ -0,0 +1,70 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmLDConfigLDConfigTool.h"
+#include "cmMakefile.h"
+#include "cmRuntimeDependencyArchive.h"
+#include "cmSystemTools.h"
+#include "cmUVProcessChain.h"
+
+#include "cmsys/RegularExpression.hxx"
+
+#include <istream>
+#include <string>
+#include <vector>
+
+cmLDConfigLDConfigTool::cmLDConfigLDConfigTool(
+ cmRuntimeDependencyArchive* archive)
+ : cmLDConfigTool(archive)
+{
+}
+
+bool cmLDConfigLDConfigTool::GetLDConfigPaths(std::vector<std::string>& paths)
+{
+ std::string ldConfigPath =
+ this->Archive->GetMakefile()->GetSafeDefinition("CMAKE_LDCONFIG_COMMAND");
+ if (ldConfigPath.empty()) {
+ ldConfigPath = cmSystemTools::FindProgram(
+ "ldconfig", { "/sbin", "/usr/sbin", "/usr/local/sbin" });
+ if (ldConfigPath.empty()) {
+ this->Archive->SetError("Could not find ldconfig");
+ return false;
+ }
+ }
+
+ std::vector<std::string> ldConfigCommand;
+ cmSystemTools::ExpandListArgument(ldConfigPath, ldConfigCommand);
+ ldConfigCommand.emplace_back("-v");
+ ldConfigCommand.emplace_back("-N"); // Don't rebuild the cache.
+ ldConfigCommand.emplace_back("-X"); // Don't update links.
+
+ cmUVProcessChainBuilder builder;
+ builder.SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT)
+ .AddCommand(ldConfigCommand);
+ auto process = builder.Start();
+ if (!process.Valid()) {
+ this->Archive->SetError("Failed to start ldconfig process");
+ return false;
+ }
+
+ std::string line;
+ static const cmsys::RegularExpression regex("^([^\t:]*):");
+ while (std::getline(*process.OutputStream(), line)) {
+ cmsys::RegularExpressionMatch match;
+ if (regex.find(line.c_str(), match)) {
+ paths.push_back(match.match(1));
+ }
+ }
+
+ if (!process.Wait()) {
+ this->Archive->SetError("Failed to wait on ldconfig process");
+ return false;
+ }
+ auto status = process.GetStatus();
+ if (!status[0] || status[0]->ExitStatus != 0) {
+ this->Archive->SetError("Failed to run ldconfig");
+ return false;
+ }
+
+ return true;
+}
diff --git a/Source/cmLDConfigLDConfigTool.h b/Source/cmLDConfigLDConfigTool.h
new file mode 100644
index 0000000..d945a9b
--- /dev/null
+++ b/Source/cmLDConfigLDConfigTool.h
@@ -0,0 +1,22 @@
+/* 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
+
+#include "cmLDConfigTool.h"
+
+#include <string>
+#include <vector>
+
+class cmRuntimeDependencyArchive;
+
+class cmLDConfigLDConfigTool : public cmLDConfigTool
+{
+public:
+ cmLDConfigLDConfigTool(cmRuntimeDependencyArchive* archive);
+
+ bool GetLDConfigPaths(std::vector<std::string>& paths) override;
+};
+
+#endif
diff --git a/Source/cmLDConfigTool.cxx b/Source/cmLDConfigTool.cxx
new file mode 100644
index 0000000..8d5d563
--- /dev/null
+++ b/Source/cmLDConfigTool.cxx
@@ -0,0 +1,9 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmLDConfigTool.h"
+
+cmLDConfigTool::cmLDConfigTool(cmRuntimeDependencyArchive* archive)
+ : Archive(archive)
+{
+}
diff --git a/Source/cmLDConfigTool.h b/Source/cmLDConfigTool.h
new file mode 100644
index 0000000..c816562
--- /dev/null
+++ b/Source/cmLDConfigTool.h
@@ -0,0 +1,24 @@
+/* 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
+
+#include <string>
+#include <vector>
+
+class cmRuntimeDependencyArchive;
+
+class cmLDConfigTool
+{
+public:
+ cmLDConfigTool(cmRuntimeDependencyArchive* archive);
+ virtual ~cmLDConfigTool() = default;
+
+ virtual bool GetLDConfigPaths(std::vector<std::string>& paths) = 0;
+
+protected:
+ cmRuntimeDependencyArchive* Archive;
+};
+
+#endif
diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx
index 7850977..a278925 100644
--- a/Source/cmLinkDirectoriesCommand.cxx
+++ b/Source/cmLinkDirectoriesCommand.cxx
@@ -4,11 +4,11 @@
#include <sstream>
-#include "cmAlgorithms.h"
#include "cmGeneratorExpression.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
class cmExecutionStatus;
diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h
index ae4fb7f..1a439de 100644
--- a/Source/cmLinkDirectoriesCommand.h
+++ b/Source/cmLinkDirectoriesCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -26,7 +28,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmLinkDirectoriesCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmLinkDirectoriesCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h
index 5b635b5..6450c62 100644
--- a/Source/cmLinkItem.h
+++ b/Source/cmLinkItem.h
@@ -58,6 +58,9 @@ struct cmLinkInterfaceLibraries
{
// Libraries listed in the interface.
std::vector<cmLinkItem> Libraries;
+
+ // Whether the list depends on a genex referencing the head target.
+ bool HadHeadSensitiveCondition = false;
};
struct cmLinkInterface : public cmLinkInterfaceLibraries
@@ -84,7 +87,6 @@ struct cmOptionalLinkInterface : public cmLinkInterface
bool LibrariesDone = false;
bool AllDone = false;
bool Exists = false;
- bool HadHeadSensitiveCondition = false;
const char* ExplicitLibraries = nullptr;
};
diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h
index af25fba..484ab0a 100644
--- a/Source/cmLinkLibrariesCommand.h
+++ b/Source/cmLinkLibrariesCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -25,7 +27,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmLinkLibrariesCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmLinkLibrariesCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
index 469faca..8746b35 100644
--- a/Source/cmLinkLineComputer.cxx
+++ b/Source/cmLinkLineComputer.cxx
@@ -110,8 +110,7 @@ std::string cmLinkLineComputer::ComputeLinkPath(
if (target->GetType() == cmStateEnums::STATIC_LIBRARY ||
target->GetType() == cmStateEnums::SHARED_LIBRARY) {
cmStateEnums::ArtifactType type = cmStateEnums::RuntimeBinaryArtifact;
- if (target->GetType() == cmStateEnums::SHARED_LIBRARY &&
- target->IsDLLPlatform()) {
+ if (target->HasImportLibrary(cli.GetConfig())) {
type = cmStateEnums::ImportLibraryArtifact;
}
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx
index 8d2add6..656907a 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -9,7 +9,6 @@
#include <utility>
#include <vector>
-#include "cmAlgorithms.h"
#include "cmComputeLinkInformation.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
@@ -17,6 +16,7 @@
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
class cmOutputConverter;
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 1b01ea2..8c14596 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -13,6 +13,9 @@
#include <stdio.h>
#include <stdlib.h> // required for atoi
#include <utility>
+#include <vector>
+
+#include "cm_memory.hxx"
#include "cmAlgorithms.h"
#include "cmGeneratorExpression.h"
@@ -20,6 +23,7 @@
#include "cmMessageType.h"
#include "cmPolicies.h"
#include "cmRange.h"
+#include "cmStringAlgorithms.h"
#include "cmStringReplaceHelper.h"
#include "cmSystemTools.h"
@@ -219,7 +223,7 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args)
value += varArgsExpanded[item];
}
- this->Makefile->AddDefinition(variableName, value.c_str());
+ this->Makefile->AddDefinition(variableName, value);
return true;
}
@@ -243,7 +247,7 @@ bool cmListCommand::HandleAppendCommand(std::vector<std::string> const& args)
std::string::size_type(listString.empty() || args.empty());
listString += &";"[offset] + cmJoin(cmMakeRange(args).advance(2), ";");
- this->Makefile->AddDefinition(listName, listString.c_str());
+ this->Makefile->AddDefinition(listName, listString);
return true;
}
@@ -268,7 +272,7 @@ bool cmListCommand::HandlePrependCommand(std::vector<std::string> const& args)
listString.insert(0,
cmJoin(cmMakeRange(args).advance(2), ";") + &";"[offset]);
- this->Makefile->AddDefinition(listName, listString.c_str());
+ this->Makefile->AddDefinition(listName, listString);
return true;
}
@@ -296,7 +300,7 @@ bool cmListCommand::HandlePopBackCommand(std::vector<std::string> const& args)
// Ok, assign elements to be removed to the given variables
for (; !varArgsExpanded.empty() && ai != args.cend(); ++ai) {
assert(!ai->empty());
- this->Makefile->AddDefinition(*ai, varArgsExpanded.back().c_str());
+ this->Makefile->AddDefinition(*ai, varArgsExpanded.back());
varArgsExpanded.pop_back();
}
// Undefine the rest variables if the list gets empty earlier...
@@ -305,8 +309,7 @@ bool cmListCommand::HandlePopBackCommand(std::vector<std::string> const& args)
}
}
- this->Makefile->AddDefinition(listName,
- cmJoin(varArgsExpanded, ";").c_str());
+ this->Makefile->AddDefinition(listName, cmJoin(varArgsExpanded, ";"));
} else if (ai !=
args.cend()) { // The list is empty, but some args were given
@@ -344,7 +347,7 @@ bool cmListCommand::HandlePopFrontCommand(std::vector<std::string> const& args)
auto vi = varArgsExpanded.begin();
for (; vi != varArgsExpanded.end() && ai != args.cend(); ++ai, ++vi) {
assert(!ai->empty());
- this->Makefile->AddDefinition(*ai, vi->c_str());
+ this->Makefile->AddDefinition(*ai, *vi);
}
varArgsExpanded.erase(varArgsExpanded.begin(), vi);
// Undefine the rest variables if the list gets empty earlier...
@@ -353,8 +356,7 @@ bool cmListCommand::HandlePopFrontCommand(std::vector<std::string> const& args)
}
}
- this->Makefile->AddDefinition(listName,
- cmJoin(varArgsExpanded, ";").c_str());
+ this->Makefile->AddDefinition(listName, cmJoin(varArgsExpanded, ";"));
} else if (ai !=
args.cend()) { // The list is empty, but some args were given
@@ -388,7 +390,7 @@ bool cmListCommand::HandleFindCommand(std::vector<std::string> const& args)
if (it != varArgsExpanded.end()) {
std::ostringstream indexStream;
indexStream << std::distance(varArgsExpanded.begin(), it);
- this->Makefile->AddDefinition(variableName, indexStream.str().c_str());
+ this->Makefile->AddDefinition(variableName, indexStream.str());
return true;
}
@@ -434,7 +436,7 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args)
args.end());
std::string value = cmJoin(varArgsExpanded, ";");
- this->Makefile->AddDefinition(listName, value.c_str());
+ this->Makefile->AddDefinition(listName, value);
return true;
}
@@ -462,7 +464,7 @@ bool cmListCommand::HandleJoinCommand(std::vector<std::string> const& args)
std::string value =
cmJoin(cmMakeRange(varArgsExpanded.begin(), varArgsExpanded.end()), glue);
- this->Makefile->AddDefinition(variableName, value.c_str());
+ this->Makefile->AddDefinition(variableName, value);
return true;
}
@@ -491,7 +493,7 @@ bool cmListCommand::HandleRemoveItemCommand(
cmRemoveMatching(varArgsExpanded, cmMakeRange(remBegin, remEnd));
std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";");
- this->Makefile->AddDefinition(listName, value.c_str());
+ this->Makefile->AddDefinition(listName, value);
return true;
}
@@ -512,7 +514,7 @@ bool cmListCommand::HandleReverseCommand(std::vector<std::string> const& args)
std::string value = cmJoin(cmReverseRange(varArgsExpanded), ";");
- this->Makefile->AddDefinition(listName, value.c_str());
+ this->Makefile->AddDefinition(listName, value);
return true;
}
@@ -537,7 +539,7 @@ bool cmListCommand::HandleRemoveDuplicatesCommand(
std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";");
- this->Makefile->AddDefinition(listName, value.c_str());
+ this->Makefile->AddDefinition(listName, value);
return true;
}
@@ -1088,7 +1090,7 @@ bool cmListCommand::HandleTransformCommand(
}
this->Makefile->AddDefinition(command.OutputName,
- cmJoin(varArgsExpanded, ";").c_str());
+ cmJoin(varArgsExpanded, ";"));
return true;
}
@@ -1297,7 +1299,7 @@ bool cmListCommand::HandleSortCommand(std::vector<std::string> const& args)
}
std::string value = cmJoin(varArgsExpanded, ";");
- this->Makefile->AddDefinition(listName, value.c_str());
+ this->Makefile->AddDefinition(listName, value);
return true;
}
@@ -1346,7 +1348,7 @@ bool cmListCommand::HandleSublistCommand(std::vector<std::string> const& args)
: size_type(start + length);
std::vector<std::string> sublist(varArgsExpanded.begin() + start,
varArgsExpanded.begin() + end);
- this->Makefile->AddDefinition(variableName, cmJoin(sublist, ";").c_str());
+ this->Makefile->AddDefinition(variableName, cmJoin(sublist, ";"));
return true;
}
@@ -1403,7 +1405,7 @@ bool cmListCommand::HandleRemoveAtCommand(std::vector<std::string> const& args)
std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";");
- this->Makefile->AddDefinition(listName, value.c_str());
+ this->Makefile->AddDefinition(listName, value);
return true;
}
@@ -1497,6 +1499,6 @@ bool cmListCommand::FilterRegex(std::vector<std::string> const& args,
std::remove_if(argsBegin, argsEnd, MatchesRegex(regex, includeMatches));
std::string value = cmJoin(cmMakeRange(argsBegin, newArgsEnd), ";");
- this->Makefile->AddDefinition(listName, value.c_str());
+ this->Makefile->AddDefinition(listName, value);
return true;
}
diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h
index ea3d643..70c7f4e 100644
--- a/Source/cmListCommand.h
+++ b/Source/cmListCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -22,7 +24,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmListCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmListCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index 9457415..5de1a74 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -6,7 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <iosfwd>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <stddef.h>
#include <string>
#include <utility>
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index b1fee8d..3fd7343 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -153,7 +153,7 @@ void cmLoadCacheCommand::CheckLine(const char* line)
// prefix.
var = this->Prefix + var;
if (!value.empty()) {
- this->Makefile->AddDefinition(var, value.c_str());
+ this->Makefile->AddDefinition(var, value);
} else {
this->Makefile->RemoveDefinition(var);
}
diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h
index e0f6e4f..45e52f0 100644
--- a/Source/cmLoadCacheCommand.h
+++ b/Source/cmLoadCacheCommand.h
@@ -9,6 +9,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -24,7 +26,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmLoadCacheCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmLoadCacheCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index 69751b6..5ae660a 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -3,10 +3,14 @@
#include "cmLoadCommandCommand.h"
#include <signal.h>
+
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <utility>
+
+#include "cm_memory.hxx"
#include "cmCPluginAPI.cxx"
#include "cmCPluginAPI.h"
@@ -21,30 +25,98 @@ class cmExecutionStatus;
# include <malloc.h> /* for malloc/free on QNX */
#endif
-extern "C" void TrapsForSignalsCFunction(int sig);
+namespace {
+
+const char* LastName = nullptr;
+
+extern "C" void TrapsForSignals(int sig)
+{
+ fprintf(stderr, "CMake loaded command %s crashed with signal: %d.\n",
+ LastName, sig);
+}
+
+struct SignalHandlerGuard
+{
+ explicit SignalHandlerGuard(const char* name)
+ {
+ LastName = name != nullptr ? name : "????";
+
+ signal(SIGSEGV, TrapsForSignals);
+#ifdef SIGBUS
+ signal(SIGBUS, TrapsForSignals);
+#endif
+ signal(SIGILL, TrapsForSignals);
+ }
+
+ ~SignalHandlerGuard()
+ {
+ signal(SIGSEGV, nullptr);
+#ifdef SIGBUS
+ signal(SIGBUS, nullptr);
+#endif
+ signal(SIGILL, nullptr);
+ }
+
+ SignalHandlerGuard(SignalHandlerGuard const&) = delete;
+ SignalHandlerGuard& operator=(SignalHandlerGuard const&) = delete;
+};
+
+struct LoadedCommandImpl : cmLoadedCommandInfo
+{
+ explicit LoadedCommandImpl(CM_INIT_FUNCTION init)
+ : cmLoadedCommandInfo{ 0, 0, &cmStaticCAPI, 0,
+ nullptr, nullptr, nullptr, nullptr,
+ nullptr, nullptr, nullptr, nullptr }
+ {
+ init(this);
+ }
+
+ ~LoadedCommandImpl()
+ {
+ if (this->Destructor) {
+ SignalHandlerGuard guard(this->Name);
+ this->Destructor(this);
+ }
+ if (this->Error != nullptr) {
+ free(this->Error);
+ }
+ }
+
+ LoadedCommandImpl(LoadedCommandImpl const&) = delete;
+ LoadedCommandImpl& operator=(LoadedCommandImpl const&) = delete;
+
+ int DoInitialPass(cmMakefile* mf, int argc, char* argv[])
+ {
+ SignalHandlerGuard guard(this->Name);
+ return this->InitialPass(this, mf, argc, argv);
+ }
+
+ void DoFinalPass(cmMakefile* mf)
+ {
+ SignalHandlerGuard guard(this->Name);
+ this->FinalPass(this, mf);
+ }
+};
// a class for loadabple commands
class cmLoadedCommand : public cmCommand
{
public:
- cmLoadedCommand()
+ cmLoadedCommand() = default;
+ explicit cmLoadedCommand(CM_INIT_FUNCTION init)
+ : Impl(std::make_shared<LoadedCommandImpl>(init))
{
- memset(&this->info, 0, sizeof(this->info));
- this->info.CAPI = &cmStaticCAPI;
}
- //! clean up any memory allocated by the plugin
- ~cmLoadedCommand() override;
-
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override
+ std::unique_ptr<cmCommand> Clone() override
{
- cmLoadedCommand* newC = new cmLoadedCommand;
+ auto newC = cm::make_unique<cmLoadedCommand>();
// we must copy when we clone
- memcpy(&newC->info, &this->info, sizeof(info));
- return newC;
+ newC->Impl = this->Impl;
+ return std::unique_ptr<cmCommand>(std::move(newC));
}
/**
@@ -54,66 +126,20 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&) override;
- /**
- * This is called at the end after all the information
- * specified by the command is accumulated. Most commands do
- * not implement this method. At this point, reading and
- * writing to the cache can be done.
- */
- void FinalPass() override;
- bool HasFinalPass() const override
- {
- return this->info.FinalPass != nullptr;
- }
-
- static const char* LastName;
- static void TrapsForSignals(int sig)
- {
- fprintf(stderr, "CMake loaded command %s crashed with signal: %d.\n",
- cmLoadedCommand::LastName, sig);
- }
- static void InstallSignalHandlers(const char* name, int remove = 0)
- {
- cmLoadedCommand::LastName = name;
- if (!name) {
- cmLoadedCommand::LastName = "????";
- }
-
- if (!remove) {
- signal(SIGSEGV, TrapsForSignalsCFunction);
-#ifdef SIGBUS
- signal(SIGBUS, TrapsForSignalsCFunction);
-#endif
- signal(SIGILL, TrapsForSignalsCFunction);
- } else {
- signal(SIGSEGV, nullptr);
-#ifdef SIGBUS
- signal(SIGBUS, nullptr);
-#endif
- signal(SIGILL, nullptr);
- }
- }
-
- cmLoadedCommandInfo info;
+private:
+ std::shared_ptr<LoadedCommandImpl> Impl;
};
-extern "C" void TrapsForSignalsCFunction(int sig)
-{
- cmLoadedCommand::TrapsForSignals(sig);
-}
-
-const char* cmLoadedCommand::LastName = nullptr;
-
bool cmLoadedCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (!info.InitialPass) {
+ if (!this->Impl->InitialPass) {
return true;
}
// clear the error string
- if (this->info.Error) {
- free(this->info.Error);
+ if (this->Impl->Error) {
+ free(this->Impl->Error);
}
// create argc and argv and then invoke the command
@@ -126,42 +152,26 @@ bool cmLoadedCommand::InitialPass(std::vector<std::string> const& args,
for (i = 0; i < argc; ++i) {
argv[i] = strdup(args[i].c_str());
}
- cmLoadedCommand::InstallSignalHandlers(info.Name);
- int result = info.InitialPass(&info, this->Makefile, argc, argv);
- cmLoadedCommand::InstallSignalHandlers(info.Name, 1);
+ int result = this->Impl->DoInitialPass(this->Makefile, argc, argv);
cmFreeArguments(argc, argv);
if (result) {
+ if (this->Impl->FinalPass) {
+ auto impl = this->Impl;
+ this->Makefile->AddFinalAction(
+ [impl](cmMakefile& makefile) { impl->DoFinalPass(&makefile); });
+ }
return true;
}
/* Initial Pass must have failed so set the error string */
- if (this->info.Error) {
- this->SetError(this->info.Error);
+ if (this->Impl->Error) {
+ this->SetError(this->Impl->Error);
}
return false;
}
-void cmLoadedCommand::FinalPass()
-{
- if (this->info.FinalPass) {
- cmLoadedCommand::InstallSignalHandlers(info.Name);
- this->info.FinalPass(&this->info, this->Makefile);
- cmLoadedCommand::InstallSignalHandlers(info.Name, 1);
- }
-}
-
-cmLoadedCommand::~cmLoadedCommand()
-{
- if (this->info.Destructor) {
- cmLoadedCommand::InstallSignalHandlers(info.Name);
- this->info.Destructor(&this->info);
- cmLoadedCommand::InstallSignalHandlers(info.Name, 1);
- }
- if (this->info.Error) {
- free(this->info.Error);
- }
-}
+} // namespace
// cmLoadCommandCommand
bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args,
@@ -220,7 +230,7 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args,
}
// Report what file was loaded for this command.
- this->Makefile->AddDefinition(reportVar, fullPath.c_str());
+ this->Makefile->AddDefinition(reportVar, fullPath);
// find the init function
std::string initFuncName = args[0] + "Init";
@@ -236,10 +246,9 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args,
// if the symbol is found call it to set the name on the
// function blocker
if (initFunction) {
- // create a function blocker and set it up
- cmLoadedCommand* f = new cmLoadedCommand();
- (*initFunction)(&f->info);
- this->Makefile->GetState()->AddScriptedCommand(args[0], f);
+ this->Makefile->GetState()->AddScriptedCommand(
+ args[0],
+ cmLegacyCommandWrapper(cm::make_unique<cmLoadedCommand>(initFunction)));
return true;
}
this->SetError("Attempt to load command failed. "
diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h
index 021e6c7..d81cefb 100644
--- a/Source/cmLoadCommandCommand.h
+++ b/Source/cmLoadCommandCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -15,7 +17,10 @@ class cmExecutionStatus;
class cmLoadCommandCommand : public cmCommand
{
public:
- cmCommand* Clone() override { return new cmLoadCommandCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmLoadCommandCommand>();
+ }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
};
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 3abf2dd..28ae82e 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -21,27 +21,30 @@
#include "cmState.h"
#include "cmStateDirectory.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTestGenerator.h"
#include "cmVersion.h"
#include "cmake.h"
+#include "cmsys/RegularExpression.hxx"
#if defined(CMAKE_BUILD_WITH_CMAKE)
# define CM_LG_ENCODE_OBJECT_NAMES
# include "cmCryptoHash.h"
#endif
-#include "cmsys/RegularExpression.hxx"
#include <algorithm>
#include <assert.h>
#include <initializer_list>
#include <iterator>
+#include <memory>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <unordered_set>
#include <utility>
+#include <vector>
#if defined(__HAIKU__)
# include <FindDirectory.h>
@@ -1017,7 +1020,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
}
for (std::string const& i : impDirVec) {
- if (implicitSet.insert(i).second) {
+ if (implicitSet.insert(cmSystemTools::GetRealPath(i)).second) {
implicitDirs.emplace_back(i);
}
}
@@ -1028,7 +1031,8 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
&lang](std::string const& dir) {
return (
// Do not exclude directories that are not in an excluded set.
- ((implicitSet.find(dir) == implicitSet.end()) &&
+ ((implicitSet.find(cmSystemTools::GetRealPath(dir)) ==
+ implicitSet.end()) &&
(implicitExclude.find(dir) == implicitExclude.end()))
// Do not exclude entries of the CPATH environment variable even though
// they are implicitly searched by the compiler. They are meant to be
@@ -1082,7 +1086,8 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
if (!stripImplicitDirs) {
// Append implicit directories that were requested by the user only
for (BT<std::string> const& udr : userDirs) {
- if (implicitSet.find(udr.Value) != implicitSet.end()) {
+ if (implicitSet.find(cmSystemTools::GetRealPath(udr.Value)) !=
+ implicitSet.end()) {
emitBT(udr);
}
}
@@ -1130,11 +1135,13 @@ void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags,
std::string const& linkLanguage,
cmGeneratorTarget* target)
{
- this->AppendFlags(
- flags, this->Makefile->GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS"));
- if (!config.empty()) {
- std::string name = "CMAKE_STATIC_LINKER_FLAGS_" + config;
- this->AppendFlags(flags, this->Makefile->GetSafeDefinition(name));
+ if (linkLanguage != "Swift") {
+ this->AppendFlags(
+ flags, this->Makefile->GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS"));
+ if (!config.empty()) {
+ std::string name = "CMAKE_STATIC_LINKER_FLAGS_" + config;
+ this->AppendFlags(flags, this->Makefile->GetSafeDefinition(name));
+ }
}
this->AppendFlags(flags, target->GetProperty("STATIC_LIBRARY_FLAGS"));
if (!config.empty()) {
@@ -1511,8 +1518,10 @@ std::string cmLocalGenerator::GetLinkLibsCMP0065(
}
CM_FALLTHROUGH;
case cmPolicies::OLD:
- // OLD behavior is to always add the flags
- add_shlib_flags = true;
+ // OLD behavior is to always add the flags, except on AIX where
+ // we compute symbol exports if ENABLE_EXPORTS is on.
+ add_shlib_flags =
+ !(tgt.Target->IsAIX() && tgt.GetPropertyAsBool("ENABLE_EXPORTS"));
break;
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
@@ -1521,8 +1530,10 @@ std::string cmLocalGenerator::GetLinkLibsCMP0065(
cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0065));
CM_FALLTHROUGH;
case cmPolicies::NEW:
- // NEW behavior is to only add the flags if ENABLE_EXPORTS is on
- add_shlib_flags = tgt.GetPropertyAsBool("ENABLE_EXPORTS");
+ // NEW behavior is to only add the flags if ENABLE_EXPORTS is on,
+ // except on AIX where we compute symbol exports.
+ add_shlib_flags =
+ !tgt.Target->IsAIX() && tgt.GetPropertyAsBool("ENABLE_EXPORTS");
break;
}
@@ -2963,7 +2974,7 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target,
// back to the directory-level values set by the user.
cmMakefile* mf = this->Makefile;
cmMakefile::ScopePushPop varScope(mf);
- mf->AddDefinition("MACOSX_BUNDLE_EXECUTABLE_NAME", targetName.c_str());
+ mf->AddDefinition("MACOSX_BUNDLE_EXECUTABLE_NAME", targetName);
cmLGInfoProp(mf, target, "MACOSX_BUNDLE_INFO_STRING");
cmLGInfoProp(mf, target, "MACOSX_BUNDLE_ICON_FILE");
cmLGInfoProp(mf, target, "MACOSX_BUNDLE_GUI_IDENTIFIER");
@@ -3002,7 +3013,7 @@ void cmLocalGenerator::GenerateFrameworkInfoPList(
// back to the directory-level values set by the user.
cmMakefile* mf = this->Makefile;
cmMakefile::ScopePushPop varScope(mf);
- mf->AddDefinition("MACOSX_FRAMEWORK_NAME", targetName.c_str());
+ mf->AddDefinition("MACOSX_FRAMEWORK_NAME", targetName);
cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_ICON_FILE");
cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_IDENTIFIER");
cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_SHORT_VERSION_STRING");
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 81cafa3..248f4a6 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -5,7 +5,7 @@
#include <algorithm>
#include <assert.h>
#include <iterator>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <sstream>
#include <stdio.h>
#include <utility>
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index c392e97..713c985 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -5,11 +5,12 @@
#include "cmsys/FStream.hxx"
#include "cmsys/Terminal.h"
#include <algorithm>
-#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
#include <utility>
+#include "cm_memory.hxx"
+
#include "cmAlgorithms.h"
#include "cmCustomCommand.h" // IWYU pragma: keep
#include "cmCustomCommandGenerator.h"
@@ -31,6 +32,7 @@
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmVersion.h"
#include "cmake.h"
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index 3fdafd2..585eb3c 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -6,7 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <map>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <string>
#include "cmGlobalVisualStudioGenerator.h"
diff --git a/Source/cmMachO.cxx b/Source/cmMachO.cxx
index d4af1e0..bec3ad8 100644
--- a/Source/cmMachO.cxx
+++ b/Source/cmMachO.cxx
@@ -2,12 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMachO.h"
+#include "cmAlgorithms.h"
#include "cmsys/FStream.hxx"
-#include <algorithm>
-#include <stddef.h>
+
+#include <cstddef>
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
// Include the Mach-O format information system header.
#include <mach-o/fat.h>
#include <mach-o/loader.h>
@@ -120,7 +123,7 @@ protected:
// Implementation for reading Mach-O header and load commands.
// This is 32 or 64 bit arch specific.
-template <class T>
+template <typename T>
class cmMachOHeaderAndLoadCommandsImpl : public cmMachOHeaderAndLoadCommands
{
public:
@@ -306,15 +309,11 @@ bool cmMachOInternal::read_mach_o(uint32_t file_offset)
// External class implementation.
cmMachO::cmMachO(const char* fname)
- : Internal(nullptr)
+ : Internal(cm::make_unique<cmMachOInternal>(fname))
{
- this->Internal = new cmMachOInternal(fname);
}
-cmMachO::~cmMachO()
-{
- delete this->Internal;
-}
+cmMachO::~cmMachO() = default;
std::string const& cmMachO::GetErrorMessage() const
{
diff --git a/Source/cmMachO.h b/Source/cmMachO.h
index 5482465..0c44b55 100644
--- a/Source/cmMachO.h
+++ b/Source/cmMachO.h
@@ -41,7 +41,7 @@ public:
private:
friend class cmMachOInternal;
bool Valid() const;
- cmMachOInternal* Internal;
+ std::unique_ptr<cmMachOInternal> Internal;
};
#endif
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index e9c6aea..1f2b5b2 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -6,44 +6,27 @@
#include <stdio.h>
#include <utility>
+#include "cm_memory.hxx"
+
#include "cmAlgorithms.h"
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmPolicies.h"
#include "cmRange.h"
#include "cmState.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
// define the class for macro commands
-class cmMacroHelperCommand : public cmCommand
+class cmMacroHelperCommand
{
public:
/**
- * This is a virtual constructor for the command.
- */
- cmCommand* Clone() override
- {
- cmMacroHelperCommand* newC = new cmMacroHelperCommand;
- // we must copy when we clone
- newC->Args = this->Args;
- newC->Functions = this->Functions;
- newC->FilePath = this->FilePath;
- newC->Policies = this->Policies;
- return newC;
- }
-
- /**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
- bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
- cmExecutionStatus&) override;
-
- bool InitialPass(std::vector<std::string> const&,
- cmExecutionStatus&) override
- {
- return false;
- }
+ bool operator()(std::vector<cmListFileArgument> const& args,
+ cmExecutionStatus& inStatus) const;
std::vector<std::string> Args;
std::vector<cmListFileFunction> Functions;
@@ -51,12 +34,15 @@ public:
std::string FilePath;
};
-bool cmMacroHelperCommand::InvokeInitialPass(
- const std::vector<cmListFileArgument>& args, cmExecutionStatus& inStatus)
+bool cmMacroHelperCommand::operator()(
+ std::vector<cmListFileArgument> const& args,
+ cmExecutionStatus& inStatus) const
{
+ cmMakefile& makefile = inStatus.GetMakefile();
+
// Expand the argument list to the macro.
std::vector<std::string> expandedArgs;
- this->Makefile->ExpandArguments(args, expandedArgs);
+ makefile.ExpandArguments(args, expandedArgs);
// make sure the number of arguments passed is at least the number
// required by the signature
@@ -64,11 +50,11 @@ bool cmMacroHelperCommand::InvokeInitialPass(
std::string errorMsg =
"Macro invoked with incorrect arguments for macro named: ";
errorMsg += this->Args[0];
- this->SetError(errorMsg);
+ inStatus.SetError(errorMsg);
return false;
}
- cmMakefile::MacroPushPop macroScope(this->Makefile, this->FilePath,
+ cmMakefile::MacroPushPop macroScope(&makefile, this->FilePath,
this->Policies);
// set the value of argc
@@ -130,9 +116,8 @@ bool cmMacroHelperCommand::InvokeInitialPass(
arg.Line = k.Line;
newLFF.Arguments.push_back(std::move(arg));
}
- cmExecutionStatus status;
- if (!this->Makefile->ExecuteCommand(newLFF, status) ||
- status.GetNestedError()) {
+ cmExecutionStatus status(makefile);
+ if (!makefile.ExecuteCommand(newLFF, status) || status.GetNestedError()) {
// The error message should have already included the call stack
// so we do not need to report an error here.
macroScope.Quiet();
@@ -164,12 +149,12 @@ bool cmMacroFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
if (!this->Depth) {
mf.AppendProperty("MACROS", this->Args[0].c_str());
// create a new command and add it to cmake
- cmMacroHelperCommand* f = new cmMacroHelperCommand();
- f->Args = this->Args;
- f->Functions = this->Functions;
- f->FilePath = this->GetStartingContext().FilePath;
- mf.RecordPolicies(f->Policies);
- mf.GetState()->AddScriptedCommand(this->Args[0], f);
+ cmMacroHelperCommand f;
+ f.Args = this->Args;
+ f.Functions = this->Functions;
+ f.FilePath = this->GetStartingContext().FilePath;
+ mf.RecordPolicies(f.Policies);
+ mf.GetState()->AddScriptedCommand(this->Args[0], std::move(f));
// remove the function blocker now that the macro is defined
mf.RemoveFunctionBlocker(this, lff);
return true;
@@ -211,8 +196,10 @@ bool cmMacroCommand::InitialPass(std::vector<std::string> const& args,
}
// create a function blocker
- cmMacroFunctionBlocker* f = new cmMacroFunctionBlocker();
- cmAppend(f->Args, args);
- this->Makefile->AddFunctionBlocker(f);
+ {
+ auto fb = cm::make_unique<cmMacroFunctionBlocker>();
+ cmAppend(fb->Args, args);
+ this->Makefile->AddFunctionBlocker(std::move(fb));
+ }
return true;
}
diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h
index b54ed66..3ebd959 100644
--- a/Source/cmMacroCommand.h
+++ b/Source/cmMacroCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
#include "cmFunctionBlocker.h"
#include "cmListFileCache.h"
@@ -34,7 +36,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmMacroCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmMacroCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h
index d2637f3..b1fb49b 100644
--- a/Source/cmMakeDirectoryCommand.h
+++ b/Source/cmMakeDirectoryCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -27,7 +29,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmMakeDirectoryCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmMakeDirectoryCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index e0f69cb..8188ffa 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -9,14 +9,13 @@
#include <cstring>
#include <ctype.h>
#include <iterator>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <utility>
#include "cmAlgorithms.h"
-#include "cmCommand.h"
#include "cmCommandArgumentParserHelper.h"
#include "cmCustomCommand.h"
#include "cmCustomCommandLines.h"
@@ -118,8 +117,6 @@ cmMakefile::~cmMakefile()
cmDeleteAll(this->SourceFiles);
cmDeleteAll(this->Tests);
cmDeleteAll(this->ImportedTargetsOwned);
- cmDeleteAll(this->FinalPassCommands);
- cmDeleteAll(this->FunctionBlockers);
cmDeleteAll(this->EvaluationFiles);
}
@@ -390,12 +387,8 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
}
// Lookup the command prototype.
- if (cmCommand* proto =
+ if (cmState::Command command =
this->GetState()->GetCommandByExactName(lff.Name.Lower)) {
- // Clone the prototype.
- std::unique_ptr<cmCommand> pcmd(proto->Clone());
- pcmd->SetMakefile(this);
-
// Decide whether to invoke the command.
if (!cmSystemTools::GetFatalErrorOccured()) {
// if trace is enabled, print out invoke information
@@ -403,22 +396,19 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
this->PrintCommandTrace(lff);
}
// Try invoking the command.
- bool invokeSucceeded = pcmd->InvokeInitialPass(lff.Arguments, status);
+ bool invokeSucceeded = command(lff.Arguments, status);
bool hadNestedError = status.GetNestedError();
if (!invokeSucceeded || hadNestedError) {
if (!hadNestedError) {
// The command invocation requested that we report an error.
std::string const error =
- std::string(lff.Name.Original) + " " + pcmd->GetError();
+ std::string(lff.Name.Original) + " " + status.GetError();
this->IssueMessage(MessageType::FATAL_ERROR, error);
}
result = false;
if (this->GetCMakeInstance()->GetWorkingMode() != cmake::NORMAL_MODE) {
cmSystemTools::SetFatalErrorOccured();
}
- } else if (pcmd->HasFinalPass()) {
- // use the command
- this->FinalPassCommands.push_back(pcmd.release());
}
}
} else {
@@ -567,8 +557,9 @@ void cmMakefile::IncludeScope::EnforceCMP0011()
bool cmMakefile::ReadDependentFile(const std::string& filename,
bool noPolicyScope)
{
- this->AddDefinition("CMAKE_PARENT_LIST_FILE",
- this->GetDefinition("CMAKE_CURRENT_LIST_FILE"));
+ if (const char* def = this->GetDefinition("CMAKE_CURRENT_LIST_FILE")) {
+ this->AddDefinition("CMAKE_PARENT_LIST_FILE", def);
+ }
std::string filenametoread = cmSystemTools::CollapseFullPath(
filename, this->GetCurrentSourceDirectory());
@@ -651,9 +642,9 @@ void cmMakefile::ReadListFile(cmListFile const& listFile,
this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE");
std::string currentFile = this->GetSafeDefinition("CMAKE_CURRENT_LIST_FILE");
- this->AddDefinition("CMAKE_CURRENT_LIST_FILE", filenametoread.c_str());
+ this->AddDefinition("CMAKE_CURRENT_LIST_FILE", filenametoread);
this->AddDefinition("CMAKE_CURRENT_LIST_DIR",
- cmSystemTools::GetFilenamePath(filenametoread).c_str());
+ cmSystemTools::GetFilenamePath(filenametoread));
this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE");
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE");
@@ -662,7 +653,7 @@ void cmMakefile::ReadListFile(cmListFile const& listFile,
// Run the parsed commands.
const size_t numberFunctions = listFile.Functions.size();
for (size_t i = 0; i < numberFunctions; ++i) {
- cmExecutionStatus status;
+ cmExecutionStatus status(*this);
this->ExecuteCommand(listFile.Functions[i], status);
if (cmSystemTools::GetFatalErrorOccured()) {
break;
@@ -674,10 +665,10 @@ void cmMakefile::ReadListFile(cmListFile const& listFile,
}
this->CheckForUnusedVariables();
- this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str());
- this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str());
+ this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile);
+ this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile);
this->AddDefinition("CMAKE_CURRENT_LIST_DIR",
- cmSystemTools::GetFilenamePath(currentFile).c_str());
+ cmSystemTools::GetFilenamePath(currentFile));
this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE");
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE");
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR");
@@ -769,6 +760,11 @@ struct file_not_persistent
};
}
+void cmMakefile::AddFinalAction(FinalAction action)
+{
+ this->FinalActions.push_back(std::move(action));
+}
+
void cmMakefile::FinalPass()
{
// do all the variable expansions here
@@ -776,8 +772,8 @@ void cmMakefile::FinalPass()
// give all the commands a chance to do something
// after the file has been parsed before generation
- for (cmCommand* fpCommand : this->FinalPassCommands) {
- fpCommand->FinalPass();
+ for (FinalAction& action : this->FinalActions) {
+ action(*this);
}
// go through all configured files and see which ones still exist.
@@ -1540,7 +1536,7 @@ void cmMakefile::Configure()
cmSystemTools::MakeDirectory(filesDir);
assert(cmSystemTools::FileExists(currentStart, true));
- this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart.c_str());
+ this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart);
cmListFile listFile;
if (!listFile.ParseFile(currentStart.c_str(), this->GetMessenger(),
@@ -1788,12 +1784,8 @@ void cmMakefile::AddSystemIncludeDirectories(const std::set<std::string>& incs)
}
}
-void cmMakefile::AddDefinition(const std::string& name, const char* value)
+void cmMakefile::AddDefinition(const std::string& name, cm::string_view value)
{
- if (!value) {
- return;
- }
-
if (this->VariableInitialized(name)) {
this->LogUnused("changing definition", name);
}
@@ -1803,11 +1795,16 @@ void cmMakefile::AddDefinition(const std::string& name, const char* value)
cmVariableWatch* vv = this->GetVariableWatch();
if (vv) {
vv->VariableAccessed(name, cmVariableWatch::VARIABLE_MODIFIED_ACCESS,
- value, this);
+ value.data(), this);
}
#endif
}
+void cmMakefile::AddDefinitionBool(const std::string& name, bool value)
+{
+ this->AddDefinition(name, value ? "ON" : "OFF");
+}
+
void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
const char* doc,
cmStateEnums::CacheEntryType type,
@@ -1853,23 +1850,6 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
this->StateSnapshot.RemoveDefinition(name);
}
-void cmMakefile::AddDefinition(const std::string& name, bool value)
-{
- if (this->VariableInitialized(name)) {
- this->LogUnused("changing definition", name);
- }
-
- this->StateSnapshot.SetDefinition(name, value ? "ON" : "OFF");
-
-#ifdef CMAKE_BUILD_WITH_CMAKE
- cmVariableWatch* vv = this->GetVariableWatch();
- if (vv) {
- vv->VariableAccessed(name, cmVariableWatch::VARIABLE_MODIFIED_ACCESS,
- value ? "ON" : "OFF", this);
- }
-#endif
-}
-
void cmMakefile::CheckForUnusedVariables() const
{
if (!this->WarnUnused) {
@@ -3077,19 +3057,11 @@ bool cmMakefile::IsFunctionBlocked(const cmListFileFunction& lff,
cmExecutionStatus& status)
{
// if there are no blockers get out of here
- if (this->FunctionBlockers.begin() == this->FunctionBlockers.end()) {
+ if (this->FunctionBlockers.empty()) {
return false;
}
- // loop over all function blockers to see if any block this command
- // evaluate in reverse, this is critical for balanced IF statements etc
- for (cmFunctionBlocker* pos : cmReverseRange(this->FunctionBlockers)) {
- if (pos->IsFunctionBlocked(lff, *this, status)) {
- return true;
- }
- }
-
- return false;
+ return this->FunctionBlockers.top()->IsFunctionBlocked(lff, *this, status);
}
void cmMakefile::PushFunctionBlockerBarrier()
@@ -3103,8 +3075,9 @@ void cmMakefile::PopFunctionBlockerBarrier(bool reportError)
FunctionBlockersType::size_type barrier =
this->FunctionBlockerBarriers.back();
while (this->FunctionBlockers.size() > barrier) {
- std::unique_ptr<cmFunctionBlocker> fb(this->FunctionBlockers.back());
- this->FunctionBlockers.pop_back();
+ std::unique_ptr<cmFunctionBlocker> fb(
+ std::move(this->FunctionBlockers.top()));
+ this->FunctionBlockers.pop();
if (reportError) {
// Report the context in which the unclosed block was opened.
cmListFileContext const& lfc = fb->GetStartingContext();
@@ -3228,54 +3201,43 @@ bool cmMakefile::ExpandArguments(
return !cmSystemTools::GetFatalErrorOccured();
}
-void cmMakefile::AddFunctionBlocker(cmFunctionBlocker* fb)
+void cmMakefile::AddFunctionBlocker(std::unique_ptr<cmFunctionBlocker> fb)
{
if (!this->ExecutionStatusStack.empty()) {
// Record the context in which the blocker is created.
fb->SetStartingContext(this->GetExecutionContext());
}
- this->FunctionBlockers.push_back(fb);
+ this->FunctionBlockers.push(std::move(fb));
}
std::unique_ptr<cmFunctionBlocker> cmMakefile::RemoveFunctionBlocker(
cmFunctionBlocker* fb, const cmListFileFunction& lff)
{
- // Find the function blocker stack barrier for the current scope.
- // We only remove a blocker whose index is not less than the barrier.
- FunctionBlockersType::size_type barrier = 0;
- if (!this->FunctionBlockerBarriers.empty()) {
- barrier = this->FunctionBlockerBarriers.back();
- }
-
- // Search for the function blocker whose scope this command ends.
- for (FunctionBlockersType::size_type i = this->FunctionBlockers.size();
- i > barrier; --i) {
- std::vector<cmFunctionBlocker*>::iterator pos =
- this->FunctionBlockers.begin() + (i - 1);
- if (*pos == fb) {
- // Warn if the arguments do not match, but always remove.
- if (!(*pos)->ShouldRemove(lff, *this)) {
- cmListFileContext const& lfc = fb->GetStartingContext();
- cmListFileContext closingContext =
- cmListFileContext::FromCommandContext(lff, lfc.FilePath);
- std::ostringstream e;
- /* clang-format off */
- e << "A logical block opening on the line\n"
- << " " << lfc << "\n"
- << "closes on the line\n"
- << " " << closingContext << "\n"
- << "with mis-matching arguments.";
- /* clang-format on */
- this->IssueMessage(MessageType::AUTHOR_WARNING, e.str());
- }
- cmFunctionBlocker* b = *pos;
- this->FunctionBlockers.erase(pos);
- return std::unique_ptr<cmFunctionBlocker>(b);
- }
+ assert(!this->FunctionBlockers.empty());
+ assert(this->FunctionBlockers.top().get() == fb);
+ assert(this->FunctionBlockerBarriers.empty() ||
+ this->FunctionBlockers.size() > this->FunctionBlockerBarriers.back());
+
+ // Warn if the arguments do not match, but always remove.
+ if (!fb->ShouldRemove(lff, *this)) {
+ cmListFileContext const& lfc = fb->GetStartingContext();
+ cmListFileContext closingContext =
+ cmListFileContext::FromCommandContext(lff, lfc.FilePath);
+ std::ostringstream e;
+ /* clang-format off */
+ e << "A logical block opening on the line\n"
+ << " " << lfc << "\n"
+ << "closes on the line\n"
+ << " " << closingContext << "\n"
+ << "with mis-matching arguments.";
+ /* clang-format on */
+ this->IssueMessage(MessageType::AUTHOR_WARNING, e.str());
}
- return std::unique_ptr<cmFunctionBlocker>();
+ auto b = std::move(this->FunctionBlockers.top());
+ this->FunctionBlockers.pop();
+ return b;
}
std::string const& cmMakefile::GetHomeDirectory() const
@@ -3290,20 +3252,20 @@ std::string const& cmMakefile::GetHomeOutputDirectory() const
void cmMakefile::SetScriptModeFile(std::string const& scriptfile)
{
- this->AddDefinition("CMAKE_SCRIPT_MODE_FILE", scriptfile.c_str());
+ this->AddDefinition("CMAKE_SCRIPT_MODE_FILE", scriptfile);
}
void cmMakefile::SetArgcArgv(const std::vector<std::string>& args)
{
std::ostringstream strStream;
strStream << args.size();
- this->AddDefinition("CMAKE_ARGC", strStream.str().c_str());
+ this->AddDefinition("CMAKE_ARGC", strStream.str());
// this->MarkVariableAsUsed("CMAKE_ARGC");
for (unsigned int t = 0; t < args.size(); ++t) {
std::ostringstream tmpStream;
tmpStream << "CMAKE_ARGV" << t;
- this->AddDefinition(tmpStream.str(), args[t].c_str());
+ this->AddDefinition(tmpStream.str(), args[t]);
// this->MarkVariableAsUsed(tmpStream.str().c_str());
}
}
@@ -3384,8 +3346,9 @@ void cmMakefile::AddTargetObject(std::string const& tgtName,
void cmMakefile::EnableLanguage(std::vector<std::string> const& lang,
bool optional)
{
- this->AddDefinition("CMAKE_CFG_INTDIR",
- this->GetGlobalGenerator()->GetCMakeCFGIntDir());
+ if (const char* def = this->GetGlobalGenerator()->GetCMakeCFGIntDir()) {
+ this->AddDefinition("CMAKE_CFG_INTDIR", def);
+ }
// If RC is explicitly listed we need to do it after other languages.
// On some platforms we enable RC implicitly while enabling others.
// Do not let that look like recursive enable_language(RC).
@@ -4237,7 +4200,7 @@ void cmMakefile::StoreMatches(cmsys::RegularExpression& re)
std::string const& m = re.match(i);
if (!m.empty()) {
std::string const& var = matchVariables[i];
- this->AddDefinition(var, m.c_str());
+ this->AddDefinition(var, m);
this->MarkVariableAsUsed(var);
highest = static_cast<char>('0' + i);
}
@@ -4300,7 +4263,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
// Deprecate old policies, especially those that require a lot
// of code to maintain the old behavior.
- if (status == cmPolicies::OLD && id <= cmPolicies::CMP0066 &&
+ if (status == cmPolicies::OLD && id <= cmPolicies::CMP0067 &&
!(this->GetCMakeInstance()->GetIsInTryCompile() &&
(
// Policies set by cmCoreTryCompile::TryCompileCode.
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index d223347..dc196ac 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -7,8 +7,9 @@
#include "cmsys/RegularExpression.hxx"
#include <deque>
+#include <functional>
#include <map>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <set>
#include <stack>
#include <stddef.h>
@@ -16,6 +17,8 @@
#include <unordered_map>
#include <vector>
+#include "cm_string_view.hxx"
+
#include "cmAlgorithms.h"
#include "cmListFileCache.h"
#include "cmMessageType.h"
@@ -24,13 +27,13 @@
#include "cmSourceFileLocationKind.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmTarget.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmSourceGroup.h"
#endif
-class cmCommand;
class cmCompiledGeneratorExpression;
class cmCustomCommandLines;
class cmExecutionStatus;
@@ -95,7 +98,7 @@ public:
/**
* Add a function blocker to this makefile
*/
- void AddFunctionBlocker(cmFunctionBlocker* fb);
+ void AddFunctionBlocker(std::unique_ptr<cmFunctionBlocker> fb);
/// @return whether we are processing the top CMakeLists.txt file.
bool IsRootMakefile() const;
@@ -125,6 +128,13 @@ public:
bool EnforceUniqueName(std::string const& name, std::string& msg,
bool isCustom = false) const;
+ using FinalAction = std::function<void(cmMakefile&)>;
+
+ /**
+ * Register an action that is executed during FinalPass
+ */
+ void AddFinalAction(FinalAction action);
+
/**
* Perform FinalPass, Library dependency analysis etc before output of the
* makefile.
@@ -132,7 +142,7 @@ public:
void ConfigureFinalPass();
/**
- * run the final pass on all commands.
+ * run all FinalActions.
*/
void FinalPass();
@@ -256,18 +266,17 @@ public:
* Add a variable definition to the build. This variable
* can be used in CMake to refer to lists, directories, etc.
*/
- void AddDefinition(const std::string& name, const char* value);
+ void AddDefinition(const std::string& name, cm::string_view value);
+ /**
+ * Add bool variable definition to the build.
+ */
+ void AddDefinitionBool(const std::string& name, bool);
//! Add a definition to this makefile and the global cmake cache.
void AddCacheDefinition(const std::string& name, const char* value,
const char* doc, cmStateEnums::CacheEntryType type,
bool force = false);
/**
- * Add bool variable definition to the build.
- */
- void AddDefinition(const std::string& name, bool);
-
- /**
* Remove a variable definition from the build. This is not valid
* for cache entries, and will only affect the current makefile.
*/
@@ -937,7 +946,7 @@ protected:
size_t ObjectLibrariesSourceGroupIndex;
#endif
- std::vector<cmCommand*> FinalPassCommands;
+ std::vector<FinalAction> FinalActions;
cmGlobalGenerator* GlobalGenerator;
bool IsFunctionBlocked(const cmListFileFunction& lff,
cmExecutionStatus& status);
@@ -955,7 +964,9 @@ private:
bool EnforceUniqueDir(const std::string& srcPath,
const std::string& binPath) const;
- typedef std::vector<cmFunctionBlocker*> FunctionBlockersType;
+ using FunctionBlockerPtr = std::unique_ptr<cmFunctionBlocker>;
+ using FunctionBlockersType =
+ std::stack<FunctionBlockerPtr, std::vector<FunctionBlockerPtr>>;
FunctionBlockersType FunctionBlockers;
std::vector<FunctionBlockersType::size_type> FunctionBlockerBarriers;
void PushFunctionBlockerBarrier();
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 6b9b9c7..a7f2a97 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -2,13 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMakefileExecutableTargetGenerator.h"
-#include <memory> // IWYU pragma: keep
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmAlgorithms.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
@@ -482,9 +483,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Construct the main link rule.
std::vector<std::string> real_link_commands;
- std::string linkRuleVar = "CMAKE_";
- linkRuleVar += linkLanguage;
- linkRuleVar += "_LINK_EXECUTABLE";
+ std::string linkRuleVar = this->GeneratorTarget->GetCreateRuleVariable(
+ linkLanguage, this->ConfigName);
std::string linkRule = this->GetLinkRule(linkRuleVar);
std::vector<std::string> commands1;
cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index b9f7c6d..bdde4b8 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -2,13 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMakefileLibraryTargetGenerator.h"
-#include <memory> // IWYU pragma: keep
#include <set>
#include <sstream>
#include <stddef.h>
#include <utility>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmAlgorithms.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index b3bab4b..008248c 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -2,7 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMakefileTargetGenerator.h"
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <sstream>
#include <stdio.h>
#include <utility>
@@ -28,6 +28,7 @@
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index c570a7c..9eeeed0 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -7,6 +7,7 @@
#include <iosfwd>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <vector>
diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx
index 4236995..8ed6be5 100644
--- a/Source/cmMakefileUtilityTargetGenerator.cxx
+++ b/Source/cmMakefileUtilityTargetGenerator.cxx
@@ -7,7 +7,8 @@
#include <utility>
#include <vector>
-#include "cmAlgorithms.h"
+#include "cm_memory.hxx"
+
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h
index 5dd198f..e367c46 100644
--- a/Source/cmMarkAsAdvancedCommand.h
+++ b/Source/cmMarkAsAdvancedCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -23,7 +25,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmMarkAsAdvancedCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmMarkAsAdvancedCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h
index 0c6c76b..23633d3 100644
--- a/Source/cmMathCommand.h
+++ b/Source/cmMathCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -19,7 +21,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmMathCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmMathCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index 5320ec5..66d3c88 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -2,11 +2,11 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMessageCommand.h"
-#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmMessenger.h"
#include "cmRange.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -25,7 +25,6 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
auto i = args.cbegin();
auto type = MessageType::MESSAGE;
- auto status = false;
auto fatal = false;
auto level = cmake::LogLevel::LOG_UNDEFINED;
if (*i == "SEND_ERROR") {
@@ -55,19 +54,15 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
}
++i;
} else if (*i == "STATUS") {
- status = true;
level = cmake::LogLevel::LOG_STATUS;
++i;
} else if (*i == "VERBOSE") {
- status = true;
level = cmake::LogLevel::LOG_VERBOSE;
++i;
} else if (*i == "DEBUG") {
- status = true;
level = cmake::LogLevel::LOG_DEBUG;
++i;
} else if (*i == "TRACE") {
- status = true;
level = cmake::LogLevel::LOG_TRACE;
++i;
} else if (*i == "DEPRECATION") {
@@ -105,17 +100,46 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
auto message = cmJoin(cmMakeRange(i, args.cend()), "");
- if (type != MessageType::MESSAGE) {
- // we've overridden the message type, above, so display it directly
- cmMessenger* m = this->Makefile->GetMessenger();
- m->DisplayMessage(type, message, this->Makefile->GetBacktrace());
- } else {
- if (status) {
- this->Makefile->DisplayStatus(message, -1);
- } else {
+ if (cmake::LogLevel::LOG_NOTICE <= level) {
+ // Check if any indentation has requested:
+ // `CMAKE_MESSAGE_INDENT` is a list of "padding" pieces
+ // to be joined and prepended to the message lines.
+ auto indent =
+ cmJoin(cmSystemTools::ExpandedListArgument(
+ this->Makefile->GetSafeDefinition("CMAKE_MESSAGE_INDENT")),
+ "");
+ // Make every line of the `message` indented
+ // NOTE Can't reuse `cmDocumentationFormatter::PrintPreformatted`
+ // here cuz it appends `\n` to the EOM ;-(
+ cmSystemTools::ReplaceString(message, "\n", "\n" + indent);
+ message = indent + message;
+ }
+
+ switch (level) {
+ case cmake::LogLevel::LOG_ERROR:
+ case cmake::LogLevel::LOG_WARNING:
+ // we've overridden the message type, above, so display it directly
+ this->Makefile->GetMessenger()->DisplayMessage(
+ type, message, this->Makefile->GetBacktrace());
+ break;
+
+ case cmake::LogLevel::LOG_NOTICE:
cmSystemTools::Message(message);
- }
+ break;
+
+ case cmake::LogLevel::LOG_STATUS:
+ case cmake::LogLevel::LOG_VERBOSE:
+ case cmake::LogLevel::LOG_DEBUG:
+ case cmake::LogLevel::LOG_TRACE:
+ this->Makefile->DisplayStatus(message, -1);
+ break;
+
+ default:
+ assert("Unexpected log level! Review the `cmMessageCommand.cxx`." &&
+ false);
+ break;
}
+
if (fatal) {
cmSystemTools::SetFatalErrorOccured();
}
diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h
index 819ebda..ef89d59 100644
--- a/Source/cmMessageCommand.h
+++ b/Source/cmMessageCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -22,7 +24,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmMessageCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmMessageCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmMessenger.cxx b/Source/cmMessenger.cxx
index 1d790e2..07d011e 100644
--- a/Source/cmMessenger.cxx
+++ b/Source/cmMessenger.cxx
@@ -2,8 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMessenger.h"
-#include "cmAlgorithms.h"
#include "cmDocumentationFormatter.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -100,8 +100,7 @@ void displayMessage(MessageType t, std::ostringstream& msg)
"it.";
} else if (t == MessageType::AUTHOR_ERROR) {
msg << "This error is for project developers. Use -Wno-error=dev to "
- "suppress "
- "it.";
+ "suppress it.";
}
// Add a terminating blank line.
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index f65abc8..cd84c03 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -6,11 +6,12 @@
#include <assert.h>
#include <iterator>
#include <map>
-#include <memory> // IWYU pragma: keep
#include <set>
#include <sstream>
#include <utility>
+#include "cm_memory.hxx"
+
#include "cmAlgorithms.h"
#include "cmCustomCommand.h" // IWYU pragma: keep
#include "cmCustomCommandGenerator.h"
@@ -32,6 +33,7 @@
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
cmNinjaNormalTargetGenerator::cmNinjaNormalTargetGenerator(
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 2139a45..8b0a6ba 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -8,10 +8,11 @@
#include <assert.h>
#include <iterator>
#include <map>
-#include <memory> // IWYU pragma: keep
#include <ostream>
#include <utility>
+#include "cm_memory.hxx"
+
#include "cmAlgorithms.h"
#include "cmComputeLinkInformation.h"
#include "cmCustomCommandGenerator.h"
@@ -30,6 +31,7 @@
#include "cmSourceFile.h"
#include "cmState.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -909,8 +911,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements()
this->GetBuildFileStream() << "\n";
if (!this->SwiftOutputMap.empty()) {
- std::string const mapFilePath = this->ConvertToNinjaPath(
- this->GeneratorTarget->GetSupportDirectory() + "/output-file-map.json");
+ std::string const mapFilePath =
+ this->GeneratorTarget->GetSupportDirectory() + "/output-file-map.json";
std::string const targetSwiftDepsPath = [this]() -> std::string {
cmGeneratorTarget const* target = this->GeneratorTarget;
if (const char* name = target->GetProperty("Swift_DEPENDENCIES_FILE")) {
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 3055e18..a99d8e7 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -13,7 +13,7 @@
#include "cmOSXBundleGenerator.h"
#include <map>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <set>
#include <string>
#include <vector>
diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx
index 52f63a3..3724ba7 100644
--- a/Source/cmOptionCommand.cxx
+++ b/Source/cmOptionCommand.cxx
@@ -4,13 +4,13 @@
#include <sstream>
-#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
#include "cmState.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
class cmExecutionStatus;
diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h
index 34e0e6f..eddab03 100644
--- a/Source/cmOptionCommand.h
+++ b/Source/cmOptionCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -23,7 +25,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmOptionCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmOptionCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx
index 585db42..2d055ff 100644
--- a/Source/cmOrderDirectories.cxx
+++ b/Source/cmOrderDirectories.cxx
@@ -13,6 +13,7 @@
#include <assert.h>
#include <functional>
#include <sstream>
+#include <vector>
/*
Directory ordering computation.
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index 7d88b08..da7f8bc 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -6,7 +6,6 @@
#include <assert.h>
#include <ctype.h>
#include <set>
-#include <string.h>
#include <vector>
#include "cmState.h"
@@ -38,10 +37,10 @@ std::string cmOutputConverter::ConvertToOutputForExisting(
return this->ConvertToOutputFormat(remote, format);
}
-std::string cmOutputConverter::ConvertToOutputFormat(const std::string& source,
+std::string cmOutputConverter::ConvertToOutputFormat(cm::string_view source,
OutputFormat output) const
{
- std::string result = source;
+ std::string result(source);
// Convert it to an output path.
if (output == SHELL || output == WATCOMQUOTE) {
result = this->ConvertDirectorySeparatorsForShell(source);
@@ -53,9 +52,9 @@ std::string cmOutputConverter::ConvertToOutputFormat(const std::string& source,
}
std::string cmOutputConverter::ConvertDirectorySeparatorsForShell(
- const std::string& source) const
+ cm::string_view source) const
{
- std::string result = source;
+ std::string result(source);
// For the MSYS shell convert drive letters to posix paths, so
// that c:/some/path becomes /c/some/path. This is needed to
// avoid problems with the shell path translation.
@@ -71,33 +70,21 @@ std::string cmOutputConverter::ConvertDirectorySeparatorsForShell(
return result;
}
-static bool cmOutputConverterIsShellOperator(const std::string& str)
+static bool cmOutputConverterIsShellOperator(cm::string_view str)
{
- static std::set<std::string> shellOperators;
- if (shellOperators.empty()) {
- shellOperators.insert("<");
- shellOperators.insert(">");
- shellOperators.insert("<<");
- shellOperators.insert(">>");
- shellOperators.insert("|");
- shellOperators.insert("||");
- shellOperators.insert("&&");
- shellOperators.insert("&>");
- shellOperators.insert("1>");
- shellOperators.insert("2>");
- shellOperators.insert("2>&1");
- shellOperators.insert("1>&2");
- }
- return shellOperators.count(str) > 0;
+ static std::set<cm::string_view> const shellOperators{
+ "<", ">", "<<", ">>", "|", "||", "&&", "&>", "1>", "2>", "2>&1", "1>&2"
+ };
+ return (shellOperators.count(str) != 0);
}
-std::string cmOutputConverter::EscapeForShell(const std::string& str,
+std::string cmOutputConverter::EscapeForShell(cm::string_view str,
bool makeVars, bool forEcho,
bool useWatcomQuote) const
{
// Do not escape shell operators.
if (cmOutputConverterIsShellOperator(str)) {
- return str;
+ return std::string(str);
}
// Compute the flags for the target shell environment.
@@ -129,46 +116,44 @@ std::string cmOutputConverter::EscapeForShell(const std::string& str,
flags |= Shell_Flag_IsUnix;
}
- return Shell__GetArgument(str.c_str(), flags);
+ return Shell__GetArgument(str, flags);
}
-std::string cmOutputConverter::EscapeForCMake(const std::string& str)
+std::string cmOutputConverter::EscapeForCMake(cm::string_view str)
{
// Always double-quote the argument to take care of most escapes.
std::string result = "\"";
- for (const char* c = str.c_str(); *c; ++c) {
- if (*c == '"') {
+ for (const char c : str) {
+ if (c == '"') {
// Escape the double quote to avoid ending the argument.
result += "\\\"";
- } else if (*c == '$') {
+ } else if (c == '$') {
// Escape the dollar to avoid expanding variables.
result += "\\$";
- } else if (*c == '\\') {
+ } else if (c == '\\') {
// Escape the backslash to avoid other escapes.
result += "\\\\";
} else {
// Other characters will be parsed correctly.
- result += *c;
+ result += c;
}
}
result += "\"";
return result;
}
-std::string cmOutputConverter::EscapeWindowsShellArgument(const char* arg,
+std::string cmOutputConverter::EscapeWindowsShellArgument(cm::string_view arg,
int shell_flags)
{
return Shell__GetArgument(arg, shell_flags);
}
cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat(
- const char* value)
+ cm::string_view value)
{
FortranFormat format = FortranFormatNone;
- if (value && *value) {
- std::vector<std::string> fmt;
- cmSystemTools::ExpandListArgument(value, fmt);
- for (std::string const& fi : fmt) {
+ if (!value.empty()) {
+ for (std::string const& fi : cmSystemTools::ExpandedListArgument(value)) {
if (fi == "FIXED") {
format = FortranFormatFixed;
}
@@ -180,6 +165,15 @@ cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat(
return format;
}
+cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat(
+ const char* value)
+{
+ if (!value) {
+ return FortranFormatNone;
+ }
+ return GetFortranFormat(cm::string_view(value));
+}
+
void cmOutputConverter::SetLinkScriptShell(bool linkScriptShell)
{
this->LinkScriptShell = linkScriptShell;
@@ -225,12 +219,12 @@ use the caret character itself (^), use two in a row (^^).
*/
/* Some helpers to identify character classes */
-static int Shell__CharIsWhitespace(char c)
+static bool Shell__CharIsWhitespace(char c)
{
return ((c == ' ') || (c == '\t'));
}
-static int Shell__CharNeedsQuotesOnUnix(char c)
+static bool Shell__CharNeedsQuotesOnUnix(char c)
{
return ((c == '\'') || (c == '`') || (c == ';') || (c == '#') ||
(c == '&') || (c == '$') || (c == '(') || (c == ')') || (c == '~') ||
@@ -238,51 +232,52 @@ static int Shell__CharNeedsQuotesOnUnix(char c)
(c == '\\'));
}
-static int Shell__CharNeedsQuotesOnWindows(char c)
+static bool Shell__CharNeedsQuotesOnWindows(char c)
{
return ((c == '\'') || (c == '#') || (c == '&') || (c == '<') ||
(c == '>') || (c == '|') || (c == '^'));
}
-static int Shell__CharIsMakeVariableName(char c)
+static bool Shell__CharIsMakeVariableName(char c)
{
return c && (c == '_' || isalpha((static_cast<int>(c))));
}
-int cmOutputConverter::Shell__CharNeedsQuotes(char c, int flags)
+bool cmOutputConverter::Shell__CharNeedsQuotes(char c, int flags)
{
/* On Windows the built-in command shell echo never needs quotes. */
if (!(flags & Shell_Flag_IsUnix) && (flags & Shell_Flag_EchoWindows)) {
- return 0;
+ return false;
}
/* On all platforms quotes are needed to preserve whitespace. */
if (Shell__CharIsWhitespace(c)) {
- return 1;
+ return true;
}
if (flags & Shell_Flag_IsUnix) {
/* On UNIX several special characters need quotes to preserve them. */
if (Shell__CharNeedsQuotesOnUnix(c)) {
- return 1;
+ return true;
}
} else {
/* On Windows several special characters need quotes to preserve them. */
if (Shell__CharNeedsQuotesOnWindows(c)) {
- return 1;
+ return true;
}
}
- return 0;
+ return false;
}
-const char* cmOutputConverter::Shell__SkipMakeVariables(const char* c)
+cm::string_view::iterator cmOutputConverter::Shell__SkipMakeVariables(
+ cm::string_view::iterator c, cm::string_view::iterator end)
{
- while (*c == '$' && *(c + 1) == '(') {
- const char* skip = c + 2;
- while (Shell__CharIsMakeVariableName(*skip)) {
+ while ((c != end && (c + 1) != end) && (*c == '$' && *(c + 1) == '(')) {
+ cm::string_view::iterator skip = c + 2;
+ while ((skip != end) && Shell__CharIsMakeVariableName(*skip)) {
++skip;
}
- if (*skip == ')') {
+ if ((skip != end) && *skip == ')') {
c = skip + 1;
} else {
break;
@@ -314,63 +309,60 @@ flag later when we understand applications of this better.
*/
#define KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES 0
-int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int flags)
+bool cmOutputConverter::Shell__ArgumentNeedsQuotes(cm::string_view in,
+ int flags)
{
/* The empty string needs quotes. */
- if (!*in) {
- return 1;
+ if (in.empty()) {
+ return true;
}
/* Scan the string for characters that require quoting. */
- {
- const char* c;
- for (c = in; *c; ++c) {
- /* Look for $(MAKEVAR) syntax if requested. */
- if (flags & Shell_Flag_AllowMakeVariables) {
+ for (cm::string_view::iterator cit = in.begin(), cend = in.end();
+ cit != cend; ++cit) {
+ /* Look for $(MAKEVAR) syntax if requested. */
+ if (flags & Shell_Flag_AllowMakeVariables) {
#if KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES
- const char* skip = Shell__SkipMakeVariables(c);
- if (skip != c) {
- /* We need to quote make variable references to preserve the
- string with contents substituted in its place. */
- return 1;
- }
+ cm::string_view::iterator skip = Shell__SkipMakeVariables(cit, cend);
+ if (skip != cit) {
+ /* We need to quote make variable references to preserve the
+ string with contents substituted in its place. */
+ return true;
+ }
#else
- /* Skip over the make variable references if any are present. */
- c = Shell__SkipMakeVariables(c);
+ /* Skip over the make variable references if any are present. */
+ cit = Shell__SkipMakeVariables(cit, cend);
- /* Stop if we have reached the end of the string. */
- if (!*c) {
- break;
- }
-#endif
+ /* Stop if we have reached the end of the string. */
+ if (cit == cend) {
+ break;
}
+#endif
+ }
- /* Check whether this character needs quotes. */
- if (Shell__CharNeedsQuotes(*c, flags)) {
- return 1;
- }
+ /* Check whether this character needs quotes. */
+ if (Shell__CharNeedsQuotes(*cit, flags)) {
+ return true;
}
}
/* On Windows some single character arguments need quotes. */
- if (flags & Shell_Flag_IsUnix && *in && !*(in + 1)) {
- char c = *in;
+ if (flags & Shell_Flag_IsUnix && in.size() == 1) {
+ char c = in[0];
if ((c == '?') || (c == '&') || (c == '^') || (c == '|') || (c == '#')) {
- return 1;
+ return true;
}
}
- return 0;
+ return false;
}
-std::string cmOutputConverter::Shell__GetArgument(const char* in, int flags)
+std::string cmOutputConverter::Shell__GetArgument(cm::string_view in,
+ int flags)
{
/* Output will be at least as long as input string. */
std::string out;
- out.reserve(strlen(in));
-
- /* String iterator. */
- const char* c;
+ out.reserve(in.size());
/* Keep track of how many backslashes have been encountered in a row. */
int windows_backslashes = 0;
@@ -390,14 +382,15 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int flags)
}
/* Scan the string for characters that require escaping or quoting. */
- for (c = in; *c; ++c) {
+ for (cm::string_view::iterator cit = in.begin(), cend = in.end();
+ cit != cend; ++cit) {
/* Look for $(MAKEVAR) syntax if requested. */
if (flags & Shell_Flag_AllowMakeVariables) {
- const char* skip = Shell__SkipMakeVariables(c);
- if (skip != c) {
+ cm::string_view::iterator skip = Shell__SkipMakeVariables(cit, cend);
+ if (skip != cit) {
/* Copy to the end of the make variable references. */
- while (c != skip) {
- out += *c++;
+ while (cit != skip) {
+ out += *cit++;
}
/* The make variable reference eliminates any escaping needed
@@ -405,7 +398,7 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int flags)
windows_backslashes = 0;
/* Stop if we have reached the end of the string. */
- if (!*c) {
+ if (cit == cend) {
break;
}
}
@@ -415,7 +408,7 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int flags)
if (flags & Shell_Flag_IsUnix) {
/* On Unix a few special characters need escaping even inside a
quoted argument. */
- if (*c == '\\' || *c == '"' || *c == '`' || *c == '$') {
+ if (*cit == '\\' || *cit == '"' || *cit == '`' || *cit == '$') {
/* This character needs a backslash to escape it. */
out += '\\';
}
@@ -423,10 +416,10 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int flags)
/* On Windows the built-in command shell echo never needs escaping. */
} else {
/* On Windows only backslashes and double-quotes need escaping. */
- if (*c == '\\') {
+ if (*cit == '\\') {
/* Found a backslash. It may need to be escaped later. */
++windows_backslashes;
- } else if (*c == '"') {
+ } else if (*cit == '"') {
/* Found a double-quote. Escape all immediately preceding
backslashes. */
while (windows_backslashes > 0) {
@@ -444,7 +437,7 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int flags)
}
/* Check whether this character needs escaping for a make tool. */
- if (*c == '$') {
+ if (*cit == '$') {
if (flags & Shell_Flag_Make) {
/* In Makefiles a dollar is written $$. The make tool will
replace it with just $ before passing it to the shell. */
@@ -461,7 +454,7 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int flags)
/* Otherwise a dollar is written just $. */
out += '$';
}
- } else if (*c == '#') {
+ } else if (*cit == '#') {
if ((flags & Shell_Flag_Make) && (flags & Shell_Flag_WatcomWMake)) {
/* In Watcom WMake makefiles a pound is written $#. The make
tool will replace it with just # before passing it to the
@@ -471,7 +464,7 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int flags)
/* Otherwise a pound is written just #. */
out += '#';
}
- } else if (*c == '%') {
+ } else if (*cit == '%') {
if ((flags & Shell_Flag_VSIDE) ||
((flags & Shell_Flag_Make) &&
((flags & Shell_Flag_MinGWMake) || (flags & Shell_Flag_NMake)))) {
@@ -481,7 +474,7 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int flags)
/* Otherwise a percent is written just %. */
out += '%';
}
- } else if (*c == ';') {
+ } else if (*cit == ';') {
if (flags & Shell_Flag_VSIDE) {
/* In a VS IDE a semicolon is written ";". If this is written
in an un-quoted argument it starts a quoted segment,
@@ -495,7 +488,7 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int flags)
}
} else {
/* Store this character. */
- out += *c;
+ out += *cit;
}
}
diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h
index deca767..671efe7 100644
--- a/Source/cmOutputConverter.h
+++ b/Source/cmOutputConverter.h
@@ -5,9 +5,10 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include <string>
-
#include "cmStateSnapshot.h"
+#include "cm_string_view.hxx"
+
+#include <string>
class cmState;
@@ -22,10 +23,9 @@ public:
WATCOMQUOTE,
RESPONSE
};
- std::string ConvertToOutputFormat(const std::string& source,
+ std::string ConvertToOutputFormat(cm::string_view source,
OutputFormat output) const;
- std::string ConvertDirectorySeparatorsForShell(
- const std::string& source) const;
+ std::string ConvertDirectorySeparatorsForShell(cm::string_view source) const;
//! for existing files convert to output path and short path if spaces
std::string ConvertToOutputForExisting(const std::string& remote,
@@ -72,15 +72,15 @@ public:
Shell_Flag_IsUnix = (1 << 8)
};
- std::string EscapeForShell(const std::string& str, bool makeVars = false,
+ std::string EscapeForShell(cm::string_view str, bool makeVars = false,
bool forEcho = false,
bool useWatcomQuote = false) const;
- static std::string EscapeForCMake(const std::string& str);
+ static std::string EscapeForCMake(cm::string_view str);
/** Compute an escaped version of the given argument for use in a
windows shell. */
- static std::string EscapeWindowsShellArgument(const char* arg,
+ static std::string EscapeWindowsShellArgument(cm::string_view arg,
int shell_flags);
enum FortranFormat
@@ -89,15 +89,17 @@ public:
FortranFormatFixed,
FortranFormatFree
};
+ static FortranFormat GetFortranFormat(cm::string_view value);
static FortranFormat GetFortranFormat(const char* value);
private:
cmState* GetState() const;
- static int Shell__CharNeedsQuotes(char c, int flags);
- static const char* Shell__SkipMakeVariables(const char* c);
- static int Shell__ArgumentNeedsQuotes(const char* in, int flags);
- static std::string Shell__GetArgument(const char* in, int flags);
+ static bool Shell__CharNeedsQuotes(char c, int flags);
+ static cm::string_view::iterator Shell__SkipMakeVariables(
+ cm::string_view::iterator begin, cm::string_view::iterator end);
+ static bool Shell__ArgumentNeedsQuotes(cm::string_view in, int flags);
+ static std::string Shell__GetArgument(cm::string_view in, int flags);
private:
cmStateSnapshot StateSnapshot;
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index f3276ec..a66af5a 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -11,6 +11,7 @@
#include "cmGeneratorExpression.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h
index 09e622b..faffabd 100644
--- a/Source/cmOutputRequiredFilesCommand.h
+++ b/Source/cmOutputRequiredFilesCommand.h
@@ -10,6 +10,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmDependInformation;
@@ -18,7 +20,10 @@ class cmExecutionStatus;
class cmOutputRequiredFilesCommand : public cmCommand
{
public:
- cmCommand* Clone() override { return new cmOutputRequiredFilesCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmOutputRequiredFilesCommand>();
+ }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx
index 5213432..04fa0fb 100644
--- a/Source/cmParseArgumentsCommand.cxx
+++ b/Source/cmParseArgumentsCommand.cxx
@@ -7,11 +7,11 @@
#include <sstream>
#include <utility>
-#include "cmAlgorithms.h"
#include "cmArgumentParser.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmRange.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cm_string_view.hxx"
@@ -75,7 +75,7 @@ static void PassParsedArguments(
for (auto const& iter : singleValArgs) {
if (!iter.second.empty()) {
- makefile.AddDefinition(prefix + iter.first, iter.second.c_str());
+ makefile.AddDefinition(prefix + iter.first, iter.second);
} else {
makefile.RemoveDefinition(prefix + iter.first);
}
@@ -84,7 +84,7 @@ static void PassParsedArguments(
for (auto const& iter : multiValArgs) {
if (!iter.second.empty()) {
makefile.AddDefinition(prefix + iter.first,
- JoinList(iter.second, parseFromArgV).c_str());
+ JoinList(iter.second, parseFromArgV));
} else {
makefile.RemoveDefinition(prefix + iter.first);
}
@@ -92,15 +92,14 @@ static void PassParsedArguments(
if (!unparsed.empty()) {
makefile.AddDefinition(prefix + "UNPARSED_ARGUMENTS",
- JoinList(unparsed, parseFromArgV).c_str());
+ JoinList(unparsed, parseFromArgV));
} else {
makefile.RemoveDefinition(prefix + "UNPARSED_ARGUMENTS");
}
if (!keywordsMissingValues.empty()) {
- makefile.AddDefinition(
- prefix + "KEYWORDS_MISSING_VALUES",
- cmJoin(cmMakeRange(keywordsMissingValues), ";").c_str());
+ makefile.AddDefinition(prefix + "KEYWORDS_MISSING_VALUES",
+ cmJoin(cmMakeRange(keywordsMissingValues), ";"));
} else {
makefile.RemoveDefinition(prefix + "KEYWORDS_MISSING_VALUES");
}
diff --git a/Source/cmParseArgumentsCommand.h b/Source/cmParseArgumentsCommand.h
index b8ba61d..692ea64 100644
--- a/Source/cmParseArgumentsCommand.h
+++ b/Source/cmParseArgumentsCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -21,7 +23,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmParseArgumentsCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmParseArgumentsCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index ec40136..51a61dc 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -1,10 +1,10 @@
#include "cmPolicies.h"
-#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmState.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmVersion.h"
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index b705119..92c80bb 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -279,7 +279,18 @@ class cmMakefile;
SELECT(POLICY, CMP0094, \
"FindPython3, FindPython2 and FindPyton use " \
"LOCATION for lookup strategy.", \
- 3, 15, 0, cmPolicies::WARN)
+ 3, 15, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0095, \
+ "RPATH entries are properly escaped in the intermediary CMake " \
+ "install script.", \
+ 3, 16, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0096, \
+ "project() preserves leading zeros in version components.", 3, 16, \
+ 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0097, \
+ "ExternalProject_Add with GIT_SUBMODULES \"\" initializes no " \
+ "submodules.", \
+ 3, 16, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \
@@ -307,7 +318,8 @@ class cmMakefile;
F(CMP0073) \
F(CMP0076) \
F(CMP0081) \
- F(CMP0083)
+ F(CMP0083) \
+ F(CMP0095)
/** \class cmPolicies
* \brief Handles changes in CMake behavior and policies
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 8615ecc..96d9843 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -3,15 +3,18 @@
#include "cmProjectCommand.h"
#include "cmsys/RegularExpression.hxx"
+#include <array>
+#include <cstdio>
#include <functional>
+#include <limits>
#include <sstream>
-#include <stdio.h>
+#include <utility>
-#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
class cmExecutionStatus;
@@ -33,27 +36,21 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
this->Makefile->SetProjectName(projectName);
- std::string bindir = projectName;
- bindir += "_BINARY_DIR";
- std::string srcdir = projectName;
- srcdir += "_SOURCE_DIR";
-
this->Makefile->AddCacheDefinition(
- bindir, this->Makefile->GetCurrentBinaryDirectory().c_str(),
+ projectName + "_BINARY_DIR",
+ this->Makefile->GetCurrentBinaryDirectory().c_str(),
"Value Computed by CMake", cmStateEnums::STATIC);
this->Makefile->AddCacheDefinition(
- srcdir, this->Makefile->GetCurrentSourceDirectory().c_str(),
+ projectName + "_SOURCE_DIR",
+ this->Makefile->GetCurrentSourceDirectory().c_str(),
"Value Computed by CMake", cmStateEnums::STATIC);
- bindir = "PROJECT_BINARY_DIR";
- srcdir = "PROJECT_SOURCE_DIR";
-
- this->Makefile->AddDefinition(
- bindir, this->Makefile->GetCurrentBinaryDirectory().c_str());
- this->Makefile->AddDefinition(
- srcdir, this->Makefile->GetCurrentSourceDirectory().c_str());
+ this->Makefile->AddDefinition("PROJECT_BINARY_DIR",
+ this->Makefile->GetCurrentBinaryDirectory());
+ this->Makefile->AddDefinition("PROJECT_SOURCE_DIR",
+ this->Makefile->GetCurrentSourceDirectory());
- this->Makefile->AddDefinition("PROJECT_NAME", projectName.c_str());
+ this->Makefile->AddDefinition("PROJECT_NAME", projectName);
// Set the CMAKE_PROJECT_NAME variable to be the highest-level
// project name in the tree. If there are two project commands
@@ -63,7 +60,7 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
// will work.
if (!this->Makefile->GetDefinition("CMAKE_PROJECT_NAME") ||
(this->Makefile->IsRootMakefile())) {
- this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", projectName.c_str());
+ this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", projectName);
this->Makefile->AddCacheDefinition(
"CMAKE_PROJECT_NAME", projectName.c_str(), "Value Computed by CMake",
cmStateEnums::STATIC);
@@ -205,7 +202,7 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
languages.emplace_back("NONE");
}
- cmPolicies::PolicyStatus cmp0048 =
+ cmPolicies::PolicyStatus const cmp0048 =
this->Makefile->GetPolicyStatus(cmPolicies::CMP0048);
if (haveVersion) {
// Set project VERSION variables to given values
@@ -220,64 +217,87 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
cmsys::RegularExpression vx(
R"(^([0-9]+(\.[0-9]+(\.[0-9]+(\.[0-9]+)?)?)?)?$)");
if (!vx.find(version)) {
- std::string e = "VERSION \"" + version + "\" format invalid.";
+ std::string e = R"(VERSION ")" + version + R"(" format invalid.)";
this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e);
cmSystemTools::SetFatalErrorOccured();
return true;
}
- std::string vs;
- const char* sep = "";
- char vb[4][64];
- unsigned int v[4] = { 0, 0, 0, 0 };
- int vc =
- sscanf(version.c_str(), "%u.%u.%u.%u", &v[0], &v[1], &v[2], &v[3]);
- for (int i = 0; i < 4; ++i) {
- if (i < vc) {
- sprintf(vb[i], "%u", v[i]);
- vs += sep;
- vs += vb[i];
- sep = ".";
- } else {
- vb[i][0] = 0;
+ cmPolicies::PolicyStatus const cmp0096 =
+ this->Makefile->GetPolicyStatus(cmPolicies::CMP0096);
+
+ constexpr std::size_t MAX_VERSION_COMPONENTS = 4u;
+ std::string version_string;
+ std::array<std::string, MAX_VERSION_COMPONENTS> version_components;
+
+ if (cmp0096 == cmPolicies::OLD || cmp0096 == cmPolicies::WARN) {
+ char vb[MAX_VERSION_COMPONENTS][std::numeric_limits<unsigned>::digits10];
+ unsigned v[MAX_VERSION_COMPONENTS] = { 0, 0, 0, 0 };
+ const int vc = std::sscanf(version.c_str(), "%u.%u.%u.%u", &v[0], &v[1],
+ &v[2], &v[3]);
+ for (auto i = 0u; i < MAX_VERSION_COMPONENTS; ++i) {
+ if (int(i) < vc) {
+ std::sprintf(vb[i], "%u", v[i]);
+ version_string += &"."[std::size_t(i == 0)];
+ version_string += vb[i];
+ version_components[i] = vb[i];
+ } else {
+ vb[i][0] = '\x00';
+ }
+ }
+ } else {
+ // The regex above verified that we have a .-separated string of
+ // non-negative integer components. Keep the original string.
+ version_string = std::move(version);
+ // Split the integer components.
+ auto components = cmSystemTools::SplitString(version_string, '.');
+ for (auto i = 0u; i < components.size(); ++i) {
+ version_components[i] = std::move(components[i]);
}
}
std::string vv;
vv = projectName + "_VERSION";
- this->Makefile->AddDefinition("PROJECT_VERSION", vs.c_str());
- this->Makefile->AddDefinition(vv, vs.c_str());
+ this->Makefile->AddDefinition("PROJECT_VERSION", version_string);
+ this->Makefile->AddDefinition(vv, version_string);
vv = projectName + "_VERSION_MAJOR";
- this->Makefile->AddDefinition("PROJECT_VERSION_MAJOR", vb[0]);
- this->Makefile->AddDefinition(vv, vb[0]);
+ this->Makefile->AddDefinition("PROJECT_VERSION_MAJOR",
+ version_components[0]);
+ this->Makefile->AddDefinition(vv, version_components[0]);
vv = projectName + "_VERSION_MINOR";
- this->Makefile->AddDefinition("PROJECT_VERSION_MINOR", vb[1]);
- this->Makefile->AddDefinition(vv, vb[1]);
+ this->Makefile->AddDefinition("PROJECT_VERSION_MINOR",
+ version_components[1]);
+ this->Makefile->AddDefinition(vv, version_components[1]);
vv = projectName + "_VERSION_PATCH";
- this->Makefile->AddDefinition("PROJECT_VERSION_PATCH", vb[2]);
- this->Makefile->AddDefinition(vv, vb[2]);
+ this->Makefile->AddDefinition("PROJECT_VERSION_PATCH",
+ version_components[2]);
+ this->Makefile->AddDefinition(vv, version_components[2]);
vv = projectName + "_VERSION_TWEAK";
- this->Makefile->AddDefinition("PROJECT_VERSION_TWEAK", vb[3]);
- this->Makefile->AddDefinition(vv, vb[3]);
+ this->Makefile->AddDefinition("PROJECT_VERSION_TWEAK",
+ version_components[3]);
+ this->Makefile->AddDefinition(vv, version_components[3]);
// Also, try set top level variables
- TopLevelCMakeVarCondSet("CMAKE_PROJECT_VERSION", vs.c_str());
- TopLevelCMakeVarCondSet("CMAKE_PROJECT_VERSION_MAJOR", vb[0]);
- TopLevelCMakeVarCondSet("CMAKE_PROJECT_VERSION_MINOR", vb[1]);
- TopLevelCMakeVarCondSet("CMAKE_PROJECT_VERSION_PATCH", vb[2]);
- TopLevelCMakeVarCondSet("CMAKE_PROJECT_VERSION_TWEAK", vb[3]);
+ TopLevelCMakeVarCondSet("CMAKE_PROJECT_VERSION", version_string.c_str());
+ TopLevelCMakeVarCondSet("CMAKE_PROJECT_VERSION_MAJOR",
+ version_components[0].c_str());
+ TopLevelCMakeVarCondSet("CMAKE_PROJECT_VERSION_MINOR",
+ version_components[1].c_str());
+ TopLevelCMakeVarCondSet("CMAKE_PROJECT_VERSION_PATCH",
+ version_components[2].c_str());
+ TopLevelCMakeVarCondSet("CMAKE_PROJECT_VERSION_TWEAK",
+ version_components[3].c_str());
} else if (cmp0048 != cmPolicies::OLD) {
// Set project VERSION variables to empty
- std::vector<std::string> vv;
- vv.emplace_back("PROJECT_VERSION");
- vv.emplace_back("PROJECT_VERSION_MAJOR");
- vv.emplace_back("PROJECT_VERSION_MINOR");
- vv.emplace_back("PROJECT_VERSION_PATCH");
- vv.emplace_back("PROJECT_VERSION_TWEAK");
- vv.push_back(projectName + "_VERSION");
- vv.push_back(projectName + "_VERSION_MAJOR");
- vv.push_back(projectName + "_VERSION_MINOR");
- vv.push_back(projectName + "_VERSION_PATCH");
- vv.push_back(projectName + "_VERSION_TWEAK");
+ std::vector<std::string> vv = { "PROJECT_VERSION",
+ "PROJECT_VERSION_MAJOR",
+ "PROJECT_VERSION_MINOR",
+ "PROJECT_VERSION_PATCH",
+ "PROJECT_VERSION_TWEAK",
+ projectName + "_VERSION",
+ projectName + "_VERSION_MAJOR",
+ projectName + "_VERSION_MINOR",
+ projectName + "_VERSION_PATCH",
+ projectName + "_VERSION_TWEAK" };
if (this->Makefile->IsRootMakefile()) {
vv.emplace_back("CMAKE_PROJECT_VERSION");
vv.emplace_back("CMAKE_PROJECT_VERSION_MAJOR");
@@ -287,7 +307,7 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
}
std::string vw;
for (std::string const& i : vv) {
- const char* v = this->Makefile->GetDefinition(i);
+ const char* const v = this->Makefile->GetDefinition(i);
if (v && *v) {
if (cmp0048 == cmPolicies::WARN) {
if (!injectedProjectCommand) {
@@ -307,20 +327,17 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
}
}
- this->Makefile->AddDefinition("PROJECT_DESCRIPTION", description.c_str());
- this->Makefile->AddDefinition(projectName + "_DESCRIPTION",
- description.c_str());
+ this->Makefile->AddDefinition("PROJECT_DESCRIPTION", description);
+ this->Makefile->AddDefinition(projectName + "_DESCRIPTION", description);
TopLevelCMakeVarCondSet("CMAKE_PROJECT_DESCRIPTION", description.c_str());
- this->Makefile->AddDefinition("PROJECT_HOMEPAGE_URL", homepage.c_str());
- this->Makefile->AddDefinition(projectName + "_HOMEPAGE_URL",
- homepage.c_str());
+ this->Makefile->AddDefinition("PROJECT_HOMEPAGE_URL", homepage);
+ this->Makefile->AddDefinition(projectName + "_HOMEPAGE_URL", homepage);
TopLevelCMakeVarCondSet("CMAKE_PROJECT_HOMEPAGE_URL", homepage.c_str());
if (languages.empty()) {
// if no language is specified do c and c++
- languages.emplace_back("C");
- languages.emplace_back("CXX");
+ languages = { "C", "CXX" };
}
this->Makefile->EnableLanguage(languages, false);
@@ -337,7 +354,7 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
bool cmProjectCommand::IncludeByVariable(const std::string& variable)
{
- const char* include = this->Makefile->GetDefinition(variable);
+ const char* const include = this->Makefile->GetDefinition(variable);
if (!include) {
return true;
}
diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h
index f1d03e7..8b9bcc8 100644
--- a/Source/cmProjectCommand.h
+++ b/Source/cmProjectCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -26,7 +28,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmProjectCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmProjectCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmProperty.cxx b/Source/cmProperty.cxx
deleted file mode 100644
index 27f0ecd..0000000
--- a/Source/cmProperty.cxx
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmProperty.h"
-
-void cmProperty::Set(const char* value)
-{
- this->Value = value;
- this->ValueHasBeenSet = true;
-}
-
-void cmProperty::Append(const char* value, bool asString)
-{
- if (!this->Value.empty() && *value && !asString) {
- this->Value += ";";
- }
- this->Value += value;
- this->ValueHasBeenSet = true;
-}
-
-const char* cmProperty::GetValue() const
-{
- if (this->ValueHasBeenSet) {
- return this->Value.c_str();
- }
- return nullptr;
-}
diff --git a/Source/cmProperty.h b/Source/cmProperty.h
index d11c5ef..80f131a 100644
--- a/Source/cmProperty.h
+++ b/Source/cmProperty.h
@@ -5,8 +5,6 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include <string>
-
class cmProperty
{
public:
@@ -22,22 +20,6 @@ public:
CACHED_VARIABLE,
INSTALL
};
-
- // set this property
- void Set(const char* value);
-
- // append to this property
- void Append(const char* value, bool asString = false);
-
- // get the value
- const char* GetValue() const;
-
- // construct with the value not set
- cmProperty() { this->ValueHasBeenSet = false; }
-
-protected:
- std::string Value;
- bool ValueHasBeenSet;
};
#endif
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index 3f6d7c8..3ed4c05 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -3,40 +3,21 @@
#include "cmPropertyMap.h"
#include <algorithm>
-#include <assert.h>
#include <utility>
-cmProperty* cmPropertyMap::GetOrCreateProperty(const std::string& name)
+void cmPropertyMap::Clear()
{
- cmPropertyMap::iterator it = this->find(name);
- cmProperty* prop;
- if (it == this->end()) {
- prop = &(*this)[name];
- } else {
- prop = &(it->second);
- }
- return prop;
-}
-
-std::vector<std::string> cmPropertyMap::GetPropertyList() const
-{
- std::vector<std::string> keyList;
- for (auto const& i : *this) {
- keyList.push_back(i.first);
- }
- std::sort(keyList.begin(), keyList.end());
- return keyList;
+ Map_.clear();
}
void cmPropertyMap::SetProperty(const std::string& name, const char* value)
{
if (!value) {
- this->erase(name);
+ Map_.erase(name);
return;
}
- cmProperty* prop = this->GetOrCreateProperty(name);
- prop->Set(value);
+ Map_[name] = value;
}
void cmPropertyMap::AppendProperty(const std::string& name, const char* value,
@@ -47,17 +28,53 @@ void cmPropertyMap::AppendProperty(const std::string& name, const char* value,
return;
}
- cmProperty* prop = this->GetOrCreateProperty(name);
- prop->Append(value, asString);
+ {
+ std::string& pVal = Map_[name];
+ if (!pVal.empty() && !asString) {
+ pVal += ';';
+ }
+ pVal += value;
+ }
+}
+
+void cmPropertyMap::RemoveProperty(const std::string& name)
+{
+ Map_.erase(name);
}
const char* cmPropertyMap::GetPropertyValue(const std::string& name) const
{
- assert(!name.empty());
+ {
+ auto it = Map_.find(name);
+ if (it != Map_.end()) {
+ return it->second.c_str();
+ }
+ }
+ return nullptr;
+}
- cmPropertyMap::const_iterator it = this->find(name);
- if (it == this->end()) {
- return nullptr;
+std::vector<std::string> cmPropertyMap::GetKeys() const
+{
+ std::vector<std::string> keyList;
+ keyList.reserve(Map_.size());
+ for (auto const& item : Map_) {
+ keyList.push_back(item.first);
+ }
+ std::sort(keyList.begin(), keyList.end());
+ return keyList;
+}
+
+std::vector<std::pair<std::string, std::string>> cmPropertyMap::GetList() const
+{
+ typedef std::pair<std::string, std::string> StringPair;
+ std::vector<StringPair> kvList;
+ kvList.reserve(Map_.size());
+ for (auto const& item : Map_) {
+ kvList.emplace_back(item.first, item.second);
}
- return it->second.GetValue();
+ std::sort(kvList.begin(), kvList.end(),
+ [](StringPair const& a, StringPair const& b) {
+ return a.first < b.first;
+ });
+ return kvList;
}
diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h
index 5a05150..9aed349 100644
--- a/Source/cmPropertyMap.h
+++ b/Source/cmPropertyMap.h
@@ -5,25 +5,47 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include "cmProperty.h"
-
-#include <map>
#include <string>
+#include <unordered_map>
+#include <utility>
#include <vector>
-class cmPropertyMap : public std::map<std::string, cmProperty>
+/** \class cmPropertyMap
+ * \brief String property map.
+ */
+class cmPropertyMap
{
public:
- cmProperty* GetOrCreateProperty(const std::string& name);
+ // -- General
+
+ //! Clear property list
+ void Clear();
- std::vector<std::string> GetPropertyList() const;
+ // -- Properties
+ //! Set the property value
void SetProperty(const std::string& name, const char* value);
+ //! Append to the property value
void AppendProperty(const std::string& name, const char* value,
bool asString = false);
+ //! Get the property value
const char* GetPropertyValue(const std::string& name) const;
+
+ //! Remove the property @a name from the map
+ void RemoveProperty(const std::string& name);
+
+ // -- Lists
+
+ //! Get a sorted list of property keys
+ std::vector<std::string> GetKeys() const;
+
+ //! Get a sorted by key list of property key,value pairs
+ std::vector<std::pair<std::string, std::string>> GetList() const;
+
+private:
+ std::unordered_map<std::string, std::string> Map_;
};
#endif
diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx
index 9a764c6..f5852a9 100644
--- a/Source/cmQTWrapCPPCommand.cxx
+++ b/Source/cmQTWrapCPPCommand.cxx
@@ -89,6 +89,6 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& args,
}
// Store the final list of source files.
- this->Makefile->AddDefinition(sourceList, sourceListValue.c_str());
+ this->Makefile->AddDefinition(sourceList, sourceListValue);
return true;
}
diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h
index c1dcd54..88a2210 100644
--- a/Source/cmQTWrapCPPCommand.h
+++ b/Source/cmQTWrapCPPCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -24,7 +26,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmQTWrapCPPCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmQTWrapCPPCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx
index 2223e2d..361d7b3 100644
--- a/Source/cmQTWrapUICommand.cxx
+++ b/Source/cmQTWrapUICommand.cxx
@@ -132,7 +132,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& args,
}
// Store the final list of source files and headers.
- this->Makefile->AddDefinition(sourceList, sourceListValue.c_str());
- this->Makefile->AddDefinition(headerList, headerListValue.c_str());
+ this->Makefile->AddDefinition(sourceList, sourceListValue);
+ this->Makefile->AddDefinition(headerList, headerListValue);
return true;
}
diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h
index 15cab40..6a346d4 100644
--- a/Source/cmQTWrapUICommand.h
+++ b/Source/cmQTWrapUICommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -23,7 +25,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmQTWrapUICommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmQTWrapUICommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx
index 3683edd..712e22c 100644
--- a/Source/cmQtAutoGen.cxx
+++ b/Source/cmQtAutoGen.cxx
@@ -5,6 +5,7 @@
#include "cmAlgorithms.h"
#include "cmDuration.h"
#include "cmProcessOutput.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmsys/FStream.hxx"
#include "cmsys/RegularExpression.hxx"
diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h
index 9c52129..619fff1 100644
--- a/Source/cmQtAutoGen.h
+++ b/Source/cmQtAutoGen.h
@@ -5,7 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <string>
#include <vector>
diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx
index ef8a56b..f172b77 100644
--- a/Source/cmQtAutoGenGlobalInitializer.cxx
+++ b/Source/cmQtAutoGenGlobalInitializer.cxx
@@ -4,7 +4,6 @@
#include "cmQtAutoGen.h"
#include "cmQtAutoGenInitializer.h"
-#include "cmAlgorithms.h"
#include "cmCustomCommandLines.h"
#include "cmDuration.h"
#include "cmGeneratorTarget.h"
@@ -17,9 +16,10 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
-#include <memory>
#include <utility>
+#include "cm_memory.hxx"
+
cmQtAutoGenGlobalInitializer::Keywords::Keywords()
: AUTOMOC("AUTOMOC")
, AUTOUIC("AUTOUIC")
diff --git a/Source/cmQtAutoGenGlobalInitializer.h b/Source/cmQtAutoGenGlobalInitializer.h
index d56153a..d7f4cc6 100644
--- a/Source/cmQtAutoGenGlobalInitializer.h
+++ b/Source/cmQtAutoGenGlobalInitializer.h
@@ -8,7 +8,7 @@
#include "cmQtAutoGen.h"
#include <map>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 9985f93..da6094d 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -4,7 +4,6 @@
#include "cmQtAutoGen.h"
#include "cmQtAutoGenGlobalInitializer.h"
-#include "cmAlgorithms.h"
#include "cmCustomCommand.h"
#include "cmCustomCommandLines.h"
#include "cmFilePathChecksum.h"
@@ -23,6 +22,7 @@
#include "cmSourceGroup.h"
#include "cmState.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmake.h"
@@ -38,6 +38,8 @@
#include <utility>
#include <vector>
+#include "cm_memory.hxx"
+
static std::size_t GetParallelCPUCount()
{
static std::size_t count = 0;
@@ -620,6 +622,7 @@ bool cmQtAutoGenInitializer::InitRcc()
bool cmQtAutoGenInitializer::InitScanFiles()
{
cmMakefile* makefile = this->Target->Target->GetMakefile();
+ cmake const* cm = makefile->GetCMakeInstance();
auto const& kw = this->GlobalInitializer->kw();
auto makeMUFile = [this, &kw](cmSourceFile* sf, std::string const& fullPath,
@@ -665,25 +668,21 @@ bool cmQtAutoGenInitializer::InitScanFiles()
if (!pathError.empty() || fullPath.empty()) {
continue;
}
- std::string const& ext = sf->GetExtension();
+ std::string const& extLower =
+ cmSystemTools::LowerCase(sf->GetExtension());
// Register files that will be scanned by moc or uic
if (this->MocOrUicEnabled()) {
- switch (cmSystemTools::GetFileFormat(ext)) {
- case cmSystemTools::HEADER_FILE_FORMAT:
- addMUFile(makeMUFile(sf, fullPath, true), true);
- break;
- case cmSystemTools::CXX_FILE_FORMAT:
- addMUFile(makeMUFile(sf, fullPath, true), false);
- break;
- default:
- break;
+ if (cm->IsHeaderExtension(extLower)) {
+ addMUFile(makeMUFile(sf, fullPath, true), true);
+ } else if (cm->IsSourceExtension(extLower)) {
+ addMUFile(makeMUFile(sf, fullPath, true), false);
}
}
// Register rcc enabled files
if (this->Rcc.Enabled) {
- if ((ext == kw.qrc) && !sf->GetPropertyAsBool(kw.SKIP_AUTOGEN) &&
+ if ((extLower == kw.qrc) && !sf->GetPropertyAsBool(kw.SKIP_AUTOGEN) &&
!sf->GetPropertyAsBool(kw.SKIP_AUTORCC)) {
// Register qrc file
Qrc qrc;
@@ -715,7 +714,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
extraHeaders.reserve(this->AutogenTarget.Sources.size() * 2);
// Header search suffixes and extensions
std::array<std::string, 2> const suffixes{ { "", "_p" } };
- auto const& exts = makefile->GetCMakeInstance()->GetHeaderExtensions();
+ auto const& exts = cm->GetHeaderExtensions();
// Scan through sources
for (auto const& pair : this->AutogenTarget.Sources) {
MUFile const& muf = *pair.second;
@@ -784,10 +783,10 @@ bool cmQtAutoGenInitializer::InitScanFiles()
if (!pathError.empty() || fullPath.empty()) {
continue;
}
- std::string const& ext = sf->GetExtension();
+ std::string const& extLower =
+ cmSystemTools::LowerCase(sf->GetExtension());
- auto const fileFormat = cmSystemTools::GetFileFormat(ext);
- if (fileFormat == cmSystemTools::HEADER_FILE_FORMAT) {
+ if (cm->IsHeaderExtension(extLower)) {
if (this->AutogenTarget.Headers.find(sf) ==
this->AutogenTarget.Headers.end()) {
auto muf = makeMUFile(sf, fullPath, false);
@@ -795,7 +794,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
this->AutogenTarget.Headers.emplace(sf, std::move(muf));
}
}
- } else if (fileFormat == cmSystemTools::CXX_FILE_FORMAT) {
+ } else if (cm->IsSourceExtension(extLower)) {
if (this->AutogenTarget.Sources.find(sf) ==
this->AutogenTarget.Sources.end()) {
auto muf = makeMUFile(sf, fullPath, false);
@@ -803,7 +802,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
this->AutogenTarget.Sources.emplace(sf, std::move(muf));
}
}
- } else if (this->Uic.Enabled && (ext == kw.ui)) {
+ } else if (this->Uic.Enabled && (extLower == kw.ui)) {
// .ui file
std::string realPath = cmSystemTools::GetRealPath(fullPath);
bool const skipAutogen = sf->GetPropertyAsBool(kw.SKIP_AUTOGEN);
diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h
index aa073d1..eb0d35e 100644
--- a/Source/cmQtAutoGenInitializer.h
+++ b/Source/cmQtAutoGenInitializer.h
@@ -8,7 +8,7 @@
#include "cmQtAutoGen.h"
#include <map>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <ostream>
#include <set>
#include <string>
diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx
index e1c435b..2516d84 100644
--- a/Source/cmQtAutoGenerator.cxx
+++ b/Source/cmQtAutoGenerator.cxx
@@ -5,7 +5,8 @@
#include "cmsys/FStream.hxx"
-#include "cmAlgorithms.h"
+#include "cm_memory.hxx"
+
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmState.h"
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index 889f47d..2aefe8f 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -5,16 +5,18 @@
#include <algorithm>
#include <array>
#include <list>
-#include <memory>
#include <set>
#include <sstream>
#include <utility>
+#include "cm_memory.hxx"
+
#include "cmAlgorithms.h"
#include "cmCryptoHash.h"
#include "cmGeneratedFileStream.h"
#include "cmMakefile.h"
#include "cmQtAutoGen.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
#include "cmsys/FStream.hxx"
diff --git a/Source/cmQtAutoMocUic.h b/Source/cmQtAutoMocUic.h
index 8061c13..dc18328 100644
--- a/Source/cmQtAutoMocUic.h
+++ b/Source/cmQtAutoMocUic.h
@@ -14,7 +14,7 @@
#include <atomic>
#include <cstddef>
#include <map>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <set>
#include <string>
#include <unordered_map>
diff --git a/Source/cmQtAutoRcc.cxx b/Source/cmQtAutoRcc.cxx
index 20885df..59f632d 100644
--- a/Source/cmQtAutoRcc.cxx
+++ b/Source/cmQtAutoRcc.cxx
@@ -11,6 +11,7 @@
#include "cmFileLockResult.h"
#include "cmMakefile.h"
#include "cmProcessOutput.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
// -- Class methods
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index 2064275..a329f7d 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -4,6 +4,7 @@
#include "cmAlgorithms.h"
#include "cmRange.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmVersion.h"
diff --git a/Source/cmRemoveCommand.cxx b/Source/cmRemoveCommand.cxx
index a64ad8c..d0ee4d4 100644
--- a/Source/cmRemoveCommand.cxx
+++ b/Source/cmRemoveCommand.cxx
@@ -52,7 +52,7 @@ bool cmRemoveCommand::InitialPass(std::vector<std::string> const& args,
}
// add the definition
- this->Makefile->AddDefinition(variable, value.c_str());
+ this->Makefile->AddDefinition(variable, value);
return true;
}
diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h
index 7b11849..088d8ad 100644
--- a/Source/cmRemoveCommand.h
+++ b/Source/cmRemoveCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -23,7 +25,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmRemoveCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmRemoveCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h
index a5cb204..85d01d4 100644
--- a/Source/cmRemoveDefinitionsCommand.h
+++ b/Source/cmRemoveDefinitionsCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -25,7 +27,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmRemoveDefinitionsCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmRemoveDefinitionsCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmReturnCommand.cxx b/Source/cmReturnCommand.cxx
index ceea8b4..5905669 100644
--- a/Source/cmReturnCommand.cxx
+++ b/Source/cmReturnCommand.cxx
@@ -5,8 +5,8 @@
#include "cmExecutionStatus.h"
// cmReturnCommand
-bool cmReturnCommand::InitialPass(std::vector<std::string> const&,
- cmExecutionStatus& status)
+bool cmReturnCommand(std::vector<std::string> const&,
+ cmExecutionStatus& status)
{
status.SetReturnInvoked();
return true;
diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h
index ef39614..2404a36 100644
--- a/Source/cmReturnCommand.h
+++ b/Source/cmReturnCommand.h
@@ -8,29 +8,10 @@
#include <string>
#include <vector>
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmReturnCommand
- * \brief Return from a directory or function
- *
- * cmReturnCommand returns from a directory or function
- */
-class cmReturnCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- cmCommand* Clone() override { return new cmReturnCommand; }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+/// Return from a directory or function
+bool cmReturnCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmRuntimeDependencyArchive.cxx b/Source/cmRuntimeDependencyArchive.cxx
new file mode 100644
index 0000000..45aff69
--- /dev/null
+++ b/Source/cmRuntimeDependencyArchive.cxx
@@ -0,0 +1,376 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmRuntimeDependencyArchive.h"
+
+#include "cmBinUtilsLinuxELFLinker.h"
+#include "cmBinUtilsMacOSMachOLinker.h"
+#include "cmBinUtilsWindowsPELinker.h"
+#include "cmCommand.h"
+#include "cmMakefile.h"
+#include "cmStateTypes.h"
+#include "cmSystemTools.h"
+
+#if defined(_WIN32)
+# include "cmGlobalGenerator.h"
+# ifdef CMAKE_BUILD_WITH_CMAKE
+# include "cmGlobalVisualStudioVersionedGenerator.h"
+# endif
+# include "cmVSSetupHelper.h"
+# include "cmsys/Glob.hxx"
+#endif
+
+#include <algorithm>
+#include <sstream>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "cm_memory.hxx"
+
+#if defined(_WIN32)
+static void AddVisualStudioPath(std::vector<std::string>& paths,
+ const std::string& prefix,
+ unsigned int version, cmGlobalGenerator* gg)
+{
+ // If generating for the VS IDE, use the same instance.
+ std::string vsloc;
+ bool found = false;
+# ifdef CMAKE_BUILD_WITH_CMAKE
+ if (gg->GetName().find(prefix) == 0) {
+ cmGlobalVisualStudioVersionedGenerator* vsgen =
+ static_cast<cmGlobalVisualStudioVersionedGenerator*>(gg);
+ if (vsgen->GetVSInstance(vsloc)) {
+ found = true;
+ }
+ }
+# endif
+
+ // Otherwise, find a VS instance ourselves.
+ if (!found) {
+ cmVSSetupAPIHelper vsSetupAPIHelper(version);
+ if (vsSetupAPIHelper.GetVSInstanceInfo(vsloc)) {
+ cmSystemTools::ConvertToUnixSlashes(vsloc);
+ found = true;
+ }
+ }
+
+ if (found) {
+ cmsys::Glob glob;
+ glob.SetListDirs(true);
+ glob.FindFiles(vsloc + "/VC/Tools/MSVC/*");
+ for (auto const& vcdir : glob.GetFiles()) {
+ paths.push_back(vcdir + "/bin/Hostx64/x64");
+ paths.push_back(vcdir + "/bin/Hostx86/x64");
+ paths.push_back(vcdir + "/bin/Hostx64/x86");
+ paths.push_back(vcdir + "/bin/Hostx86/x86");
+ }
+ }
+}
+
+static void AddRegistryPath(std::vector<std::string>& paths,
+ const std::string& path, cmMakefile* mf)
+{
+ // We should view the registry as the target application would view
+ // it.
+ cmSystemTools::KeyWOW64 view = cmSystemTools::KeyWOW64_32;
+ cmSystemTools::KeyWOW64 other_view = cmSystemTools::KeyWOW64_64;
+ if (mf->PlatformIs64Bit()) {
+ view = cmSystemTools::KeyWOW64_64;
+ other_view = cmSystemTools::KeyWOW64_32;
+ }
+
+ // Expand using the view of the target application.
+ std::string expanded = path;
+ cmSystemTools::ExpandRegistryValues(expanded, view);
+ cmSystemTools::GlobDirs(expanded, paths);
+
+ // Executables can be either 32-bit or 64-bit, so expand using the
+ // alternative view.
+ expanded = path;
+ cmSystemTools::ExpandRegistryValues(expanded, other_view);
+ cmSystemTools::GlobDirs(expanded, paths);
+}
+
+static void AddEnvPath(std::vector<std::string>& paths, const std::string& var,
+ const std::string& suffix)
+{
+ std::string value;
+ if (cmSystemTools::GetEnv(var, value)) {
+ paths.push_back(value + suffix);
+ }
+}
+#endif
+
+static cmsys::RegularExpression TransformCompile(const std::string& str)
+{
+ return cmsys::RegularExpression(str);
+}
+
+cmRuntimeDependencyArchive::cmRuntimeDependencyArchive(
+ cmCommand* command, std::vector<std::string> searchDirectories,
+ std::string bundleExecutable,
+ const std::vector<std::string>& preIncludeRegexes,
+ const std::vector<std::string>& preExcludeRegexes,
+ const std::vector<std::string>& postIncludeRegexes,
+ const std::vector<std::string>& postExcludeRegexes)
+ : Command(command)
+ , SearchDirectories(std::move(searchDirectories))
+ , BundleExecutable(std::move(bundleExecutable))
+ , PreIncludeRegexes(preIncludeRegexes.size())
+ , PreExcludeRegexes(preExcludeRegexes.size())
+ , PostIncludeRegexes(postIncludeRegexes.size())
+ , PostExcludeRegexes(postExcludeRegexes.size())
+{
+ std::transform(preIncludeRegexes.begin(), preIncludeRegexes.end(),
+ this->PreIncludeRegexes.begin(), TransformCompile);
+ std::transform(preExcludeRegexes.begin(), preExcludeRegexes.end(),
+ this->PreExcludeRegexes.begin(), TransformCompile);
+ std::transform(postIncludeRegexes.begin(), postIncludeRegexes.end(),
+ this->PostIncludeRegexes.begin(), TransformCompile);
+ std::transform(postExcludeRegexes.begin(), postExcludeRegexes.end(),
+ this->PostExcludeRegexes.begin(), TransformCompile);
+}
+
+bool cmRuntimeDependencyArchive::Prepare()
+{
+ std::string platform = this->GetMakefile()->GetSafeDefinition(
+ "CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM");
+ if (platform.empty()) {
+ std::string systemName =
+ this->GetMakefile()->GetSafeDefinition("CMAKE_HOST_SYSTEM_NAME");
+ if (systemName == "Windows") {
+ platform = "windows+pe";
+ } else if (systemName == "Darwin") {
+ platform = "macos+macho";
+ } else if (systemName == "Linux") {
+ platform = "linux+elf";
+ }
+ }
+ if (platform == "linux+elf") {
+ this->Linker = cm::make_unique<cmBinUtilsLinuxELFLinker>(this);
+ } else if (platform == "windows+pe") {
+ this->Linker = cm::make_unique<cmBinUtilsWindowsPELinker>(this);
+ } else if (platform == "macos+macho") {
+ this->Linker = cm::make_unique<cmBinUtilsMacOSMachOLinker>(this);
+ } else {
+ std::ostringstream e;
+ e << "Invalid value for CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM: "
+ << platform;
+ this->SetError(e.str());
+ return false;
+ }
+
+ return this->Linker->Prepare();
+}
+
+bool cmRuntimeDependencyArchive::GetRuntimeDependencies(
+ const std::vector<std::string>& executables,
+ const std::vector<std::string>& libraries,
+ const std::vector<std::string>& modules)
+{
+ for (auto const& exe : executables) {
+ if (!this->Linker->ScanDependencies(exe, cmStateEnums::EXECUTABLE)) {
+ return false;
+ }
+ }
+ for (auto const& lib : libraries) {
+ if (!this->Linker->ScanDependencies(lib, cmStateEnums::SHARED_LIBRARY)) {
+ return false;
+ }
+ }
+ for (auto const& mod : modules) {
+ if (!this->Linker->ScanDependencies(mod, cmStateEnums::MODULE_LIBRARY)) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+void cmRuntimeDependencyArchive::SetError(const std::string& e)
+{
+ this->Command->SetError(e);
+}
+
+std::string cmRuntimeDependencyArchive::GetBundleExecutable()
+{
+ return this->BundleExecutable;
+}
+
+const std::vector<std::string>&
+cmRuntimeDependencyArchive::GetSearchDirectories()
+{
+ return this->SearchDirectories;
+}
+
+std::string cmRuntimeDependencyArchive::GetGetRuntimeDependenciesTool()
+{
+ return this->GetMakefile()->GetSafeDefinition(
+ "CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL");
+}
+
+bool cmRuntimeDependencyArchive::GetGetRuntimeDependenciesCommand(
+ const std::string& search, std::vector<std::string>& command)
+{
+ // First see if it was supplied by the user
+ std::string toolCommand = this->GetMakefile()->GetSafeDefinition(
+ "CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND");
+ if (!toolCommand.empty()) {
+ cmSystemTools::ExpandListArgument(toolCommand, command);
+ return true;
+ }
+
+ // Now go searching for it
+ std::vector<std::string> paths;
+#ifdef _WIN32
+ cmGlobalGenerator* gg = this->GetMakefile()->GetGlobalGenerator();
+
+ // Add newer Visual Studio paths
+ AddVisualStudioPath(paths, "Visual Studio 16 ", 16, gg);
+ AddVisualStudioPath(paths, "Visual Studio 15 ", 15, gg);
+
+ // Add older Visual Studio paths
+ AddRegistryPath(
+ paths,
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0;InstallDir]/"
+ "../../VC/bin",
+ this->GetMakefile());
+ AddEnvPath(paths, "VS140COMNTOOLS", "/../../VC/bin");
+ paths.push_back(
+ "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin");
+ AddRegistryPath(
+ paths,
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0;InstallDir]/"
+ "../../VC/bin",
+ this->GetMakefile());
+ AddEnvPath(paths, "VS120COMNTOOLS", "/../../VC/bin");
+ paths.push_back(
+ "C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin");
+ AddRegistryPath(
+ paths,
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;InstallDir]/"
+ "../../VC/bin",
+ this->GetMakefile());
+ AddEnvPath(paths, "VS110COMNTOOLS", "/../../VC/bin");
+ paths.push_back(
+ "C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/bin");
+ AddRegistryPath(
+ paths,
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]/"
+ "../../VC/bin",
+ this->GetMakefile());
+ AddEnvPath(paths, "VS100COMNTOOLS", "/../../VC/bin");
+ paths.push_back(
+ "C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin");
+ AddRegistryPath(
+ paths,
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0;InstallDir]/"
+ "../../VC/bin",
+ this->GetMakefile());
+ AddEnvPath(paths, "VS90COMNTOOLS", "/../../VC/bin");
+ paths.push_back("C:/Program Files/Microsoft Visual Studio 9.0/VC/bin");
+ paths.push_back("C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin");
+ AddRegistryPath(
+ paths,
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]/"
+ "../../VC/bin",
+ this->GetMakefile());
+ AddEnvPath(paths, "VS80COMNTOOLS", "/../../VC/bin");
+ paths.push_back("C:/Program Files/Microsoft Visual Studio 8/VC/BIN");
+ paths.push_back("C:/Program Files (x86)/Microsoft Visual Studio 8/VC/BIN");
+ AddRegistryPath(
+ paths,
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1;InstallDir]/"
+ "../../VC7/bin",
+ this->GetMakefile());
+ AddEnvPath(paths, "VS71COMNTOOLS", "/../../VC7/bin");
+ paths.push_back(
+ "C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/BIN");
+ paths.push_back(
+ "C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/VC7/BIN");
+#endif
+
+ std::string program = cmSystemTools::FindProgram(search, paths);
+ if (!program.empty()) {
+ command = { program };
+ return true;
+ }
+
+ // Couldn't find it
+ return false;
+}
+
+bool cmRuntimeDependencyArchive::IsPreExcluded(const std::string& name)
+{
+ cmsys::RegularExpressionMatch match;
+
+ for (auto const& regex : this->PreIncludeRegexes) {
+ if (regex.find(name.c_str(), match)) {
+ return false;
+ }
+ }
+
+ for (auto const& regex : this->PreExcludeRegexes) {
+ if (regex.find(name.c_str(), match)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool cmRuntimeDependencyArchive::IsPostExcluded(const std::string& name)
+{
+ cmsys::RegularExpressionMatch match;
+
+ for (auto const& regex : this->PostIncludeRegexes) {
+ if (regex.find(name.c_str(), match)) {
+ return false;
+ }
+ }
+
+ for (auto const& regex : this->PostExcludeRegexes) {
+ if (regex.find(name.c_str(), match)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void cmRuntimeDependencyArchive::AddResolvedPath(const std::string& name,
+ const std::string& path,
+ bool& unique)
+{
+ auto it = this->ResolvedPaths.emplace(name, std::set<std::string>{}).first;
+ unique = true;
+ for (auto const& other : it->second) {
+ if (cmSystemTools::SameFile(path, other)) {
+ unique = false;
+ break;
+ }
+ }
+ it->second.insert(path);
+}
+
+void cmRuntimeDependencyArchive::AddUnresolvedPath(const std::string& name)
+{
+ this->UnresolvedPaths.insert(name);
+}
+
+cmMakefile* cmRuntimeDependencyArchive::GetMakefile()
+{
+ return this->Command->GetMakefile();
+}
+
+const std::map<std::string, std::set<std::string>>&
+cmRuntimeDependencyArchive::GetResolvedPaths()
+{
+ return this->ResolvedPaths;
+}
+
+const std::set<std::string>& cmRuntimeDependencyArchive::GetUnresolvedPaths()
+{
+ return this->UnresolvedPaths;
+}
diff --git a/Source/cmRuntimeDependencyArchive.h b/Source/cmRuntimeDependencyArchive.h
new file mode 100644
index 0000000..67efec7
--- /dev/null
+++ b/Source/cmRuntimeDependencyArchive.h
@@ -0,0 +1,70 @@
+/* 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
+
+#include "cmBinUtilsLinker.h"
+
+#include "cmsys/RegularExpression.hxx"
+
+#include <map>
+#include <memory>
+#include <set>
+#include <string>
+#include <vector>
+
+class cmCommand;
+class cmMakefile;
+
+class cmRuntimeDependencyArchive
+{
+public:
+ explicit cmRuntimeDependencyArchive(
+ cmCommand* command, std::vector<std::string> searchDirectories,
+ std::string bundleExecutable,
+ const std::vector<std::string>& preIncludeRegexes,
+ const std::vector<std::string>& preExcludeRegexes,
+ const std::vector<std::string>& postIncludeRegexes,
+ const std::vector<std::string>& postExcludeRegexes);
+ bool Prepare();
+ bool GetRuntimeDependencies(const std::vector<std::string>& executables,
+ const std::vector<std::string>& libraries,
+ const std::vector<std::string>& modules);
+
+ void SetError(const std::string& e);
+
+ std::string GetBundleExecutable();
+ const std::vector<std::string>& GetSearchDirectories();
+ std::string GetGetRuntimeDependenciesTool();
+ bool GetGetRuntimeDependenciesCommand(const std::string& search,
+ std::vector<std::string>& command);
+ bool IsPreExcluded(const std::string& name);
+ bool IsPostExcluded(const std::string& name);
+
+ void AddResolvedPath(const std::string& name, const std::string& path,
+ bool& unique);
+ void AddUnresolvedPath(const std::string& name);
+
+ cmMakefile* GetMakefile();
+ const std::map<std::string, std::set<std::string>>& GetResolvedPaths();
+ const std::set<std::string>& GetUnresolvedPaths();
+
+private:
+ cmCommand* Command;
+ std::unique_ptr<cmBinUtilsLinker> Linker;
+
+ std::string GetRuntimeDependenciesTool;
+ std::vector<std::string> GetRuntimeDependenciesCommand;
+
+ std::vector<std::string> SearchDirectories;
+ std::string BundleExecutable;
+ std::vector<cmsys::RegularExpression> PreIncludeRegexes;
+ std::vector<cmsys::RegularExpression> PreExcludeRegexes;
+ std::vector<cmsys::RegularExpression> PostIncludeRegexes;
+ std::vector<cmsys::RegularExpression> PostExcludeRegexes;
+ std::map<std::string, std::set<std::string>> ResolvedPaths;
+ std::set<std::string> UnresolvedPaths;
+};
+
+#endif // cmRuntimeDependencyArchive_h
diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx
index f98984e..879cc95 100644
--- a/Source/cmSearchPath.cxx
+++ b/Source/cmSearchPath.cxx
@@ -6,9 +6,9 @@
#include <cassert>
#include <utility>
-#include "cmAlgorithms.h"
#include "cmFindCommon.h"
#include "cmMakefile.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
cmSearchPath::cmSearchPath(cmFindCommon* findCmd)
diff --git a/Source/cmSeparateArgumentsCommand.cxx b/Source/cmSeparateArgumentsCommand.cxx
index 28cbdc0..ab4a0c7 100644
--- a/Source/cmSeparateArgumentsCommand.cxx
+++ b/Source/cmSeparateArgumentsCommand.cxx
@@ -69,7 +69,7 @@ bool cmSeparateArgumentsCommand::InitialPass(
if (const char* def = this->Makefile->GetDefinition(var)) {
std::string value = def;
std::replace(value.begin(), value.end(), ' ', ';');
- this->Makefile->AddDefinition(var, value.c_str());
+ this->Makefile->AddDefinition(var, value);
}
} else {
// Parse the command line.
@@ -97,7 +97,7 @@ bool cmSeparateArgumentsCommand::InitialPass(
value += si;
}
}
- this->Makefile->AddDefinition(var, value.c_str());
+ this->Makefile->AddDefinition(var, value);
}
return true;
diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h
index 988ad23..76e2002 100644
--- a/Source/cmSeparateArgumentsCommand.h
+++ b/Source/cmSeparateArgumentsCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -23,7 +25,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmSeparateArgumentsCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmSeparateArgumentsCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx
index 1903fd9..9df1883 100644
--- a/Source/cmServer.cxx
+++ b/Source/cmServer.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmServer.h"
-#include "cmAlgorithms.h"
#include "cmConnection.h"
#include "cmFileMonitor.h"
#include "cmJsonObjectDictionary.h"
@@ -18,10 +17,11 @@
#include <cassert>
#include <cstdint>
#include <iostream>
-#include <memory>
#include <mutex>
#include <utility>
+#include "cm_memory.hxx"
+
void on_signal(uv_signal_t* signal, int signum)
{
auto conn = static_cast<cmServerBase*>(signal->data);
diff --git a/Source/cmServer.h b/Source/cmServer.h
index aba4924..ab2ad23 100644
--- a/Source/cmServer.h
+++ b/Source/cmServer.h
@@ -10,7 +10,7 @@
#include "cmUVHandlePtr.h"
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <string>
#include <vector>
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 558391f..c5de742 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmServerProtocol.h"
-#include "cmAlgorithms.h"
#include "cmExternalMakefileProjectGenerator.h"
#include "cmFileMonitor.h"
#include "cmGlobalGenerator.h"
@@ -19,11 +18,12 @@
#include <algorithm>
#include <cassert>
#include <functional>
-#include <memory>
#include <string>
#include <utility>
#include <vector>
+#include "cm_memory.hxx"
+
// Get rid of some windows macros:
#undef max
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 41555e8..1a12785 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -2,12 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSetCommand.h"
-#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmRange.h"
#include "cmState.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
class cmExecutionStatus;
@@ -154,7 +154,7 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
type, force);
} else {
// add the definition
- this->Makefile->AddDefinition(variable, value.c_str());
+ this->Makefile->AddDefinition(variable, value);
}
return true;
}
diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h
index 76e3eae..1c5a435 100644
--- a/Source/cmSetCommand.h
+++ b/Source/cmSetCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -23,7 +25,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmSetCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmSetCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h
index 473347c..5416127 100644
--- a/Source/cmSetDirectoryPropertiesCommand.h
+++ b/Source/cmSetDirectoryPropertiesCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -16,7 +18,10 @@ class cmMakefile;
class cmSetDirectoryPropertiesCommand : public cmCommand
{
public:
- cmCommand* Clone() override { return new cmSetDirectoryPropertiesCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmSetDirectoryPropertiesCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h
index f1126bb..4051e48 100644
--- a/Source/cmSetPropertyCommand.h
+++ b/Source/cmSetPropertyCommand.h
@@ -9,6 +9,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -22,7 +24,10 @@ class cmSetPropertyCommand : public cmCommand
public:
cmSetPropertyCommand();
- cmCommand* Clone() override { return new cmSetPropertyCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmSetPropertyCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h
index afb19f6..6fd6c41 100644
--- a/Source/cmSetSourceFilesPropertiesCommand.h
+++ b/Source/cmSetSourceFilesPropertiesCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -16,7 +18,10 @@ class cmMakefile;
class cmSetSourceFilesPropertiesCommand : public cmCommand
{
public:
- cmCommand* Clone() override { return new cmSetSourceFilesPropertiesCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmSetSourceFilesPropertiesCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h
index c9755da..7e4606e 100644
--- a/Source/cmSetTargetPropertiesCommand.h
+++ b/Source/cmSetTargetPropertiesCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -16,7 +18,10 @@ class cmMakefile;
class cmSetTargetPropertiesCommand : public cmCommand
{
public:
- cmCommand* Clone() override { return new cmSetTargetPropertiesCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmSetTargetPropertiesCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h
index 84b2645..d73e95a 100644
--- a/Source/cmSetTestsPropertiesCommand.h
+++ b/Source/cmSetTestsPropertiesCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -16,7 +18,10 @@ class cmMakefile;
class cmSetTestsPropertiesCommand : public cmCommand
{
public:
- cmCommand* Clone() override { return new cmSetTestsPropertiesCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmSetTestsPropertiesCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h
index 2d8dc17..0190abb 100644
--- a/Source/cmSiteNameCommand.h
+++ b/Source/cmSiteNameCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -23,7 +25,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmSiteNameCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmSiteNameCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index acacba2..6e2e820 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -2,10 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSourceFileLocation.h"
-#include "cmAlgorithms.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -146,8 +146,7 @@ bool cmSourceFileLocation::MatchesAmbiguousExtension(
// adding an extension.
if (!(this->Name.size() > loc.Name.size() &&
this->Name[loc.Name.size()] == '.' &&
- cmHasLiteralPrefixImpl(this->Name.c_str(), loc.Name.c_str(),
- loc.Name.size()))) {
+ cmHasPrefix(this->Name, loc.Name))) {
return false;
}
diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h
index ec5ad32..eec4ec0 100644
--- a/Source/cmSourceGroupCommand.h
+++ b/Source/cmSourceGroupCommand.h
@@ -9,6 +9,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -25,7 +27,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmSourceGroupCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmSourceGroupCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index fa7df0b..1ea72e1 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -5,35 +5,33 @@
#include "cmsys/RegularExpression.hxx"
#include <algorithm>
#include <assert.h>
+#include <stdlib.h>
#include <string.h>
#include <utility>
-#include "cmAlgorithms.h"
+#include "cm_memory.hxx"
+
#include "cmCacheManager.h"
#include "cmCommand.h"
#include "cmDefinitions.h"
#include "cmDisallowedCommand.h"
+#include "cmExecutionStatus.h"
#include "cmGlobVerificationManager.h"
#include "cmListFileCache.h"
+#include "cmMakefile.h"
#include "cmStatePrivate.h"
#include "cmStateSnapshot.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-#include "cmUnexpectedCommand.h"
#include "cmake.h"
cmState::cmState()
{
- this->CacheManager = new cmCacheManager;
- this->GlobVerificationManager = new cmGlobVerificationManager;
+ this->CacheManager = cm::make_unique<cmCacheManager>();
+ this->GlobVerificationManager = cm::make_unique<cmGlobVerificationManager>();
}
-cmState::~cmState()
-{
- delete this->CacheManager;
- delete this->GlobVerificationManager;
- cmDeleteAll(this->BuiltinCommands);
- cmDeleteAll(this->ScriptedCommands);
-}
+cmState::~cmState() = default;
const char* cmState::GetTargetTypeName(cmStateEnums::TargetType targetType)
{
@@ -267,7 +265,7 @@ void cmState::RemoveCacheEntryProperty(std::string const& key,
cmStateSnapshot cmState::Reset()
{
- this->GlobalProperties.clear();
+ this->GlobalProperties.Clear();
this->PropertyDefinitions.clear();
this->GlobVerificationManager->Reset();
@@ -289,7 +287,7 @@ cmStateSnapshot cmState::Reset()
it->LinkDirectoriesBacktraces.clear();
it->DirectoryEnd = pos;
it->NormalTargetNames.clear();
- it->Properties.clear();
+ it->Properties.Clear();
it->Children.clear();
}
@@ -310,8 +308,8 @@ cmStateSnapshot cmState::Reset()
pos->Parent = this->VarTree.Root();
pos->Root = this->VarTree.Root();
- pos->Vars->Set("CMAKE_SOURCE_DIR", srcDir.c_str());
- pos->Vars->Set("CMAKE_BINARY_DIR", binDir.c_str());
+ pos->Vars->Set("CMAKE_SOURCE_DIR", srcDir);
+ pos->Vars->Set("CMAKE_BINARY_DIR", binDir);
}
this->DefineProperty("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY, "", "",
@@ -421,61 +419,82 @@ void cmState::SetIsGeneratorMultiConfig(bool b)
this->IsGeneratorMultiConfig = b;
}
-void cmState::AddBuiltinCommand(std::string const& name, cmCommand* command)
+void cmState::AddBuiltinCommand(std::string const& name,
+ std::unique_ptr<cmCommand> command)
+{
+ this->AddBuiltinCommand(name, cmLegacyCommandWrapper(std::move(command)));
+}
+
+void cmState::AddBuiltinCommand(std::string const& name, Command command)
{
assert(name == cmSystemTools::LowerCase(name));
assert(this->BuiltinCommands.find(name) == this->BuiltinCommands.end());
- this->BuiltinCommands.insert(std::make_pair(name, command));
+ this->BuiltinCommands.emplace(name, std::move(command));
}
-void cmState::AddDisallowedCommand(std::string const& name, cmCommand* command,
+void cmState::AddBuiltinCommand(std::string const& name,
+ BuiltinCommand command)
+{
+ this->AddBuiltinCommand(
+ name,
+ [command](const std::vector<cmListFileArgument>& args,
+ cmExecutionStatus& status) -> bool {
+ std::vector<std::string> expandedArguments;
+ if (!status.GetMakefile().ExpandArguments(args, expandedArguments)) {
+ // There was an error expanding arguments. It was already
+ // reported, so we can skip this command without error.
+ return true;
+ }
+ return command(expandedArguments, status);
+ });
+}
+
+void cmState::AddDisallowedCommand(std::string const& name,
+ std::unique_ptr<cmCommand> command,
cmPolicies::PolicyID policy,
const char* message)
{
- this->AddBuiltinCommand(name,
- new cmDisallowedCommand(command, policy, message));
+ this->AddBuiltinCommand(
+ name,
+ cm::make_unique<cmDisallowedCommand>(std::move(command), policy, message));
}
void cmState::AddUnexpectedCommand(std::string const& name, const char* error)
{
- this->AddBuiltinCommand(name, new cmUnexpectedCommand(name, error));
+ this->AddBuiltinCommand(
+ name,
+ [name, error](std::vector<cmListFileArgument> const&,
+ cmExecutionStatus& status) -> bool {
+ const char* versionValue =
+ status.GetMakefile().GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
+ if (name == "endif" && (!versionValue || atof(versionValue) <= 1.4)) {
+ return true;
+ }
+ status.SetError(error);
+ return false;
+ });
}
-void cmState::AddScriptedCommand(std::string const& name, cmCommand* command)
+void cmState::AddScriptedCommand(std::string const& name, Command command)
{
std::string sName = cmSystemTools::LowerCase(name);
// if the command already exists, give a new name to the old command.
- if (cmCommand* oldCmd = this->GetCommand(sName)) {
- std::string const newName = "_" + sName;
- std::map<std::string, cmCommand*>::iterator pos =
- this->ScriptedCommands.find(newName);
- if (pos != this->ScriptedCommands.end()) {
- delete pos->second;
- this->ScriptedCommands.erase(pos);
- }
- this->ScriptedCommands.insert(std::make_pair(newName, oldCmd->Clone()));
+ if (Command oldCmd = this->GetCommand(sName)) {
+ this->ScriptedCommands["_" + sName] = oldCmd;
}
- // if the command already exists, free the old one
- std::map<std::string, cmCommand*>::iterator pos =
- this->ScriptedCommands.find(sName);
- if (pos != this->ScriptedCommands.end()) {
- delete pos->second;
- this->ScriptedCommands.erase(pos);
- }
- this->ScriptedCommands.insert(std::make_pair(sName, command));
+ this->ScriptedCommands[sName] = std::move(command);
}
-cmCommand* cmState::GetCommand(std::string const& name) const
+cmState::Command cmState::GetCommand(std::string const& name) const
{
return GetCommandByExactName(cmSystemTools::LowerCase(name));
}
-cmCommand* cmState::GetCommandByExactName(std::string const& name) const
+cmState::Command cmState::GetCommandByExactName(std::string const& name) const
{
- std::map<std::string, cmCommand*>::const_iterator pos;
- pos = this->ScriptedCommands.find(name);
+ auto pos = this->ScriptedCommands.find(name);
if (pos != this->ScriptedCommands.end()) {
return pos->second;
}
@@ -506,16 +525,11 @@ std::vector<std::string> cmState::GetCommandNames() const
void cmState::RemoveBuiltinCommand(std::string const& name)
{
assert(name == cmSystemTools::LowerCase(name));
- std::map<std::string, cmCommand*>::iterator i =
- this->BuiltinCommands.find(name);
- assert(i != this->BuiltinCommands.end());
- delete i->second;
- this->BuiltinCommands.erase(i);
+ this->BuiltinCommands.erase(name);
}
void cmState::RemoveUserDefinedCommands()
{
- cmDeleteAll(this->ScriptedCommands);
this->ScriptedCommands.clear();
}
diff --git a/Source/cmState.h b/Source/cmState.h
index 6abe71c..8847f3b 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -5,7 +5,9 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <functional>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -26,6 +28,7 @@ class cmGlobVerificationManager;
class cmPropertyDefinition;
class cmStateSnapshot;
class cmMessenger;
+class cmExecutionStatus;
class cmState
{
@@ -140,16 +143,25 @@ public:
bool GetIsGeneratorMultiConfig() const;
void SetIsGeneratorMultiConfig(bool b);
+ using Command = std::function<bool(std::vector<cmListFileArgument> const&,
+ cmExecutionStatus&)>;
+ using BuiltinCommand = bool (*)(std::vector<std::string> const&,
+ cmExecutionStatus&);
+
// Returns a command from its name, case insensitive, or nullptr
- cmCommand* GetCommand(std::string const& name) const;
+ Command GetCommand(std::string const& name) const;
// Returns a command from its name, or nullptr
- cmCommand* GetCommandByExactName(std::string const& name) const;
-
- void AddBuiltinCommand(std::string const& name, cmCommand* command);
- void AddDisallowedCommand(std::string const& name, cmCommand* command,
+ Command GetCommandByExactName(std::string const& name) const;
+
+ void AddBuiltinCommand(std::string const& name,
+ std::unique_ptr<cmCommand> command);
+ void AddBuiltinCommand(std::string const& name, Command command);
+ void AddBuiltinCommand(std::string const& name, BuiltinCommand command);
+ void AddDisallowedCommand(std::string const& name,
+ std::unique_ptr<cmCommand> command,
cmPolicies::PolicyID policy, const char* message);
void AddUnexpectedCommand(std::string const& name, const char* error);
- void AddScriptedCommand(std::string const& name, cmCommand* command);
+ void AddScriptedCommand(std::string const& name, Command command);
void RemoveBuiltinCommand(std::string const& name);
void RemoveUserDefinedCommands();
std::vector<std::string> GetCommandNames() const;
@@ -208,11 +220,11 @@ private:
std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions;
std::vector<std::string> EnabledLanguages;
- std::map<std::string, cmCommand*> BuiltinCommands;
- std::map<std::string, cmCommand*> ScriptedCommands;
+ std::map<std::string, Command> BuiltinCommands;
+ std::map<std::string, Command> ScriptedCommands;
cmPropertyMap GlobalProperties;
- cmCacheManager* CacheManager;
- cmGlobVerificationManager* GlobVerificationManager;
+ std::unique_ptr<cmCacheManager> CacheManager;
+ std::unique_ptr<cmGlobVerificationManager> GlobVerificationManager;
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>
BuildsystemDirectory;
diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx
index 182d3fe..3f70ed3 100644
--- a/Source/cmStateDirectory.cxx
+++ b/Source/cmStateDirectory.cxx
@@ -6,7 +6,7 @@
#include <algorithm>
#include <assert.h>
#include <iterator>
-#include <utility>
+#include <vector>
#include "cmAlgorithms.h"
#include "cmProperty.h"
@@ -667,12 +667,7 @@ bool cmStateDirectory::GetPropertyAsBool(const std::string& prop) const
std::vector<std::string> cmStateDirectory::GetPropertyKeys() const
{
- std::vector<std::string> keys;
- keys.reserve(this->DirectoryState->Properties.size());
- for (auto const& it : this->DirectoryState->Properties) {
- keys.push_back(it.first);
- }
- return keys;
+ return this->DirectoryState->Properties.GetKeys();
}
void cmStateDirectory::AddNormalTargetName(std::string const& name)
diff --git a/Source/cmStateDirectory.h b/Source/cmStateDirectory.h
index 6956594..fe15563 100644
--- a/Source/cmStateDirectory.h
+++ b/Source/cmStateDirectory.h
@@ -14,6 +14,7 @@
#include "cmListFileCache.h"
#include "cmStatePrivate.h"
#include "cmStateSnapshot.h"
+#include "cmStringAlgorithms.h"
class cmStateDirectory
{
diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx
index 63bec71..110ec56 100644
--- a/Source/cmStateSnapshot.cxx
+++ b/Source/cmStateSnapshot.cxx
@@ -222,14 +222,14 @@ bool cmStateSnapshot::IsInitialized(std::string const& name) const
}
void cmStateSnapshot::SetDefinition(std::string const& name,
- std::string const& value)
+ cm::string_view value)
{
- this->Position->Vars->Set(name, value.c_str());
+ this->Position->Vars->Set(name, value);
}
void cmStateSnapshot::RemoveDefinition(std::string const& name)
{
- this->Position->Vars->Set(name, nullptr);
+ this->Position->Vars->Unset(name);
}
std::vector<std::string> cmStateSnapshot::UnusedKeys() const
@@ -264,7 +264,11 @@ bool cmStateSnapshot::RaiseScope(std::string const& var, const char* varDef)
cmDefinitions::Raise(var, this->Position->Vars, this->Position->Root);
// Now update the definition in the parent scope.
- this->Position->Parent->Set(var, varDef);
+ if (varDef) {
+ this->Position->Parent->Set(var, varDef);
+ } else {
+ this->Position->Parent->Unset(var);
+ }
return true;
}
diff --git a/Source/cmStateSnapshot.h b/Source/cmStateSnapshot.h
index c315f48..da39127 100644
--- a/Source/cmStateSnapshot.h
+++ b/Source/cmStateSnapshot.h
@@ -9,6 +9,8 @@
#include <string>
#include <vector>
+#include "cm_string_view.hxx"
+
#include "cmLinkedTree.h"
#include "cmPolicies.h"
#include "cmStateTypes.h"
@@ -24,7 +26,7 @@ public:
std::string const* GetDefinition(std::string const& name) const;
bool IsInitialized(std::string const& name) const;
- void SetDefinition(std::string const& name, std::string const& value);
+ void SetDefinition(std::string const& name, cm::string_view value);
void RemoveDefinition(std::string const& name);
std::vector<std::string> UnusedKeys() const;
std::vector<std::string> ClosureKeys() const;
diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h
new file mode 100644
index 0000000..149e0ad
--- /dev/null
+++ b/Source/cmStringAlgorithms.h
@@ -0,0 +1,139 @@
+/* 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
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include "cmRange.h"
+#include "cm_string_view.hxx"
+#include <algorithm>
+#include <iterator>
+#include <sstream>
+#include <string.h>
+#include <string>
+#include <utility>
+#include <vector>
+
+typedef cmRange<std::vector<std::string>::const_iterator> cmStringRange;
+
+struct cmStrCmp
+{
+ cmStrCmp(const char* test)
+ : m_test(test)
+ {
+ }
+ cmStrCmp(std::string test)
+ : m_test(std::move(test))
+ {
+ }
+
+ bool operator()(const std::string& input) const { return m_test == input; }
+
+ bool operator()(const char* input) const
+ {
+ return strcmp(input, m_test.c_str()) == 0;
+ }
+
+private:
+ const std::string m_test;
+};
+
+template <typename Range>
+std::string cmJoin(Range const& r, const char* delimiter)
+{
+ if (r.empty()) {
+ return std::string();
+ }
+ std::ostringstream os;
+ typedef typename Range::value_type ValueType;
+ typedef typename Range::const_iterator InputIt;
+ const InputIt first = r.begin();
+ InputIt last = r.end();
+ --last;
+ std::copy(first, last, std::ostream_iterator<ValueType>(os, delimiter));
+
+ os << *last;
+
+ return os.str();
+}
+
+template <typename Range>
+std::string cmJoin(Range const& r, std::string const& delimiter)
+{
+ return cmJoin(r, delimiter.c_str());
+}
+
+template <typename Range>
+std::string cmWrap(std::string const& prefix, Range const& r,
+ std::string const& suffix, std::string const& sep)
+{
+ if (r.empty()) {
+ return std::string();
+ }
+ return prefix + cmJoin(r, suffix + sep + prefix) + suffix;
+}
+
+template <typename Range>
+std::string cmWrap(char prefix, Range const& r, char suffix,
+ std::string const& sep)
+{
+ return cmWrap(std::string(1, prefix), r, std::string(1, suffix), sep);
+}
+
+/** Returns true if string @a str starts with the character @a prefix. **/
+inline bool cmHasPrefix(cm::string_view str, char prefix)
+{
+ return !str.empty() && (str.front() == prefix);
+}
+
+/** Returns true if string @a str starts with string @a prefix. **/
+inline bool cmHasPrefix(cm::string_view str, cm::string_view prefix)
+{
+ return str.compare(0, prefix.size(), prefix) == 0;
+}
+
+/** Returns true if string @a str starts with string @a prefix. **/
+template <size_t N>
+inline bool cmHasLiteralPrefix(cm::string_view str, const char (&prefix)[N])
+{
+ return cmHasPrefix(str, cm::string_view(prefix, N - 1));
+}
+
+/** Returns true if string @a str ends with the character @a suffix. **/
+inline bool cmHasSuffix(cm::string_view str, char suffix)
+{
+ return !str.empty() && (str.back() == suffix);
+}
+
+/** Returns true if string @a str ends with string @a suffix. **/
+inline bool cmHasSuffix(cm::string_view str, cm::string_view suffix)
+{
+ return str.size() >= suffix.size() &&
+ str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0;
+}
+
+/** Returns true if string @a str ends with string @a suffix. **/
+template <size_t N>
+inline bool cmHasLiteralSuffix(cm::string_view str, const char (&suffix)[N])
+{
+ return cmHasSuffix(str, cm::string_view(suffix, N - 1));
+}
+
+/** Removes an existing suffix character of from the string @a str. **/
+inline void cmStripSuffixIfExists(std::string& str, char suffix)
+{
+ if (cmHasSuffix(str, suffix)) {
+ str.pop_back();
+ }
+}
+
+/** Removes an existing suffix string of from the string @a str. **/
+inline void cmStripSuffixIfExists(std::string& str, cm::string_view suffix)
+{
+ if (cmHasSuffix(str, suffix)) {
+ str.resize(str.size() - suffix.size());
+ }
+}
+
+#endif
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 998f904..8b3b1e3 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -8,7 +8,6 @@
#include <algorithm>
#include <ctype.h>
#include <iterator>
-#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
@@ -19,6 +18,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmRange.h"
+#include "cmStringAlgorithms.h"
#include "cmStringReplaceHelper.h"
#include "cmSystemTools.h"
#include "cmTimestamp.h"
@@ -124,7 +124,7 @@ bool cmStringCommand::HandleHashCommand(std::vector<std::string> const& args)
std::unique_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str()));
if (hash) {
std::string out = hash->HashString(args[2]);
- this->Makefile->AddDefinition(args[1], out.c_str());
+ this->Makefile->AddDefinition(args[1], out);
return true;
}
return false;
@@ -154,7 +154,7 @@ bool cmStringCommand::HandleToUpperLowerCommand(
}
// Store the output in the provided variable.
- this->Makefile->AddDefinition(outvar, output.c_str());
+ this->Makefile->AddDefinition(outvar, output);
return true;
}
@@ -180,7 +180,7 @@ bool cmStringCommand::HandleAsciiCommand(std::vector<std::string> const& args)
}
}
// Store the output in the provided variable.
- this->Makefile->AddDefinition(outvar, output.c_str());
+ this->Makefile->AddDefinition(outvar, output);
return true;
}
@@ -217,7 +217,7 @@ bool cmStringCommand::HandleConfigureCommand(
this->Makefile->ConfigureString(args[1], output, atOnly, escapeQuotes);
// Store the output in the provided variable.
- this->Makefile->AddDefinition(args[2], output.c_str());
+ this->Makefile->AddDefinition(args[2], output);
return true;
}
@@ -296,7 +296,7 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
}
// Store the output in the provided variable.
- this->Makefile->AddDefinition(outvar, output.c_str());
+ this->Makefile->AddDefinition(outvar, output);
return true;
}
@@ -343,7 +343,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
}
// Store the output in the provided variable.
- this->Makefile->AddDefinition(outvar, output.c_str());
+ this->Makefile->AddDefinition(outvar, output);
return true;
}
@@ -384,7 +384,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
}
// Store the output in the provided variable.
- this->Makefile->AddDefinition(outvar, output.c_str());
+ this->Makefile->AddDefinition(outvar, output);
return true;
}
@@ -431,7 +431,7 @@ bool cmStringCommand::HandleFindCommand(std::vector<std::string> const& args)
if (std::string::npos != pos) {
std::ostringstream s;
s << pos;
- this->Makefile->AddDefinition(outvar, s.str().c_str());
+ this->Makefile->AddDefinition(outvar, s.str());
return true;
}
@@ -506,7 +506,7 @@ bool cmStringCommand::HandleReplaceCommand(
cmsys::SystemTools::ReplaceString(input, matchExpression.c_str(),
replaceExpression.c_str());
- this->Makefile->AddDefinition(variableName, input.c_str());
+ this->Makefile->AddDefinition(variableName, input);
return true;
}
@@ -539,8 +539,7 @@ bool cmStringCommand::HandleSubstringCommand(
return false;
}
- this->Makefile->AddDefinition(variableName,
- stringValue.substr(begin, end).c_str());
+ this->Makefile->AddDefinition(variableName, stringValue.substr(begin, end));
return true;
}
@@ -582,7 +581,7 @@ bool cmStringCommand::HandleAppendCommand(std::vector<std::string> const& args)
value = oldValue;
}
value += cmJoin(cmMakeRange(args).advance(2), std::string());
- this->Makefile->AddDefinition(variable, value.c_str());
+ this->Makefile->AddDefinition(variable, value);
return true;
}
@@ -606,7 +605,7 @@ bool cmStringCommand::HandlePrependCommand(
if (oldValue) {
value += oldValue;
}
- this->Makefile->AddDefinition(variable, value.c_str());
+ this->Makefile->AddDefinition(variable, value);
return true;
}
@@ -638,7 +637,7 @@ bool cmStringCommand::joinImpl(std::vector<std::string> const& args,
// both `CONCAT` and `JOIN` sub-commands.
std::string value = cmJoin(cmMakeRange(args).advance(varIdx + 1), glue);
- this->Makefile->AddDefinition(variableName, value.c_str());
+ this->Makefile->AddDefinition(variableName, value);
return true;
}
@@ -654,7 +653,7 @@ bool cmStringCommand::HandleMakeCIdentifierCommand(
const std::string& variableName = args[2];
this->Makefile->AddDefinition(variableName,
- cmSystemTools::MakeCidentifier(input).c_str());
+ cmSystemTools::MakeCidentifier(input));
return true;
}
@@ -673,7 +672,7 @@ bool cmStringCommand::HandleGenexStripCommand(
const std::string& variableName = args[2];
- this->Makefile->AddDefinition(variableName, result.c_str());
+ this->Makefile->AddDefinition(variableName, result);
return true;
}
@@ -712,8 +711,8 @@ bool cmStringCommand::HandleStripCommand(std::vector<std::string> const& args)
outLength = endPos - startPos + 1;
}
- this->Makefile->AddDefinition(
- variableName, stringValue.substr(startPos, outLength).c_str());
+ this->Makefile->AddDefinition(variableName,
+ stringValue.substr(startPos, outLength));
return true;
}
@@ -766,7 +765,7 @@ bool cmStringCommand::HandleRepeatCommand(std::vector<std::string> const& args)
break;
}
- this->Makefile->AddDefinition(variableName, result.c_str());
+ this->Makefile->AddDefinition(variableName, result);
return true;
}
@@ -872,7 +871,7 @@ bool cmStringCommand::HandleTimestampCommand(
cmTimestamp timestamp;
std::string result = timestamp.CurrentTime(formatString, utcFlag);
- this->Makefile->AddDefinition(outputVariable, result.c_str());
+ this->Makefile->AddDefinition(outputVariable, result);
return true;
}
@@ -955,7 +954,7 @@ bool cmStringCommand::HandleUuidCommand(std::vector<std::string> const& args)
uuid = cmSystemTools::UpperCase(uuid);
}
- this->Makefile->AddDefinition(outputVariable, uuid.c_str());
+ this->Makefile->AddDefinition(outputVariable, uuid);
return true;
#else
std::ostringstream e;
diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h
index acde605..f48ea17 100644
--- a/Source/cmStringCommand.h
+++ b/Source/cmStringCommand.h
@@ -9,6 +9,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -23,7 +25,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmStringCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmStringCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h
index adab757..3499c46 100644
--- a/Source/cmSubdirCommand.h
+++ b/Source/cmSubdirCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -25,7 +27,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmSubdirCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmSubdirCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h
index 2db28c6..64c28b9 100644
--- a/Source/cmSubdirDependsCommand.h
+++ b/Source/cmSubdirDependsCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -15,7 +17,10 @@ class cmExecutionStatus;
class cmSubdirDependsCommand : public cmCommand
{
public:
- cmCommand* Clone() override { return new cmSubdirDependsCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmSubdirDependsCommand>();
+ }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
};
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 1501481..5f4e1fc 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -6,6 +6,7 @@
#include "cmDuration.h"
#include "cmProcessOutput.h"
#include "cmRange.h"
+#include "cmStringAlgorithms.h"
#include "cm_uv.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -176,36 +177,37 @@ void cmSystemTools::ExpandRegistryValues(std::string& source,
}
#endif
-std::string cmSystemTools::EscapeQuotes(const std::string& str)
+std::string cmSystemTools::EscapeQuotes(cm::string_view str)
{
std::string result;
result.reserve(str.size());
- for (const char* ch = str.c_str(); *ch != '\0'; ++ch) {
- if (*ch == '"') {
+ for (const char ch : str) {
+ if (ch == '"') {
result += '\\';
}
- result += *ch;
+ result += ch;
}
return result;
}
-std::string cmSystemTools::HelpFileName(std::string name)
+std::string cmSystemTools::HelpFileName(cm::string_view str)
{
+ std::string name(str);
cmSystemTools::ReplaceString(name, "<", "");
cmSystemTools::ReplaceString(name, ">", "");
return name;
}
-std::string cmSystemTools::TrimWhitespace(const std::string& s)
+std::string cmSystemTools::TrimWhitespace(cm::string_view str)
{
- std::string::const_iterator start = s.begin();
- while (start != s.end() && cm_isspace(*start)) {
+ auto start = str.begin();
+ while (start != str.end() && cm_isspace(*start)) {
++start;
}
- if (start == s.end()) {
- return "";
+ if (start == str.end()) {
+ return std::string();
}
- std::string::const_iterator stop = s.end() - 1;
+ auto stop = str.end() - 1;
while (cm_isspace(*stop)) {
--stop;
}
@@ -282,115 +284,85 @@ void cmSystemTools::ReportLastSystemError(const char* msg)
cmSystemTools::Error(m);
}
-bool cmSystemTools::IsInternallyOn(const char* val)
-{
- if (!val) {
- return false;
- }
- std::string v = val;
- if (v.size() > 4) {
- return false;
+bool cmSystemTools::IsInternallyOn(cm::string_view val)
+{
+ return (val.size() == 4) && //
+ (val[0] == 'I' || val[0] == 'i') && //
+ (val[1] == '_') && //
+ (val[2] == 'O' || val[2] == 'o') && //
+ (val[3] == 'N' || val[3] == 'n');
+}
+
+bool cmSystemTools::IsOn(cm::string_view val)
+{
+ switch (val.size()) {
+ case 1:
+ return val[0] == '1' || val[0] == 'Y' || val[0] == 'y';
+ case 2:
+ return //
+ (val[0] == 'O' || val[0] == 'o') && //
+ (val[1] == 'N' || val[1] == 'n');
+ case 3:
+ return //
+ (val[0] == 'Y' || val[0] == 'y') && //
+ (val[1] == 'E' || val[1] == 'e') && //
+ (val[2] == 'S' || val[2] == 's');
+ case 4:
+ return //
+ (val[0] == 'T' || val[0] == 't') && //
+ (val[1] == 'R' || val[1] == 'r') && //
+ (val[2] == 'U' || val[2] == 'u') && //
+ (val[3] == 'E' || val[3] == 'e');
+ default:
+ break;
}
- for (char& c : v) {
- c = static_cast<char>(toupper(c));
- }
- return v == "I_ON";
-}
-
-bool cmSystemTools::IsOn(const char* val)
-{
- if (!val) {
- return false;
- }
- /* clang-format off */
- // "1"
- if (val[0] == '1' && val[1] == '\0') {
- return true;
- }
- // "ON"
- if ((val[0] == 'O' || val[0] == 'o') &&
- (val[1] == 'N' || val[1] == 'n') && val[2] == '\0') {
- return true;
- }
- // "Y", "YES"
- if ((val[0] == 'Y' || val[0] == 'y') && (val[1] == '\0' || (
- (val[1] == 'E' || val[1] == 'e') &&
- (val[2] == 'S' || val[2] == 's') && val[3] == '\0'))) {
- return true;
- }
- // "TRUE"
- if ((val[0] == 'T' || val[0] == 't') &&
- (val[1] == 'R' || val[1] == 'r') &&
- (val[2] == 'U' || val[2] == 'u') &&
- (val[3] == 'E' || val[3] == 'e') && val[4] == '\0') {
- return true;
- }
- /* clang-format on */
return false;
}
-bool cmSystemTools::IsOn(const std::string& val)
+bool cmSystemTools::IsNOTFOUND(cm::string_view val)
{
- return cmSystemTools::IsOn(val.c_str());
+ return (val == "NOTFOUND") || cmHasLiteralSuffix(val, "-NOTFOUND");
}
-bool cmSystemTools::IsNOTFOUND(const char* val)
+bool cmSystemTools::IsOff(cm::string_view val)
{
- if (strcmp(val, "NOTFOUND") == 0) {
- return true;
+ switch (val.size()) {
+ case 0:
+ return true;
+ case 1:
+ return val[0] == '0' || val[0] == 'N' || val[0] == 'n';
+ case 2:
+ return //
+ (val[0] == 'N' || val[0] == 'n') && //
+ (val[1] == 'O' || val[1] == 'o');
+ case 3:
+ return //
+ (val[0] == 'O' || val[0] == 'o') && //
+ (val[1] == 'F' || val[1] == 'f') && //
+ (val[2] == 'F' || val[2] == 'f');
+ case 5:
+ return //
+ (val[0] == 'F' || val[0] == 'f') && //
+ (val[1] == 'A' || val[1] == 'a') && //
+ (val[2] == 'L' || val[2] == 'l') && //
+ (val[3] == 'S' || val[3] == 's') && //
+ (val[4] == 'E' || val[4] == 'e');
+ case 6:
+ return //
+ (val[0] == 'I' || val[0] == 'i') && //
+ (val[1] == 'G' || val[1] == 'g') && //
+ (val[2] == 'N' || val[2] == 'n') && //
+ (val[3] == 'O' || val[3] == 'o') && //
+ (val[4] == 'R' || val[4] == 'r') && //
+ (val[5] == 'E' || val[5] == 'e');
+ default:
+ break;
}
- return cmHasLiteralSuffix(val, "-NOTFOUND");
-}
-bool cmSystemTools::IsOff(const char* val)
-{
- // ""
- if (!val || val[0] == '\0') {
- return true;
- }
- /* clang-format off */
- // "0"
- if (val[0] == '0' && val[1] == '\0') {
- return true;
- }
- // "OFF"
- if ((val[0] == 'O' || val[0] == 'o') &&
- (val[1] == 'F' || val[1] == 'f') &&
- (val[2] == 'F' || val[2] == 'f') && val[3] == '\0') {
- return true;
- }
- // "N", "NO"
- if ((val[0] == 'N' || val[0] == 'n') && (val[1] == '\0' || (
- (val[1] == 'O' || val[1] == 'o') && val[2] == '\0'))) {
- return true;
- }
- // "FALSE"
- if ((val[0] == 'F' || val[0] == 'f') &&
- (val[1] == 'A' || val[1] == 'a') &&
- (val[2] == 'L' || val[2] == 'l') &&
- (val[3] == 'S' || val[3] == 's') &&
- (val[4] == 'E' || val[4] == 'e') && val[5] == '\0') {
- return true;
- }
- // "IGNORE"
- if ((val[0] == 'I' || val[0] == 'i') &&
- (val[1] == 'G' || val[1] == 'g') &&
- (val[2] == 'N' || val[2] == 'n') &&
- (val[3] == 'O' || val[3] == 'o') &&
- (val[4] == 'R' || val[4] == 'r') &&
- (val[5] == 'E' || val[5] == 'e') && val[6] == '\0') {
- return true;
- }
- /* clang-format on */
return cmSystemTools::IsNOTFOUND(val);
}
-bool cmSystemTools::IsOff(const std::string& val)
-{
- return cmSystemTools::IsOff(val.c_str());
-}
-
void cmSystemTools::ParseWindowsCommandLine(const char* command,
std::vector<std::string>& args)
{
@@ -1151,7 +1123,7 @@ void cmSystemTools::GlobDirs(const std::string& path,
}
}
-void cmSystemTools::ExpandListArgument(const std::string& arg,
+void cmSystemTools::ExpandListArgument(cm::string_view arg,
std::vector<std::string>& argsOut,
bool emptyArgs)
{
@@ -1159,25 +1131,29 @@ void cmSystemTools::ExpandListArgument(const std::string& arg,
if (!emptyArgs && arg.empty()) {
return;
}
+
// if there are no ; in the name then just copy the current string
- if (arg.find(';') == std::string::npos) {
- argsOut.push_back(arg);
+ if (arg.find(';') == cm::string_view::npos) {
+ argsOut.emplace_back(arg);
return;
}
+
std::string newArg;
- const char* last = arg.c_str();
// Break the string at non-escaped semicolons not nested in [].
int squareNesting = 0;
- for (const char* c = last; *c; ++c) {
+ cm::string_view::iterator last = arg.begin();
+ cm::string_view::iterator const cend = arg.end();
+ for (cm::string_view::iterator c = last; c != cend; ++c) {
switch (*c) {
case '\\': {
// We only want to allow escaping of semicolons. Other
// escapes should not be processed here.
- const char* next = c + 1;
- if (*next == ';') {
- newArg.append(last, c - last);
+ cm::string_view::iterator cnext = c + 1;
+ if ((cnext != cend) && *cnext == ';') {
+ newArg.append(last, c);
// Skip over the escape character
- last = c = next;
+ last = cnext;
+ c = cnext;
}
} break;
case '[': {
@@ -1190,7 +1166,7 @@ void cmSystemTools::ExpandListArgument(const std::string& arg,
// Break the string here if we are not nested inside square
// brackets.
if (squareNesting == 0) {
- newArg.append(last, c - last);
+ newArg.append(last, c);
// Skip over the semicolon
last = c + 1;
if (!newArg.empty() || emptyArgs) {
@@ -1205,15 +1181,15 @@ void cmSystemTools::ExpandListArgument(const std::string& arg,
} break;
}
}
- newArg.append(last);
+ newArg.append(last, cend);
if (!newArg.empty() || emptyArgs) {
// Add the last argument if the string is not empty.
- argsOut.push_back(newArg);
+ argsOut.push_back(std::move(newArg));
}
}
std::vector<std::string> cmSystemTools::ExpandedListArgument(
- const std::string& arg, bool emptyArgs)
+ cm::string_view arg, bool emptyArgs)
{
std::vector<std::string> argsOut;
ExpandListArgument(arg, argsOut, emptyArgs);
@@ -1264,65 +1240,6 @@ bool cmSystemTools::SimpleGlob(const std::string& glob,
return res;
}
-cmSystemTools::FileFormat cmSystemTools::GetFileFormat(std::string const& ext)
-{
- if (ext.empty()) {
- return cmSystemTools::NO_FILE_FORMAT;
- }
- if (ext == "c" || ext == ".c" || ext == "m" || ext == ".m") {
- return cmSystemTools::C_FILE_FORMAT;
- }
- if (ext == "C" || ext == ".C" || ext == "M" || ext == ".M" || ext == "c++" ||
- ext == ".c++" || ext == "cc" || ext == ".cc" || ext == "cpp" ||
- ext == ".cpp" || ext == "cxx" || ext == ".cxx" || ext == "mm" ||
- ext == ".mm") {
- return cmSystemTools::CXX_FILE_FORMAT;
- }
- if (ext == "f" || ext == ".f" || ext == "F" || ext == ".F" || ext == "f77" ||
- ext == ".f77" || ext == "f90" || ext == ".f90" || ext == "for" ||
- ext == ".for" || ext == "f95" || ext == ".f95") {
- return cmSystemTools::FORTRAN_FILE_FORMAT;
- }
- if (ext == "java" || ext == ".java") {
- return cmSystemTools::JAVA_FILE_FORMAT;
- }
- if (ext == "cu" || ext == ".cu") {
- return cmSystemTools::CUDA_FILE_FORMAT;
- }
- if (ext == "H" || ext == ".H" || ext == "h" || ext == ".h" || ext == "h++" ||
- ext == ".h++" || ext == "hm" || ext == ".hm" || ext == "hpp" ||
- ext == ".hpp" || ext == "hxx" || ext == ".hxx" || ext == "in" ||
- ext == ".in" || ext == "txx" || ext == ".txx") {
- return cmSystemTools::HEADER_FILE_FORMAT;
- }
- if (ext == "rc" || ext == ".rc") {
- return cmSystemTools::RESOURCE_FILE_FORMAT;
- }
- if (ext == "def" || ext == ".def") {
- return cmSystemTools::DEFINITION_FILE_FORMAT;
- }
- if (ext == "lib" || ext == ".lib" || ext == "a" || ext == ".a") {
- return cmSystemTools::STATIC_LIBRARY_FILE_FORMAT;
- }
- if (ext == "o" || ext == ".o" || ext == "obj" || ext == ".obj") {
- return cmSystemTools::OBJECT_FILE_FORMAT;
- }
-#ifdef __APPLE__
- if (ext == "dylib" || ext == ".dylib") {
- return cmSystemTools::SHARED_LIBRARY_FILE_FORMAT;
- }
- if (ext == "so" || ext == ".so" || ext == "bundle" || ext == ".bundle") {
- return cmSystemTools::MODULE_FILE_FORMAT;
- }
-#else // __APPLE__
- if (ext == "so" || ext == ".so" || ext == "sl" || ext == ".sl" ||
- ext == "dll" || ext == ".dll") {
- return cmSystemTools::SHARED_LIBRARY_FILE_FORMAT;
- }
-#endif // __APPLE__
- return cmSystemTools::UNKNOWN_FILE_FORMAT;
-}
-
std::string cmSystemTools::ConvertToOutputPath(std::string const& path)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
@@ -2456,7 +2373,8 @@ struct cmSystemToolsRPathInfo
#if defined(CMAKE_USE_ELF_PARSER)
bool cmSystemTools::ChangeRPath(std::string const& file,
std::string const& oldRPath,
- std::string const& newRPath, std::string* emsg,
+ std::string const& newRPath,
+ bool removeEnvironmentRPath, std::string* emsg,
bool* changed)
{
if (changed) {
@@ -2543,7 +2461,9 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
// Construct the new value which preserves the part of the path
// not being changed.
- rp[rp_count].Value = se[i]->Value.substr(0, prefix_len);
+ if (!removeEnvironmentRPath) {
+ rp[rp_count].Value = se[i]->Value.substr(0, prefix_len);
+ }
rp[rp_count].Value += newRPath;
rp[rp_count].Value += se[i]->Value.substr(pos + oldRPath.length());
@@ -2629,6 +2549,7 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
bool cmSystemTools::ChangeRPath(std::string const& /*file*/,
std::string const& /*oldRPath*/,
std::string const& /*newRPath*/,
+ bool /*removeEnvironmentRPath*/,
std::string* /*emsg*/, bool* /*changed*/)
{
return false;
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 016c266..ac1aa80 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -8,6 +8,7 @@
#include "cmCryptoHash.h"
#include "cmDuration.h"
#include "cmProcessOutput.h"
+#include "cm_string_view.hxx"
#include "cmsys/Process.h"
#include "cmsys/SystemTools.hxx" // IWYU pragma: export
#include <functional>
@@ -31,7 +32,7 @@ public:
* Expand the ; separated string @a arg into multiple arguments.
* All found arguments are appended to @a argsOut.
*/
- static void ExpandListArgument(const std::string& arg,
+ static void ExpandListArgument(cm::string_view arg,
std::vector<std::string>& argsOut,
bool emptyArgs = false);
@@ -53,7 +54,7 @@ public:
* Same as ExpandListArgument but a new vector is created containing
* the expanded arguments from the string @a arg.
*/
- static std::vector<std::string> ExpandedListArgument(const std::string& arg,
+ static std::vector<std::string> ExpandedListArgument(cm::string_view arg,
bool emptyArgs = false);
/**
@@ -77,15 +78,15 @@ public:
KeyWOW64 view = KeyWOW64_Default);
//! Escape quotes in a string.
- static std::string EscapeQuotes(const std::string& str);
+ static std::string EscapeQuotes(cm::string_view str);
/** Map help document name to file name. */
- static std::string HelpFileName(std::string);
+ static std::string HelpFileName(cm::string_view);
/**
* Returns a string that has whitespace removed from the start and the end.
*/
- static std::string TrimWhitespace(const std::string& s);
+ static std::string TrimWhitespace(cm::string_view str);
using MessageCallback = std::function<void(const std::string&, const char*)>;
/**
@@ -149,26 +150,45 @@ public:
* forced this value. This is not the same as On, but this
* may be considered as "internally switched on".
*/
- static bool IsInternallyOn(const char* val);
+ static bool IsInternallyOn(cm::string_view val);
+ static inline bool IsInternallyOn(const char* val)
+ {
+ if (!val) {
+ return false;
+ }
+ return IsInternallyOn(cm::string_view(val));
+ }
+
/**
- * does a string indicate a true or on value ? This is not the same
- * as ifdef.
+ * Does a string indicate a true or on value? This is not the same as ifdef.
*/
- static bool IsOn(const char* val);
- static bool IsOn(const std::string& val);
+ static bool IsOn(cm::string_view val);
+ inline static bool IsOn(const char* val)
+ {
+ if (!val) {
+ return false;
+ }
+ return IsOn(cm::string_view(val));
+ }
/**
- * does a string indicate a false or off value ? Note that this is
+ * Does a string indicate a false or off value ? Note that this is
* not the same as !IsOn(...) because there are a number of
* ambiguous values such as "/usr/local/bin" a path will result in
* IsON and IsOff both returning false. Note that the special path
* NOTFOUND, *-NOTFOUND or IGNORE will cause IsOff to return true.
*/
- static bool IsOff(const char* val);
- static bool IsOff(const std::string& val);
+ static bool IsOff(cm::string_view val);
+ inline static bool IsOff(const char* val)
+ {
+ if (!val) {
+ return true;
+ }
+ return IsOff(cm::string_view(val));
+ }
//! Return true if value is NOTFOUND or ends in -NOTFOUND.
- static bool IsNOTFOUND(const char* value);
+ static bool IsNOTFOUND(cm::string_view val);
//! Return true if the path is a framework
static bool IsPathToFramework(const std::string& value);
@@ -299,27 +319,6 @@ public:
static void EnableRunCommandOutput() { s_DisableRunCommandOutput = false; }
static bool GetRunCommandOutput() { return s_DisableRunCommandOutput; }
- /**
- * Some constants for different file formats.
- */
- enum FileFormat
- {
- NO_FILE_FORMAT = 0,
- C_FILE_FORMAT,
- CXX_FILE_FORMAT,
- FORTRAN_FILE_FORMAT,
- JAVA_FILE_FORMAT,
- CUDA_FILE_FORMAT,
- HEADER_FILE_FORMAT,
- RESOURCE_FILE_FORMAT,
- DEFINITION_FILE_FORMAT,
- STATIC_LIBRARY_FILE_FORMAT,
- SHARED_LIBRARY_FILE_FORMAT,
- MODULE_FILE_FORMAT,
- OBJECT_FILE_FORMAT,
- UNKNOWN_FILE_FORMAT
- };
-
enum CompareOp
{
OP_EQUAL = 1,
@@ -350,11 +349,6 @@ public:
*/
static int strverscmp(std::string const& lhs, std::string const& rhs);
- /**
- * Determine the file type based on the extension
- */
- static FileFormat GetFileFormat(std::string const& ext);
-
/** Windows if this is true, the CreateProcess in RunCommand will
* not show new console windows when running programs.
*/
@@ -499,6 +493,7 @@ public:
/** Try to set the RPATH in an ELF binary. */
static bool ChangeRPath(std::string const& file, std::string const& oldRPath,
std::string const& newRPath,
+ bool removeEnvironmentRPath,
std::string* emsg = nullptr,
bool* changed = nullptr);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index cd67586..beccfce 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -12,6 +12,8 @@
#include <string.h>
#include <unordered_set>
+#include "cm_memory.hxx"
+
#include "cmAlgorithms.h"
#include "cmCustomCommand.h"
#include "cmGeneratorExpression.h"
@@ -168,7 +170,8 @@ public:
cmPropertyMap Properties;
bool IsGeneratorProvided;
bool HaveInstallRule;
- bool DLLPlatform;
+ bool IsDLLPlatform;
+ bool IsAIX;
bool IsAndroid;
bool IsImportedTarget;
bool ImportedGloballyVisible;
@@ -216,7 +219,8 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
impl->Name = name;
impl->IsGeneratorProvided = false;
impl->HaveInstallRule = false;
- impl->DLLPlatform = false;
+ impl->IsDLLPlatform = false;
+ impl->IsAIX = false;
impl->IsAndroid = false;
impl->IsImportedTarget =
(vis == VisibilityImported || vis == VisibilityImportedGlobally);
@@ -224,21 +228,32 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
impl->BuildInterfaceIncludesAppended = false;
// Check whether this is a DLL platform.
- impl->DLLPlatform =
+ impl->IsDLLPlatform =
!impl->Makefile->GetSafeDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX").empty();
+ // Check whether we are targeting AIX.
+ impl->IsAIX =
+ (impl->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME") == "AIX");
+
// Check whether we are targeting an Android platform.
impl->IsAndroid =
(impl->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME") == "Android");
- std::string gKey;
- gKey.reserve(128);
- gKey += "CMAKE_";
- auto InitProperty = [this, mf, &gKey](const std::string& property,
- const char* default_value) {
+ std::string defKey;
+ defKey.reserve(128);
+ defKey += "CMAKE_";
+ 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);
+ }
+ };
+ auto initPropValue = [this, mf, &defKey](const std::string& property,
+ const char* default_value) {
// Replace everything after "CMAKE_"
- gKey.replace(gKey.begin() + 6, gKey.end(), property);
- if (const char* value = mf->GetDefinition(gKey)) {
+ defKey.replace(defKey.begin() + 6, defKey.end(), property);
+ if (const char* value = mf->GetDefinition(defKey)) {
this->SetProperty(property, value);
} else if (default_value) {
this->SetProperty(property, default_value);
@@ -248,107 +263,108 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
// Setup default property values.
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
this->GetType() != cmStateEnums::UTILITY) {
- InitProperty("ANDROID_API", nullptr);
- InitProperty("ANDROID_API_MIN", nullptr);
- InitProperty("ANDROID_ARCH", nullptr);
- InitProperty("ANDROID_STL_TYPE", nullptr);
- InitProperty("ANDROID_SKIP_ANT_STEP", nullptr);
- InitProperty("ANDROID_PROCESS_MAX", nullptr);
- InitProperty("ANDROID_PROGUARD", nullptr);
- InitProperty("ANDROID_PROGUARD_CONFIG_PATH", nullptr);
- InitProperty("ANDROID_SECURE_PROPS_PATH", nullptr);
- InitProperty("ANDROID_NATIVE_LIB_DIRECTORIES", nullptr);
- InitProperty("ANDROID_NATIVE_LIB_DEPENDENCIES", nullptr);
- InitProperty("ANDROID_JAVA_SOURCE_DIR", nullptr);
- InitProperty("ANDROID_JAR_DIRECTORIES", nullptr);
- InitProperty("ANDROID_JAR_DEPENDENCIES", nullptr);
- InitProperty("ANDROID_ASSETS_DIRECTORIES", nullptr);
- InitProperty("ANDROID_ANT_ADDITIONAL_OPTIONS", nullptr);
- InitProperty("BUILD_RPATH", nullptr);
- InitProperty("BUILD_RPATH_USE_ORIGIN", nullptr);
- InitProperty("INSTALL_NAME_DIR", nullptr);
- InitProperty("INSTALL_RPATH", "");
- InitProperty("INSTALL_RPATH_USE_LINK_PATH", "OFF");
- InitProperty("INTERPROCEDURAL_OPTIMIZATION", nullptr);
- InitProperty("SKIP_BUILD_RPATH", "OFF");
- InitProperty("BUILD_WITH_INSTALL_RPATH", "OFF");
- InitProperty("ARCHIVE_OUTPUT_DIRECTORY", nullptr);
- InitProperty("LIBRARY_OUTPUT_DIRECTORY", nullptr);
- InitProperty("RUNTIME_OUTPUT_DIRECTORY", nullptr);
- InitProperty("PDB_OUTPUT_DIRECTORY", nullptr);
- InitProperty("COMPILE_PDB_OUTPUT_DIRECTORY", nullptr);
- InitProperty("FRAMEWORK", nullptr);
- InitProperty("Fortran_FORMAT", nullptr);
- InitProperty("Fortran_MODULE_DIRECTORY", nullptr);
- InitProperty("Fortran_COMPILER_LAUNCHER", nullptr);
- InitProperty("GNUtoMS", nullptr);
- InitProperty("OSX_ARCHITECTURES", nullptr);
- InitProperty("IOS_INSTALL_COMBINED", nullptr);
- InitProperty("AUTOMOC", nullptr);
- InitProperty("AUTOUIC", nullptr);
- InitProperty("AUTORCC", nullptr);
- InitProperty("AUTOGEN_ORIGIN_DEPENDS", nullptr);
- InitProperty("AUTOGEN_PARALLEL", nullptr);
- InitProperty("AUTOMOC_COMPILER_PREDEFINES", nullptr);
- InitProperty("AUTOMOC_DEPEND_FILTERS", nullptr);
- InitProperty("AUTOMOC_MACRO_NAMES", nullptr);
- InitProperty("AUTOMOC_MOC_OPTIONS", nullptr);
- InitProperty("AUTOUIC_OPTIONS", nullptr);
- InitProperty("AUTOUIC_SEARCH_PATHS", nullptr);
- InitProperty("AUTORCC_OPTIONS", nullptr);
- InitProperty("LINK_DEPENDS_NO_SHARED", nullptr);
- InitProperty("LINK_INTERFACE_LIBRARIES", nullptr);
- InitProperty("MSVC_RUNTIME_LIBRARY", nullptr);
- InitProperty("WIN32_EXECUTABLE", nullptr);
- InitProperty("MACOSX_BUNDLE", nullptr);
- InitProperty("MACOSX_RPATH", nullptr);
- InitProperty("NO_SYSTEM_FROM_IMPORTED", nullptr);
- InitProperty("BUILD_WITH_INSTALL_NAME_DIR", nullptr);
- InitProperty("C_CLANG_TIDY", nullptr);
- InitProperty("C_COMPILER_LAUNCHER", nullptr);
- InitProperty("C_CPPLINT", nullptr);
- InitProperty("C_CPPCHECK", nullptr);
- InitProperty("C_INCLUDE_WHAT_YOU_USE", nullptr);
- InitProperty("LINK_WHAT_YOU_USE", nullptr);
- InitProperty("C_STANDARD", nullptr);
- InitProperty("C_STANDARD_REQUIRED", nullptr);
- InitProperty("C_EXTENSIONS", nullptr);
- InitProperty("CXX_CLANG_TIDY", nullptr);
- InitProperty("CXX_COMPILER_LAUNCHER", nullptr);
- InitProperty("CXX_CPPLINT", nullptr);
- InitProperty("CXX_CPPCHECK", nullptr);
- InitProperty("CXX_INCLUDE_WHAT_YOU_USE", nullptr);
- InitProperty("CXX_STANDARD", nullptr);
- InitProperty("CXX_STANDARD_REQUIRED", nullptr);
- InitProperty("CXX_EXTENSIONS", nullptr);
- InitProperty("CUDA_STANDARD", nullptr);
- InitProperty("CUDA_STANDARD_REQUIRED", nullptr);
- InitProperty("CUDA_EXTENSIONS", nullptr);
- InitProperty("CUDA_COMPILER_LAUNCHER", nullptr);
- InitProperty("CUDA_SEPARABLE_COMPILATION", nullptr);
- InitProperty("LINK_SEARCH_START_STATIC", nullptr);
- InitProperty("LINK_SEARCH_END_STATIC", nullptr);
- InitProperty("FOLDER", nullptr);
- InitProperty("Swift_MODULE_DIRECTORY", nullptr);
- InitProperty("VS_JUST_MY_CODE_DEBUGGING", nullptr);
+ initProp("ANDROID_API");
+ initProp("ANDROID_API_MIN");
+ initProp("ANDROID_ARCH");
+ initProp("ANDROID_STL_TYPE");
+ initProp("ANDROID_SKIP_ANT_STEP");
+ initProp("ANDROID_PROCESS_MAX");
+ initProp("ANDROID_PROGUARD");
+ initProp("ANDROID_PROGUARD_CONFIG_PATH");
+ initProp("ANDROID_SECURE_PROPS_PATH");
+ initProp("ANDROID_NATIVE_LIB_DIRECTORIES");
+ initProp("ANDROID_NATIVE_LIB_DEPENDENCIES");
+ initProp("ANDROID_JAVA_SOURCE_DIR");
+ initProp("ANDROID_JAR_DIRECTORIES");
+ initProp("ANDROID_JAR_DEPENDENCIES");
+ initProp("ANDROID_ASSETS_DIRECTORIES");
+ initProp("ANDROID_ANT_ADDITIONAL_OPTIONS");
+ initProp("BUILD_RPATH");
+ initProp("BUILD_RPATH_USE_ORIGIN");
+ initProp("INSTALL_NAME_DIR");
+ initProp("INSTALL_REMOVE_ENVIRONMENT_RPATH");
+ initPropValue("INSTALL_RPATH", "");
+ initPropValue("INSTALL_RPATH_USE_LINK_PATH", "OFF");
+ initProp("INTERPROCEDURAL_OPTIMIZATION");
+ initPropValue("SKIP_BUILD_RPATH", "OFF");
+ initPropValue("BUILD_WITH_INSTALL_RPATH", "OFF");
+ initProp("ARCHIVE_OUTPUT_DIRECTORY");
+ initProp("LIBRARY_OUTPUT_DIRECTORY");
+ initProp("RUNTIME_OUTPUT_DIRECTORY");
+ initProp("PDB_OUTPUT_DIRECTORY");
+ initProp("COMPILE_PDB_OUTPUT_DIRECTORY");
+ initProp("FRAMEWORK");
+ initProp("Fortran_FORMAT");
+ initProp("Fortran_MODULE_DIRECTORY");
+ initProp("Fortran_COMPILER_LAUNCHER");
+ initProp("GNUtoMS");
+ initProp("OSX_ARCHITECTURES");
+ initProp("IOS_INSTALL_COMBINED");
+ initProp("AUTOMOC");
+ initProp("AUTOUIC");
+ initProp("AUTORCC");
+ initProp("AUTOGEN_ORIGIN_DEPENDS");
+ initProp("AUTOGEN_PARALLEL");
+ initProp("AUTOMOC_COMPILER_PREDEFINES");
+ initProp("AUTOMOC_DEPEND_FILTERS");
+ initProp("AUTOMOC_MACRO_NAMES");
+ initProp("AUTOMOC_MOC_OPTIONS");
+ initProp("AUTOUIC_OPTIONS");
+ initProp("AUTOUIC_SEARCH_PATHS");
+ initProp("AUTORCC_OPTIONS");
+ initProp("LINK_DEPENDS_NO_SHARED");
+ initProp("LINK_INTERFACE_LIBRARIES");
+ initProp("MSVC_RUNTIME_LIBRARY");
+ initProp("WIN32_EXECUTABLE");
+ initProp("MACOSX_BUNDLE");
+ initProp("MACOSX_RPATH");
+ initProp("NO_SYSTEM_FROM_IMPORTED");
+ initProp("BUILD_WITH_INSTALL_NAME_DIR");
+ initProp("C_CLANG_TIDY");
+ initProp("C_COMPILER_LAUNCHER");
+ initProp("C_CPPLINT");
+ initProp("C_CPPCHECK");
+ initProp("C_INCLUDE_WHAT_YOU_USE");
+ initProp("LINK_WHAT_YOU_USE");
+ initProp("C_STANDARD");
+ initProp("C_STANDARD_REQUIRED");
+ initProp("C_EXTENSIONS");
+ initProp("CXX_CLANG_TIDY");
+ initProp("CXX_COMPILER_LAUNCHER");
+ initProp("CXX_CPPLINT");
+ initProp("CXX_CPPCHECK");
+ initProp("CXX_INCLUDE_WHAT_YOU_USE");
+ initProp("CXX_STANDARD");
+ initProp("CXX_STANDARD_REQUIRED");
+ initProp("CXX_EXTENSIONS");
+ initProp("CUDA_STANDARD");
+ initProp("CUDA_STANDARD_REQUIRED");
+ initProp("CUDA_EXTENSIONS");
+ initProp("CUDA_COMPILER_LAUNCHER");
+ initProp("CUDA_SEPARABLE_COMPILATION");
+ initProp("LINK_SEARCH_START_STATIC");
+ initProp("LINK_SEARCH_END_STATIC");
+ initProp("FOLDER");
+ initProp("Swift_MODULE_DIRECTORY");
+ initProp("VS_JUST_MY_CODE_DEBUGGING");
#ifdef __APPLE__
if (this->GetGlobalGenerator()->IsXcode()) {
- InitProperty("XCODE_GENERATE_SCHEME", nullptr);
- InitProperty("XCODE_SCHEME_ADDRESS_SANITIZER", nullptr);
- InitProperty("XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN", nullptr);
- InitProperty("XCODE_SCHEME_THREAD_SANITIZER", nullptr);
- InitProperty("XCODE_SCHEME_THREAD_SANITIZER_STOP", nullptr);
- InitProperty("XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER", nullptr);
- InitProperty("XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP", nullptr);
- InitProperty("XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER", nullptr);
- InitProperty("XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP", nullptr);
- InitProperty("XCODE_SCHEME_MALLOC_SCRIBBLE", nullptr);
- InitProperty("XCODE_SCHEME_MALLOC_GUARD_EDGES", nullptr);
- InitProperty("XCODE_SCHEME_GUARD_MALLOC", nullptr);
- InitProperty("XCODE_SCHEME_ZOMBIE_OBJECTS", nullptr);
- InitProperty("XCODE_SCHEME_MALLOC_STACK", nullptr);
- InitProperty("XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE", nullptr);
- InitProperty("XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS", nullptr);
+ initProp("XCODE_GENERATE_SCHEME");
+ initProp("XCODE_SCHEME_ADDRESS_SANITIZER");
+ initProp("XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN");
+ initProp("XCODE_SCHEME_THREAD_SANITIZER");
+ initProp("XCODE_SCHEME_THREAD_SANITIZER_STOP");
+ initProp("XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER");
+ initProp("XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP");
+ initProp("XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER");
+ initProp("XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP");
+ initProp("XCODE_SCHEME_MALLOC_SCRIBBLE");
+ initProp("XCODE_SCHEME_MALLOC_GUARD_EDGES");
+ initProp("XCODE_SCHEME_GUARD_MALLOC");
+ initProp("XCODE_SCHEME_ZOMBIE_OBJECTS");
+ initProp("XCODE_SCHEME_MALLOC_STACK");
+ initProp("XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE");
+ initProp("XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS");
}
#endif
}
@@ -376,7 +392,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
}
std::string property = prop;
property += configUpper;
- InitProperty(property, nullptr);
+ initProp(property);
}
// Initialize per-configuration name postfix property from the
@@ -388,7 +404,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
impl->TargetType != cmStateEnums::INTERFACE_LIBRARY) {
std::string property = cmSystemTools::UpperCase(configName);
property += "_POSTFIX";
- InitProperty(property, nullptr);
+ initProp(property);
}
}
}
@@ -427,16 +443,16 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
this->GetType() != cmStateEnums::UTILITY) {
- InitProperty("C_VISIBILITY_PRESET", nullptr);
- InitProperty("CXX_VISIBILITY_PRESET", nullptr);
- InitProperty("CUDA_VISIBILITY_PRESET", nullptr);
- InitProperty("VISIBILITY_INLINES_HIDDEN", nullptr);
+ initProp("C_VISIBILITY_PRESET");
+ initProp("CXX_VISIBILITY_PRESET");
+ initProp("CUDA_VISIBILITY_PRESET");
+ initProp("VISIBILITY_INLINES_HIDDEN");
}
if (impl->TargetType == cmStateEnums::EXECUTABLE) {
- InitProperty("ANDROID_GUI", nullptr);
- InitProperty("CROSSCOMPILING_EMULATOR", nullptr);
- InitProperty("ENABLE_EXPORTS", nullptr);
+ initProp("ANDROID_GUI");
+ initProp("CROSSCOMPILING_EMULATOR");
+ initProp("ENABLE_EXPORTS");
}
if (impl->TargetType == cmStateEnums::SHARED_LIBRARY ||
impl->TargetType == cmStateEnums::MODULE_LIBRARY) {
@@ -444,12 +460,12 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
}
if (impl->TargetType == cmStateEnums::SHARED_LIBRARY ||
impl->TargetType == cmStateEnums::EXECUTABLE) {
- InitProperty("WINDOWS_EXPORT_ALL_SYMBOLS", nullptr);
+ initProp("WINDOWS_EXPORT_ALL_SYMBOLS");
}
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
this->GetType() != cmStateEnums::UTILITY) {
- InitProperty("POSITION_INDEPENDENT_CODE", nullptr);
+ initProp("POSITION_INDEPENDENT_CODE");
}
// Record current policies for later use.
@@ -465,12 +481,12 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
this->GetType() != cmStateEnums::UTILITY) {
- InitProperty("JOB_POOL_COMPILE", nullptr);
- InitProperty("JOB_POOL_LINK", nullptr);
+ initProp("JOB_POOL_COMPILE");
+ initProp("JOB_POOL_LINK");
}
if (impl->TargetType <= cmStateEnums::UTILITY) {
- InitProperty("DOTNET_TARGET_FRAMEWORK_VERSION", nullptr);
+ initProp("DOTNET_TARGET_FRAMEWORK_VERSION");
}
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
@@ -491,7 +507,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
if (assignment != std::string::npos) {
const std::string propName = vsGlobal + i.substr(0, assignment);
const std::string propValue = i.substr(assignment + 1);
- InitProperty(propName, propValue.c_str());
+ initPropValue(propName, propValue.c_str());
}
}
}
@@ -1484,7 +1500,6 @@ const char* cmTarget::GetComputedProperty(
const char* cmTarget::GetProperty(const std::string& prop) const
{
- static std::unordered_set<std::string> specialProps;
#define MAKE_STATIC_PROP(PROP) static const std::string prop##PROP = #PROP
MAKE_STATIC_PROP(LINK_LIBRARIES);
MAKE_STATIC_PROP(TYPE);
@@ -1502,23 +1517,23 @@ const char* cmTarget::GetProperty(const std::string& prop) const
MAKE_STATIC_PROP(SOURCE_DIR);
MAKE_STATIC_PROP(SOURCES);
#undef MAKE_STATIC_PROP
- if (specialProps.empty()) {
- specialProps.insert(propLINK_LIBRARIES);
- specialProps.insert(propTYPE);
- specialProps.insert(propINCLUDE_DIRECTORIES);
- specialProps.insert(propCOMPILE_FEATURES);
- specialProps.insert(propCOMPILE_OPTIONS);
- specialProps.insert(propCOMPILE_DEFINITIONS);
- specialProps.insert(propLINK_OPTIONS);
- specialProps.insert(propLINK_DIRECTORIES);
- specialProps.insert(propIMPORTED);
- specialProps.insert(propIMPORTED_GLOBAL);
- specialProps.insert(propMANUALLY_ADDED_DEPENDENCIES);
- specialProps.insert(propNAME);
- specialProps.insert(propBINARY_DIR);
- specialProps.insert(propSOURCE_DIR);
- specialProps.insert(propSOURCES);
- }
+ static std::unordered_set<std::string> const specialProps{
+ propLINK_LIBRARIES,
+ propTYPE,
+ propINCLUDE_DIRECTORIES,
+ propCOMPILE_FEATURES,
+ propCOMPILE_OPTIONS,
+ propCOMPILE_DEFINITIONS,
+ propLINK_OPTIONS,
+ propLINK_DIRECTORIES,
+ propIMPORTED,
+ propIMPORTED_GLOBAL,
+ propMANUALLY_ADDED_DEPENDENCIES,
+ propNAME,
+ propBINARY_DIR,
+ propSOURCE_DIR,
+ propSOURCES
+ };
if (specialProps.count(prop)) {
if (prop == propLINK_LIBRARIES) {
if (impl->LinkImplementationPropertyEntries.empty()) {
@@ -1651,6 +1666,16 @@ cmPropertyMap const& cmTarget::GetProperties() const
return impl->Properties;
}
+bool cmTarget::IsDLLPlatform() const
+{
+ return impl->IsDLLPlatform;
+}
+
+bool cmTarget::IsAIX() const
+{
+ return impl->IsAIX;
+}
+
bool cmTarget::IsImported() const
{
return impl->IsImportedTarget;
@@ -1692,7 +1717,8 @@ const char* cmTarget::GetSuffixVariableInternal(
? "CMAKE_SHARED_LIBRARY_SUFFIX"
: "CMAKE_EXECUTABLE_SUFFIX");
case cmStateEnums::ImportLibraryArtifact:
- return "CMAKE_IMPORT_LIBRARY_SUFFIX";
+ return (impl->IsAIX ? "CMAKE_AIX_IMPORT_FILE_SUFFIX"
+ : "CMAKE_IMPORT_LIBRARY_SUFFIX");
}
break;
default:
@@ -1732,7 +1758,8 @@ const char* cmTarget::GetPrefixVariableInternal(
? "CMAKE_SHARED_LIBRARY_PREFIX"
: "");
case cmStateEnums::ImportLibraryArtifact:
- return "CMAKE_IMPORT_LIBRARY_PREFIX";
+ return (impl->IsAIX ? "CMAKE_AIX_IMPORT_FILE_PREFIX"
+ : "CMAKE_IMPORT_LIBRARY_PREFIX");
}
break;
default:
@@ -1866,9 +1893,10 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config,
// If we needed to find one of the mapped configurations but did not
// On a DLL platform there may be only IMPORTED_IMPLIB for a shared
// library or an executable with exports.
- bool allowImp = (impl->DLLPlatform &&
+ bool allowImp = (this->IsDLLPlatform() &&
(this->GetType() == cmStateEnums::SHARED_LIBRARY ||
- this->IsExecutableWithExports()));
+ this->IsExecutableWithExports())) ||
+ (this->IsAIX() && this->IsExecutableWithExports());
// If a mapping was found, check its configurations.
for (std::vector<std::string>::const_iterator mci = mappedConfigs.begin();
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index fdcca47..4e5141b 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -6,7 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <iosfwd>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <set>
#include <string>
#include <utility>
@@ -16,6 +16,7 @@
#include "cmListFileCache.h"
#include "cmPolicies.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmTargetLinkLibraryType.h"
class cmCustomCommand;
@@ -177,6 +178,12 @@ public:
//! Get all properties
cmPropertyMap const& GetProperties() const;
+ //! Return whether or not the target is for a DLL platform.
+ bool IsDLLPlatform() const;
+
+ //! Return whether or not we are targeting AIX.
+ bool IsAIX() const;
+
bool IsImported() const;
bool IsImportedGloballyVisible() const;
diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx
index c4dc838..b64646a 100644
--- a/Source/cmTargetCompileDefinitionsCommand.cxx
+++ b/Source/cmTargetCompileDefinitionsCommand.cxx
@@ -4,9 +4,9 @@
#include <sstream>
-#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmStringAlgorithms.h"
#include "cmTarget.h"
class cmExecutionStatus;
diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h
index d41483a..25af21d 100644
--- a/Source/cmTargetCompileDefinitionsCommand.h
+++ b/Source/cmTargetCompileDefinitionsCommand.h
@@ -8,9 +8,11 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
+#include "cmCommand.h"
#include "cmTargetPropCommandBase.h"
-class cmCommand;
class cmExecutionStatus;
class cmTarget;
@@ -20,7 +22,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmTargetCompileDefinitionsCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmTargetCompileDefinitionsCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx
index c9e394b..976c8cb 100644
--- a/Source/cmTargetCompileFeaturesCommand.cxx
+++ b/Source/cmTargetCompileFeaturesCommand.cxx
@@ -4,9 +4,9 @@
#include <sstream>
-#include "cmAlgorithms.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmStringAlgorithms.h"
class cmExecutionStatus;
class cmTarget;
diff --git a/Source/cmTargetCompileFeaturesCommand.h b/Source/cmTargetCompileFeaturesCommand.h
index 45240a5..07948fa 100644
--- a/Source/cmTargetCompileFeaturesCommand.h
+++ b/Source/cmTargetCompileFeaturesCommand.h
@@ -8,15 +8,20 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
+#include "cmCommand.h"
#include "cmTargetPropCommandBase.h"
-class cmCommand;
class cmExecutionStatus;
class cmTarget;
class cmTargetCompileFeaturesCommand : public cmTargetPropCommandBase
{
- cmCommand* Clone() override { return new cmTargetCompileFeaturesCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmTargetCompileFeaturesCommand>();
+ }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx
index 8b4763a..7dadb82 100644
--- a/Source/cmTargetCompileOptionsCommand.cxx
+++ b/Source/cmTargetCompileOptionsCommand.cxx
@@ -4,10 +4,10 @@
#include <sstream>
-#include "cmAlgorithms.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmStringAlgorithms.h"
#include "cmTarget.h"
class cmExecutionStatus;
diff --git a/Source/cmTargetCompileOptionsCommand.h b/Source/cmTargetCompileOptionsCommand.h
index 6fb151a..a571cfb 100644
--- a/Source/cmTargetCompileOptionsCommand.h
+++ b/Source/cmTargetCompileOptionsCommand.h
@@ -8,9 +8,11 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
+#include "cmCommand.h"
#include "cmTargetPropCommandBase.h"
-class cmCommand;
class cmExecutionStatus;
class cmTarget;
@@ -20,7 +22,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmTargetCompileOptionsCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmTargetCompileOptionsCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h
index 57bf8fc..6defab2 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.h
+++ b/Source/cmTargetIncludeDirectoriesCommand.h
@@ -8,9 +8,11 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
+#include "cmCommand.h"
#include "cmTargetPropCommandBase.h"
-class cmCommand;
class cmExecutionStatus;
class cmTarget;
@@ -20,7 +22,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmTargetIncludeDirectoriesCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmTargetIncludeDirectoriesCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmTargetLinkDirectoriesCommand.cxx b/Source/cmTargetLinkDirectoriesCommand.cxx
index 269f751..435c392 100644
--- a/Source/cmTargetLinkDirectoriesCommand.cxx
+++ b/Source/cmTargetLinkDirectoriesCommand.cxx
@@ -4,11 +4,11 @@
#include <sstream>
-#include "cmAlgorithms.h"
#include "cmGeneratorExpression.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
diff --git a/Source/cmTargetLinkDirectoriesCommand.h b/Source/cmTargetLinkDirectoriesCommand.h
index 52c75a0..a2fcfa9 100644
--- a/Source/cmTargetLinkDirectoriesCommand.h
+++ b/Source/cmTargetLinkDirectoriesCommand.h
@@ -8,9 +8,11 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
+#include "cmCommand.h"
#include "cmTargetPropCommandBase.h"
-class cmCommand;
class cmExecutionStatus;
class cmTarget;
@@ -20,7 +22,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmTargetLinkDirectoriesCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmTargetLinkDirectoriesCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index 54f8cf4..6698ce0 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
#include "cmTargetLinkLibraryType.h"
@@ -30,7 +32,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmTargetLinkLibrariesCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmTargetLinkLibrariesCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmTargetLinkOptionsCommand.cxx b/Source/cmTargetLinkOptionsCommand.cxx
index 5366486..2866cf1 100644
--- a/Source/cmTargetLinkOptionsCommand.cxx
+++ b/Source/cmTargetLinkOptionsCommand.cxx
@@ -4,10 +4,10 @@
#include <sstream>
-#include "cmAlgorithms.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmStringAlgorithms.h"
#include "cmTarget.h"
class cmExecutionStatus;
diff --git a/Source/cmTargetLinkOptionsCommand.h b/Source/cmTargetLinkOptionsCommand.h
index a1fc9fc..3710739 100644
--- a/Source/cmTargetLinkOptionsCommand.h
+++ b/Source/cmTargetLinkOptionsCommand.h
@@ -8,9 +8,11 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
+#include "cmCommand.h"
#include "cmTargetPropCommandBase.h"
-class cmCommand;
class cmExecutionStatus;
class cmTarget;
@@ -20,7 +22,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmTargetLinkOptionsCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmTargetLinkOptionsCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx
index 1b8ee81..3aa845c 100644
--- a/Source/cmTargetPropCommandBase.cxx
+++ b/Source/cmTargetPropCommandBase.cxx
@@ -32,12 +32,13 @@ bool cmTargetPropCommandBase::HandleArguments(
this->HandleMissingTarget(args[0]);
return false;
}
- if ((this->Target->GetType() != cmStateEnums::SHARED_LIBRARY) &&
+ if ((this->Target->GetType() != cmStateEnums::EXECUTABLE) &&
(this->Target->GetType() != cmStateEnums::STATIC_LIBRARY) &&
- (this->Target->GetType() != cmStateEnums::OBJECT_LIBRARY) &&
+ (this->Target->GetType() != cmStateEnums::SHARED_LIBRARY) &&
(this->Target->GetType() != cmStateEnums::MODULE_LIBRARY) &&
+ (this->Target->GetType() != cmStateEnums::OBJECT_LIBRARY) &&
(this->Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) &&
- (this->Target->GetType() != cmStateEnums::EXECUTABLE)) {
+ (this->Target->GetType() != cmStateEnums::UNKNOWN_LIBRARY)) {
this->SetError("called with non-compilable target type");
return false;
}
diff --git a/Source/cmTargetPropertyComputer.cxx b/Source/cmTargetPropertyComputer.cxx
index 3f763af..baab8da 100644
--- a/Source/cmTargetPropertyComputer.cxx
+++ b/Source/cmTargetPropertyComputer.cxx
@@ -11,6 +11,7 @@
#include "cmMessenger.h"
#include "cmPolicies.h"
#include "cmStateSnapshot.h"
+#include "cmStringAlgorithms.h"
bool cmTargetPropertyComputer::HandleLocationPropertyPolicy(
std::string const& tgtName, cmMessenger* messenger,
@@ -56,22 +57,21 @@ bool cmTargetPropertyComputer::WhiteListedInterfaceProperty(
if (std::islower(prop[0])) {
return true;
}
- static std::unordered_set<std::string> builtIns;
- if (builtIns.empty()) {
- builtIns.insert("COMPATIBLE_INTERFACE_BOOL");
- builtIns.insert("COMPATIBLE_INTERFACE_NUMBER_MAX");
- builtIns.insert("COMPATIBLE_INTERFACE_NUMBER_MIN");
- builtIns.insert("COMPATIBLE_INTERFACE_STRING");
- builtIns.insert("EXPORT_NAME");
- builtIns.insert("EXPORT_PROPERTIES");
- builtIns.insert("IMPORTED");
- builtIns.insert("IMPORTED_GLOBAL");
- builtIns.insert("MANUALLY_ADDED_DEPENDENCIES");
- builtIns.insert("NAME");
- builtIns.insert("PRIVATE_HEADER");
- builtIns.insert("PUBLIC_HEADER");
- builtIns.insert("TYPE");
- }
+ static std::unordered_set<std::string> const builtIns{
+ "COMPATIBLE_INTERFACE_BOOL",
+ "COMPATIBLE_INTERFACE_NUMBER_MAX",
+ "COMPATIBLE_INTERFACE_NUMBER_MIN",
+ "COMPATIBLE_INTERFACE_STRING",
+ "EXPORT_NAME",
+ "EXPORT_PROPERTIES",
+ "IMPORTED",
+ "IMPORTED_GLOBAL",
+ "MANUALLY_ADDED_DEPENDENCIES",
+ "NAME",
+ "PRIVATE_HEADER",
+ "PUBLIC_HEADER",
+ "TYPE"
+ };
if (builtIns.count(prop)) {
return true;
diff --git a/Source/cmTargetPropertyComputer.h b/Source/cmTargetPropertyComputer.h
index efbf95f..3b11acd 100644
--- a/Source/cmTargetPropertyComputer.h
+++ b/Source/cmTargetPropertyComputer.h
@@ -7,9 +7,9 @@
#include <string>
-#include "cmAlgorithms.h"
#include "cmListFileCache.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
class cmMessenger;
diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx
index 11e288f..eb5f37c 100644
--- a/Source/cmTargetSourcesCommand.cxx
+++ b/Source/cmTargetSourcesCommand.cxx
@@ -4,11 +4,11 @@
#include <sstream>
-#include "cmAlgorithms.h"
#include "cmGeneratorExpression.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
diff --git a/Source/cmTargetSourcesCommand.h b/Source/cmTargetSourcesCommand.h
index b01e3ca..90fd45f 100644
--- a/Source/cmTargetSourcesCommand.h
+++ b/Source/cmTargetSourcesCommand.h
@@ -8,9 +8,11 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
+#include "cmCommand.h"
#include "cmTargetPropCommandBase.h"
-class cmCommand;
class cmExecutionStatus;
class cmTarget;
@@ -20,7 +22,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmTargetSourcesCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmTargetSourcesCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index 7d45cf5..01f2b96 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -8,7 +8,8 @@
#include "cmSystemTools.h"
cmTest::cmTest(cmMakefile* mf)
- : Backtrace(mf->GetBacktrace())
+ : CommandExpandLists(false)
+ , Backtrace(mf->GetBacktrace())
{
this->Makefile = mf;
this->OldStyle = true;
@@ -59,3 +60,13 @@ void cmTest::AppendProperty(const std::string& prop, const char* value,
{
this->Properties.AppendProperty(prop, value, asString);
}
+
+bool cmTest::GetCommandExpandLists() const
+{
+ return this->CommandExpandLists;
+}
+
+void cmTest::SetCommandExpandLists(bool b)
+{
+ this->CommandExpandLists = b;
+}
diff --git a/Source/cmTest.h b/Source/cmTest.h
index 88dc730..02d8f46 100644
--- a/Source/cmTest.h
+++ b/Source/cmTest.h
@@ -51,10 +51,15 @@ public:
bool GetOldStyle() const { return this->OldStyle; }
void SetOldStyle(bool b) { this->OldStyle = b; }
+ /** Set/Get whether lists in command lines should be expanded. */
+ bool GetCommandExpandLists() const;
+ void SetCommandExpandLists(bool b);
+
private:
cmPropertyMap Properties;
std::string Name;
std::vector<std::string> Command;
+ bool CommandExpandLists;
bool OldStyle;
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 571cd09..916784c 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -2,15 +2,16 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTestGenerator.h"
+#include <memory>
#include <ostream>
#include <utility>
+#include <vector>
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmOutputConverter.h"
-#include "cmProperty.h"
#include "cmPropertyMap.h"
#include "cmRange.h"
#include "cmStateTypes.h"
@@ -76,12 +77,22 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
// Start the test command.
os << indent << "add_test(" << this->Test->GetName() << " ";
- // Get the test command line to be executed.
- std::vector<std::string> const& command = this->Test->GetCommand();
+ // Evaluate command line arguments
+ std::vector<std::string> argv =
+ EvaluateCommandLineArguments(this->Test->GetCommand(), ge, config);
+
+ // Expand arguments if COMMAND_EXPAND_LISTS is set
+ if (this->Test->GetCommandExpandLists()) {
+ argv = cmSystemTools::ExpandedLists(argv.begin(), argv.end());
+ // Expanding lists on an empty command may have left it empty
+ if (argv.empty()) {
+ argv.emplace_back();
+ }
+ }
// Check whether the command executable is a target whose name is to
// be translated.
- std::string exe = command[0];
+ std::string exe = argv[0];
cmGeneratorTarget* target = this->LG->FindGeneratorTargetToUse(exe);
if (target && target->GetType() == cmStateEnums::EXECUTABLE) {
// Use the target file on disk.
@@ -101,29 +112,26 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
}
} else {
// Use the command name given.
- exe = ge.Parse(exe)->Evaluate(this->LG, config);
cmSystemTools::ConvertToUnixSlashes(exe);
}
// Generate the command line with full escapes.
os << cmOutputConverter::EscapeForCMake(exe);
- for (std::string const& arg : cmMakeRange(command).advance(1)) {
- os << " "
- << cmOutputConverter::EscapeForCMake(
- ge.Parse(arg)->Evaluate(this->LG, config));
+
+ for (auto const& arg : cmMakeRange(argv).advance(1)) {
+ os << " " << cmOutputConverter::EscapeForCMake(arg);
}
// Finish the test command.
os << ")\n";
// Output properties for the test.
- cmPropertyMap& pm = this->Test->GetProperties();
os << indent << "set_tests_properties(" << this->Test->GetName()
<< " PROPERTIES ";
- for (auto const& i : pm) {
+ for (auto const& i : this->Test->GetProperties().GetList()) {
os << " " << i.first << " "
<< cmOutputConverter::EscapeForCMake(
- ge.Parse(i.second.GetValue())->Evaluate(this->LG, config));
+ ge.Parse(i.second)->Evaluate(this->LG, config));
}
this->GenerateInternalProperties(os);
os << ")" << std::endl;
@@ -173,12 +181,11 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, Indent indent)
fout << ")" << std::endl;
// Output properties for the test.
- cmPropertyMap& pm = this->Test->GetProperties();
fout << indent << "set_tests_properties(" << this->Test->GetName()
<< " PROPERTIES ";
- for (auto const& i : pm) {
+ for (auto const& i : this->Test->GetProperties().GetList()) {
fout << " " << i.first << " "
- << cmOutputConverter::EscapeForCMake(i.second.GetValue());
+ << cmOutputConverter::EscapeForCMake(i.second);
}
this->GenerateInternalProperties(fout);
fout << ")" << std::endl;
@@ -208,3 +215,16 @@ void cmTestGenerator::GenerateInternalProperties(std::ostream& os)
os << "\"";
}
+
+std::vector<std::string> cmTestGenerator::EvaluateCommandLineArguments(
+ const std::vector<std::string>& argv, cmGeneratorExpression& ge,
+ const std::string& config) const
+{
+ // Evaluate executable name and arguments
+ auto evaluatedRange =
+ cmMakeRange(argv).transform([&](const std::string& arg) {
+ return ge.Parse(arg)->Evaluate(this->LG, config);
+ });
+
+ return { evaluatedRange.begin(), evaluatedRange.end() };
+}
diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h
index 8b9cf78..7ac68eb 100644
--- a/Source/cmTestGenerator.h
+++ b/Source/cmTestGenerator.h
@@ -11,6 +11,7 @@
#include <string>
#include <vector>
+class cmGeneratorExpression;
class cmLocalGenerator;
class cmTest;
@@ -38,6 +39,9 @@ public:
private:
void GenerateInternalProperties(std::ostream& os);
+ std::vector<std::string> EvaluateCommandLineArguments(
+ const std::vector<std::string>& argv, cmGeneratorExpression& ge,
+ const std::string& config) const;
protected:
void GenerateScriptConfigs(std::ostream& os, Indent indent) override;
diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h
index 8237878..ec9f8b8 100644
--- a/Source/cmTryCompileCommand.h
+++ b/Source/cmTryCompileCommand.h
@@ -8,9 +8,11 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
+#include "cmCommand.h"
#include "cmCoreTryCompile.h"
-class cmCommand;
class cmExecutionStatus;
/** \class cmTryCompileCommand
@@ -24,7 +26,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmTryCompileCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmTryCompileCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index a92c2a0..ed944ac 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -137,7 +137,7 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv,
// now put the output into the variables
if (!this->RunOutputVariable.empty()) {
this->Makefile->AddDefinition(this->RunOutputVariable,
- runOutputContents.c_str());
+ runOutputContents);
}
if (!this->OutputVariable.empty()) {
@@ -148,8 +148,7 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv,
if (compileOutput) {
runOutputContents = compileOutput + runOutputContents;
}
- this->Makefile->AddDefinition(this->OutputVariable,
- runOutputContents.c_str());
+ this->Makefile->AddDefinition(this->OutputVariable, runOutputContents);
}
}
}
diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h
index c54622c..bacfcdb 100644
--- a/Source/cmTryRunCommand.h
+++ b/Source/cmTryRunCommand.h
@@ -8,9 +8,11 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
+#include "cmCommand.h"
#include "cmCoreTryCompile.h"
-class cmCommand;
class cmExecutionStatus;
/** \class cmTryRunCommand
@@ -24,7 +26,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmTryRunCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmTryRunCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmUVProcessChain.cxx b/Source/cmUVProcessChain.cxx
index 90ece0b..56d6c09 100644
--- a/Source/cmUVProcessChain.cxx
+++ b/Source/cmUVProcessChain.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmUVProcessChain.h"
-#include "cmAlgorithms.h"
#include "cmGetPipes.h"
#include "cmUVHandlePtr.h"
#include "cmUVStreambuf.h"
@@ -10,10 +9,12 @@
#include <assert.h>
+#include <istream> // IWYU pragma: keep
#include <iterator>
-#include <memory>
#include <utility>
+#include "cm_memory.hxx"
+
struct cmUVProcessChain::InternalData
{
struct BasicStreamData
diff --git a/Source/cmUVProcessChain.h b/Source/cmUVProcessChain.h
index 2b33520..75f8f66 100644
--- a/Source/cmUVProcessChain.h
+++ b/Source/cmUVProcessChain.h
@@ -7,7 +7,7 @@
#include <array>
#include <iosfwd>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <string>
#include <vector>
diff --git a/Source/cmUnexpectedCommand.cxx b/Source/cmUnexpectedCommand.cxx
deleted file mode 100644
index a8de9e6..0000000
--- a/Source/cmUnexpectedCommand.cxx
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmUnexpectedCommand.h"
-
-#include <stdlib.h>
-
-#include "cmMakefile.h"
-
-class cmExecutionStatus;
-
-bool cmUnexpectedCommand::InitialPass(std::vector<std::string> const&,
- cmExecutionStatus&)
-{
- const char* versionValue =
- this->Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
- if (this->Name == "endif" && (!versionValue || atof(versionValue) <= 1.4)) {
- return true;
- }
-
- this->SetError(this->Error);
- return false;
-}
diff --git a/Source/cmUnexpectedCommand.h b/Source/cmUnexpectedCommand.h
deleted file mode 100644
index 33d6bdc..0000000
--- a/Source/cmUnexpectedCommand.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmUnexpectedCommand_h
-#define cmUnexpectedCommand_h
-
-#include "cmConfigure.h" // IWYU pragma: keep
-
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "cmCommand.h"
-
-class cmExecutionStatus;
-
-class cmUnexpectedCommand : public cmCommand
-{
-public:
- cmUnexpectedCommand(std::string name, const char* error)
- : Name(std::move(name))
- , Error(error)
- {
- }
-
- cmCommand* Clone() override
- {
- return new cmUnexpectedCommand(this->Name, this->Error);
- }
-
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-
-private:
- std::string Name;
- const char* Error;
-};
-
-#endif
diff --git a/Source/cmUnsetCommand.cxx b/Source/cmUnsetCommand.cxx
index cfaa1fd2..0e903c7 100644
--- a/Source/cmUnsetCommand.cxx
+++ b/Source/cmUnsetCommand.cxx
@@ -2,8 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmUnsetCommand.h"
-#include "cmAlgorithms.h"
#include "cmMakefile.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
class cmExecutionStatus;
diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h
index 4e1208a..9b78d44 100644
--- a/Source/cmUnsetCommand.h
+++ b/Source/cmUnsetCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -23,7 +25,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmUnsetCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmUnsetCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h
index e2f1d9b..1c01596 100644
--- a/Source/cmUseMangledMesaCommand.h
+++ b/Source/cmUseMangledMesaCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -15,7 +17,10 @@ class cmExecutionStatus;
class cmUseMangledMesaCommand : public cmCommand
{
public:
- cmCommand* Clone() override { return new cmUseMangledMesaCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmUseMangledMesaCommand>();
+ }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h
index 165ecef..cef7fed 100644
--- a/Source/cmUtilitySourceCommand.h
+++ b/Source/cmUtilitySourceCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -15,7 +17,10 @@ class cmExecutionStatus;
class cmUtilitySourceCommand : public cmCommand
{
public:
- cmCommand* Clone() override { return new cmUtilitySourceCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmUtilitySourceCommand>();
+ }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
};
diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx
index c02157a..9878ff1 100644
--- a/Source/cmVariableRequiresCommand.cxx
+++ b/Source/cmVariableRequiresCommand.cxx
@@ -42,7 +42,7 @@ bool cmVariableRequiresCommand::InitialPass(
// if reqVar is set to true, but requirementsMet is false , then
// set reqVar to false.
if (!reqVar || (!requirementsMet && this->Makefile->IsOn(reqVar))) {
- this->Makefile->AddDefinition(resultVariable, requirementsMet);
+ this->Makefile->AddDefinitionBool(resultVariable, requirementsMet);
}
if (!requirementsMet) {
diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h
index 94970c5..38e7490 100644
--- a/Source/cmVariableRequiresCommand.h
+++ b/Source/cmVariableRequiresCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -15,7 +17,10 @@ class cmExecutionStatus;
class cmVariableRequiresCommand : public cmCommand
{
public:
- cmCommand* Clone() override { return new cmVariableRequiresCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmVariableRequiresCommand>();
+ }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
};
diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h
index 1230101..acac2c1 100644
--- a/Source/cmVariableWatch.h
+++ b/Source/cmVariableWatch.h
@@ -6,7 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <map>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <string>
#include <vector>
diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index 5fe55bd..83a774d 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -3,6 +3,7 @@
#include "cmVariableWatchCommand.h"
#include <sstream>
+#include <utility>
#include "cmExecutionStatus.h"
#include "cmListFileCache.h"
@@ -54,7 +55,7 @@ static void cmVariableWatchCommandVariableAccessed(const std::string& variable,
newLFF.Arguments.emplace_back(stack, cmListFileArgument::Quoted, 9999);
newLFF.Name = data->Command;
newLFF.Line = 9999;
- cmExecutionStatus status;
+ cmExecutionStatus status(*makefile);
if (!makefile->ExecuteCommand(newLFF, status)) {
std::ostringstream error;
error << "Error in cmake code at\nUnknown:0:\n"
@@ -84,15 +85,39 @@ static void deleteVariableWatchCallbackData(void* client_data)
delete data;
}
-cmVariableWatchCommand::cmVariableWatchCommand() = default;
-
-cmVariableWatchCommand::~cmVariableWatchCommand()
+/** This command does not really have a final pass but it needs to
+ stay alive since it owns variable watch callback information. */
+class FinalAction
{
- for (std::string const& wv : this->WatchedVariables) {
- this->Makefile->GetCMakeInstance()->GetVariableWatch()->RemoveWatch(
- wv, cmVariableWatchCommandVariableAccessed);
+public:
+ FinalAction(cmMakefile* makefile, std::string variable)
+ : Action(std::make_shared<Impl>(makefile, std::move(variable)))
+ {
}
-}
+
+ void operator()(cmMakefile&) const {}
+
+private:
+ struct Impl
+ {
+ Impl(cmMakefile* makefile, std::string variable)
+ : Makefile(makefile)
+ , Variable(std::move(variable))
+ {
+ }
+
+ ~Impl()
+ {
+ this->Makefile->GetCMakeInstance()->GetVariableWatch()->RemoveWatch(
+ this->Variable, cmVariableWatchCommandVariableAccessed);
+ }
+
+ cmMakefile* Makefile;
+ std::string Variable;
+ };
+
+ std::shared_ptr<Impl const> Action;
+};
bool cmVariableWatchCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
@@ -118,7 +143,6 @@ bool cmVariableWatchCommand::InitialPass(std::vector<std::string> const& args,
data->InCallback = false;
data->Command = command;
- this->WatchedVariables.insert(variable);
if (!this->Makefile->GetCMakeInstance()->GetVariableWatch()->AddWatch(
variable, cmVariableWatchCommandVariableAccessed, data,
deleteVariableWatchCallbackData)) {
@@ -126,5 +150,6 @@ bool cmVariableWatchCommand::InitialPass(std::vector<std::string> const& args,
return false;
}
+ this->Makefile->AddFinalAction(FinalAction(this->Makefile, variable));
return true;
}
diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h
index 6a8115d..221269f 100644
--- a/Source/cmVariableWatchCommand.h
+++ b/Source/cmVariableWatchCommand.h
@@ -5,10 +5,11 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include <set>
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -23,13 +24,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmVariableWatchCommand; }
-
- //! Default constructor
- cmVariableWatchCommand();
-
- //! Destructor.
- ~cmVariableWatchCommand() override;
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmVariableWatchCommand>();
+ }
/**
* This is called when the command is first encountered in
@@ -37,13 +35,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
-
- /** This command does not really have a final pass but it needs to
- stay alive since it owns variable watch callback information. */
- bool HasFinalPass() const override { return true; }
-
-protected:
- std::set<std::string> WatchedVariables;
};
#endif
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 8c6ba4e..ed6e4d9 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -19,9 +19,10 @@
#include "windows.h"
#include <iterator>
-#include <memory> // IWYU pragma: keep
#include <set>
+#include "cm_memory.hxx"
+
static void ConvertToWindowsSlash(std::string& s);
static std::string cmVS10EscapeXML(std::string arg)
@@ -505,6 +506,11 @@ void cmVisualStudio10TargetGenerator::Generate()
if (targetFrameworkVersion) {
e1.Element("TargetFrameworkVersion", targetFrameworkVersion);
}
+ if (this->ProjectType == vcxproj &&
+ this->GlobalGenerator->TargetsWindowsCE()) {
+ e1.Element("EnableRedirectPlatform", "true");
+ e1.Element("RedirectPlatformValue", this->Platform);
+ }
if (this->ProjectType == csproj &&
this->GlobalGenerator->TargetsWindowsCE()) {
const char* targetFrameworkId = this->GeneratorTarget->GetProperty(
@@ -774,11 +780,11 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences(Elem& e0)
cmSystemTools::ExpandListArgument(vsDotNetReferences, references);
}
cmPropertyMap const& props = this->GeneratorTarget->Target->GetProperties();
- for (auto const& i : props) {
+ for (auto const& i : props.GetList()) {
if (i.first.find("VS_DOTNET_REFERENCE_") == 0) {
std::string name = i.first.substr(20);
if (!name.empty()) {
- std::string path = i.second.GetValue();
+ std::string path = i.second;
if (!cmsys::SystemTools::FileIsFullPath(path)) {
path = this->Makefile->GetCurrentSourceDirectory() + "/" + path;
}
@@ -870,10 +876,10 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferenceCustomTags(
typedef std::map<std::string, std::string> CustomTags;
CustomTags tags;
cmPropertyMap const& props = this->GeneratorTarget->Target->GetProperties();
- for (const auto& i : props) {
+ for (const auto& i : props.GetList()) {
if (i.first.find(refPropFullPrefix) == 0) {
std::string refTag = i.first.substr(refPropFullPrefix.length());
- std::string refVal = i.second.GetValue();
+ std::string refVal = i.second;
if (!refTag.empty() && !refVal.empty()) {
tags[refTag] = refVal;
}
@@ -967,12 +973,12 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup(Elem& e0)
}
}
const cmPropertyMap& props = oi->GetProperties();
- for (const auto& p : props) {
+ for (const std::string& p : props.GetKeys()) {
static const std::string propNamePrefix = "VS_CSHARP_";
- if (p.first.find(propNamePrefix) == 0) {
- std::string tagName = p.first.substr(propNamePrefix.length());
+ if (p.find(propNamePrefix) == 0) {
+ std::string tagName = p.substr(propNamePrefix.length());
if (!tagName.empty()) {
- std::string value = props.GetPropertyValue(p.first);
+ std::string value = props.GetPropertyValue(p);
if (!value.empty()) {
e2.Element(tagName.c_str(), value);
}
@@ -1229,8 +1235,11 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues(
if (this->IPOEnabledConfigurations.count(config) > 0) {
e1.Element("WholeProgramOptimization", "true");
}
- if (this->SpectreMitigationConfigurations.count(config) > 0) {
- e1.Element("SpectreMitigation", "Spectre");
+ {
+ auto s = this->SpectreMitigation.find(config);
+ if (s != this->SpectreMitigation.end()) {
+ e1.Element("SpectreMitigation", s->second);
+ }
}
}
@@ -2760,8 +2769,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
}
}
- if (clOptions.HasFlag("SpectreMitigation")) {
- this->SpectreMitigationConfigurations.insert(configName);
+ if (const char* s = clOptions.GetFlag("SpectreMitigation")) {
+ this->SpectreMitigation[configName] = s;
clOptions.RemoveFlag("SpectreMitigation");
}
@@ -3247,15 +3256,32 @@ void cmVisualStudio10TargetGenerator::WriteManifestOptions(
std::vector<cmSourceFile const*> manifest_srcs;
this->GeneratorTarget->GetManifests(manifest_srcs, config);
- if (!manifest_srcs.empty()) {
- std::ostringstream oss;
- for (cmSourceFile const* mi : manifest_srcs) {
- std::string m = this->ConvertPath(mi->GetFullPath(), false);
- ConvertToWindowsSlash(m);
- oss << m << ";";
- }
+
+ const char* dpiAware = this->GeneratorTarget->GetProperty("VS_DPI_AWARE");
+
+ if (!manifest_srcs.empty() || dpiAware) {
Elem e2(e1, "Manifest");
- e2.Element("AdditionalManifestFiles", oss.str());
+ if (!manifest_srcs.empty()) {
+ std::ostringstream oss;
+ for (cmSourceFile const* mi : manifest_srcs) {
+ std::string m = this->ConvertPath(mi->GetFullPath(), false);
+ ConvertToWindowsSlash(m);
+ oss << m << ";";
+ }
+ e2.Element("AdditionalManifestFiles", oss.str());
+ }
+ if (dpiAware) {
+ if (!strcmp(dpiAware, "PerMonitor")) {
+ e2.Element("EnableDpiAwareness", "PerMonitorHighDPIAware");
+ } else if (cmSystemTools::IsOn(dpiAware)) {
+ e2.Element("EnableDpiAwareness", "true");
+ } else if (cmSystemTools::IsOff(dpiAware)) {
+ e2.Element("EnableDpiAwareness", "false");
+ } else {
+ cmSystemTools::Error("Bad parameter for VS_DPI_AWARE: " +
+ std::string(dpiAware));
+ }
+ }
}
}
@@ -4676,12 +4702,12 @@ void cmVisualStudio10TargetGenerator::GetCSharpSourceProperties(
{
if (this->ProjectType == csproj) {
const cmPropertyMap& props = sf->GetProperties();
- for (auto const& p : props) {
+ for (const std::string& p : props.GetKeys()) {
static const std::string propNamePrefix = "VS_CSHARP_";
- if (p.first.find(propNamePrefix) == 0) {
- std::string tagName = p.first.substr(propNamePrefix.length());
+ if (p.find(propNamePrefix) == 0) {
+ std::string tagName = p.substr(propNamePrefix.length());
if (!tagName.empty()) {
- const std::string val = props.GetPropertyValue(p.first);
+ const std::string val = props.GetPropertyValue(p);
if (!val.empty()) {
tags[tagName] = val;
} else {
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 860b809..6607e77 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -215,7 +215,7 @@ private:
unsigned int NsightTegraVersion[4];
bool TargetCompileAsWinRT;
std::set<std::string> IPOEnabledConfigurations;
- std::set<std::string> SpectreMitigationConfigurations;
+ std::map<std::string, std::string> SpectreMitigation;
cmGlobalVisualStudio10Generator* const GlobalGenerator;
cmLocalVisualStudio10Generator* const LocalGenerator;
std::set<std::string> CSharpCustomCommandNames;
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index a01fa6f..37d1c74 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmWhileCommand.h"
+#include "cm_memory.hxx"
+
#include "cmConditionEvaluator.h"
#include "cmExecutionStatus.h"
#include "cmExpandedCommandArgument.h"
@@ -9,7 +11,8 @@
#include "cmMessageType.h"
#include "cmSystemTools.h"
-#include <memory> // IWYU pragma: keep
+#include <string>
+#include <utility>
cmWhileFunctionBlocker::cmWhileFunctionBlocker(cmMakefile* mf)
: Makefile(mf)
@@ -80,7 +83,7 @@ bool cmWhileFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
// Invoke all the functions that were collected in the block.
for (cmListFileFunction const& fn : this->Functions) {
- cmExecutionStatus status;
+ cmExecutionStatus status(mf);
mf.ExecuteCommand(fn, status);
if (status.GetReturnInvoked()) {
inStatus.SetReturnInvoked();
@@ -127,18 +130,20 @@ bool cmWhileFunctionBlocker::ShouldRemove(const cmListFileFunction& lff,
return false;
}
-bool cmWhileCommand::InvokeInitialPass(
- const std::vector<cmListFileArgument>& args, cmExecutionStatus&)
+bool cmWhileCommand(std::vector<cmListFileArgument> const& args,
+ cmExecutionStatus& status)
{
if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
// create a function blocker
- cmWhileFunctionBlocker* f = new cmWhileFunctionBlocker(this->Makefile);
- f->Args = args;
- this->Makefile->AddFunctionBlocker(f);
-
+ {
+ cmMakefile& makefile = status.GetMakefile();
+ auto fb = cm::make_unique<cmWhileFunctionBlocker>(&makefile);
+ fb->Args = args;
+ makefile.AddFunctionBlocker(std::move(fb));
+ }
return true;
}
diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h
index 6f6d405..2257799 100644
--- a/Source/cmWhileCommand.h
+++ b/Source/cmWhileCommand.h
@@ -5,10 +5,8 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include <string>
#include <vector>
-#include "cmCommand.h"
#include "cmFunctionBlocker.h"
#include "cmListFileCache.h"
@@ -33,30 +31,7 @@ private:
};
/// \brief Starts a while loop
-class cmWhileCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- cmCommand* Clone() override { return new cmWhileCommand; }
-
- /**
- * This overrides the default InvokeInitialPass implementation.
- * It records the arguments before expansion.
- */
- bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
- cmExecutionStatus&) override;
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const&,
- cmExecutionStatus&) override
- {
- return false;
- }
-};
+bool cmWhileCommand(std::vector<cmListFileArgument> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmWorkerPool.cxx b/Source/cmWorkerPool.cxx
index cbf070e..974100b 100644
--- a/Source/cmWorkerPool.cxx
+++ b/Source/cmWorkerPool.cxx
@@ -16,6 +16,8 @@
#include <stddef.h>
#include <thread>
+#include "cm_memory.hxx"
+
/**
* @brief libuv pipe buffer class
*/
diff --git a/Source/cmWorkerPool.h b/Source/cmWorkerPool.h
index f08bb4f..d708118 100644
--- a/Source/cmWorkerPool.h
+++ b/Source/cmWorkerPool.h
@@ -5,14 +5,13 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include "cmAlgorithms.h" // IWYU pragma: keep
-
-#include <memory> // IWYU pragma: keep
#include <stdint.h>
#include <string>
#include <utility>
#include <vector>
+#include "cm_memory.hxx"
+
// -- Types
class cmWorkerPoolInternal;
diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h
index 9028f84..3961898 100644
--- a/Source/cmWriteFileCommand.h
+++ b/Source/cmWriteFileCommand.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include "cm_memory.hxx"
+
#include "cmCommand.h"
class cmExecutionStatus;
@@ -22,7 +24,10 @@ public:
/**
* This is a virtual constructor for the command.
*/
- cmCommand* Clone() override { return new cmWriteFileCommand; }
+ std::unique_ptr<cmCommand> Clone() override
+ {
+ return cm::make_unique<cmWriteFileCommand>();
+ }
/**
* This is called when the command is first encountered in
diff --git a/Source/cm_memory.hxx b/Source/cm_memory.hxx
new file mode 100644
index 0000000..9f5e678
--- /dev/null
+++ b/Source/cm_memory.hxx
@@ -0,0 +1,31 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#ifndef cm_memory_hxx
+#define cm_memory_hxx
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include <memory> // IWYU pragma: export
+#if !defined(CMake_HAVE_CXX_MAKE_UNIQUE)
+# include <utility>
+#endif
+
+namespace cm {
+
+#if defined(CMake_HAVE_CXX_MAKE_UNIQUE)
+
+using std::make_unique;
+
+#else
+
+template <typename T, typename... Args>
+std::unique_ptr<T> make_unique(Args&&... args)
+{
+ return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
+}
+
+#endif
+
+} // namespace cm
+
+#endif
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 3772f09..3b4a6c0 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmake.h"
+#include "cm_memory.hxx"
+
#include "cmAlgorithms.h"
#include "cmCommands.h"
#include "cmDocumentation.h"
@@ -19,6 +21,7 @@
#include "cmMessenger.h"
#include "cmState.h"
#include "cmStateDirectory.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetLinkLibraryType.h"
@@ -104,8 +107,6 @@
#include <cstring>
#include <initializer_list>
#include <iostream>
-#include <iterator>
-#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
@@ -122,9 +123,9 @@ typedef std::unordered_map<std::string, Json::Value> JsonValueMapType;
static bool cmakeCheckStampFile(const std::string& stampName);
static bool cmakeCheckStampList(const std::string& stampList);
-void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/,
- void* ctx, const char* /*unused*/,
- const cmMakefile* /*unused*/)
+static void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/,
+ void* ctx, const char* /*unused*/,
+ const cmMakefile* /*unused*/)
{
cmake* cm = reinterpret_cast<cmake*>(ctx);
cm->MarkCliAsUsed(variable);
@@ -141,12 +142,12 @@ cmake::cmake(Role role, cmState::Mode mode)
this->DebugOutput = false;
this->DebugTryCompile = false;
this->ClearBuildSystem = false;
- this->FileTimeCache = new cmFileTimeCache;
+ this->FileTimeCache = cm::make_unique<cmFileTimeCache>();
- this->State = new cmState;
+ this->State = cm::make_unique<cmState>();
this->State->SetMode(mode);
this->CurrentSnapshot = this->State->CreateBaseSnapshot();
- this->Messenger = new cmMessenger;
+ this->Messenger = cm::make_unique<cmMessenger>();
#ifdef __APPLE__
struct rlimit rlp;
@@ -165,7 +166,7 @@ cmake::cmake(Role role, cmState::Mode mode)
this->CurrentWorkingMode = NORMAL_MODE;
#ifdef CMAKE_BUILD_WITH_CMAKE
- this->VariableWatch = new cmVariableWatch;
+ this->VariableWatch = cm::make_unique<cmVariableWatch>();
#endif
this->AddDefaultGenerators();
@@ -184,55 +185,45 @@ cmake::cmake(Role role, cmState::Mode mode)
// Make sure we can capture the build tool output.
cmSystemTools::EnableVSConsoleOutput();
- // Set up a list of source and header extensions
- // these are used to find files when the extension
- // is not given
- // The "c" extension MUST precede the "C" extension.
- this->SourceFileExtensions.emplace_back("c");
- this->SourceFileExtensions.emplace_back("C");
-
- this->SourceFileExtensions.emplace_back("c++");
- this->SourceFileExtensions.emplace_back("cc");
- this->SourceFileExtensions.emplace_back("cpp");
- this->SourceFileExtensions.emplace_back("cxx");
- this->SourceFileExtensions.emplace_back("cu");
- this->SourceFileExtensions.emplace_back("m");
- this->SourceFileExtensions.emplace_back("M");
- this->SourceFileExtensions.emplace_back("mm");
-
- std::copy(this->SourceFileExtensions.begin(),
- this->SourceFileExtensions.end(),
- std::inserter(this->SourceFileExtensionsSet,
- this->SourceFileExtensionsSet.end()));
-
- this->HeaderFileExtensions.emplace_back("h");
- this->HeaderFileExtensions.emplace_back("hh");
- this->HeaderFileExtensions.emplace_back("h++");
- this->HeaderFileExtensions.emplace_back("hm");
- this->HeaderFileExtensions.emplace_back("hpp");
- this->HeaderFileExtensions.emplace_back("hxx");
- this->HeaderFileExtensions.emplace_back("in");
- this->HeaderFileExtensions.emplace_back("txx");
-
- std::copy(this->HeaderFileExtensions.begin(),
- this->HeaderFileExtensions.end(),
- std::inserter(this->HeaderFileExtensionsSet,
- this->HeaderFileExtensionsSet.end()));
+ // Set up a list of source and header extensions.
+ // These are used to find files when the extension is not given.
+ {
+ auto fillExts = [](FileExtensions& exts,
+ std::initializer_list<const char*> extList) {
+ // Fill ordered vector
+ exts.ordered.reserve(extList.size());
+ for (const char* ext : extList) {
+ exts.ordered.emplace_back(ext);
+ };
+ // Fill unordered set
+ exts.unordered.insert(exts.ordered.begin(), exts.ordered.end());
+ };
+
+ // Source extensions
+ // The "c" extension MUST precede the "C" extension.
+ fillExts(this->SourceFileExtensions,
+ { "c", "C", "c++", "cc", "cpp", "cxx", "cu", "m", "M", "mm" });
+
+ // Header extensions
+ fillExts(this->HeaderFileExtensions,
+ { "h", "hh", "h++", "hm", "hpp", "hxx", "in", "txx" });
+
+ // Cuda extensions
+ fillExts(this->CudaFileExtensions, { "cu" });
+
+ // Fortran extensions
+ fillExts(this->FortranFileExtensions,
+ { "f", "F", "for", "f77", "f90", "f95", "f03" });
+ }
}
cmake::~cmake()
{
- delete this->State;
- delete this->Messenger;
if (this->GlobalGenerator) {
delete this->GlobalGenerator;
this->GlobalGenerator = nullptr;
}
cmDeleteAll(this->Generators);
-#ifdef CMAKE_BUILD_WITH_CMAKE
- delete this->VariableWatch;
-#endif
- delete this->FileTimeCache;
}
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -460,7 +451,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
return false;
}
// Register fake project commands that hint misuse in script mode.
- GetProjectCommandsInScriptMode(this->State);
+ GetProjectCommandsInScriptMode(this->GetState());
this->ReadListFile(args, path);
} else if (arg.find("--find-package", 0) == 0) {
findPackageMode = true;
@@ -1898,12 +1889,12 @@ const char* cmake::GetCacheDefinition(const std::string& name) const
void cmake::AddScriptingCommands()
{
- GetScriptingCommands(this->State);
+ GetScriptingCommands(this->GetState());
}
void cmake::AddProjectCommands()
{
- GetProjectCommands(this->State);
+ GetProjectCommands(this->GetState());
}
void cmake::AddDefaultGenerators()
@@ -2607,11 +2598,6 @@ std::vector<std::string> cmake::GetDebugConfigs()
return configs;
}
-cmMessenger* cmake::GetMessenger() const
-{
- return this->Messenger;
-}
-
int cmake::Build(int jobs, const std::string& dir,
const std::vector<std::string>& targets,
const std::string& config,
diff --git a/Source/cmake.h b/Source/cmake.h
index fa4409a..6aa00e1 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -7,7 +7,7 @@
#include <functional>
#include <map>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <set>
#include <string>
#include <unordered_set>
@@ -121,6 +121,17 @@ public:
bool isAlias;
};
+ struct FileExtensions
+ {
+ bool Test(std::string const& ext) const
+ {
+ return (this->unordered.find(ext) != this->unordered.end());
+ }
+
+ std::vector<std::string> ordered;
+ std::unordered_set<std::string> unordered;
+ };
+
typedef std::map<std::string, cmInstalledFile> InstalledFilesMap;
static const int NO_BUILD_PARALLEL_LEVEL = -1;
@@ -233,24 +244,42 @@ public:
const std::vector<std::string>& GetSourceExtensions() const
{
- return this->SourceFileExtensions;
+ return this->SourceFileExtensions.ordered;
}
bool IsSourceExtension(const std::string& ext) const
{
- return this->SourceFileExtensionsSet.find(ext) !=
- this->SourceFileExtensionsSet.end();
+ return this->SourceFileExtensions.Test(ext);
}
const std::vector<std::string>& GetHeaderExtensions() const
{
- return this->HeaderFileExtensions;
+ return this->HeaderFileExtensions.ordered;
}
bool IsHeaderExtension(const std::string& ext) const
{
- return this->HeaderFileExtensionsSet.find(ext) !=
- this->HeaderFileExtensionsSet.end();
+ return this->HeaderFileExtensions.Test(ext);
+ }
+
+ const std::vector<std::string>& GetCudaExtensions() const
+ {
+ return this->CudaFileExtensions.ordered;
+ }
+
+ bool IsCudaExtension(const std::string& ext) const
+ {
+ return this->CudaFileExtensions.Test(ext);
+ }
+
+ const std::vector<std::string>& GetFortranExtensions() const
+ {
+ return this->FortranFileExtensions.ordered;
+ }
+
+ bool IsFortranExtension(const std::string& ext) const
+ {
+ return this->FortranFileExtensions.Test(ext);
}
// Strips the extension (if present and known) from a filename
@@ -307,7 +336,7 @@ public:
#if defined(CMAKE_BUILD_WITH_CMAKE)
//! Get the variable watch object
- cmVariableWatch* GetVariableWatch() { return this->VariableWatch; }
+ cmVariableWatch* GetVariableWatch() { return this->VariableWatch.get(); }
#endif
std::vector<cmDocumentationEntry> GetGeneratorsDocumentation();
@@ -348,18 +377,18 @@ public:
/**
* Get the file comparison class
*/
- cmFileTimeCache* GetFileTimeCache() { return this->FileTimeCache; }
+ cmFileTimeCache* GetFileTimeCache() { return this->FileTimeCache.get(); }
- // Get the selected log level for `message()` commands during the cmake run.
+ //! Get the selected log level for `message()` commands during the cmake run.
LogLevel GetLogLevel() const { return this->MessageLogLevel; }
void SetLogLevel(LogLevel level) { this->MessageLogLevel = level; }
static LogLevel StringToLogLevel(const std::string& levelStr);
- // Do we want debug output during the cmake run.
+ //! Do we want debug output during the cmake run.
bool GetDebugOutput() { return this->DebugOutput; }
void SetDebugOutputOn(bool b) { this->DebugOutput = b; }
- // Do we want trace output during the cmake run.
+ //! Do we want trace output during the cmake run.
bool GetTrace() { return this->Trace; }
void SetTrace(bool b) { this->Trace = b; }
bool GetTraceExpand() { return this->TraceExpand; }
@@ -396,31 +425,31 @@ public:
return this->CMakeEditCommand;
}
- cmMessenger* GetMessenger() const;
+ cmMessenger* GetMessenger() const { return this->Messenger.get(); }
- /*
+ /**
* Get the state of the suppression of developer (author) warnings.
* Returns false, by default, if developer warnings should be shown, true
* otherwise.
*/
bool GetSuppressDevWarnings() const;
- /*
+ /**
* Set the state of the suppression of developer (author) warnings.
*/
void SetSuppressDevWarnings(bool v);
- /*
+ /**
* Get the state of the suppression of deprecated warnings.
* Returns false, by default, if deprecated warnings should be shown, true
* otherwise.
*/
bool GetSuppressDeprecatedWarnings() const;
- /*
+ /**
* Set the state of the suppression of deprecated warnings.
*/
void SetSuppressDeprecatedWarnings(bool v);
- /*
+ /**
* Get the state of treating developer (author) warnings as errors.
* Returns false, by default, if warnings should not be treated as errors,
* true otherwise.
@@ -431,7 +460,7 @@ public:
*/
void SetDevWarningsAsErrors(bool v);
- /*
+ /**
* Get the state of treating deprecated warnings as errors.
* Returns false, by default, if warnings should not be treated as errors,
* true otherwise.
@@ -459,7 +488,7 @@ public:
void UnwatchUnusedCli(const std::string& var);
void WatchUnusedCli(const std::string& var);
- cmState* GetState() const { return this->State; }
+ cmState* GetState() const { return this->State.get(); }
void SetCurrentSnapshot(cmStateSnapshot const& snapshot)
{
this->CurrentSnapshot = snapshot;
@@ -531,24 +560,24 @@ private:
std::string CheckStampList;
std::string VSSolutionFile;
std::string EnvironmentGenerator;
- std::vector<std::string> SourceFileExtensions;
- std::unordered_set<std::string> SourceFileExtensionsSet;
- std::vector<std::string> HeaderFileExtensions;
- std::unordered_set<std::string> HeaderFileExtensionsSet;
+ FileExtensions SourceFileExtensions;
+ FileExtensions HeaderFileExtensions;
+ FileExtensions CudaFileExtensions;
+ FileExtensions FortranFileExtensions;
bool ClearBuildSystem;
bool DebugTryCompile;
- cmFileTimeCache* FileTimeCache;
+ std::unique_ptr<cmFileTimeCache> FileTimeCache;
std::string GraphVizFile;
InstalledFilesMap InstalledFiles;
#if defined(CMAKE_BUILD_WITH_CMAKE)
- cmVariableWatch* VariableWatch;
+ std::unique_ptr<cmVariableWatch> VariableWatch;
std::unique_ptr<cmFileAPI> FileAPI;
#endif
- cmState* State;
+ std::unique_ptr<cmState> State;
cmStateSnapshot CurrentSnapshot;
- cmMessenger* Messenger;
+ std::unique_ptr<cmMessenger> Messenger;
std::vector<std::string> TraceOnlyThisSources;
@@ -556,7 +585,7 @@ private:
void UpdateConversionPathTable();
- // Print a list of valid generators to stderr.
+ //! Print a list of valid generators to stderr.
void PrintGeneratorList();
std::unique_ptr<cmGlobalGenerator> EvaluateDefaultGlobalGenerator();
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index a6348b3..10a6825 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -7,6 +7,7 @@
#include "cmMakefile.h"
#include "cmState.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
#include "cmcmd.h"
@@ -31,13 +32,14 @@
#include <string>
#include <vector>
+namespace {
#ifdef CMAKE_BUILD_WITH_CMAKE
-static const char* cmDocumentationName[][2] = {
+const char* cmDocumentationName[][2] = {
{ nullptr, " cmake - Cross-Platform Makefile Generator." },
{ nullptr, nullptr }
};
-static const char* cmDocumentationUsage[][2] = {
+const char* cmDocumentationUsage[][2] = {
{ nullptr,
" cmake [options] <path-to-source>\n"
" cmake [options] <path-to-existing-build>\n"
@@ -49,40 +51,12 @@ static const char* cmDocumentationUsage[][2] = {
{ nullptr, nullptr }
};
-static const char* cmDocumentationUsageNote[][2] = {
+const char* cmDocumentationUsageNote[][2] = {
{ nullptr, "Run 'cmake --help' for more information." },
{ nullptr, nullptr }
};
-# define CMAKE_BUILD_OPTIONS \
- " <dir> = Project binary directory to be built.\n" \
- " --parallel [<jobs>], -j [<jobs>]\n" \
- " = Build in parallel using the given number of jobs. \n" \
- " If <jobs> is omitted the native build tool's \n" \
- " default number is used.\n" \
- " The CMAKE_BUILD_PARALLEL_LEVEL environment " \
- "variable\n" \
- " specifies a default parallel level when this " \
- "option\n" \
- " is not given.\n" \
- " --target <tgt>..., -t <tgt>... \n" \
- " = Build <tgt> instead of default targets.\n" \
- " --config <cfg> = For multi-configuration tools, choose <cfg>.\n" \
- " --clean-first = Build target 'clean' first, then build.\n" \
- " (To clean only, use --target 'clean'.)\n" \
- " --verbose, -v = Enable verbose output - if supported - including\n" \
- " the build commands to be executed. \n" \
- " -- = Pass remaining options to the native tool.\n"
-
-# define CMAKE_INSTALL_OPTIONS \
- " <dir> = Project binary directory to install.\n" \
- " --config <cfg> = For multi-configuration tools, choose <cfg>.\n" \
- " --component <comp> = Component-based install. Only install <comp>.\n" \
- " --prefix <prefix> = The installation prefix CMAKE_INSTALL_PREFIX.\n" \
- " --strip = Performing install/strip.\n" \
- " -v --verbose = Enable verbose output.\n"
-
-static const char* cmDocumentationOptions[][2] = {
+const char* cmDocumentationOptions[][2] = {
CMAKE_STANDARD_OPTIONS_TABLE,
{ "-E", "CMake command mode." },
{ "-L[A][H]", "List non-advanced cached variables." },
@@ -117,7 +91,7 @@ static const char* cmDocumentationOptions[][2] = {
#endif
-static int do_command(int ac, char const* const* av)
+int do_command(int ac, char const* const* av)
{
std::vector<std::string> args;
args.reserve(ac - 1);
@@ -126,12 +100,7 @@ static int do_command(int ac, char const* const* av)
return cmcmd::ExecuteCMakeCommand(args);
}
-int do_cmake(int ac, char const* const* av);
-static int do_build(int ac, char const* const* av);
-static int do_install(int ac, char const* const* av);
-static int do_open(int ac, char const* const* av);
-
-static cmMakefile* cmakemainGetMakefile(cmake* cm)
+cmMakefile* cmakemainGetMakefile(cmake* cm)
{
if (cm && cm->GetDebugOutput()) {
cmGlobalGenerator* gg = cm->GetGlobalGenerator();
@@ -142,7 +111,7 @@ static cmMakefile* cmakemainGetMakefile(cmake* cm)
return nullptr;
}
-static std::string cmakemainGetStack(cmake* cm)
+std::string cmakemainGetStack(cmake* cm)
{
std::string msg;
cmMakefile* mf = cmakemainGetMakefile(cm);
@@ -156,14 +125,13 @@ static std::string cmakemainGetStack(cmake* cm)
return msg;
}
-static void cmakemainMessageCallback(const std::string& m,
- const char* /*unused*/, cmake* cm)
+void cmakemainMessageCallback(const std::string& m, const char* /*unused*/,
+ cmake* cm)
{
- std::cerr << m << cmakemainGetStack(cm) << std::endl << std::flush;
+ std::cerr << m << cmakemainGetStack(cm) << std::endl;
}
-static void cmakemainProgressCallback(const std::string& m, float prog,
- cmake* cm)
+void cmakemainProgressCallback(const std::string& m, float prog, cmake* cm)
{
cmMakefile* mf = cmakemainGetMakefile(cm);
std::string dir;
@@ -178,48 +146,6 @@ static void cmakemainProgressCallback(const std::string& m, float prog,
if ((prog < 0) || (!dir.empty())) {
std::cout << "-- " << m << dir << cmakemainGetStack(cm) << std::endl;
}
-
- std::cout.flush();
-}
-
-int main(int ac, char const* const* av)
-{
- cmSystemTools::EnsureStdPipes();
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
- // Replace streambuf so we can output Unicode to console
- cmsys::ConsoleBuf::Manager consoleOut(std::cout);
- consoleOut.SetUTF8Pipes();
- cmsys::ConsoleBuf::Manager consoleErr(std::cerr, true);
- consoleErr.SetUTF8Pipes();
-#endif
- cmsys::Encoding::CommandLineArguments args =
- cmsys::Encoding::CommandLineArguments::Main(ac, av);
- ac = args.argc();
- av = args.argv();
-
- cmSystemTools::EnableMSVCDebugHook();
- cmSystemTools::InitializeLibUV();
- cmSystemTools::FindCMakeResources(av[0]);
- if (ac > 1) {
- if (strcmp(av[1], "--build") == 0) {
- return do_build(ac, av);
- }
- if (strcmp(av[1], "--install") == 0) {
- return do_install(ac, av);
- }
- if (strcmp(av[1], "--open") == 0) {
- return do_open(ac, av);
- }
- if (strcmp(av[1], "-E") == 0) {
- return do_command(ac, av);
- }
- }
- int ret = do_cmake(ac, av);
-#ifdef CMAKE_BUILD_WITH_CMAKE
- cmDynamicLoader::FlushCache();
-#endif
- uv_loop_close(uv_default_loop());
- return ret;
}
int do_cmake(int ac, char const* const* av)
@@ -381,7 +307,6 @@ int do_cmake(int ac, char const* const* av)
return 0;
}
-namespace {
int extract_job_number(int& index, char const* current, char const* next,
int len_of_flag)
{
@@ -411,9 +336,8 @@ int extract_job_number(int& index, char const* current, char const* next,
}
return jobs;
}
-}
-static int do_build(int ac, char const* const* av)
+int do_build(int ac, char const* const* av)
{
#ifndef CMAKE_BUILD_WITH_CMAKE
std::cerr << "This cmake does not support --build\n";
@@ -541,7 +465,24 @@ static int do_build(int ac, char const* const* av)
std::cerr <<
"Usage: cmake --build <dir> [options] [-- [native-options]]\n"
"Options:\n"
- CMAKE_BUILD_OPTIONS
+ " <dir> = Project binary directory to be built.\n"
+ " --parallel [<jobs>], -j [<jobs>]\n"
+ " = Build in parallel using the given number of jobs. \n"
+ " If <jobs> is omitted the native build tool's \n"
+ " default number is used.\n"
+ " The CMAKE_BUILD_PARALLEL_LEVEL environment "
+ "variable\n"
+ " specifies a default parallel level when this "
+ "option\n"
+ " is not given.\n"
+ " --target <tgt>..., -t <tgt>... \n"
+ " = Build <tgt> instead of default targets.\n"
+ " --config <cfg> = For multi-configuration tools, choose <cfg>.\n"
+ " --clean-first = Build target 'clean' first, then build.\n"
+ " (To clean only, use --target 'clean'.)\n"
+ " --verbose, -v = Enable verbose output - if supported - including\n"
+ " the build commands to be executed. \n"
+ " -- = Pass remaining options to the native tool.\n"
;
/* clang-format on */
return 1;
@@ -560,7 +501,7 @@ static int do_build(int ac, char const* const* av)
#endif
}
-static int do_install(int ac, char const* const* av)
+int do_install(int ac, char const* const* av)
{
#ifndef CMAKE_BUILD_WITH_CMAKE
std::cerr << "This cmake does not support --install\n";
@@ -627,8 +568,18 @@ static int do_install(int ac, char const* const* av)
}
if (dir.empty()) {
- std::cerr << "Usage: cmake --install <dir> "
- "[options]\nOptions:\n" CMAKE_INSTALL_OPTIONS;
+ /* clang-format off */
+ std::cerr <<
+ "Usage: cmake --install <dir> [options]\n"
+ "Options:\n"
+ " <dir> = Project binary directory to install.\n"
+ " --config <cfg> = For multi-configuration tools, choose <cfg>.\n"
+ " --component <comp> = Component-based install. Only install <comp>.\n"
+ " --prefix <prefix> = The installation prefix CMAKE_INSTALL_PREFIX.\n"
+ " --strip = Performing install/strip.\n"
+ " -v --verbose = Enable verbose output.\n"
+ ;
+ /* clang-format on */
return 1;
}
@@ -671,7 +622,7 @@ static int do_install(int ac, char const* const* av)
#endif
}
-static int do_open(int ac, char const* const* av)
+int do_open(int ac, char const* const* av)
{
#ifndef CMAKE_BUILD_WITH_CMAKE
std::cerr << "This cmake does not support --open\n";
@@ -713,3 +664,44 @@ static int do_open(int ac, char const* const* av)
return cm.Open(dir, false) ? 0 : 1;
#endif
}
+} // namespace
+
+int main(int ac, char const* const* av)
+{
+ cmSystemTools::EnsureStdPipes();
+#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+ // Replace streambuf so we can output Unicode to console
+ cmsys::ConsoleBuf::Manager consoleOut(std::cout);
+ consoleOut.SetUTF8Pipes();
+ cmsys::ConsoleBuf::Manager consoleErr(std::cerr, true);
+ consoleErr.SetUTF8Pipes();
+#endif
+ cmsys::Encoding::CommandLineArguments args =
+ cmsys::Encoding::CommandLineArguments::Main(ac, av);
+ ac = args.argc();
+ av = args.argv();
+
+ cmSystemTools::EnableMSVCDebugHook();
+ cmSystemTools::InitializeLibUV();
+ cmSystemTools::FindCMakeResources(av[0]);
+ if (ac > 1) {
+ if (strcmp(av[1], "--build") == 0) {
+ return do_build(ac, av);
+ }
+ if (strcmp(av[1], "--install") == 0) {
+ return do_install(ac, av);
+ }
+ if (strcmp(av[1], "--open") == 0) {
+ return do_open(ac, av);
+ }
+ if (strcmp(av[1], "-E") == 0) {
+ return do_command(ac, av);
+ }
+ }
+ int ret = do_cmake(ac, av);
+#ifdef CMAKE_BUILD_WITH_CMAKE
+ cmDynamicLoader::FlushCache();
+#endif
+ uv_loop_close(uv_default_loop());
+ return ret;
+}
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 86082e5..aecc978 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -13,6 +13,7 @@
#include "cmState.h"
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmUtils.hxx"
#include "cmVersion.h"
@@ -41,7 +42,7 @@
#include <array>
#include <iostream>
#include <iterator>
-#include <memory> // IWYU pragma: keep
+#include <memory>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
@@ -114,6 +115,8 @@ void CMakeCommandUsage(const char* program)
<< " touch <file>... - touch a <file>.\n"
<< " touch_nocreate <file>... - touch a <file> but do not create it.\n"
<< " create_symlink old new - create a symbolic link new -> old\n"
+ << " true - do nothing with an exit code of 0\n"
+ << " false - do nothing with an exit code of 1\n"
#if defined(_WIN32) && !defined(__CYGWIN__)
<< "Available on Windows only:\n"
<< " delete_regv key - delete registry value\n"
@@ -891,6 +894,16 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
return 0;
}
+ // Command to do nothing with an exit code of 0.
+ if (args[1] == "true") {
+ return 0;
+ }
+
+ // Command to do nothing with an exit code of 1.
+ if (args[1] == "false") {
+ return 1;
+ }
+
// Internal CMake shared library support.
if (args[1] == "cmake_symlink_library" && args.size() == 5) {
return cmcmd::SymlinkLibrary(args);
diff --git a/Source/kwsys/CommandLineArguments.cxx b/Source/kwsys/CommandLineArguments.cxx
index a97f7a8..dc9f01d 100644
--- a/Source/kwsys/CommandLineArguments.cxx
+++ b/Source/kwsys/CommandLineArguments.cxx
@@ -67,10 +67,10 @@ class CommandLineArgumentsInternal
{
public:
CommandLineArgumentsInternal()
+ : UnknownArgumentCallback{ KWSYS_NULLPTR }
+ , ClientData{ KWSYS_NULLPTR }
+ , LastArgument{ 0 }
{
- this->UnknownArgumentCallback = KWSYS_NULLPTR;
- this->ClientData = KWSYS_NULLPTR;
- this->LastArgument = 0;
}
typedef CommandLineArgumentsVectorOfStrings VectorOfStrings;
diff --git a/Source/kwsys/RegularExpression.cxx b/Source/kwsys/RegularExpression.cxx
index 5f84b19..3e10765 100644
--- a/Source/kwsys/RegularExpression.cxx
+++ b/Source/kwsys/RegularExpression.cxx
@@ -337,7 +337,6 @@ bool RegularExpression::compile(const char* exp)
{
const char* scan;
const char* longest;
- size_t len;
int flags;
if (exp == KWSYS_NULLPTR) {
@@ -412,7 +411,7 @@ bool RegularExpression::compile(const char* exp)
//
if (flags & SPSTART) {
longest = KWSYS_NULLPTR;
- len = 0;
+ size_t len = 0;
for (; scan != KWSYS_NULLPTR; scan = regnext(scan))
if (OP(scan) == EXACTLY && strlen(OPERAND(scan)) >= len) {
longest = OPERAND(scan);
diff --git a/Source/kwsys/RegularExpression.hxx.in b/Source/kwsys/RegularExpression.hxx.in
index b7b93f9..ed86418 100644
--- a/Source/kwsys/RegularExpression.hxx.in
+++ b/Source/kwsys/RegularExpression.hxx.in
@@ -407,8 +407,12 @@ private:
* Create an empty regular expression.
*/
inline RegularExpression::RegularExpression()
+ : regstart{}
+ , reganch{}
+ , regmust{}
+ , program{ 0 }
+ , progsize{}
{
- this->program = 0;
}
/**
@@ -416,8 +420,12 @@ inline RegularExpression::RegularExpression()
* compiles s.
*/
inline RegularExpression::RegularExpression(const char* s)
+ : regstart{}
+ , reganch{}
+ , regmust{}
+ , program{ 0 }
+ , progsize{}
{
- this->program = 0;
if (s) {
this->compile(s);
}
@@ -428,8 +436,12 @@ inline RegularExpression::RegularExpression(const char* s)
* compiles s.
*/
inline RegularExpression::RegularExpression(const std::string& s)
+ : regstart{}
+ , reganch{}
+ , regmust{}
+ , program{ 0 }
+ , progsize{}
{
- this->program = 0;
this->compile(s);
}
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index ae7a18a..36f24c7 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -3403,11 +3403,7 @@ static void SystemToolsAppendComponents(
out_components.emplace_back(std::move(*i));
}
} else if (!i->empty() && *i != cur) {
-#if __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L)
- out_components.push_back(std::move(*i));
-#else
- out_components.push_back(*i);
-#endif
+ out_components.emplace_back(std::move(*i));
}
}
}
@@ -4743,7 +4739,7 @@ void SystemTools::ClassInitialize()
// Test progressively shorter logical-to-physical mappings.
std::string cwd_str = cwd;
std::string pwd_path;
- Realpath(pwd_str.c_str(), pwd_path);
+ Realpath(pwd_str, pwd_path);
while (cwd_str == pwd_path && cwd_str != pwd_str) {
// The current pair of paths is a working logical mapping.
cwd_changed = cwd_str;
@@ -4753,7 +4749,7 @@ void SystemTools::ClassInitialize()
// mapping still works.
pwd_str = SystemTools::GetFilenamePath(pwd_str);
cwd_str = SystemTools::GetFilenamePath(cwd_str);
- Realpath(pwd_str.c_str(), pwd_path);
+ Realpath(pwd_str, pwd_path);
}
// Add the translation to keep the logical path name.