summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-03-09 14:29:02 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-03-09 14:29:02 (GMT)
commitad9f0d831e6522d9606bab7ae08559cebeed83ce (patch)
treed85ba309d378fac37063e7b05fc624e60a819a64
parent6aad93f407f341fae1afb80ebeab532451c39458 (diff)
parentb633b263082ae2c74a030aefb9048b0a20098b61 (diff)
downloadCMake-ad9f0d831e6522d9606bab7ae08559cebeed83ce.zip
CMake-ad9f0d831e6522d9606bab7ae08559cebeed83ce.tar.gz
CMake-ad9f0d831e6522d9606bab7ae08559cebeed83ce.tar.bz2
Merge topic 'dev/string-apis'
b633b263 CPackWiX: Fix test to build with expected config 191f25e2 stringapi: Prevent a NULL dereference in WiX 219d6ad6 speedup: Avoid excess iterator dereferences caaad357 speedup: Cache strings for comparisons 7abf4e31 stringapi: Use strings for dependency information 94fc63e2 stringapi: Use strings for cache iterator values 85fc9f26 stringapi: Command names 6557382d stringapi: Use strings for program paths 1a1b737c stringapi: Use strings for generator names 24b5e93d stringapi: Use strings for directories 11ed3e2c stringapi: Add string overload for the Def struct b3bf31a5 stringapi: Miscellaneous char* parameters 5af95c39 typo: Match argument name with the header 2b17626e stringapi: Pass strings as install directories in CPack 3def29da stringapi: Use strings for feature arguments acb116e3 stringapi: Return a string reference for the configuration ...
-rw-r--r--Modules/FindCUDA.cmake2
-rw-r--r--Source/CPack/WiX/cmWIXPatchParser.cxx12
-rw-r--r--Source/CPack/WiX/cmWIXPatchParser.h4
-rw-r--r--Source/CPack/cmCPackComponentGroup.cxx5
-rw-r--r--Source/CPack/cmCPackComponentGroup.h4
-rw-r--r--Source/CPack/cmCPackGenerator.cxx55
-rw-r--r--Source/CPack/cmCPackGenerator.h34
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.cxx13
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.h10
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.cxx8
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.h5
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.cxx24
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.h11
-rw-r--r--Source/CPack/cpack.cxx2
-rw-r--r--Source/CTest/cmCTestBZR.cxx40
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.h2
-rw-r--r--Source/CTest/cmCTestBuildCommand.cxx8
-rw-r--r--Source/CTest/cmCTestBuildCommand.h2
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx12
-rw-r--r--Source/CTest/cmCTestBuildHandler.h14
-rw-r--r--Source/CTest/cmCTestCVS.cxx6
-rw-r--r--Source/CTest/cmCTestCVS.h4
-rw-r--r--Source/CTest/cmCTestConfigureCommand.h2
-rw-r--r--Source/CTest/cmCTestCoverageCommand.h4
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx24
-rw-r--r--Source/CTest/cmCTestCoverageHandler.h12
-rw-r--r--Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h2
-rw-r--r--Source/CTest/cmCTestGIT.cxx4
-rw-r--r--Source/CTest/cmCTestGenericHandler.cxx14
-rw-r--r--Source/CTest/cmCTestGenericHandler.h8
-rw-r--r--Source/CTest/cmCTestGlobalVC.cxx2
-rw-r--r--Source/CTest/cmCTestGlobalVC.h4
-rw-r--r--Source/CTest/cmCTestHG.cxx26
-rw-r--r--Source/CTest/cmCTestLaunch.cxx2
-rw-r--r--Source/CTest/cmCTestLaunch.h2
-rw-r--r--Source/CTest/cmCTestMemCheckCommand.h2
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx52
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.h10
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx2
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.h10
-rw-r--r--Source/CTest/cmCTestP4.cxx8
-rw-r--r--Source/CTest/cmCTestReadCustomFilesCommand.h2
-rw-r--r--Source/CTest/cmCTestRunScriptCommand.h2
-rw-r--r--Source/CTest/cmCTestSVN.cxx26
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx4
-rw-r--r--Source/CTest/cmCTestScriptHandler.h28
-rw-r--r--Source/CTest/cmCTestSleepCommand.h2
-rw-r--r--Source/CTest/cmCTestStartCommand.h2
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx6
-rw-r--r--Source/CTest/cmCTestSubmitCommand.h2
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx112
-rw-r--r--Source/CTest/cmCTestSubmitHandler.h60
-rw-r--r--Source/CTest/cmCTestTestCommand.h2
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx38
-rw-r--r--Source/CTest/cmCTestTestHandler.h18
-rw-r--r--Source/CTest/cmCTestUpdateCommand.h2
-rw-r--r--Source/CTest/cmCTestUploadCommand.cxx2
-rw-r--r--Source/CTest/cmCTestUploadCommand.h2
-rw-r--r--Source/CTest/cmCTestVC.cxx4
-rw-r--r--Source/CTest/cmParseGTMCoverage.cxx2
-rw-r--r--Source/CTest/cmParseMumpsCoverage.cxx2
-rw-r--r--Source/CTest/cmParseMumpsCoverage.h2
-rw-r--r--Source/CTest/cmParsePHPCoverage.cxx4
-rw-r--r--Source/CTest/cmParsePHPCoverage.h2
-rw-r--r--Source/CTest/cmParsePythonCoverage.cxx8
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.cxx14
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.h5
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx10
-rw-r--r--Source/CursesDialog/cmCursesMainForm.h2
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.cxx2
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.h2
-rw-r--r--Source/CursesDialog/cmCursesPathWidget.cxx2
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.cxx2
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.h2
-rw-r--r--Source/CursesDialog/cmCursesWidget.cxx4
-rw-r--r--Source/CursesDialog/cmCursesWidget.h2
-rw-r--r--Source/QtDialog/QCMake.cxx12
-rw-r--r--Source/cmAddCompileOptionsCommand.h2
-rw-r--r--Source/cmAddCustomCommandCommand.h2
-rw-r--r--Source/cmAddCustomTargetCommand.h2
-rw-r--r--Source/cmAddDefinitionsCommand.h2
-rw-r--r--Source/cmAddDependenciesCommand.h2
-rw-r--r--Source/cmAddExecutableCommand.h2
-rw-r--r--Source/cmAddLibraryCommand.h2
-rw-r--r--Source/cmAddSubDirectoryCommand.h2
-rw-r--r--Source/cmAddTestCommand.h2
-rw-r--r--Source/cmAuxSourceDirectoryCommand.h2
-rw-r--r--Source/cmBreakCommand.h2
-rw-r--r--Source/cmBuildCommand.cxx10
-rw-r--r--Source/cmBuildCommand.h2
-rw-r--r--Source/cmBuildNameCommand.h2
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.h2
-rw-r--r--Source/cmCMakeMinimumRequired.h2
-rw-r--r--Source/cmCMakePolicyCommand.h2
-rw-r--r--Source/cmCTest.cxx44
-rw-r--r--Source/cmCTest.h34
-rw-r--r--Source/cmCacheManager.cxx71
-rw-r--r--Source/cmCacheManager.h56
-rw-r--r--Source/cmCommand.h4
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx12
-rw-r--r--Source/cmCommandArgumentParserHelper.h6
-rw-r--r--Source/cmComputeLinkDepends.cxx24
-rw-r--r--Source/cmComputeLinkDepends.h12
-rw-r--r--Source/cmComputeLinkInformation.cxx26
-rw-r--r--Source/cmComputeLinkInformation.h18
-rw-r--r--Source/cmComputeTargetDepends.cxx37
-rw-r--r--Source/cmComputeTargetDepends.h14
-rw-r--r--Source/cmConfigureFileCommand.h2
-rw-r--r--Source/cmCoreTryCompile.cxx18
-rw-r--r--Source/cmCoreTryCompile.h2
-rw-r--r--Source/cmCreateTestSourceList.h2
-rw-r--r--Source/cmCryptoHash.cxx10
-rw-r--r--Source/cmCryptoHash.h4
-rw-r--r--Source/cmCustomCommand.h2
-rw-r--r--Source/cmCustomCommandGenerator.cxx2
-rw-r--r--Source/cmCustomCommandGenerator.h5
-rw-r--r--Source/cmDefinePropertyCommand.h2
-rw-r--r--Source/cmDefinitions.cxx28
-rw-r--r--Source/cmDefinitions.h32
-rw-r--r--Source/cmDepends.cxx2
-rw-r--r--Source/cmDepends.h4
-rw-r--r--Source/cmDependsC.cxx18
-rw-r--r--Source/cmDependsC.h19
-rw-r--r--Source/cmDependsFortran.cxx40
-rw-r--r--Source/cmDependsJavaParserHelper.cxx24
-rw-r--r--Source/cmDependsJavaParserHelper.h20
-rw-r--r--Source/cmDocumentation.cxx4
-rw-r--r--Source/cmDocumentation.h2
-rw-r--r--Source/cmDocumentationSection.h4
-rw-r--r--Source/cmDynamicLoader.cxx8
-rw-r--r--Source/cmElseCommand.h2
-rw-r--r--Source/cmElseIfCommand.h2
-rw-r--r--Source/cmEnableLanguageCommand.h2
-rw-r--r--Source/cmEnableTestingCommand.h2
-rw-r--r--Source/cmEndForEachCommand.h2
-rw-r--r--Source/cmEndFunctionCommand.h2
-rw-r--r--Source/cmEndIfCommand.h2
-rw-r--r--Source/cmEndMacroCommand.h2
-rw-r--r--Source/cmEndWhileCommand.h2
-rw-r--r--Source/cmExecProgramCommand.h2
-rw-r--r--Source/cmExecuteProcessCommand.h2
-rw-r--r--Source/cmExportBuildFileGenerator.cxx8
-rw-r--r--Source/cmExportBuildFileGenerator.h4
-rw-r--r--Source/cmExportCommand.cxx2
-rw-r--r--Source/cmExportCommand.h2
-rw-r--r--Source/cmExportFileGenerator.cxx40
-rw-r--r--Source/cmExportFileGenerator.h28
-rw-r--r--Source/cmExportInstallFileGenerator.cxx11
-rw-r--r--Source/cmExportInstallFileGenerator.h10
-rw-r--r--Source/cmExportLibraryDependenciesCommand.cxx14
-rw-r--r--Source/cmExportLibraryDependenciesCommand.h2
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx5
-rw-r--r--Source/cmExportTryCompileFileGenerator.h8
-rw-r--r--Source/cmExprParserHelper.h4
-rw-r--r--Source/cmExternalMakefileProjectGenerator.cxx22
-rw-r--r--Source/cmExternalMakefileProjectGenerator.h11
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx24
-rw-r--r--Source/cmExtraCodeBlocksGenerator.h10
-rw-r--r--Source/cmExtraCodeLiteGenerator.cxx12
-rw-r--r--Source/cmExtraCodeLiteGenerator.h6
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx4
-rw-r--r--Source/cmExtraEclipseCDT4Generator.h6
-rw-r--r--Source/cmExtraKateGenerator.cxx4
-rw-r--r--Source/cmExtraKateGenerator.h6
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx32
-rw-r--r--Source/cmExtraSublimeTextGenerator.h10
-rw-r--r--Source/cmFLTKWrapUICommand.cxx2
-rw-r--r--Source/cmFLTKWrapUICommand.h2
-rw-r--r--Source/cmFileCommand.h2
-rw-r--r--Source/cmFileTimeComparison.cxx4
-rw-r--r--Source/cmFindBase.cxx6
-rw-r--r--Source/cmFindBase.h10
-rw-r--r--Source/cmFindCommon.cxx2
-rw-r--r--Source/cmFindCommon.h6
-rw-r--r--Source/cmFindFileCommand.h2
-rw-r--r--Source/cmFindLibraryCommand.cxx4
-rw-r--r--Source/cmFindLibraryCommand.h2
-rw-r--r--Source/cmFindPackageCommand.cxx5
-rw-r--r--Source/cmFindPackageCommand.h16
-rw-r--r--Source/cmFindPathCommand.cxx10
-rw-r--r--Source/cmFindPathCommand.h2
-rw-r--r--Source/cmFindProgramCommand.h2
-rw-r--r--Source/cmForEachCommand.h2
-rw-r--r--Source/cmFunctionCommand.cxx2
-rw-r--r--Source/cmFunctionCommand.h2
-rw-r--r--Source/cmGeneratedFileStream.cxx7
-rw-r--r--Source/cmGeneratedFileStream.h2
-rw-r--r--Source/cmGeneratorExpression.cxx22
-rw-r--r--Source/cmGeneratorExpression.h12
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx6
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.h2
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.cxx4
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.h2
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx144
-rw-r--r--Source/cmGeneratorExpressionEvaluator.h4
-rw-r--r--Source/cmGeneratorExpressionLexer.cxx6
-rw-r--r--Source/cmGeneratorExpressionLexer.h2
-rw-r--r--Source/cmGeneratorTarget.cxx50
-rw-r--r--Source/cmGeneratorTarget.h16
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx4
-rw-r--r--Source/cmGetCMakePropertyCommand.h2
-rw-r--r--Source/cmGetDirectoryPropertyCommand.h2
-rw-r--r--Source/cmGetFilenameComponentCommand.h2
-rw-r--r--Source/cmGetPropertyCommand.cxx2
-rw-r--r--Source/cmGetPropertyCommand.h2
-rw-r--r--Source/cmGetSourceFilePropertyCommand.cxx2
-rw-r--r--Source/cmGetSourceFilePropertyCommand.h2
-rw-r--r--Source/cmGetTargetPropertyCommand.cxx12
-rw-r--r--Source/cmGetTargetPropertyCommand.h2
-rw-r--r--Source/cmGetTestPropertyCommand.h2
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.h4
-rw-r--r--Source/cmGlobalGenerator.cxx210
-rw-r--r--Source/cmGlobalGenerator.h126
-rw-r--r--Source/cmGlobalGeneratorFactory.h8
-rw-r--r--Source/cmGlobalJOMMakefileGenerator.h4
-rw-r--r--Source/cmGlobalKdevelopGenerator.cxx10
-rw-r--r--Source/cmGlobalKdevelopGenerator.h6
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.h4
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.h4
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.h4
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx20
-rw-r--r--Source/cmGlobalNinjaGenerator.h14
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx157
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h16
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx49
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h17
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx24
-rw-r--r--Source/cmGlobalVisualStudio11Generator.h7
-rw-r--r--Source/cmGlobalVisualStudio12Generator.cxx24
-rw-r--r--Source/cmGlobalVisualStudio12Generator.h7
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx39
-rw-r--r--Source/cmGlobalVisualStudio6Generator.h27
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx21
-rw-r--r--Source/cmGlobalVisualStudio71Generator.h18
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx76
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h44
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx43
-rw-r--r--Source/cmGlobalVisualStudio8Generator.h14
-rw-r--r--Source/cmGlobalVisualStudio9Generator.cxx14
-rw-r--r--Source/cmGlobalVisualStudio9Generator.h5
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx18
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h13
-rw-r--r--Source/cmGlobalWatcomWMakeGenerator.h4
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx202
-rw-r--r--Source/cmGlobalXCodeGenerator.h58
-rw-r--r--Source/cmGraphVizWriter.cxx32
-rw-r--r--Source/cmGraphVizWriter.h20
-rw-r--r--Source/cmIDEOptions.cxx4
-rw-r--r--Source/cmIDEOptions.h4
-rw-r--r--Source/cmIfCommand.cxx18
-rw-r--r--Source/cmIfCommand.h4
-rw-r--r--Source/cmIncludeCommand.h2
-rw-r--r--Source/cmIncludeDirectoryCommand.cxx2
-rw-r--r--Source/cmIncludeDirectoryCommand.h2
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.h2
-rw-r--r--Source/cmIncludeRegularExpressionCommand.h2
-rw-r--r--Source/cmInstallCommand.cxx2
-rw-r--r--Source/cmInstallCommand.h2
-rw-r--r--Source/cmInstallExportGenerator.cxx4
-rw-r--r--Source/cmInstallFilesCommand.h2
-rw-r--r--Source/cmInstallFilesGenerator.cxx4
-rw-r--r--Source/cmInstallFilesGenerator.h2
-rw-r--r--Source/cmInstallGenerator.cxx2
-rw-r--r--Source/cmInstallGenerator.h2
-rw-r--r--Source/cmInstallProgramsCommand.h2
-rw-r--r--Source/cmInstallTargetGenerator.cxx33
-rw-r--r--Source/cmInstallTargetGenerator.h25
-rw-r--r--Source/cmInstallTargetsCommand.h2
-rw-r--r--Source/cmLinkDirectoriesCommand.h2
-rw-r--r--Source/cmLinkLibrariesCommand.h2
-rw-r--r--Source/cmListCommand.cxx10
-rw-r--r--Source/cmListCommand.h6
-rw-r--r--Source/cmLoadCacheCommand.cxx4
-rw-r--r--Source/cmLoadCacheCommand.h4
-rw-r--r--Source/cmLoadCommandCommand.cxx2
-rw-r--r--Source/cmLoadCommandCommand.h2
-rw-r--r--Source/cmLocalGenerator.cxx241
-rw-r--r--Source/cmLocalGenerator.h87
-rw-r--r--Source/cmLocalNinjaGenerator.h4
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx34
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h41
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx8
-rw-r--r--Source/cmLocalVisualStudio10Generator.h2
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx87
-rw-r--r--Source/cmLocalVisualStudio6Generator.h21
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx101
-rw-r--r--Source/cmLocalVisualStudio7Generator.h35
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx8
-rw-r--r--Source/cmLocalVisualStudioGenerator.h7
-rw-r--r--Source/cmLocalXCodeGenerator.cxx6
-rw-r--r--Source/cmLocalXCodeGenerator.h3
-rw-r--r--Source/cmMacroCommand.cxx2
-rw-r--r--Source/cmMacroCommand.h2
-rw-r--r--Source/cmMakeDepend.cxx2
-rw-r--r--Source/cmMakeDepend.h8
-rw-r--r--Source/cmMakeDirectoryCommand.h2
-rw-r--r--Source/cmMakefile.cxx370
-rw-r--r--Source/cmMakefile.h150
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx8
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx44
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.h5
-rw-r--r--Source/cmMakefileTargetGenerator.cxx70
-rw-r--r--Source/cmMakefileTargetGenerator.h32
-rw-r--r--Source/cmMakefileUtilityTargetGenerator.cxx2
-rw-r--r--Source/cmMarkAsAdvancedCommand.h2
-rw-r--r--Source/cmMathCommand.h2
-rw-r--r--Source/cmMessageCommand.h2
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx14
-rw-r--r--Source/cmNinjaNormalTargetGenerator.h2
-rw-r--r--Source/cmNinjaTargetGenerator.cxx8
-rw-r--r--Source/cmNinjaTargetGenerator.h10
-rw-r--r--Source/cmOSXBundleGenerator.cxx2
-rw-r--r--Source/cmOSXBundleGenerator.h8
-rw-r--r--Source/cmOptionCommand.cxx5
-rw-r--r--Source/cmOptionCommand.h2
-rw-r--r--Source/cmOrderDirectories.cxx20
-rw-r--r--Source/cmOrderDirectories.h10
-rw-r--r--Source/cmOutputRequiredFilesCommand.h2
-rw-r--r--Source/cmProjectCommand.h2
-rw-r--r--Source/cmProperty.cxx5
-rw-r--r--Source/cmProperty.h5
-rw-r--r--Source/cmPropertyDefinition.cxx2
-rw-r--r--Source/cmPropertyDefinition.h2
-rw-r--r--Source/cmPropertyDefinitionMap.cxx21
-rw-r--r--Source/cmPropertyDefinitionMap.h8
-rw-r--r--Source/cmPropertyMap.cxx16
-rw-r--r--Source/cmPropertyMap.h10
-rw-r--r--Source/cmQTWrapCPPCommand.cxx2
-rw-r--r--Source/cmQTWrapCPPCommand.h2
-rw-r--r--Source/cmQTWrapUICommand.cxx2
-rw-r--r--Source/cmQTWrapUICommand.h2
-rw-r--r--Source/cmQtAutoGenerators.cxx87
-rw-r--r--Source/cmQtAutoGenerators.h10
-rw-r--r--Source/cmRST.cxx4
-rw-r--r--Source/cmRST.h4
-rw-r--r--Source/cmRemoveCommand.h2
-rw-r--r--Source/cmRemoveDefinitionsCommand.h2
-rw-r--r--Source/cmReturnCommand.h2
-rw-r--r--Source/cmScriptGenerator.cxx23
-rw-r--r--Source/cmScriptGenerator.h12
-rw-r--r--Source/cmSeparateArgumentsCommand.h2
-rw-r--r--Source/cmSetCommand.h2
-rw-r--r--Source/cmSetDirectoryPropertiesCommand.h2
-rw-r--r--Source/cmSetPropertyCommand.cxx14
-rw-r--r--Source/cmSetPropertyCommand.h4
-rw-r--r--Source/cmSetSourceFilesPropertiesCommand.h2
-rw-r--r--Source/cmSetTargetPropertiesCommand.cxx2
-rw-r--r--Source/cmSetTargetPropertiesCommand.h4
-rw-r--r--Source/cmSetTestsPropertiesCommand.cxx2
-rw-r--r--Source/cmSetTestsPropertiesCommand.h4
-rw-r--r--Source/cmSiteNameCommand.h2
-rw-r--r--Source/cmSourceFile.cxx47
-rw-r--r--Source/cmSourceFile.h19
-rw-r--r--Source/cmSourceFileLocation.cxx15
-rw-r--r--Source/cmSourceFileLocation.h10
-rw-r--r--Source/cmSourceGroup.cxx4
-rw-r--r--Source/cmSourceGroup.h4
-rw-r--r--Source/cmSourceGroupCommand.h2
-rw-r--r--Source/cmStandardIncludes.h13
-rw-r--r--Source/cmStringCommand.h2
-rw-r--r--Source/cmSubdirCommand.h2
-rw-r--r--Source/cmSubdirDependsCommand.h2
-rw-r--r--Source/cmSystemTools.cxx73
-rw-r--r--Source/cmSystemTools.h28
-rw-r--r--Source/cmTarget.cxx545
-rw-r--r--Source/cmTarget.h223
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.h2
-rw-r--r--Source/cmTargetCompileOptionsCommand.h2
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.h2
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx12
-rw-r--r--Source/cmTargetLinkLibrariesCommand.h4
-rw-r--r--Source/cmTargetPropCommandBase.cxx7
-rw-r--r--Source/cmTargetPropCommandBase.h3
-rw-r--r--Source/cmTest.cxx24
-rw-r--r--Source/cmTest.h15
-rw-r--r--Source/cmTestGenerator.cxx2
-rw-r--r--Source/cmTestGenerator.h2
-rw-r--r--Source/cmTryCompileCommand.h2
-rw-r--r--Source/cmTryRunCommand.h2
-rw-r--r--Source/cmUnsetCommand.h2
-rw-r--r--Source/cmUseMangledMesaCommand.h2
-rw-r--r--Source/cmUtilitySourceCommand.h2
-rw-r--r--Source/cmVariableRequiresCommand.h2
-rw-r--r--Source/cmVariableWatch.h2
-rw-r--r--Source/cmVariableWatchCommand.h2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx41
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h6
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx8
-rw-r--r--Source/cmVisualStudioGeneratorOptions.h2
-rw-r--r--Source/cmVisualStudioWCEPlatformParser.cxx20
-rw-r--r--Source/cmVisualStudioWCEPlatformParser.h4
-rw-r--r--Source/cmWhileCommand.h2
-rw-r--r--Source/cmWriteFileCommand.h2
-rw-r--r--Source/cmXCodeObject.cxx8
-rw-r--r--Source/cmXCodeObject.h56
-rw-r--r--Source/cmXMLParser.cxx4
-rw-r--r--Source/cmXMLParser.h4
-rw-r--r--Source/cmake.cxx95
-rw-r--r--Source/cmake.h58
-rw-r--r--Source/cmcldeps.cxx2
-rw-r--r--Source/cmcmd.cxx20
-rw-r--r--Source/cmcmd.h4
-rw-r--r--Tests/CMakeLib/run_compile_commands.cxx8
-rw-r--r--Tests/CMakeLists.txt2
-rw-r--r--Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake5
405 files changed, 3432 insertions, 3469 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 7bc8d49..94f82f6 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -987,7 +987,7 @@ function(CUDA_COMPUTE_BUILD_PATH path build_path)
endif()
endif()
- # This recipie is from cmLocalGenerator::CreateSafeUniqueObjectFileName in the
+ # This recipe is from cmLocalGenerator::CreateSafeUniqueObjectFileName in the
# CMake source.
# Remove leading /
diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx
index 10af1f6..ef67b23 100644
--- a/Source/CPack/WiX/cmWIXPatchParser.cxx
+++ b/Source/CPack/WiX/cmWIXPatchParser.cxx
@@ -34,12 +34,11 @@ cmWIXPatchParser::cmWIXPatchParser(
}
-void cmWIXPatchParser::StartElement(const char *name, const char **atts)
+void cmWIXPatchParser::StartElement(const std::string& name, const char **atts)
{
- std::string name_str = name;
if(State == BEGIN_DOCUMENT)
{
- if(name_str == "CPackWiXPatch")
+ if(name == "CPackWiXPatch")
{
State = BEGIN_FRAGMENTS;
}
@@ -50,7 +49,7 @@ void cmWIXPatchParser::StartElement(const char *name, const char **atts)
}
else if(State == BEGIN_FRAGMENTS)
{
- if(name_str == "CPackWiXFragment")
+ if(name == "CPackWiXFragment")
{
State = INSIDE_FRAGMENT;
StartFragment(atts);
@@ -107,12 +106,11 @@ void cmWIXPatchParser::StartFragment(const char **attributes)
}
}
-void cmWIXPatchParser::EndElement(const char *name)
+void cmWIXPatchParser::EndElement(const std::string& name)
{
- std::string name_str = name;
if(State == INSIDE_FRAGMENT)
{
- if(name_str == "CPackWiXFragment")
+ if(name == "CPackWiXFragment")
{
State = BEGIN_FRAGMENTS;
ElementStack.clear();
diff --git a/Source/CPack/WiX/cmWIXPatchParser.h b/Source/CPack/WiX/cmWIXPatchParser.h
index da3adf5..acfb4c0 100644
--- a/Source/CPack/WiX/cmWIXPatchParser.h
+++ b/Source/CPack/WiX/cmWIXPatchParser.h
@@ -43,11 +43,11 @@ public:
cmWIXPatchParser(fragment_map_t& Fragments, cmCPackLog* logger);
private:
- virtual void StartElement(const char *name, const char **atts);
+ virtual void StartElement(const std::string& name, const char **atts);
void StartFragment(const char **attributes);
- virtual void EndElement(const char *name);
+ virtual void EndElement(const std::string& name);
virtual void ReportError(int line, int column, const char* msg);
void ReportValidationError(std::string const& message);
diff --git a/Source/CPack/cmCPackComponentGroup.cxx b/Source/CPack/cmCPackComponentGroup.cxx
index f93eca8..77f11cb 100644
--- a/Source/CPack/cmCPackComponentGroup.cxx
+++ b/Source/CPack/cmCPackComponentGroup.cxx
@@ -16,7 +16,8 @@
#include <string>
//----------------------------------------------------------------------
-unsigned long cmCPackComponent::GetInstalledSize(const char* installDir) const
+unsigned long cmCPackComponent::GetInstalledSize(
+ const std::string& installDir) const
{
if (this->TotalSize != 0)
{
@@ -37,7 +38,7 @@ unsigned long cmCPackComponent::GetInstalledSize(const char* installDir) const
//----------------------------------------------------------------------
unsigned long
-cmCPackComponent::GetInstalledSizeInKbytes(const char* installDir) const
+cmCPackComponent::GetInstalledSizeInKbytes(const std::string& installDir) const
{
unsigned long result = (GetInstalledSize(installDir) + 512) / 1024;
return result? result : 1;
diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h
index abae372..0679638 100644
--- a/Source/CPack/cmCPackComponentGroup.h
+++ b/Source/CPack/cmCPackComponentGroup.h
@@ -94,11 +94,11 @@ public:
/// Get the total installed size of all of the files in this
/// component, in bytes. installDir is the directory into which the
/// component was installed.
- unsigned long GetInstalledSize(const char* installDir) const;
+ unsigned long GetInstalledSize(const std::string& installDir) const;
/// Identical to GetInstalledSize, but returns the result in
/// kilobytes.
- unsigned long GetInstalledSizeInKbytes(const char* installDir) const;
+ unsigned long GetInstalledSizeInKbytes(const std::string& installDir) const;
private:
mutable unsigned long TotalSize;
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index e1dd4e9..3915b31 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -254,7 +254,7 @@ int cmCPackGenerator::InstallProject()
// If the project is a CMAKE project then run pre-install
// and then read the cmake_install script to run it
if ( !this->InstallProjectViaInstallCMakeProjects(
- setDestDir, bareTempInstallDirectory.c_str()) )
+ setDestDir, bareTempInstallDirectory) )
{
return 0;
}
@@ -269,7 +269,7 @@ int cmCPackGenerator::InstallProject()
//----------------------------------------------------------------------
int cmCPackGenerator::InstallProjectViaInstallCommands(
- bool setDestDir, const char* tempInstallDirectory)
+ bool setDestDir, const std::string& tempInstallDirectory)
{
(void) setDestDir;
const char* installCommands = this->GetOption("CPACK_INSTALL_COMMANDS");
@@ -312,7 +312,7 @@ int cmCPackGenerator::InstallProjectViaInstallCommands(
//----------------------------------------------------------------------
int cmCPackGenerator::InstallProjectViaInstalledDirectories(
- bool setDestDir, const char* tempInstallDirectory)
+ bool setDestDir, const std::string& tempInstallDirectory)
{
(void)setDestDir;
(void)tempInstallDirectory;
@@ -349,7 +349,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
return 0;
}
std::vector<std::string>::iterator it;
- const char* tempDir = tempInstallDirectory;
+ const std::string& tempDir = tempInstallDirectory;
for ( it = installDirectoriesVector.begin();
it != installDirectoriesVector.end();
++it )
@@ -457,7 +457,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
//----------------------------------------------------------------------
int cmCPackGenerator::InstallProjectViaInstallScript(
- bool setDestDir, const char* tempInstallDirectory)
+ bool setDestDir, const std::string& tempInstallDirectory)
{
const char* cmakeScripts
= this->GetOption("CPACK_INSTALL_SCRIPT");
@@ -499,7 +499,7 @@ int cmCPackGenerator::InstallProjectViaInstallScript(
}
else
{
- this->SetOption("CMAKE_INSTALL_PREFIX", tempInstallDirectory);
+ this->SetOption("CMAKE_INSTALL_PREFIX", tempInstallDirectory.c_str());
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"- Using non-DESTDIR install... (this->SetOption)" << std::endl);
@@ -509,9 +509,9 @@ int cmCPackGenerator::InstallProjectViaInstallScript(
}
this->SetOptionIfNotSet("CMAKE_CURRENT_BINARY_DIR",
- tempInstallDirectory);
+ tempInstallDirectory.c_str());
this->SetOptionIfNotSet("CMAKE_CURRENT_SOURCE_DIR",
- tempInstallDirectory);
+ tempInstallDirectory.c_str());
int res = this->MakefileMap->ReadListFile(0, installScript.c_str());
if ( cmSystemTools::GetErrorOccuredFlag() || !res )
{
@@ -524,7 +524,7 @@ int cmCPackGenerator::InstallProjectViaInstallScript(
//----------------------------------------------------------------------
int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
- bool setDestDir, const char* baseTempInstallDirectory)
+ bool setDestDir, const std::string& baseTempInstallDirectory)
{
const char* cmakeProjects
= this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS");
@@ -623,7 +623,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
componentsVector.push_back(installComponent);
}
- const char* buildConfig = this->GetOption("CPACK_BUILD_CONFIG");
+ const char* buildConfigCstr = this->GetOption("CPACK_BUILD_CONFIG");
+ std::string buildConfig = buildConfigCstr ? buildConfigCstr : "";
cmGlobalGenerator* globalGenerator
= this->MakefileMap->GetCMakeInstance()->CreateGlobalGenerator(
cmakeGenerator);
@@ -822,9 +823,9 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
<< "'" << std::endl);
}
- if ( buildConfig && *buildConfig )
+ if (!buildConfig.empty())
{
- mf->AddDefinition("BUILD_TYPE", buildConfig);
+ mf->AddDefinition("BUILD_TYPE", buildConfig.c_str());
}
std::string installComponentLowerCase
= cmSystemTools::LowerCase(installComponent);
@@ -972,7 +973,7 @@ bool cmCPackGenerator::ReadListFile(const char* moduleName)
}
//----------------------------------------------------------------------
-void cmCPackGenerator::SetOptionIfNotSet(const char* op,
+void cmCPackGenerator::SetOptionIfNotSet(const std::string& op,
const char* value)
{
const char* def = this->MakefileMap->GetDefinition(op);
@@ -984,12 +985,8 @@ void cmCPackGenerator::SetOptionIfNotSet(const char* op,
}
//----------------------------------------------------------------------
-void cmCPackGenerator::SetOption(const char* op, const char* value)
+void cmCPackGenerator::SetOption(const std::string& op, const char* value)
{
- if ( !op )
- {
- return;
- }
if ( !value )
{
this->MakefileMap->RemoveDefinition(op);
@@ -1092,7 +1089,7 @@ int cmCPackGenerator::DoPackage()
* may update this during PackageFiles.
* (either putting several names or updating the provided one)
*/
- packageFileNames.push_back(tempPackageFileName);
+ packageFileNames.push_back(tempPackageFileName ? tempPackageFileName : "");
toplevel = tempDirectory;
if ( !this->PackageFiles() || cmSystemTools::GetErrorOccuredFlag())
{
@@ -1142,7 +1139,7 @@ int cmCPackGenerator::DoPackage()
}
//----------------------------------------------------------------------
-int cmCPackGenerator::Initialize(const char* name, cmMakefile* mf)
+int cmCPackGenerator::Initialize(const std::string& name, cmMakefile* mf)
{
this->MakefileMap = mf;
this->Name = name;
@@ -1176,19 +1173,19 @@ int cmCPackGenerator::InitializeInternal()
}
//----------------------------------------------------------------------
-bool cmCPackGenerator::IsSet(const char* name) const
+bool cmCPackGenerator::IsSet(const std::string& name) const
{
return this->MakefileMap->IsSet(name);
}
//----------------------------------------------------------------------
-bool cmCPackGenerator::IsOn(const char* name) const
+bool cmCPackGenerator::IsOn(const std::string& name) const
{
return cmSystemTools::IsOn(GetOption(name));
}
//----------------------------------------------------------------------
-const char* cmCPackGenerator::GetOption(const char* op) const
+const char* cmCPackGenerator::GetOption(const std::string& op) const
{
const char* ret = this->MakefileMap->GetDefinition(op);
if(!ret)
@@ -1486,8 +1483,8 @@ bool cmCPackGenerator::WantsComponentInstallation() const
//----------------------------------------------------------------------
cmCPackInstallationType*
-cmCPackGenerator::GetInstallationType(const char *projectName,
- const char *name)
+cmCPackGenerator::GetInstallationType(const std::string& projectName,
+ const std::string& name)
{
(void) projectName;
bool hasInstallationType = this->InstallationTypes.count(name) != 0;
@@ -1518,7 +1515,8 @@ cmCPackGenerator::GetInstallationType(const char *projectName,
//----------------------------------------------------------------------
cmCPackComponent*
-cmCPackGenerator::GetComponent(const char *projectName, const char *name)
+cmCPackGenerator::GetComponent(const std::string& projectName,
+ const std::string& name)
{
bool hasComponent = this->Components.count(name) != 0;
cmCPackComponent *component = &this->Components[name];
@@ -1586,7 +1584,7 @@ cmCPackGenerator::GetComponent(const char *projectName, const char *name)
++installTypesIt)
{
component->InstallationTypes.push_back(
- this->GetInstallationType(projectName, installTypesIt->c_str()));
+ this->GetInstallationType(projectName, *installTypesIt));
}
}
@@ -1613,7 +1611,8 @@ cmCPackGenerator::GetComponent(const char *projectName, const char *name)
//----------------------------------------------------------------------
cmCPackComponentGroup*
-cmCPackGenerator::GetComponentGroup(const char *projectName, const char *name)
+cmCPackGenerator::GetComponentGroup(const std::string& projectName,
+ const std::string& name)
{
(void) projectName;
std::string macroPrefix = "CPACK_COMPONENT_GROUP_"
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index b1a7840..efd3bef 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -90,7 +90,7 @@ public:
/**
* Initialize generator
*/
- int Initialize(const char* name, cmMakefile* mf);
+ int Initialize(const std::string& name, cmMakefile* mf);
/**
* Construct generator
@@ -99,12 +99,12 @@ public:
virtual ~cmCPackGenerator();
//! Set and get the options
- void SetOption(const char* op, const char* value);
- void SetOptionIfNotSet(const char* op, const char* value);
- const char* GetOption(const char* op) const;
+ void SetOption(const std::string& op, const char* value);
+ void SetOptionIfNotSet(const std::string& op, const char* value);
+ const char* GetOption(const std::string& op) const;
std::vector<std::string> GetOptions() const;
- bool IsSet(const char* name) const;
- bool IsOn(const char* name) const;
+ bool IsSet(const std::string& name) const;
+ bool IsOn(const std::string& name) const;
//! Set the logger
void SetLogger(cmCPackLog* log) { this->Logger = log; }
@@ -190,13 +190,13 @@ protected:
//! Run install commands if specified
virtual int InstallProjectViaInstallCommands(
- bool setDestDir, const char* tempInstallDirectory);
+ bool setDestDir, const std::string& tempInstallDirectory);
virtual int InstallProjectViaInstallScript(
- bool setDestDir, const char* tempInstallDirectory);
+ bool setDestDir, const std::string& tempInstallDirectory);
virtual int InstallProjectViaInstalledDirectories(
- bool setDestDir, const char* tempInstallDirectory);
+ bool setDestDir, const std::string& tempInstallDirectory);
virtual int InstallProjectViaInstallCMakeProjects(
- bool setDestDir, const char* tempInstallDirectory);
+ bool setDestDir, const std::string& tempInstallDirectory);
/**
* The various level of support of
@@ -245,12 +245,14 @@ protected:
* @return true if component installation is supported and wanted.
*/
virtual bool WantsComponentInstallation() const;
- virtual cmCPackInstallationType* GetInstallationType(const char *projectName,
- const char* name);
- virtual cmCPackComponent* GetComponent(const char *projectName,
- const char* name);
- virtual cmCPackComponentGroup* GetComponentGroup(const char *projectName,
- const char* name);
+ virtual cmCPackInstallationType* GetInstallationType(
+ const std::string& projectName,
+ const std::string& name);
+ virtual cmCPackComponent* GetComponent(const std::string& projectName,
+ const std::string& name);
+ virtual cmCPackComponentGroup* GetComponentGroup(
+ const std::string& projectName,
+ const std::string& name);
cmSystemTools::OutputOption GeneratorVerbose;
std::string Name;
diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx
index b36c2a2..9faf2b0 100644
--- a/Source/CPack/cmCPackGeneratorFactory.cxx
+++ b/Source/CPack/cmCPackGeneratorFactory.cxx
@@ -151,7 +151,8 @@ cmCPackGeneratorFactory::~cmCPackGeneratorFactory()
}
//----------------------------------------------------------------------
-cmCPackGenerator* cmCPackGeneratorFactory::NewGenerator(const char* name)
+cmCPackGenerator* cmCPackGeneratorFactory::NewGenerator(
+ const std::string& name)
{
cmCPackGenerator* gen = this->NewGeneratorInternal(name);
if ( !gen )
@@ -165,12 +166,8 @@ cmCPackGenerator* cmCPackGeneratorFactory::NewGenerator(const char* name)
//----------------------------------------------------------------------
cmCPackGenerator* cmCPackGeneratorFactory::NewGeneratorInternal(
- const char* name)
+ const std::string& name)
{
- if ( !name )
- {
- return 0;
- }
cmCPackGeneratorFactory::t_GeneratorCreatorsMap::iterator it
= this->GeneratorCreators.find(name);
if ( it == this->GeneratorCreators.end() )
@@ -181,11 +178,11 @@ cmCPackGenerator* cmCPackGeneratorFactory::NewGeneratorInternal(
}
//----------------------------------------------------------------------
-void cmCPackGeneratorFactory::RegisterGenerator(const char* name,
+void cmCPackGeneratorFactory::RegisterGenerator(const std::string& name,
const char* generatorDescription,
CreateGeneratorCall* createGenerator)
{
- if ( !name || !createGenerator )
+ if ( !createGenerator )
{
cmCPack_Log(this->Logger, cmCPackLog::LOG_ERROR,
"Cannot register generator" << std::endl);
diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h
index dff2e49..010777f 100644
--- a/Source/CPack/cmCPackGeneratorFactory.h
+++ b/Source/CPack/cmCPackGeneratorFactory.h
@@ -31,26 +31,26 @@ public:
~cmCPackGeneratorFactory();
//! Get the generator
- cmCPackGenerator* NewGenerator(const char* name);
+ cmCPackGenerator* NewGenerator(const std::string& name);
void DeleteGenerator(cmCPackGenerator* gen);
typedef cmCPackGenerator* CreateGeneratorCall();
- void RegisterGenerator(const char* name,
+ void RegisterGenerator(const std::string& name,
const char* generatorDescription,
CreateGeneratorCall* createGenerator);
void SetLogger(cmCPackLog* logger) { this->Logger = logger; }
- typedef std::map<cmStdString, cmStdString> DescriptionsMap;
+ typedef std::map<std::string, std::string> DescriptionsMap;
const DescriptionsMap& GetGeneratorsList() const
{ return this->GeneratorDescriptions; }
private:
- cmCPackGenerator* NewGeneratorInternal(const char* name);
+ cmCPackGenerator* NewGeneratorInternal(const std::string& name);
std::vector<cmCPackGenerator*> Generators;
- typedef std::map<cmStdString, CreateGeneratorCall*> t_GeneratorCreatorsMap;
+ typedef std::map<std::string, CreateGeneratorCall*> t_GeneratorCreatorsMap;
t_GeneratorCreatorsMap GeneratorCreators;
DescriptionsMap GeneratorDescriptions;
cmCPackLog* Logger;
diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx
index 76e15fb..28c7f1d 100644
--- a/Source/CPack/cmCPackOSXX11Generator.cxx
+++ b/Source/CPack/cmCPackOSXX11Generator.cxx
@@ -227,7 +227,7 @@ int cmCPackOSXX11Generator::InitializeInternal()
//----------------------------------------------------------------------
/*
-bool cmCPackOSXX11Generator::CopyCreateResourceFile(const char* name)
+bool cmCPackOSXX11Generator::CopyCreateResourceFile(const std::string& name)
{
std::string uname = cmSystemTools::UpperCase(name);
std::string cpackVar = "CPACK_RESOURCE_FILE_" + uname;
@@ -271,8 +271,8 @@ bool cmCPackOSXX11Generator::CopyCreateResourceFile(const char* name)
*/
//----------------------------------------------------------------------
-bool cmCPackOSXX11Generator::CopyResourcePlistFile(const char* name,
- const char* dir, const char* outputFileName /* = 0 */,
+bool cmCPackOSXX11Generator::CopyResourcePlistFile(const std::string& name,
+ const std::string& dir, const char* outputFileName /* = 0 */,
bool copyOnly /* = false */)
{
std::string inFName = "CPack.";
@@ -288,7 +288,7 @@ bool cmCPackOSXX11Generator::CopyResourcePlistFile(const char* name,
if ( !outputFileName )
{
- outputFileName = name;
+ outputFileName = name.c_str();
}
std::string destFileName = dir;
diff --git a/Source/CPack/cmCPackOSXX11Generator.h b/Source/CPack/cmCPackOSXX11Generator.h
index b7bd243..9d0a6d1 100644
--- a/Source/CPack/cmCPackOSXX11Generator.h
+++ b/Source/CPack/cmCPackOSXX11Generator.h
@@ -37,8 +37,9 @@ protected:
virtual const char* GetPackagingInstallPrefix();
virtual const char* GetOutputExtension() { return ".dmg"; }
- //bool CopyCreateResourceFile(const char* name, const char* dir);
- bool CopyResourcePlistFile(const char* name, const char* dir,
+ //bool CopyCreateResourceFile(const std::string& name,
+ // const std::string& dir);
+ bool CopyResourcePlistFile(const std::string& name, const std::string& dir,
const char* outputFileName = 0, bool copyOnly = false);
std::string InstallPrefix;
};
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx
index c5b9c6f..d736948 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.cxx
+++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx
@@ -43,14 +43,14 @@ bool cmCPackPackageMakerGenerator::SupportsComponentInstallation() const
}
//----------------------------------------------------------------------
-int cmCPackPackageMakerGenerator::CopyInstallScript(const char* resdir,
- const char* script,
- const char* name)
+int cmCPackPackageMakerGenerator::CopyInstallScript(const std::string& resdir,
+ const std::string& script,
+ const std::string& name)
{
std::string dst = resdir;
dst += "/";
dst += name;
- cmSystemTools::CopyFileAlways(script, dst.c_str());
+ cmSystemTools::CopyFileAlways(script.c_str(), dst.c_str());
cmSystemTools::SetPermissions(dst.c_str(),0777);
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"copy script : " << script << "\ninto " << dst.c_str() <<
@@ -553,8 +553,9 @@ int cmCPackPackageMakerGenerator::InitializeInternal()
}
//----------------------------------------------------------------------
-bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name,
- const char* dirName)
+bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(
+ const std::string& name,
+ const std::string& dirName)
{
std::string uname = cmSystemTools::UpperCase(name);
std::string cpackVar = "CPACK_RESOURCE_FILE_" + uname;
@@ -563,7 +564,7 @@ bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name,
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "CPack option: " << cpackVar.c_str()
<< " not specified. It should point to "
- << (name ? name : "(NULL)")
+ << (!name.empty() ? name : "<empty>")
<< ".rtf, " << name
<< ".html, or " << name << ".txt file" << std::endl);
return false;
@@ -571,7 +572,7 @@ bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name,
if ( !cmSystemTools::FileExists(inFileName) )
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find "
- << (name ? name : "(NULL)")
+ << (!name.empty() ? name : "<empty>")
<< " resource file: " << inFileName << std::endl);
return false;
}
@@ -600,12 +601,13 @@ bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name,
return true;
}
-bool cmCPackPackageMakerGenerator::CopyResourcePlistFile(const char* name,
- const char* outName)
+bool cmCPackPackageMakerGenerator::CopyResourcePlistFile(
+ const std::string& name,
+ const char* outName)
{
if (!outName)
{
- outName = name;
+ outName = name.c_str();
}
std::string inFName = "CPack.";
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h
index ba3d968..e350a60 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.h
+++ b/Source/CPack/cmCPackPackageMakerGenerator.h
@@ -38,9 +38,9 @@ public:
virtual bool SupportsComponentInstallation() const;
protected:
- int CopyInstallScript(const char* resdir,
- const char* script,
- const char* name);
+ int CopyInstallScript(const std::string& resdir,
+ const std::string& script,
+ const std::string& name);
virtual int InitializeInternal();
int PackageFiles();
virtual const char* GetOutputExtension() { return ".dmg"; }
@@ -51,8 +51,9 @@ protected:
// CPACK_RESOURCE_FILE_${NAME} (where ${NAME} is the uppercased
// version of name) specifies the input file to use for this file,
// which will be configured via ConfigureFile.
- bool CopyCreateResourceFile(const char* name, const char *dirName);
- bool CopyResourcePlistFile(const char* name, const char* outName = 0);
+ bool CopyCreateResourceFile(const std::string& name,
+ const std::string& dirName);
+ bool CopyResourcePlistFile(const std::string& name, const char* outName = 0);
// Run PackageMaker with the given command line, which will (if
// successful) produce the given package file. Returns true if
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index a19b778..d74c38d 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -68,7 +68,7 @@ int cpackUnknownArgument(const char*, void*)
//----------------------------------------------------------------------------
struct cpackDefinitions
{
- typedef std::map<cmStdString, cmStdString> MapType;
+ typedef std::map<std::string, std::string> MapType;
MapType Map;
cmCPackLog *Log;
};
diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx
index 381c70c..3014a93 100644
--- a/Source/CTest/cmCTestBZR.cxx
+++ b/Source/CTest/cmCTestBZR.cxx
@@ -225,35 +225,35 @@ private:
return true;
}
- virtual void StartElement(const char* name, const char**)
+ virtual void StartElement(const std::string& name, const char**)
{
this->CData.clear();
- if(strcmp(name, "log") == 0)
+ if(name == "log")
{
this->Rev = Revision();
this->Changes.clear();
}
// affected-files can contain blocks of
// modified, unknown, renamed, kind-changed, removed, conflicts, added
- else if(strcmp(name, "modified") == 0
- || strcmp(name, "renamed") == 0
- || strcmp(name, "kind-changed") == 0)
+ else if(name == "modified"
+ || name == "renamed"
+ || name == "kind-changed")
{
this->CurChange = Change();
this->CurChange.Action = 'M';
}
- else if(strcmp(name, "added") == 0)
+ else if(name == "added")
{
this->CurChange = Change();
this->CurChange = 'A';
}
- else if(strcmp(name, "removed") == 0)
+ else if(name == "removed")
{
this->CurChange = Change();
this->CurChange = 'D';
}
- else if(strcmp(name, "unknown") == 0
- || strcmp(name, "conflicts") == 0)
+ else if(name == "unknown"
+ || name == "conflicts")
{
// Should not happen here
this->CurChange = Change();
@@ -265,27 +265,27 @@ private:
this->CData.insert(this->CData.end(), data, data+length);
}
- virtual void EndElement(const char* name)
+ virtual void EndElement(const std::string& name)
{
- if(strcmp(name, "log") == 0)
+ if(name == "log")
{
this->BZR->DoRevision(this->Rev, this->Changes);
}
- else if((strcmp(name, "file") == 0 || strcmp(name, "directory") == 0)
- && !this->CData.empty())
+ else if(!this->CData.empty() &&
+ (name == "file" || name == "directory"))
{
this->CurChange.Path.assign(&this->CData[0], this->CData.size());
cmSystemTools::ConvertToUnixSlashes(this->CurChange.Path);
this->Changes.push_back(this->CurChange);
}
- else if(strcmp(name, "symlink") == 0 && !this->CData.empty())
+ else if(!this->CData.empty() && name == "symlink")
{
// symlinks have an arobase at the end in the log
this->CurChange.Path.assign(&this->CData[0], this->CData.size()-1);
cmSystemTools::ConvertToUnixSlashes(this->CurChange.Path);
this->Changes.push_back(this->CurChange);
}
- else if(strcmp(name, "committer") == 0 && !this->CData.empty())
+ else if(!this->CData.empty() && name == "committer")
{
this->Rev.Author.assign(&this->CData[0], this->CData.size());
if(this->EmailRegex.find(this->Rev.Author))
@@ -294,15 +294,15 @@ private:
this->Rev.EMail = this->EmailRegex.match(2);
}
}
- else if(strcmp(name, "timestamp") == 0 && !this->CData.empty())
+ else if(!this->CData.empty() && name == "timestamp")
{
this->Rev.Date.assign(&this->CData[0], this->CData.size());
}
- else if(strcmp(name, "message") == 0 && !this->CData.empty())
+ else if(!this->CData.empty() && name == "message")
{
this->Rev.Log.assign(&this->CData[0], this->CData.size());
}
- else if(strcmp(name, "revno") == 0 && !this->CData.empty())
+ else if(!this->CData.empty() && name == "revno")
{
this->Rev.Rev.assign(&this->CData[0], this->CData.size());
}
@@ -409,7 +409,7 @@ bool cmCTestBZR::UpdateImpl()
{
opts = this->CTest->GetCTestConfiguration("BZRUpdateOptions");
}
- std::vector<cmStdString> args = cmSystemTools::ParseArguments(opts.c_str());
+ std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str());
// TODO: if(this->CTest->GetTestModel() == cmCTest::NIGHTLY)
@@ -418,7 +418,7 @@ bool cmCTestBZR::UpdateImpl()
bzr_update.push_back(this->CommandLineTool.c_str());
bzr_update.push_back("pull");
- for(std::vector<cmStdString>::const_iterator ai = args.begin();
+ for(std::vector<std::string>::const_iterator ai = args.begin();
ai != args.end(); ++ai)
{
bzr_update.push_back(ai->c_str());
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h
index ca50c64..d1e9a4d 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.h
+++ b/Source/CTest/cmCTestBuildAndTestHandler.h
@@ -54,7 +54,7 @@ protected:
std::string &cmakeOutString,
std::string &cwd, cmake *cm);
- cmStdString Output;
+ std::string Output;
std::string BuildGenerator;
std::string BuildGeneratorToolset;
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx
index 12ff718..04eabd2 100644
--- a/Source/CTest/cmCTestBuildCommand.cxx
+++ b/Source/CTest/cmCTestBuildCommand.cxx
@@ -101,8 +101,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
}
if ( this->GlobalGenerator )
{
- if ( strcmp(this->GlobalGenerator->GetName(),
- cmakeGeneratorName) != 0 )
+ if ( this->GlobalGenerator->GetName() != cmakeGeneratorName )
{
delete this->GlobalGenerator;
this->GlobalGenerator = 0;
@@ -130,8 +129,9 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
std::string dir = this->CTest->GetCTestConfiguration("BuildDirectory");
std::string buildCommand
= this->GlobalGenerator->
- GenerateCMakeBuildCommand(cmakeBuildTarget, cmakeBuildConfiguration,
- cmakeBuildAdditionalFlags, true);
+ GenerateCMakeBuildCommand(cmakeBuildTarget ? cmakeBuildTarget : "",
+ cmakeBuildConfiguration,
+ cmakeBuildAdditionalFlags ? cmakeBuildAdditionalFlags : "", true);
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"SetMakeCommand:"
<< buildCommand.c_str() << "\n");
diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h
index 08887fe..2632ebc 100644
--- a/Source/CTest/cmCTestBuildCommand.h
+++ b/Source/CTest/cmCTestBuildCommand.h
@@ -43,7 +43,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "ctest_build";}
+ virtual std::string GetName() const { return "ctest_build";}
virtual bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus &status);
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index c5deb96..291c70a 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -380,7 +380,7 @@ int cmCTestBuildHandler::ProcessHandler()
// Create lists of regular expression strings for errors, error exceptions,
// warnings and warning exceptions.
- std::vector<cmStdString>::size_type cc;
+ std::vector<std::string>::size_type cc;
for ( cc = 0; cmCTestErrorMatches[cc]; cc ++ )
{
this->CustomErrorMatches.push_back(cmCTestErrorMatches[cc]);
@@ -400,7 +400,7 @@ int cmCTestBuildHandler::ProcessHandler()
}
// Pre-compile regular expressions objects for all regular expressions
- std::vector<cmStdString>::iterator it;
+ std::vector<std::string>::iterator it;
#define cmCTestBuildHandlerPopulateRegexVector(strings, regexes) \
regexes.clear(); \
@@ -602,7 +602,7 @@ void cmCTestBuildHandler::GenerateXMLLaunched(std::ostream& os)
// Sort XML fragments in chronological order.
cmFileTimeComparison ftc;
FragmentCompare fragmentCompare(&ftc);
- typedef std::set<cmStdString, FragmentCompare> Fragments;
+ typedef std::set<std::string, FragmentCompare> Fragments;
Fragments fragments(fragmentCompare);
// Identify fragments on disk.
@@ -889,7 +889,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
int* retVal, const char* dir, int timeout, std::ostream& ofs)
{
// First generate the command and arguments
- std::vector<cmStdString> args = cmSystemTools::ParseArguments(command);
+ std::vector<std::string> args = cmSystemTools::ParseArguments(command);
if(args.size() < 1)
{
@@ -897,7 +897,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
}
std::vector<const char*> argv;
- for(std::vector<cmStdString>::const_iterator a = args.begin();
+ for(std::vector<std::string>::const_iterator a = args.begin();
a != args.end(); ++a)
{
argv.push_back(a->c_str());
@@ -1133,7 +1133,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length,
errorwarning.PostContext = "";
// Copy pre-context to report
- std::deque<cmStdString>::iterator pcit;
+ std::deque<std::string>::iterator pcit;
for ( pcit = this->PreContext.begin();
pcit != this->PreContext.end();
++pcit )
diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h
index ff7cfd6..09346f9 100644
--- a/Source/CTest/cmCTestBuildHandler.h
+++ b/Source/CTest/cmCTestBuildHandler.h
@@ -97,10 +97,10 @@ private:
double StartBuildTime;
double EndBuildTime;
- std::vector<cmStdString> CustomErrorMatches;
- std::vector<cmStdString> CustomErrorExceptions;
- std::vector<cmStdString> CustomWarningMatches;
- std::vector<cmStdString> CustomWarningExceptions;
+ std::vector<std::string> CustomErrorMatches;
+ std::vector<std::string> CustomErrorExceptions;
+ std::vector<std::string> CustomWarningMatches;
+ std::vector<std::string> CustomWarningExceptions;
std::vector<std::string> ReallyCustomWarningMatches;
std::vector<std::string> ReallyCustomWarningExceptions;
std::vector<cmCTestCompileErrorWarningRex> ErrorWarningFileLineRegex;
@@ -121,8 +121,8 @@ private:
size_t BuildOutputLogSize;
std::vector<char> CurrentProcessingLine;
- cmStdString SimplifySourceDir;
- cmStdString SimplifyBuildDir;
+ std::string SimplifySourceDir;
+ std::string SimplifyBuildDir;
size_t OutputLineCounter;
typedef std::vector<cmCTestBuildErrorWarning> t_ErrorsAndWarningsVector;
t_ErrorsAndWarningsVector ErrorsAndWarnings;
@@ -130,7 +130,7 @@ private:
size_t PostContextCount;
size_t MaxPreContext;
size_t MaxPostContext;
- std::deque<cmStdString> PreContext;
+ std::deque<std::string> PreContext;
int TotalErrors;
int TotalWarnings;
diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx
index 17dbb55..ab363d0 100644
--- a/Source/CTest/cmCTestCVS.cxx
+++ b/Source/CTest/cmCTestCVS.cxx
@@ -99,7 +99,7 @@ bool cmCTestCVS::UpdateImpl()
opts = "-dP";
}
}
- std::vector<cmStdString> args = cmSystemTools::ParseArguments(opts.c_str());
+ std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str());
// Specify the start time for nightly testing.
if(this->CTest->GetTestModel() == cmCTest::NIGHTLY)
@@ -112,7 +112,7 @@ bool cmCTestCVS::UpdateImpl()
cvs_update.push_back(this->CommandLineTool.c_str());
cvs_update.push_back("-z3");
cvs_update.push_back("update");
- for(std::vector<cmStdString>::const_iterator ai = args.begin();
+ for(std::vector<std::string>::const_iterator ai = args.begin();
ai != args.end(); ++ai)
{
cvs_update.push_back(ai->c_str());
@@ -308,7 +308,7 @@ bool cmCTestCVS::WriteXMLUpdates(std::ostream& xml)
" Gathering version information (one . per updated file):\n"
" " << std::flush);
- for(std::map<cmStdString, Directory>::const_iterator
+ for(std::map<std::string, Directory>::const_iterator
di = this->Dirs.begin(); di != this->Dirs.end(); ++di)
{
this->WriteXMLDirectory(xml, di->first, di->second);
diff --git a/Source/CTest/cmCTestCVS.h b/Source/CTest/cmCTestCVS.h
index b7fe567..64e1747 100644
--- a/Source/CTest/cmCTestCVS.h
+++ b/Source/CTest/cmCTestCVS.h
@@ -32,8 +32,8 @@ private:
virtual bool WriteXMLUpdates(std::ostream& xml);
// Update status for files in each directory.
- class Directory: public std::map<cmStdString, PathStatus> {};
- std::map<cmStdString, Directory> Dirs;
+ class Directory: public std::map<std::string, PathStatus> {};
+ std::map<std::string, Directory> Dirs;
std::string ComputeBranchFlag(std::string const& dir);
void LoadRevisions(std::string const& file, const char* branchFlag,
diff --git a/Source/CTest/cmCTestConfigureCommand.h b/Source/CTest/cmCTestConfigureCommand.h
index b592c5a..7941d4e 100644
--- a/Source/CTest/cmCTestConfigureCommand.h
+++ b/Source/CTest/cmCTestConfigureCommand.h
@@ -38,7 +38,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "ctest_configure";}
+ virtual std::string GetName() const { return "ctest_configure";}
cmTypeMacro(cmCTestConfigureCommand, cmCTestHandlerCommand);
diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h
index 11bb411..5762e07 100644
--- a/Source/CTest/cmCTestCoverageCommand.h
+++ b/Source/CTest/cmCTestCoverageCommand.h
@@ -39,7 +39,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "ctest_coverage";}
+ virtual std::string GetName() const { return "ctest_coverage";}
cmTypeMacro(cmCTestCoverageCommand, cmCTestHandlerCommand);
@@ -56,7 +56,7 @@ protected:
};
bool LabelsMentioned;
- std::set<cmStdString> Labels;
+ std::set<std::string> Labels;
};
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 0503d94..2e35b75 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -363,7 +363,7 @@ int cmCTestCoverageHandler::ProcessHandler()
// setup the regex exclude stuff
this->CustomCoverageExcludeRegex.clear();
- std::vector<cmStdString>::iterator rexIt;
+ std::vector<std::string>::iterator rexIt;
for ( rexIt = this->CustomCoverageExclude.begin();
rexIt != this->CustomCoverageExclude.end();
++ rexIt )
@@ -713,7 +713,7 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf)
this->CustomCoverageExclude);
this->CTest->PopulateCustomVector(mf, "CTEST_EXTRA_COVERAGE_GLOB",
this->ExtraCoverageGlobs);
- std::vector<cmStdString>::iterator it;
+ std::vector<std::string>::iterator it;
for ( it = this->CustomCoverageExclude.begin();
it != this->CustomCoverageExclude.end();
++ it )
@@ -989,8 +989,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
<< "--------------------------------------------------------------"
<< std::endl);
- std::vector<cmStdString> lines;
- std::vector<cmStdString>::iterator line;
+ std::vector<std::string> lines;
+ std::vector<std::string>::iterator line;
cmSystemTools::Split(output.c_str(), lines);
@@ -1504,7 +1504,7 @@ namespace
//----------------------------------------------------------------------
int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
cmCTestCoverageHandlerContainer* cont,
- std::set<cmStdString>& coveredFileNames,
+ std::set<std::string>& coveredFileNames,
std::vector<std::string>& files,
std::vector<std::string>& filesFullPath)
{
@@ -1545,7 +1545,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
outputFile.c_str() << std::endl);
return 0;
}
- std::map<cmStdString, cmStdString> fileMap;
+ std::map<std::string, std::string> fileMap;
std::vector<std::string>::iterator fp = filesFullPath.begin();
for(std::vector<std::string>::iterator f = files.begin();
f != files.end(); ++f, ++fp)
@@ -1558,7 +1558,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
std::string lineIn;
bool valid = false; // are we in a valid output file
int line = 0; // line of the current file
- cmStdString file;
+ std::string file;
while(cmSystemTools::GetLineFromStream(fin, lineIn))
{
bool startFile = false;
@@ -1593,7 +1593,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
}
count++; // move on one
}
- std::map<cmStdString, cmStdString>::iterator
+ std::map<std::string, std::string>::iterator
i = fileMap.find(file);
// if the file should be covered write out the header for that file
if(i != fileMap.end())
@@ -1758,7 +1758,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
outputFile.c_str() << std::endl);
return 0;
}
- std::set<cmStdString> coveredFileNames;
+ std::set<std::string> coveredFileNames;
while(cmSystemTools::GetLineFromStream(fin, stdline))
{
// if we have a line of output from stdout
@@ -2105,10 +2105,10 @@ void cmCTestCoverageHandler::WriteXMLLabels(std::ostream& os,
//----------------------------------------------------------------------------
void
-cmCTestCoverageHandler::SetLabelFilter(std::set<cmStdString> const& labels)
+cmCTestCoverageHandler::SetLabelFilter(std::set<std::string> const& labels)
{
this->LabelFilter.clear();
- for(std::set<cmStdString>::const_iterator li = labels.begin();
+ for(std::set<std::string>::const_iterator li = labels.begin();
li != labels.end(); ++li)
{
this->LabelFilter.insert(this->GetLabelId(*li));
@@ -2158,7 +2158,7 @@ std::set<std::string> cmCTestCoverageHandler::FindUncoveredFiles(
{
std::set<std::string> extraMatches;
- for(std::vector<cmStdString>::iterator i = this->ExtraCoverageGlobs.begin();
+ for(std::vector<std::string>::iterator i = this->ExtraCoverageGlobs.begin();
i != this->ExtraCoverageGlobs.end(); ++i)
{
cmsys::Glob gl;
diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h
index 660f501..6a8f55d 100644
--- a/Source/CTest/cmCTestCoverageHandler.h
+++ b/Source/CTest/cmCTestCoverageHandler.h
@@ -55,7 +55,7 @@ public:
void PopulateCustomVectors(cmMakefile *mf);
/** Report coverage only for sources with these labels. */
- void SetLabelFilter(std::set<cmStdString> const& labels);
+ void SetLabelFilter(std::set<std::string> const& labels);
private:
bool ShouldIDoCoverage(const char* file, const char* srcDir,
@@ -81,7 +81,7 @@ private:
int HandleBullseyeCoverage(cmCTestCoverageHandlerContainer* cont);
int RunBullseyeSourceSummary(cmCTestCoverageHandlerContainer* cont);
int RunBullseyeCoverageBranch(cmCTestCoverageHandlerContainer* cont,
- std::set<cmStdString>& coveredFileNames,
+ std::set<std::string>& coveredFileNames,
std::vector<std::string>& files,
std::vector<std::string>& filesFullPath);
@@ -112,19 +112,19 @@ private:
std::set<std::string> FindUncoveredFiles(
cmCTestCoverageHandlerContainer* cont);
- std::vector<cmStdString> CustomCoverageExclude;
+ std::vector<std::string> CustomCoverageExclude;
std::vector<cmsys::RegularExpression> CustomCoverageExcludeRegex;
- std::vector<cmStdString> ExtraCoverageGlobs;
+ std::vector<std::string> ExtraCoverageGlobs;
// Map from source file to label ids.
class LabelSet: public std::set<int> {};
- typedef std::map<cmStdString, LabelSet> LabelMapType;
+ typedef std::map<std::string, LabelSet> LabelMapType;
LabelMapType SourceLabels;
LabelMapType TargetDirs;
// Map from label name to label id.
- typedef std::map<cmStdString, int> LabelIdMapType;
+ typedef std::map<std::string, int> LabelIdMapType;
LabelIdMapType LabelIdMap;
std::vector<std::string> Labels;
int GetLabelId(std::string const& label);
diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
index 07e59a4..d182d17 100644
--- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
+++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
@@ -48,7 +48,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "ctest_empty_binary_directory";}
+ virtual std::string GetName() const { return "ctest_empty_binary_directory";}
cmTypeMacro(cmCTestEmptyBinaryDirectoryCommand, cmCTestCommand);
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 0e0e797..aaa01b2 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -179,8 +179,8 @@ bool cmCTestGIT::UpdateByFetchAndReset()
{
opts = this->CTest->GetCTestConfiguration("GITUpdateOptions");
}
- std::vector<cmStdString> args = cmSystemTools::ParseArguments(opts.c_str());
- for(std::vector<cmStdString>::const_iterator ai = args.begin();
+ std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str());
+ for(std::vector<std::string>::const_iterator ai = args.begin();
ai != args.end(); ++ai)
{
git_fetch.push_back(ai->c_str());
diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx
index 5338f30..ae498ea 100644
--- a/Source/CTest/cmCTestGenericHandler.cxx
+++ b/Source/CTest/cmCTestGenericHandler.cxx
@@ -30,12 +30,8 @@ cmCTestGenericHandler::~cmCTestGenericHandler()
}
//----------------------------------------------------------------------
-void cmCTestGenericHandler::SetOption(const char* op, const char* value)
+void cmCTestGenericHandler::SetOption(const std::string& op, const char* value)
{
- if ( !op )
- {
- return;
- }
if ( !value )
{
cmCTestGenericHandler::t_StringToString::iterator remit
@@ -51,14 +47,10 @@ void cmCTestGenericHandler::SetOption(const char* op, const char* value)
}
//----------------------------------------------------------------------
-void cmCTestGenericHandler::SetPersistentOption(const char* op,
+void cmCTestGenericHandler::SetPersistentOption(const std::string& op,
const char* value)
{
this->SetOption(op, value);
- if ( !op )
- {
- return;
- }
if ( !value )
{
cmCTestGenericHandler::t_StringToString::iterator remit
@@ -88,7 +80,7 @@ void cmCTestGenericHandler::Initialize()
}
//----------------------------------------------------------------------
-const char* cmCTestGenericHandler::GetOption(const char* op)
+const char* cmCTestGenericHandler::GetOption(const std::string& op)
{
cmCTestGenericHandler::t_StringToString::iterator remit
= this->Options.find(op);
diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h
index ba8febb..2788cba 100644
--- a/Source/CTest/cmCTestGenericHandler.h
+++ b/Source/CTest/cmCTestGenericHandler.h
@@ -71,12 +71,12 @@ public:
cmCTestGenericHandler();
virtual ~cmCTestGenericHandler();
- typedef std::map<cmStdString,cmStdString> t_StringToString;
+ typedef std::map<std::string,std::string> t_StringToString;
- void SetPersistentOption(const char* op, const char* value);
- void SetOption(const char* op, const char* value);
- const char* GetOption(const char* op);
+ void SetPersistentOption(const std::string& op, const char* value);
+ void SetOption(const std::string& op, const char* value);
+ const char* GetOption(const std::string& op);
void SetCommand(cmCTestCommand* command)
{
diff --git a/Source/CTest/cmCTestGlobalVC.cxx b/Source/CTest/cmCTestGlobalVC.cxx
index 8c51102..5f570b5 100644
--- a/Source/CTest/cmCTestGlobalVC.cxx
+++ b/Source/CTest/cmCTestGlobalVC.cxx
@@ -132,7 +132,7 @@ bool cmCTestGlobalVC::WriteXMLUpdates(std::ostream& xml)
this->WriteXMLGlobal(xml);
- for(std::map<cmStdString, Directory>::const_iterator
+ for(std::map<std::string, Directory>::const_iterator
di = this->Dirs.begin(); di != this->Dirs.end(); ++di)
{
this->WriteXMLDirectory(xml, di->first, di->second);
diff --git a/Source/CTest/cmCTestGlobalVC.h b/Source/CTest/cmCTestGlobalVC.h
index a648a59..cb0d165 100644
--- a/Source/CTest/cmCTestGlobalVC.h
+++ b/Source/CTest/cmCTestGlobalVC.h
@@ -39,8 +39,8 @@ protected:
};
// Update status for files in each directory.
- class Directory: public std::map<cmStdString, File> {};
- std::map<cmStdString, Directory> Dirs;
+ class Directory: public std::map<std::string, File> {};
+ std::map<std::string, Directory> Dirs;
// Old and new repository revisions.
std::string OldRevision;
diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx
index 86a7617..0f79d68 100644
--- a/Source/CTest/cmCTestHG.cxx
+++ b/Source/CTest/cmCTestHG.cxx
@@ -149,8 +149,8 @@ bool cmCTestHG::UpdateImpl()
{
opts = this->CTest->GetCTestConfiguration("HGUpdateOptions");
}
- std::vector<cmStdString> args = cmSystemTools::ParseArguments(opts.c_str());
- for(std::vector<cmStdString>::const_iterator ai = args.begin();
+ std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str());
+ for(std::vector<std::string>::const_iterator ai = args.begin();
ai != args.end(); ++ai)
{
hg_update.push_back(ai->c_str());
@@ -189,10 +189,10 @@ private:
return true;
}
- virtual void StartElement(const char* name, const char** atts)
+ virtual void StartElement(const std::string& name, const char** atts)
{
this->CData.clear();
- if(strcmp(name, "logentry") == 0)
+ if(name == "logentry")
{
this->Rev = Revision();
if(const char* rev = this->FindAttribute(atts, "revision"))
@@ -208,29 +208,29 @@ private:
this->CData.insert(this->CData.end(), data, data+length);
}
- virtual void EndElement(const char* name)
+ virtual void EndElement(const std::string& name)
{
- if(strcmp(name, "logentry") == 0)
+ if(name == "logentry")
{
this->HG->DoRevision(this->Rev, this->Changes);
}
- else if(strcmp(name, "author") == 0 && !this->CData.empty())
+ else if(!this->CData.empty() && name == "author")
{
this->Rev.Author.assign(&this->CData[0], this->CData.size());
}
- else if ( strcmp(name, "email") == 0 && !this->CData.empty())
+ else if(!this->CData.empty() && name == "email")
{
this->Rev.EMail.assign(&this->CData[0], this->CData.size());
}
- else if(strcmp(name, "date") == 0 && !this->CData.empty())
+ else if(!this->CData.empty() && name == "date")
{
this->Rev.Date.assign(&this->CData[0], this->CData.size());
}
- else if(strcmp(name, "msg") == 0 && !this->CData.empty())
+ else if(!this->CData.empty() && name == "msg")
{
this->Rev.Log.assign(&this->CData[0], this->CData.size());
}
- else if(strcmp(name, "files") == 0 && !this->CData.empty())
+ else if(!this->CData.empty() && name == "files")
{
std::vector<std::string> paths = this->SplitCData();
for(unsigned int i = 0; i < paths.size(); ++i)
@@ -242,7 +242,7 @@ private:
this->Changes.push_back(this->CurChange);
}
}
- else if(strcmp(name, "file_adds") == 0 && !this->CData.empty())
+ else if(!this->CData.empty() && name == "file_adds")
{
std::string added_paths(this->CData.begin(), this->CData.end());
for(unsigned int i = 0; i < this->Changes.size(); ++i)
@@ -253,7 +253,7 @@ private:
}
}
}
- else if(strcmp(name, "file_dels") == 0 && !this->CData.empty())
+ else if(!this->CData.empty() && name == "file_dels")
{
std::string added_paths(this->CData.begin(), this->CData.end());
for(unsigned int i = 0; i < this->Changes.size(); ++i)
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index cd3bd57..c9f9e9e 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -567,7 +567,7 @@ void cmCTestLaunch::WriteXMLLabels(std::ostream& fxml)
fxml << "\n";
fxml << "\t\t<!-- Interested parties -->\n";
fxml << "\t\t<Labels>\n";
- for(std::set<cmStdString>::const_iterator li = this->Labels.begin();
+ for(std::set<std::string>::const_iterator li = this->Labels.begin();
li != this->Labels.end(); ++li)
{
fxml << "\t\t\t<Label>" << cmXMLSafe(*li) << "</Label>\n";
diff --git a/Source/CTest/cmCTestLaunch.h b/Source/CTest/cmCTestLaunch.h
index f680d19..bc90d28 100644
--- a/Source/CTest/cmCTestLaunch.h
+++ b/Source/CTest/cmCTestLaunch.h
@@ -73,7 +73,7 @@ private:
bool HaveErr;
// Labels associated with the build rule.
- std::set<cmStdString> Labels;
+ std::set<std::string> Labels;
void LoadLabels();
bool SourceMatches(std::string const& lhs,
std::string const& rhs);
diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h
index b50170d..e239d46 100644
--- a/Source/CTest/cmCTestMemCheckCommand.h
+++ b/Source/CTest/cmCTestMemCheckCommand.h
@@ -41,7 +41,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "ctest_memcheck";}
+ virtual std::string GetName() const { return "ctest_memcheck";}
cmTypeMacro(cmCTestMemCheckCommand, cmCTestTestCommand);
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index fdce04d..f27dbc0 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -49,21 +49,15 @@ class cmBoundsCheckerParser : public cmXMLParser
{
public:
cmBoundsCheckerParser(cmCTest* c) { this->CTest = c;}
- void StartElement(const char* name, const char** atts)
+ void StartElement(const std::string& name, const char** atts)
{
- if(strcmp(name, "MemoryLeak") == 0)
+ if(name == "MemoryLeak" ||
+ name == "ResourceLeak")
{
this->Errors.push_back(cmCTestMemCheckHandler::MLK);
}
- if(strcmp(name, "ResourceLeak") == 0)
- {
- this->Errors.push_back(cmCTestMemCheckHandler::MLK);
- }
- if(strcmp(name, "Error") == 0)
- {
- this->ParseError(atts);
- }
- if(strcmp(name, "Dangling Pointer") == 0)
+ else if(name == "Error" ||
+ name == "Dangling Pointer")
{
this->ParseError(atts);
}
@@ -79,7 +73,7 @@ public:
ostr << "\n";
this->Log += ostr.str();
}
- void EndElement(const char* )
+ void EndElement(const std::string& )
{
}
@@ -246,8 +240,8 @@ int cmCTestMemCheckHandler::PostProcessHandler()
void cmCTestMemCheckHandler::GenerateTestCommand(
std::vector<std::string>& args, int test)
{
- std::vector<cmStdString>::size_type pp;
- cmStdString index;
+ std::vector<std::string>::size_type pp;
+ std::string index;
cmOStringStream stream;
std::string memcheckcommand
= cmSystemTools::ConvertToOutputPath(this->MemoryTester.c_str());
@@ -255,9 +249,9 @@ void cmCTestMemCheckHandler::GenerateTestCommand(
index = stream.str();
for ( pp = 0; pp < this->MemoryTesterDynamicOptions.size(); pp ++ )
{
- cmStdString arg = this->MemoryTesterDynamicOptions[pp];
- cmStdString::size_type pos = arg.find("??");
- if (pos != cmStdString::npos)
+ std::string arg = this->MemoryTesterDynamicOptions[pp];
+ std::string::size_type pos = arg.find("??");
+ if (pos != std::string::npos)
{
arg.replace(pos, 2, index);
}
@@ -580,7 +574,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
return false;
}
- std::vector<cmStdString>::size_type cc;
+ std::vector<std::string>::size_type cc;
for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ )
{
this->MemoryTesterGlobalResults[cc] = 0;
@@ -627,7 +621,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
const std::string& str, std::string& log,
int* results)
{
- std::vector<cmStdString> lines;
+ std::vector<std::string> lines;
cmSystemTools::Split(str.c_str(), lines);
cmOStringStream ostr;
log = "";
@@ -636,7 +630,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
int defects = 0;
- for( std::vector<cmStdString>::iterator i = lines.begin();
+ for( std::vector<std::string>::iterator i = lines.begin();
i != lines.end(); ++i)
{
int failure = cmCTestMemCheckHandler::NO_MEMORY_FAULT;
@@ -681,7 +675,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
const std::string& str, std::string& log,
int* results)
{
- std::vector<cmStdString> lines;
+ std::vector<std::string> lines;
cmSystemTools::Split(str.c_str(), lines);
bool unlimitedOutput = false;
if(str.find("CTEST_FULL_OUTPUT") != str.npos ||
@@ -864,10 +858,10 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput(
{
log = "";
double sttime = cmSystemTools::GetTime();
- std::vector<cmStdString> lines;
+ std::vector<std::string> lines;
cmSystemTools::Split(str.c_str(), lines);
cmCTestLog(this->CTest, DEBUG, "Start test: " << lines.size() << std::endl);
- std::vector<cmStdString>::size_type cc;
+ std::vector<std::string>::size_type cc;
for ( cc = 0; cc < lines.size(); cc ++ )
{
if(lines[cc] == BOUNDS_CHECKER_MARKER)
@@ -923,7 +917,7 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res,
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"PostProcessBoundsCheckerTest for : "
<< res.Name.c_str() << std::endl);
- cmStdString ofile = testOutputFileName(test);
+ std::string ofile = testOutputFileName(test);
if ( ofile.empty() )
{
return;
@@ -979,7 +973,7 @@ void
cmCTestMemCheckHandler::appendMemTesterOutput(cmCTestTestResult& res,
int test)
{
- cmStdString ofile = testOutputFileName(test);
+ std::string ofile = testOutputFileName(test);
if ( ofile.empty() )
{
@@ -1000,15 +994,15 @@ cmCTestMemCheckHandler::appendMemTesterOutput(cmCTestTestResult& res,
}
}
-cmStdString
+std::string
cmCTestMemCheckHandler::testOutputFileName(int test)
{
- cmStdString index;
+ std::string index;
cmOStringStream stream;
stream << test;
index = stream.str();
- cmStdString ofile = this->MemoryTesterOutputFile;
- cmStdString::size_type pos = ofile.find("??");
+ std::string ofile = this->MemoryTesterOutputFile;
+ std::string::size_type pos = ofile.find("??");
ofile.replace(pos, 2, index);
if ( !cmSystemTools::FileExists(ofile.c_str()) )
diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h
index 040d2e0..0521a48 100644
--- a/Source/CTest/cmCTestMemCheckHandler.h
+++ b/Source/CTest/cmCTestMemCheckHandler.h
@@ -89,8 +89,8 @@ private:
std::string BoundsCheckerDPBDFile;
std::string BoundsCheckerXMLFile;
std::string MemoryTester;
- std::vector<cmStdString> MemoryTesterDynamicOptions;
- std::vector<cmStdString> MemoryTesterOptions;
+ std::vector<std::string> MemoryTesterDynamicOptions;
+ std::vector<std::string> MemoryTesterOptions;
int MemoryTesterStyle;
std::string MemoryTesterOutputFile;
int MemoryTesterGlobalResults[NO_MEMORY_FAULT];
@@ -103,8 +103,8 @@ private:
*/
void GenerateDartOutput(std::ostream& os);
- std::vector<cmStdString> CustomPreMemCheck;
- std::vector<cmStdString> CustomPostMemCheck;
+ std::vector<std::string> CustomPreMemCheck;
+ std::vector<std::string> CustomPostMemCheck;
//! Parse Valgrind/Purify/Bounds Checker result out of the output
//string. After running, log holds the output and results hold the
@@ -127,7 +127,7 @@ private:
int test);
///! generate the output filename for the given test index
- cmStdString testOutputFileName(int test);
+ std::string testOutputFileName(int test);
};
#endif
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index ddd1707..c979be3 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -369,7 +369,7 @@ void cmCTestMultiProcessHandler::UpdateCostData()
// Write list of failed tests
fout << "---\n";
- for(std::vector<cmStdString>::iterator i = this->Failed->begin();
+ for(std::vector<std::string>::iterator i = this->Failed->begin();
i != this->Failed->end(); ++i)
{
fout << i->c_str() << "\n";
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index 1b53ec7..605de31 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -41,8 +41,8 @@ public:
void PrintTestList();
void PrintLabels();
- void SetPassFailVectors(std::vector<cmStdString>* passed,
- std::vector<cmStdString>* failed)
+ void SetPassFailVectors(std::vector<std::string>* passed,
+ std::vector<std::string>* failed)
{
this->Passed = passed;
this->Failed = failed;
@@ -107,9 +107,9 @@ protected:
PropertiesMap Properties;
std::map<int, bool> TestRunningMap;
std::map<int, bool> TestFinishMap;
- std::map<int, cmStdString> TestOutput;
- std::vector<cmStdString>* Passed;
- std::vector<cmStdString>* Failed;
+ std::map<int, std::string> TestOutput;
+ std::vector<std::string>* Passed;
+ std::vector<std::string>* Failed;
std::vector<std::string> LastTestsFailed;
std::set<std::string> LockedResources;
std::vector<cmCTestTestHandler::cmCTestTestResult>* TestResults;
diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx
index b09d6f5..1ad94bc 100644
--- a/Source/CTest/cmCTestP4.cxx
+++ b/Source/CTest/cmCTestP4.cxx
@@ -346,10 +346,10 @@ void cmCTestP4::SetP4Options(std::vector<char const*> &CommandOptions)
//The CTEST_P4_OPTIONS variable adds additional Perforce command line
//options before the main command
std::string opts = this->CTest->GetCTestConfiguration("P4Options");
- std::vector<cmStdString> args =
+ std::vector<std::string> args =
cmSystemTools::ParseArguments(opts.c_str());
- for(std::vector<cmStdString>::const_iterator ai = args.begin();
+ for(std::vector<std::string>::const_iterator ai = args.begin();
ai != args.end(); ++ai)
{
P4Options.push_back(ai->c_str());
@@ -538,8 +538,8 @@ bool cmCTestP4::UpdateImpl()
{
opts = this->CTest->GetCTestConfiguration("P4UpdateOptions");
}
- std::vector<cmStdString> args = cmSystemTools::ParseArguments(opts.c_str());
- for(std::vector<cmStdString>::const_iterator ai = args.begin();
+ std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str());
+ for(std::vector<std::string>::const_iterator ai = args.begin();
ai != args.end(); ++ai)
{
p4_sync.push_back(ai->c_str());
diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h
index 9c0af81..c95694a 100644
--- a/Source/CTest/cmCTestReadCustomFilesCommand.h
+++ b/Source/CTest/cmCTestReadCustomFilesCommand.h
@@ -46,7 +46,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "ctest_read_custom_files";}
+ virtual std::string GetName() const { return "ctest_read_custom_files";}
cmTypeMacro(cmCTestReadCustomFilesCommand, cmCTestCommand);
diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h
index f34bd13..0998e5c 100644
--- a/Source/CTest/cmCTestRunScriptCommand.h
+++ b/Source/CTest/cmCTestRunScriptCommand.h
@@ -47,7 +47,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "ctest_run_script";}
+ virtual std::string GetName() const { return "ctest_run_script";}
cmTypeMacro(cmCTestRunScriptCommand, cmCTestCommand);
};
diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx
index 2668c8e..86dc2f2 100644
--- a/Source/CTest/cmCTestSVN.cxx
+++ b/Source/CTest/cmCTestSVN.cxx
@@ -277,7 +277,7 @@ bool cmCTestSVN::UpdateImpl()
{
opts = this->CTest->GetCTestConfiguration("SVNUpdateOptions");
}
- std::vector<cmStdString> args = cmSystemTools::ParseArguments(opts.c_str());
+ std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str());
// Specify the start time for nightly testing.
if(this->CTest->GetTestModel() == cmCTest::NIGHTLY)
@@ -287,7 +287,7 @@ bool cmCTestSVN::UpdateImpl()
std::vector<char const*> svn_update;
svn_update.push_back("update");
- for(std::vector<cmStdString>::const_iterator ai = args.begin();
+ for(std::vector<std::string>::const_iterator ai = args.begin();
ai != args.end(); ++ai)
{
svn_update.push_back(ai->c_str());
@@ -314,9 +314,9 @@ bool cmCTestSVN::RunSVNCommand(std::vector<char const*> const& parameters,
std::string userOptions =
this->CTest->GetCTestConfiguration("SVNOptions");
- std::vector<cmStdString> parsedUserOptions =
+ std::vector<std::string> parsedUserOptions =
cmSystemTools::ParseArguments(userOptions.c_str());
- for(std::vector<cmStdString>::iterator i = parsedUserOptions.begin();
+ for(std::vector<std::string>::iterator i = parsedUserOptions.begin();
i != parsedUserOptions.end(); ++i)
{
args.push_back(i->c_str());
@@ -361,10 +361,10 @@ private:
return true;
}
- virtual void StartElement(const char* name, const char** atts)
+ virtual void StartElement(const std::string& name, const char** atts)
{
this->CData.clear();
- if(strcmp(name, "logentry") == 0)
+ if(name == "logentry")
{
this->Rev = Revision();
this->Rev.SVNInfo = &SVNRepo;
@@ -374,7 +374,7 @@ private:
}
this->Changes.clear();
}
- else if(strcmp(name, "path") == 0)
+ else if(name == "path")
{
this->CurChange = Change();
if(const char* action = this->FindAttribute(atts, "action"))
@@ -389,28 +389,28 @@ private:
this->CData.insert(this->CData.end(), data, data+length);
}
- virtual void EndElement(const char* name)
+ virtual void EndElement(const std::string& name)
{
- if(strcmp(name, "logentry") == 0)
+ if(name == "logentry")
{
this->SVN->DoRevisionSVN(this->Rev, this->Changes);
}
- else if(strcmp(name, "path") == 0 && !this->CData.empty())
+ else if(!this->CData.empty() && name == "path")
{
std::string orig_path(&this->CData[0], this->CData.size());
std::string new_path = SVNRepo.BuildLocalPath( orig_path );
this->CurChange.Path.assign(new_path);
this->Changes.push_back(this->CurChange);
}
- else if(strcmp(name, "author") == 0 && !this->CData.empty())
+ else if(!this->CData.empty() && name == "author")
{
this->Rev.Author.assign(&this->CData[0], this->CData.size());
}
- else if(strcmp(name, "date") == 0 && !this->CData.empty())
+ else if(!this->CData.empty() && name == "date")
{
this->Rev.Date.assign(&this->CData[0], this->CData.size());
}
- else if(strcmp(name, "msg") == 0 && !this->CData.empty())
+ else if(!this->CData.empty() && name == "msg")
{
this->Rev.Log.assign(&this->CData[0], this->CData.size());
}
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 00a0a09..7f13855 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -231,7 +231,7 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
cmSystemTools::GetCTestCommand() << "\n");
// now pass through all the other arguments
- std::vector<cmStdString> &initArgs =
+ std::vector<std::string> &initArgs =
this->CTest->GetInitialCommandLineArguments();
//*** need to make sure this does not have the current script ***
for(size_t i=1; i < initArgs.size(); ++i)
@@ -766,7 +766,7 @@ int cmCTestScriptHandler::PerformExtraUpdates()
// do an initial cvs update as required
command = this->UpdateCmd;
- std::vector<cmStdString>::iterator it;
+ std::vector<std::string>::iterator it;
for (it = this->ExtraUpdates.begin();
it != this->ExtraUpdates.end();
++ it )
diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h
index 44e9dd0..42c2f20 100644
--- a/Source/CTest/cmCTestScriptHandler.h
+++ b/Source/CTest/cmCTestScriptHandler.h
@@ -138,26 +138,26 @@ private:
// Try to remove the binary directory once
static bool TryToRemoveBinaryDirectoryOnce(const std::string& directoryPath);
- std::vector<cmStdString> ConfigurationScripts;
+ std::vector<std::string> ConfigurationScripts;
std::vector<bool> ScriptProcessScope;
bool Backup;
bool EmptyBinDir;
bool EmptyBinDirOnce;
- cmStdString SourceDir;
- cmStdString BinaryDir;
- cmStdString BackupSourceDir;
- cmStdString BackupBinaryDir;
- cmStdString CTestRoot;
- cmStdString CVSCheckOut;
- cmStdString CTestCmd;
- cmStdString UpdateCmd;
- cmStdString CTestEnv;
- cmStdString InitialCache;
- cmStdString CMakeCmd;
- cmStdString CMOutFile;
- std::vector<cmStdString> ExtraUpdates;
+ std::string SourceDir;
+ std::string BinaryDir;
+ std::string BackupSourceDir;
+ std::string BackupBinaryDir;
+ std::string CTestRoot;
+ std::string CVSCheckOut;
+ std::string CTestCmd;
+ std::string UpdateCmd;
+ std::string CTestEnv;
+ std::string InitialCache;
+ std::string CMakeCmd;
+ std::string CMOutFile;
+ std::vector<std::string> ExtraUpdates;
double MinimumInterval;
double ContinuousDuration;
diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h
index c6baf1c..740a7e1 100644
--- a/Source/CTest/cmCTestSleepCommand.h
+++ b/Source/CTest/cmCTestSleepCommand.h
@@ -47,7 +47,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "ctest_sleep";}
+ virtual std::string GetName() const { return "ctest_sleep";}
cmTypeMacro(cmCTestSleepCommand, cmCTestCommand);
diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h
index e5535c1..3b8843f 100644
--- a/Source/CTest/cmCTestStartCommand.h
+++ b/Source/CTest/cmCTestStartCommand.h
@@ -55,7 +55,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "ctest_start";}
+ virtual std::string GetName() const { return "ctest_start";}
cmTypeMacro(cmCTestStartCommand, cmCTestCommand);
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index 24974e3..07a994d 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -72,7 +72,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
if (notesFilesVariable)
{
std::vector<std::string> notesFiles;
- std::vector<cmStdString> newNotesFiles;
+ cmCTest::VectorOfStrings newNotesFiles;
cmSystemTools::ExpandListArgument(notesFilesVariable,notesFiles);
std::vector<std::string>::iterator it;
for ( it = notesFiles.begin();
@@ -89,7 +89,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
if (extraFilesVariable)
{
std::vector<std::string> extraFiles;
- std::vector<cmStdString> newExtraFiles;
+ cmCTest::VectorOfStrings newExtraFiles;
cmSystemTools::ExpandListArgument(extraFilesVariable,extraFiles);
std::vector<std::string>::iterator it;
for ( it = extraFiles.begin();
@@ -222,7 +222,7 @@ bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg)
if(this->ArgumentDoing == ArgumentDoingFiles)
{
- cmStdString filename(arg);
+ std::string filename(arg);
if(cmSystemTools::FileExists(filename.c_str()))
{
this->Files.insert(filename);
diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h
index 64c6cae..3673fbd 100644
--- a/Source/CTest/cmCTestSubmitCommand.h
+++ b/Source/CTest/cmCTestSubmitCommand.h
@@ -48,7 +48,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "ctest_submit";}
+ virtual std::string GetName() const { return "ctest_submit";}
cmTypeMacro(cmCTestSubmitCommand, cmCTestHandlerCommand);
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 139f515..3173f15 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -68,10 +68,10 @@ private:
return val;
}
- virtual void StartElement(const char* name, const char** atts)
+ virtual void StartElement(const std::string& name, const char** atts)
{
this->CurrentValue.clear();
- if(strcmp(name, "cdash") == 0)
+ if(name == "cdash")
{
this->CDashVersion = this->FindAttribute(atts, "version");
}
@@ -82,9 +82,9 @@ private:
this->CurrentValue.insert(this->CurrentValue.end(), data, data+length);
}
- virtual void EndElement(const char* name)
+ virtual void EndElement(const std::string& name)
{
- if(strcmp(name, "status") == 0)
+ if(name == "status")
{
std::string status = cmSystemTools::UpperCase(this->GetCurrentValue());
if(status == "OK" || status == "SUCCESS")
@@ -100,15 +100,15 @@ private:
this->Status = STATUS_ERROR;
}
}
- else if(strcmp(name, "filename") == 0)
+ else if(name == "filename")
{
this->Filename = this->GetCurrentValue();
}
- else if(strcmp(name, "md5") == 0)
+ else if(name == "md5")
{
this->MD5 = this->GetCurrentValue();
}
- else if(strcmp(name, "message") == 0)
+ else if(name == "message")
{
this->Message = this->GetCurrentValue();
}
@@ -170,10 +170,10 @@ void cmCTestSubmitHandler::Initialize()
}
//----------------------------------------------------------------------------
-bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix,
- const std::set<cmStdString>& files,
- const cmStdString& remoteprefix,
- const cmStdString& url)
+bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix,
+ const std::set<std::string>& files,
+ const std::string& remoteprefix,
+ const std::string& url)
{
CURL *curl;
CURLcode res;
@@ -217,12 +217,12 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix,
::curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
- cmStdString local_file = *file;
+ std::string local_file = *file;
if ( !cmSystemTools::FileExists(local_file.c_str()) )
{
local_file = localprefix + "/" + *file;
}
- cmStdString upload_as
+ std::string upload_as
= url + "/" + remoteprefix + cmSystemTools::GetFilenameName(*file);
struct stat st;
@@ -324,10 +324,10 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix,
//----------------------------------------------------------------------------
// Uploading files is simpler
-bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
- const std::set<cmStdString>& files,
- const cmStdString& remoteprefix,
- const cmStdString& url)
+bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
+ const std::set<std::string>& files,
+ const std::string& remoteprefix,
+ const std::string& url)
{
CURL *curl;
CURLcode res;
@@ -336,8 +336,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
/* In windows, this will init the winsock stuff */
::curl_global_init(CURL_GLOBAL_ALL);
- cmStdString dropMethod(this->CTest->GetCTestConfiguration("DropMethod"));
- cmStdString curlopt(this->CTest->GetCTestConfiguration("CurlOptions"));
+ std::string dropMethod(this->CTest->GetCTestConfiguration("DropMethod"));
+ std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions"));
std::vector<std::string> args;
cmSystemTools::ExpandListArgument(curlopt.c_str(), args);
bool verifyPeerOff = false;
@@ -354,7 +354,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
verifyHostOff = true;
}
}
- cmStdString::size_type kk;
+ std::string::size_type kk;
cmCTest::SetOfStrings::const_iterator file;
for ( file = files.begin(); file != files.end(); ++file )
{
@@ -414,18 +414,18 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
::curl_easy_setopt(curl, CURLOPT_PUT, 1);
::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
- cmStdString local_file = *file;
+ std::string local_file = *file;
if ( !cmSystemTools::FileExists(local_file.c_str()) )
{
local_file = localprefix + "/" + *file;
}
- cmStdString remote_file
+ std::string remote_file
= remoteprefix + cmSystemTools::GetFilenameName(*file);
*this->LogFile << "\tUpload file: " << local_file.c_str() << " to "
<< remote_file.c_str() << std::endl;
- cmStdString ofile = "";
+ std::string ofile = "";
for ( kk = 0; kk < remote_file.size(); kk ++ )
{
char c = remote_file[kk];
@@ -448,8 +448,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
ofile.append(hexCh);
}
}
- cmStdString upload_as
- = url + ((url.find("?",0) == cmStdString::npos) ? "?" : "&")
+ std::string upload_as
+ = url + ((url.find("?",0) == std::string::npos) ? "?" : "&")
+ "FileName=" + ofile;
upload_as += "&MD5=";
@@ -666,9 +666,9 @@ void cmCTestSubmitHandler
//----------------------------------------------------------------------------
bool cmCTestSubmitHandler::TriggerUsingHTTP(
- const std::set<cmStdString>& files,
- const cmStdString& remoteprefix,
- const cmStdString& url)
+ const std::set<std::string>& files,
+ const std::string& remoteprefix,
+ const std::string& url)
{
CURL *curl;
char error_buffer[1024];
@@ -721,10 +721,10 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
::curl_easy_setopt(curl, CURLOPT_FILE, (void *)&chunk);
::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void *)&chunkDebug);
- cmStdString rfile
+ std::string rfile
= remoteprefix + cmSystemTools::GetFilenameName(*file);
- cmStdString ofile = "";
- cmStdString::iterator kk;
+ std::string ofile = "";
+ std::string::iterator kk;
for ( kk = rfile.begin(); kk < rfile.end(); ++ kk)
{
char c = *kk;
@@ -747,8 +747,8 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
ofile.append(hexCh);
}
}
- cmStdString turl
- = url + ((url.find("?",0) == cmStdString::npos) ? "?" : "&")
+ std::string turl
+ = url + ((url.find("?",0) == std::string::npos) ? "?" : "&")
+ "xmlfile=" + ofile;
*this->LogFile << "Trigger url: " << turl.c_str() << std::endl;
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Trigger url: "
@@ -805,11 +805,11 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
//----------------------------------------------------------------------------
bool cmCTestSubmitHandler::SubmitUsingSCP(
- const cmStdString& scp_command,
- const cmStdString& localprefix,
- const std::set<cmStdString>& files,
- const cmStdString& remoteprefix,
- const cmStdString& url)
+ const std::string& scp_command,
+ const std::string& localprefix,
+ const std::set<std::string>& files,
+ const std::string& remoteprefix,
+ const std::string& url)
{
if ( !scp_command.size() || !localprefix.size() ||
!files.size() || !remoteprefix.size() || !url.size() )
@@ -906,10 +906,10 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(
//----------------------------------------------------------------------------
bool cmCTestSubmitHandler::SubmitUsingCP(
- const cmStdString& localprefix,
- const std::set<cmStdString>& files,
- const cmStdString& remoteprefix,
- const cmStdString& destination)
+ const std::string& localprefix,
+ const std::set<std::string>& files,
+ const std::string& remoteprefix,
+ const std::string& destination)
{
if ( !localprefix.size() ||
!files.size() || !remoteprefix.size() || !destination.size() )
@@ -947,17 +947,17 @@ bool cmCTestSubmitHandler::SubmitUsingCP(
//----------------------------------------------------------------------------
#if defined(CTEST_USE_XMLRPC)
-bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
- const std::set<cmStdString>& files,
- const cmStdString& remoteprefix,
- const cmStdString& url)
+bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const std::string& localprefix,
+ const std::set<std::string>& files,
+ const std::string& remoteprefix,
+ const std::string& url)
{
xmlrpc_env env;
char ctestString[] = "CTest";
std::string ctestVersionString = cmVersion::GetCMakeVersion();
char* ctestVersion = const_cast<char*>(ctestVersionString.c_str());
- cmStdString realURL = url + "/" + remoteprefix + "/Command/";
+ std::string realURL = url + "/" + remoteprefix + "/Command/";
/* Start up our XML-RPC client library. */
xmlrpc_client_init(XMLRPC_CLIENT_NO_FLAGS, ctestString, ctestVersion);
@@ -973,7 +973,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
{
xmlrpc_value *result;
- cmStdString local_file = *file;
+ std::string local_file = *file;
if ( !cmSystemTools::FileExists(local_file.c_str()) )
{
local_file = localprefix + "/" + *file;
@@ -1045,10 +1045,10 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
return true;
}
#else
-bool cmCTestSubmitHandler::SubmitUsingXMLRPC(cmStdString const&,
- std::set<cmStdString> const&,
- cmStdString const&,
- cmStdString const&)
+bool cmCTestSubmitHandler::SubmitUsingXMLRPC(std::string const&,
+ std::set<std::string> const&,
+ std::string const&,
+ std::string const&)
{
return false;
}
@@ -1085,7 +1085,7 @@ int cmCTestSubmitHandler::ProcessHandler()
}
if ( getenv("HTTP_PROXY_TYPE") )
{
- cmStdString type = getenv("HTTP_PROXY_TYPE");
+ std::string type = getenv("HTTP_PROXY_TYPE");
// HTTP/SOCKS4/SOCKS5
if ( type == "HTTP" )
{
@@ -1122,7 +1122,7 @@ int cmCTestSubmitHandler::ProcessHandler()
}
if ( getenv("FTP_PROXY_TYPE") )
{
- cmStdString type = getenv("FTP_PROXY_TYPE");
+ std::string type = getenv("FTP_PROXY_TYPE");
// HTTP/SOCKS4/SOCKS5
if ( type == "HTTP" )
{
@@ -1178,7 +1178,7 @@ int cmCTestSubmitHandler::ProcessHandler()
this->CTest->AddIfExists(cmCTest::PartTest, "Test.xml");
if(this->CTest->AddIfExists(cmCTest::PartCoverage, "Coverage.xml"))
{
- cmCTest::VectorOfStrings gfiles;
+ std::vector<std::string> gfiles;
std::string gpath
= buildDirectory + "/Testing/" + this->CTest->GetCurrentTag();
std::string::size_type glen = gpath.size() + 1;
@@ -1247,7 +1247,7 @@ int cmCTestSubmitHandler::ProcessHandler()
}
this->SetLogFile(&ofs);
- cmStdString dropMethod(this->CTest->GetCTestConfiguration("DropMethod"));
+ std::string dropMethod(this->CTest->GetCTestConfiguration("DropMethod"));
if ( dropMethod == "" || dropMethod == "ftp" )
{
diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h
index 14eac80..accabd1 100644
--- a/Source/CTest/cmCTestSubmitHandler.h
+++ b/Source/CTest/cmCTestSubmitHandler.h
@@ -47,33 +47,33 @@ private:
/**
* Submit file using various ways
*/
- bool SubmitUsingFTP(const cmStdString& localprefix,
- const std::set<cmStdString>& files,
- const cmStdString& remoteprefix,
- const cmStdString& url);
- bool SubmitUsingHTTP(const cmStdString& localprefix,
- const std::set<cmStdString>& files,
- const cmStdString& remoteprefix,
- const cmStdString& url);
- bool SubmitUsingSCP(const cmStdString& scp_command,
- const cmStdString& localprefix,
- const std::set<cmStdString>& files,
- const cmStdString& remoteprefix,
- const cmStdString& url);
-
- bool SubmitUsingCP( const cmStdString& localprefix,
- const std::set<cmStdString>& files,
- const cmStdString& remoteprefix,
- const cmStdString& url);
-
- bool TriggerUsingHTTP(const std::set<cmStdString>& files,
- const cmStdString& remoteprefix,
- const cmStdString& url);
-
- bool SubmitUsingXMLRPC(const cmStdString& localprefix,
- const std::set<cmStdString>& files,
- const cmStdString& remoteprefix,
- const cmStdString& url);
+ bool SubmitUsingFTP(const std::string& localprefix,
+ const std::set<std::string>& files,
+ const std::string& remoteprefix,
+ const std::string& url);
+ bool SubmitUsingHTTP(const std::string& localprefix,
+ const std::set<std::string>& files,
+ const std::string& remoteprefix,
+ const std::string& url);
+ bool SubmitUsingSCP(const std::string& scp_command,
+ const std::string& localprefix,
+ const std::set<std::string>& files,
+ const std::string& remoteprefix,
+ const std::string& url);
+
+ bool SubmitUsingCP( const std::string& localprefix,
+ const std::set<std::string>& files,
+ const std::string& remoteprefix,
+ const std::string& url);
+
+ bool TriggerUsingHTTP(const std::set<std::string>& files,
+ const std::string& remoteprefix,
+ const std::string& url);
+
+ bool SubmitUsingXMLRPC(const std::string& localprefix,
+ const std::set<std::string>& files,
+ const std::string& remoteprefix,
+ const std::string& url);
typedef std::vector<char> cmCTestSubmitHandlerVectorOfChar;
@@ -82,10 +82,10 @@ private:
std::string GetSubmitResultsPrefix();
class ResponseParser;
- cmStdString HTTPProxy;
+ std::string HTTPProxy;
int HTTPProxyType;
- cmStdString HTTPProxyAuth;
- cmStdString FTPProxy;
+ std::string HTTPProxyAuth;
+ std::string FTPProxy;
int FTPProxyType;
std::ostream* LogFile;
bool SubmitPart[cmCTest::PartCount];
diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h
index 451ac99..a1e5f36 100644
--- a/Source/CTest/cmCTestTestCommand.h
+++ b/Source/CTest/cmCTestTestCommand.h
@@ -39,7 +39,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "ctest_test";}
+ virtual std::string GetName() const { return "ctest_test";}
cmTypeMacro(cmCTestTestCommand, cmCTestHandlerCommand);
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 3a04b33..5970656 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -60,7 +60,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "subdirs";}
+ virtual std::string GetName() const { return "subdirs";}
cmTypeMacro(cmCTestSubdirCommand, cmCommand);
@@ -157,7 +157,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "add_subdirectory";}
+ virtual std::string GetName() const { return "add_subdirectory";}
cmTypeMacro(cmCTestAddSubdirectoryCommand, cmCommand);
@@ -243,7 +243,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "add_test";}
+ virtual std::string GetName() const { return "add_test";}
cmTypeMacro(cmCTestAddTestCommand, cmCommand);
@@ -287,7 +287,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "set_tests_properties";}
+ virtual std::string GetName() const { return "set_tests_properties";}
cmTypeMacro(cmCTestSetTestsPropertiesCommand, cmCommand);
@@ -540,8 +540,8 @@ int cmCTestTestHandler::ProcessHandler()
this->StartLogFile((this->MemCheck ? "DynamicAnalysis" : "Test"), mLogFile);
this->LogFile = &mLogFile;
- std::vector<cmStdString> passed;
- std::vector<cmStdString> failed;
+ std::vector<std::string> passed;
+ std::vector<std::string> failed;
int total;
//start the real time clock
@@ -569,7 +569,7 @@ int cmCTestTestHandler::ProcessHandler()
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl
<< "The following tests passed:" << std::endl);
- for(std::vector<cmStdString>::iterator j = passed.begin();
+ for(std::vector<std::string>::iterator j = passed.begin();
j != passed.end(); ++j)
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "\t" << *j
@@ -661,8 +661,8 @@ void cmCTestTestHandler::PrintLabelSummary()
cmCTestTestHandler::ListOfTests::iterator it = this->TestList.begin();
cmCTestTestHandler::TestResultsVector::iterator ri =
this->TestResults.begin();
- std::map<cmStdString, double> labelTimes;
- std::set<cmStdString> labels;
+ std::map<std::string, double> labelTimes;
+ std::set<std::string> labels;
// initialize maps
std::string::size_type maxlen = 0;
for(; it != this->TestList.end(); ++it)
@@ -702,7 +702,7 @@ void cmCTestTestHandler::PrintLabelSummary()
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:");
}
- for(std::set<cmStdString>::const_iterator i = labels.begin();
+ for(std::set<std::string>::const_iterator i = labels.begin();
i != labels.end(); ++i)
{
std::string label = *i;
@@ -1050,8 +1050,8 @@ bool cmCTestTestHandler::GetValue(const char* tag,
}
//---------------------------------------------------------------------
-void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
- std::vector<cmStdString> &failed)
+void cmCTestTestHandler::ProcessDirectory(std::vector<std::string> &passed,
+ std::vector<std::string> &failed)
{
this->ComputeTestList();
this->StartTest = this->CTest->CurrentTime();
@@ -1216,7 +1216,7 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os)
<< "name=\"Command Line\"><Value>"
<< cmXMLSafe(result->FullCommandLine)
<< "</Value></NamedMeasurement>\n";
- std::map<cmStdString,cmStdString>::iterator measureIt;
+ std::map<std::string,std::string>::iterator measureIt;
for ( measureIt = result->Properties->Measurements.begin();
measureIt != result->Properties->Measurements.end();
++ measureIt )
@@ -1328,9 +1328,9 @@ void cmCTestTestHandler::AttachFiles(std::ostream& os,
}
//----------------------------------------------------------------------
-int cmCTestTestHandler::ExecuteCommands(std::vector<cmStdString>& vec)
+int cmCTestTestHandler::ExecuteCommands(std::vector<std::string>& vec)
{
- std::vector<cmStdString>::iterator it;
+ std::vector<std::string>::iterator it;
for ( it = vec.begin(); it != vec.end(); ++it )
{
int retVal = 0;
@@ -2112,7 +2112,7 @@ bool cmCTestTestHandler::SetTestsProperties(
const std::vector<std::string>& args)
{
std::vector<std::string>::const_iterator it;
- std::vector<cmStdString> tests;
+ std::vector<std::string> tests;
bool found = false;
for ( it = args.begin(); it != args.end(); ++ it )
{
@@ -2137,7 +2137,7 @@ bool cmCTestTestHandler::SetTestsProperties(
break;
}
std::string val = *it;
- std::vector<cmStdString>::const_iterator tit;
+ std::vector<std::string>::const_iterator tit;
for ( tit = tests.begin(); tit != tests.end(); ++ tit )
{
cmCTestTestHandler::ListOfTests::iterator rtit;
@@ -2319,7 +2319,7 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
}
if ( this->MemCheck )
{
- std::vector<cmStdString>::iterator it;
+ std::vector<std::string>::iterator it;
bool found = false;
for ( it = this->CustomTestsIgnore.begin();
it != this->CustomTestsIgnore.end(); ++ it )
@@ -2339,7 +2339,7 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
}
else
{
- std::vector<cmStdString>::iterator it;
+ std::vector<std::string>::iterator it;
bool found = false;
for ( it = this->CustomTestsIgnore.begin();
it != this->CustomTestsIgnore.end(); ++ it )
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 63f9c93..fe43bb8 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -87,8 +87,8 @@ public:
// ctest -j N will break for that feature
struct cmCTestTestProperties
{
- cmStdString Name;
- cmStdString Directory;
+ std::string Name;
+ std::string Directory;
std::vector<std::string> Args;
std::vector<std::string> RequiredFiles;
std::vector<std::string> Depends;
@@ -98,7 +98,7 @@ public:
std::string> > ErrorRegularExpressions;
std::vector<std::pair<cmsys::RegularExpression,
std::string> > RequiredRegularExpressions;
- std::map<cmStdString, cmStdString> Measurements;
+ std::map<std::string, std::string> Measurements;
bool IsInBasedOnREOptions;
bool WillFail;
float Cost;
@@ -162,7 +162,7 @@ protected:
virtual int PreProcessHandler();
virtual int PostProcessHandler();
virtual void GenerateTestCommand(std::vector<std::string>& args, int test);
- int ExecuteCommands(std::vector<cmStdString>& vec);
+ int ExecuteCommands(std::vector<std::string>& vec);
void WriteTestResultHeader(std::ostream& os, cmCTestTestResult* result);
void WriteTestResultFooter(std::ostream& os, cmCTestTestResult* result);
@@ -177,7 +177,7 @@ protected:
typedef std::vector<cmCTestTestResult> TestResultsVector;
TestResultsVector TestResults;
- std::vector<cmStdString> CustomTestsIgnore;
+ std::vector<std::string> CustomTestsIgnore;
std::string StartTest;
std::string EndTest;
unsigned int StartTestTime;
@@ -210,8 +210,8 @@ private:
/**
* Run the tests for a directory and any subdirectories
*/
- void ProcessDirectory(std::vector<cmStdString> &passed,
- std::vector<cmStdString> &failed);
+ void ProcessDirectory(std::vector<std::string> &passed,
+ std::vector<std::string> &failed);
/**
* Get the list of tests in directory and subdirectories.
@@ -251,8 +251,8 @@ private:
void ExpandTestsToRunInformation(size_t numPossibleTests);
void ExpandTestsToRunInformationForRerunFailed();
- std::vector<cmStdString> CustomPreTest;
- std::vector<cmStdString> CustomPostTest;
+ std::vector<std::string> CustomPreTest;
+ std::vector<std::string> CustomPostTest;
std::vector<int> TestsToRun;
diff --git a/Source/CTest/cmCTestUpdateCommand.h b/Source/CTest/cmCTestUpdateCommand.h
index a785bd8..fb80333 100644
--- a/Source/CTest/cmCTestUpdateCommand.h
+++ b/Source/CTest/cmCTestUpdateCommand.h
@@ -39,7 +39,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "ctest_update";}
+ virtual std::string GetName() const { return "ctest_update";}
cmTypeMacro(cmCTestUpdateCommand, cmCTestHandlerCommand);
diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx
index 731c1c7..f7de294 100644
--- a/Source/CTest/cmCTestUploadCommand.cxx
+++ b/Source/CTest/cmCTestUploadCommand.cxx
@@ -47,7 +47,7 @@ bool cmCTestUploadCommand::CheckArgumentValue(std::string const& arg)
{
if(this->ArgumentDoing == ArgumentDoingFiles)
{
- cmStdString filename(arg);
+ std::string filename(arg);
if(cmSystemTools::FileExists(filename.c_str()))
{
this->Files.insert(filename);
diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h
index e867fb6..4a07608 100644
--- a/Source/CTest/cmCTestUploadCommand.h
+++ b/Source/CTest/cmCTestUploadCommand.h
@@ -43,7 +43,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "ctest_upload";}
+ virtual std::string GetName() const { return "ctest_upload";}
cmTypeMacro(cmCTestUploadCommand, cmCTestHandlerCommand);
diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx
index fbee227..f89fa2b 100644
--- a/Source/CTest/cmCTestVC.cxx
+++ b/Source/CTest/cmCTestVC.cxx
@@ -63,9 +63,9 @@ bool cmCTestVC::InitialCheckout(const char* command)
}
// Construct the initial checkout command line.
- std::vector<cmStdString> args = cmSystemTools::ParseArguments(command);
+ std::vector<std::string> args = cmSystemTools::ParseArguments(command);
std::vector<char const*> vc_co;
- for(std::vector<cmStdString>::const_iterator ai = args.begin();
+ for(std::vector<std::string>::const_iterator ai = args.begin();
ai != args.end(); ++ai)
{
vc_co.push_back(ai->c_str());
diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx
index 528d0db..5bcfeac 100644
--- a/Source/CTest/cmParseGTMCoverage.cxx
+++ b/Source/CTest/cmParseGTMCoverage.cxx
@@ -182,7 +182,7 @@ bool cmParseGTMCoverage::ParseMCOVLine(std::string const& line,
// ( file , entry ) = "number_executed:timing_info"
// ^COVERAGE("%RSEL","init",8,"FOR_LOOP",1)=1
// ( file , entry, line, IGNORE ) =number_executed
- std::vector<cmStdString> args;
+ std::vector<std::string> args;
std::string::size_type pos = line.find('(', 0);
// if no ( is found, then return line has no coverage
if(pos == std::string::npos)
diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx
index 6226feb..fe98964 100644
--- a/Source/CTest/cmParseMumpsCoverage.cxx
+++ b/Source/CTest/cmParseMumpsCoverage.cxx
@@ -140,7 +140,7 @@ bool cmParseMumpsCoverage::LoadPackages(const char* d)
bool cmParseMumpsCoverage::FindMumpsFile(std::string const& routine,
std::string& filepath)
{
- std::map<cmStdString, cmStdString>::iterator i =
+ std::map<std::string, std::string>::iterator i =
this->RoutineToDirectory.find(routine);
if(i != this->RoutineToDirectory.end())
{
diff --git a/Source/CTest/cmParseMumpsCoverage.h b/Source/CTest/cmParseMumpsCoverage.h
index c1effa7..bc71891 100644
--- a/Source/CTest/cmParseMumpsCoverage.h
+++ b/Source/CTest/cmParseMumpsCoverage.h
@@ -44,7 +44,7 @@ protected:
bool FindMumpsFile(std::string const& routine,
std::string& filepath);
protected:
- std::map<cmStdString, cmStdString> RoutineToDirectory;
+ std::map<std::string, std::string> RoutineToDirectory;
cmCTestCoverageHandlerContainer& Coverage;
cmCTest* CTest;
};
diff --git a/Source/CTest/cmParsePHPCoverage.cxx b/Source/CTest/cmParsePHPCoverage.cxx
index 1c26c1c..3b7f968 100644
--- a/Source/CTest/cmParsePHPCoverage.cxx
+++ b/Source/CTest/cmParsePHPCoverage.cxx
@@ -34,7 +34,7 @@ bool cmParsePHPCoverage::ReadUntil(std::istream& in, char until)
return true;
}
bool cmParsePHPCoverage::ReadCoverageArray(std::istream& in,
- cmStdString const& fileName)
+ std::string const& fileName)
{
cmCTestCoverageHandlerContainer::SingleFileCoverageVector& coverageVector
= this->Coverage.TotalCoverage[fileName];
@@ -166,7 +166,7 @@ bool cmParsePHPCoverage::ReadFileInformation(std::istream& in)
// read the string data
in.read(s, size-1);
s[size-1] = 0;
- cmStdString fileName = s;
+ std::string fileName = s;
delete [] s;
// read close quote
if(in.get(c) && c != '"')
diff --git a/Source/CTest/cmParsePHPCoverage.h b/Source/CTest/cmParsePHPCoverage.h
index 035a093..92a7634 100644
--- a/Source/CTest/cmParsePHPCoverage.h
+++ b/Source/CTest/cmParsePHPCoverage.h
@@ -35,7 +35,7 @@ private:
bool ReadArraySize(std::istream& in, int& size);
bool ReadFileInformation(std::istream& in);
bool ReadInt(std::istream& in, int& v);
- bool ReadCoverageArray(std::istream& in, cmStdString const&);
+ bool ReadCoverageArray(std::istream& in, std::string const&);
bool ReadUntil(std::istream& in, char until);
cmCTestCoverageHandlerContainer& Coverage;
cmCTest* CTest;
diff --git a/Source/CTest/cmParsePythonCoverage.cxx b/Source/CTest/cmParsePythonCoverage.cxx
index 38a770a..2578bb8 100644
--- a/Source/CTest/cmParsePythonCoverage.cxx
+++ b/Source/CTest/cmParsePythonCoverage.cxx
@@ -20,9 +20,9 @@ public:
protected:
- virtual void StartElement(const char* name, const char** atts)
+ virtual void StartElement(const std::string& name, const char** atts)
{
- if(strcmp(name, "class") == 0)
+ if(name == "class")
{
int tagCount = 0;
while(true)
@@ -57,7 +57,7 @@ protected:
++tagCount;
}
}
- else if(strcmp(name, "line") == 0)
+ else if(name == "line")
{
int tagCount = 0;
int curNumber = -1;
@@ -85,7 +85,7 @@ protected:
}
}
- virtual void EndElement(const char*) {}
+ virtual void EndElement(const std::string&) {}
private:
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
index 249137f..682f95f 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
@@ -19,9 +19,10 @@
#include "cmCursesDummyWidget.h"
#include "../cmSystemTools.h"
-cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(const char* key,
- int labelwidth,
- int entrywidth) :
+cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
+ const std::string& key,
+ int labelwidth,
+ int entrywidth) :
Key(key), LabelWidth(labelwidth), EntryWidth(entrywidth)
{
this->Label = new cmCursesLabelWidget(this->LabelWidth, 1, 1, 1, key);
@@ -31,7 +32,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(const char* key,
}
cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
- const char* key, const cmCacheManager::CacheIterator& it, bool isNew,
+ const std::string& key, const cmCacheManager::CacheIterator& it, bool isNew,
int labelwidth, int entrywidth)
: Key(key), LabelWidth(labelwidth), EntryWidth(entrywidth)
{
@@ -50,7 +51,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
{
case cmCacheManager::BOOL:
this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1);
- if (cmSystemTools::IsOn(it.GetValue()))
+ if (cmSystemTools::IsOn(it.GetValue().c_str()))
{
static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(true);
}
@@ -93,7 +94,8 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
}
break;
case cmCacheManager::UNINITIALIZED:
- cmSystemTools::Error("Found an undefined variable: ", it.GetName());
+ cmSystemTools::Error("Found an undefined variable: ",
+ it.GetName().c_str());
break;
default:
// TODO : put warning message here
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h
index 1357a02..98107cc 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.h
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h
@@ -18,8 +18,9 @@
class cmCursesCacheEntryComposite
{
public:
- cmCursesCacheEntryComposite(const char* key, int labelwidth, int entrywidth);
- cmCursesCacheEntryComposite(const char* key,
+ cmCursesCacheEntryComposite(const std::string& key, int labelwidth,
+ int entrywidth);
+ cmCursesCacheEntryComposite(const std::string& key,
const cmCacheManager::CacheIterator& it,
bool isNew, int labelwidth, int entrywidth);
~cmCursesCacheEntryComposite();
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index d94cd37..0734927 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -84,9 +84,9 @@ cmCursesMainForm::~cmCursesMainForm()
}
// See if a cache entry is in the list of entries in the ui.
-bool cmCursesMainForm::LookForCacheEntry(const char* key)
+bool cmCursesMainForm::LookForCacheEntry(const std::string& key)
{
- if (!key || !this->Entries)
+ if (!this->Entries)
{
return false;
}
@@ -94,7 +94,7 @@ bool cmCursesMainForm::LookForCacheEntry(const char* key)
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{
- if (!strcmp(key, (*it)->Key.c_str()))
+ if (key == (*it)->Key)
{
return true;
}
@@ -146,7 +146,7 @@ void cmCursesMainForm::InitializeUI()
this->CMakeInstance->GetCacheManager()->NewIterator();
!i.IsAtEnd(); i.Next())
{
- const char* key = i.GetName();
+ std::string key = i.GetName();
if ( i.GetType() == cmCacheManager::INTERNAL ||
i.GetType() == cmCacheManager::STATIC ||
i.GetType() == cmCacheManager::UNINITIALIZED )
@@ -168,7 +168,7 @@ void cmCursesMainForm::InitializeUI()
this->CMakeInstance->GetCacheManager()->NewIterator();
!i.IsAtEnd(); i.Next())
{
- const char* key = i.GetName();
+ std::string key = i.GetName();
if ( i.GetType() == cmCacheManager::INTERNAL ||
i.GetType() == cmCacheManager::STATIC ||
i.GetType() == cmCacheManager::UNINITIALIZED )
diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h
index 883a2b3..fba9bc5 100644
--- a/Source/CursesDialog/cmCursesMainForm.h
+++ b/Source/CursesDialog/cmCursesMainForm.h
@@ -51,7 +51,7 @@ public:
* Returns true if an entry with the given key is in the
* list of current composites.
*/
- bool LookForCacheEntry(const char* key);
+ bool LookForCacheEntry(const std::string& key);
enum {
MIN_WIDTH = 65,
diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx
index 652b2df..aa680fb 100644
--- a/Source/CursesDialog/cmCursesOptionsWidget.cxx
+++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx
@@ -89,7 +89,7 @@ void cmCursesOptionsWidget::PreviousOption()
this->SetValue(this->Options[this->CurrentOption].c_str());
}
-void cmCursesOptionsWidget::SetOption(const char* value)
+void cmCursesOptionsWidget::SetOption(const std::string& value)
{
this->CurrentOption = 0; // default to 0 index
this->SetValue(value);
diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h
index b52ac9d..5cee489 100644
--- a/Source/CursesDialog/cmCursesOptionsWidget.h
+++ b/Source/CursesDialog/cmCursesOptionsWidget.h
@@ -25,7 +25,7 @@ public:
// when this widget has focus. Returns true if the input was
// handled.
virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w);
- void SetOption(const char*);
+ void SetOption(const std::string&);
void AddOption(std::string const &);
void NextOption();
void PreviousOption();
diff --git a/Source/CursesDialog/cmCursesPathWidget.cxx b/Source/CursesDialog/cmCursesPathWidget.cxx
index 14c325b..893ca99 100644
--- a/Source/CursesDialog/cmCursesPathWidget.cxx
+++ b/Source/CursesDialog/cmCursesPathWidget.cxx
@@ -57,7 +57,7 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w)
{
glob = cstr + "*";
}
- std::vector<cmStdString> dirs;
+ std::vector<std::string> dirs;
cmSystemTools::SimpleGlob(glob.c_str(), dirs, (this->Type == cmCacheManager::PATH?-1:0));
if ( this->CurrentIndex < dirs.size() )
diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx
index bd1ff71..d25022d 100644
--- a/Source/CursesDialog/cmCursesStringWidget.cxx
+++ b/Source/CursesDialog/cmCursesStringWidget.cxx
@@ -195,7 +195,7 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
return true;
}
-void cmCursesStringWidget::SetString(const char* value)
+void cmCursesStringWidget::SetString(const std::string& value)
{
this->SetValue(value);
}
diff --git a/Source/CursesDialog/cmCursesStringWidget.h b/Source/CursesDialog/cmCursesStringWidget.h
index e939049..dd8c02a 100644
--- a/Source/CursesDialog/cmCursesStringWidget.h
+++ b/Source/CursesDialog/cmCursesStringWidget.h
@@ -37,7 +37,7 @@ public:
/**
* Set/Get the string.
*/
- void SetString(const char* value);
+ void SetString(const std::string& value);
const char* GetString();
virtual const char* GetValue();
diff --git a/Source/CursesDialog/cmCursesWidget.cxx b/Source/CursesDialog/cmCursesWidget.cxx
index 5dffcaa..e5363f4 100644
--- a/Source/CursesDialog/cmCursesWidget.cxx
+++ b/Source/CursesDialog/cmCursesWidget.cxx
@@ -46,10 +46,10 @@ void cmCursesWidget::Move(int x, int y, bool isNewPage)
}
}
-void cmCursesWidget::SetValue(const char* value)
+void cmCursesWidget::SetValue(const std::string& value)
{
this->Value = value;
- set_field_buffer(this->Field, 0, value);
+ set_field_buffer(this->Field, 0, value.c_str());
}
const char* cmCursesWidget::GetValue()
diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h
index 952c67a..d91a0cb 100644
--- a/Source/CursesDialog/cmCursesWidget.h
+++ b/Source/CursesDialog/cmCursesWidget.h
@@ -40,7 +40,7 @@ public:
* Set/Get the value (setting the value also changes the contents
* of the field buffer).
*/
- virtual void SetValue(const char* value);
+ virtual void SetValue(const std::string& value);
virtual const char* GetValue();
/**
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 0fe5f8c..12da320 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -111,7 +111,7 @@ void QCMake::setBinaryDirectory(const QString& _dir)
cmCacheManager::CacheIterator itm = cachem->NewIterator();
if ( itm.Find("CMAKE_HOME_DIRECTORY"))
{
- setSourceDirectory(QString::fromLocal8Bit(itm.GetValue()));
+ setSourceDirectory(QString::fromLocal8Bit(itm.GetValue().c_str()));
}
if ( itm.Find("CMAKE_GENERATOR"))
{
@@ -201,11 +201,11 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
}
QCMakeProperty prop;
- prop.Key = QString::fromLocal8Bit(i.GetName());
+ prop.Key = QString::fromLocal8Bit(i.GetName().c_str());
int idx = props.indexOf(prop);
if(idx == -1)
{
- toremove.append(QString::fromLocal8Bit(i.GetName()));
+ toremove.append(QString::fromLocal8Bit(i.GetName().c_str()));
}
else
{
@@ -286,15 +286,15 @@ QCMakePropertyList QCMake::properties() const
}
QCMakeProperty prop;
- prop.Key = QString::fromLocal8Bit(i.GetName());
+ prop.Key = QString::fromLocal8Bit(i.GetName().c_str());
prop.Help = QString::fromLocal8Bit(i.GetProperty("HELPSTRING"));
- prop.Value = QString::fromLocal8Bit(i.GetValue());
+ prop.Value = QString::fromLocal8Bit(i.GetValue().c_str());
prop.Advanced = i.GetPropertyAsBool("ADVANCED");
if(i.GetType() == cmCacheManager::BOOL)
{
prop.Type = QCMakeProperty::BOOL;
- prop.Value = cmSystemTools::IsOn(i.GetValue());
+ prop.Value = cmSystemTools::IsOn(i.GetValue().c_str());
}
else if(i.GetType() == cmCacheManager::PATH)
{
diff --git a/Source/cmAddCompileOptionsCommand.h b/Source/cmAddCompileOptionsCommand.h
index 38ed208..f147ec0 100644
--- a/Source/cmAddCompileOptionsCommand.h
+++ b/Source/cmAddCompileOptionsCommand.h
@@ -35,7 +35,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "add_compile_options";}
+ virtual std::string GetName() const {return "add_compile_options";}
cmTypeMacro(cmAddCompileOptionsCommand, cmCommand);
};
diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h
index 114957f..1d6ddb2 100644
--- a/Source/cmAddCustomCommandCommand.h
+++ b/Source/cmAddCustomCommandCommand.h
@@ -41,7 +41,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "add_custom_command";}
+ virtual std::string GetName() const {return "add_custom_command";}
cmTypeMacro(cmAddCustomCommandCommand, cmCommand);
protected:
diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h
index d0fcdad..d2b00ad 100644
--- a/Source/cmAddCustomTargetCommand.h
+++ b/Source/cmAddCustomTargetCommand.h
@@ -42,7 +42,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const
+ virtual std::string GetName() const
{return "add_custom_target";}
cmTypeMacro(cmAddCustomTargetCommand, cmCommand);
diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h
index d05f187..9800fd2 100644
--- a/Source/cmAddDefinitionsCommand.h
+++ b/Source/cmAddDefinitionsCommand.h
@@ -41,7 +41,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "add_definitions";}
+ virtual std::string GetName() const {return "add_definitions";}
cmTypeMacro(cmAddDefinitionsCommand, cmCommand);
};
diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h
index 247cc54..db3712a 100644
--- a/Source/cmAddDependenciesCommand.h
+++ b/Source/cmAddDependenciesCommand.h
@@ -40,7 +40,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "add_dependencies";}
+ virtual std::string GetName() const { return "add_dependencies";}
cmTypeMacro(cmAddDependenciesCommand, cmCommand);
};
diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h
index 30ecce3..e134077 100644
--- a/Source/cmAddExecutableCommand.h
+++ b/Source/cmAddExecutableCommand.h
@@ -41,7 +41,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "add_executable";}
+ virtual std::string GetName() const { return "add_executable";}
cmTypeMacro(cmAddExecutableCommand, cmCommand);
};
diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h
index 1001043..350708b 100644
--- a/Source/cmAddLibraryCommand.h
+++ b/Source/cmAddLibraryCommand.h
@@ -41,7 +41,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "add_library";}
+ virtual std::string GetName() const { return "add_library";}
cmTypeMacro(cmAddLibraryCommand, cmCommand);
};
diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h
index 1e5b1ab..abf3efc 100644
--- a/Source/cmAddSubDirectoryCommand.h
+++ b/Source/cmAddSubDirectoryCommand.h
@@ -42,7 +42,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "add_subdirectory";}
+ virtual std::string GetName() const { return "add_subdirectory";}
cmTypeMacro(cmAddSubDirectoryCommand, cmCommand);
};
diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h
index 9173454..624288f 100644
--- a/Source/cmAddTestCommand.h
+++ b/Source/cmAddTestCommand.h
@@ -40,7 +40,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "add_test";}
+ virtual std::string GetName() const { return "add_test";}
cmTypeMacro(cmAddTestCommand, cmCommand);
private:
diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h
index 8b5fa8a..6615273 100644
--- a/Source/cmAuxSourceDirectoryCommand.h
+++ b/Source/cmAuxSourceDirectoryCommand.h
@@ -44,7 +44,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "aux_source_directory";}
+ virtual std::string GetName() const { return "aux_source_directory";}
cmTypeMacro(cmAuxSourceDirectoryCommand, cmCommand);
};
diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h
index 52f0e9c..1fcae50 100644
--- a/Source/cmBreakCommand.h
+++ b/Source/cmBreakCommand.h
@@ -45,7 +45,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "break";}
+ virtual std::string GetName() const {return "break";}
cmTypeMacro(cmBreakCommand, cmCommand);
};
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index c06b8ad..780ffa8 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -44,7 +44,7 @@ bool cmBuildCommand
// Parse remaining arguments.
const char* configuration = 0;
const char* project_name = 0;
- const char* target = 0;
+ std::string target;
enum Doing { DoingNone, DoingConfiguration, DoingProjectName, DoingTarget };
Doing doing = DoingNone;
for(unsigned int i=1; i < args.size(); ++i)
@@ -74,7 +74,7 @@ bool cmBuildCommand
else if(doing == DoingTarget)
{
doing = DoingNone;
- target = args[i].c_str();
+ target = args[i];
}
else
{
@@ -107,7 +107,7 @@ bool cmBuildCommand
std::string makecommand = this->Makefile->GetLocalGenerator()
->GetGlobalGenerator()->GenerateCMakeBuildCommand(target, configuration,
- 0, true);
+ "", true);
this->Makefile->AddDefinition(variable, makecommand.c_str());
@@ -136,8 +136,8 @@ bool cmBuildCommand
}
std::string makecommand = this->Makefile->GetLocalGenerator()
- ->GetGlobalGenerator()->GenerateCMakeBuildCommand(0, configType.c_str(),
- 0, true);
+ ->GetGlobalGenerator()->GenerateCMakeBuildCommand("", configType.c_str(),
+ "", true);
if(cacheValue)
{
diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h
index 2160655..3fb618f 100644
--- a/Source/cmBuildCommand.h
+++ b/Source/cmBuildCommand.h
@@ -50,7 +50,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "build_command";}
+ virtual std::string GetName() const {return "build_command";}
cmTypeMacro(cmBuildCommand, cmCommand);
};
diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h
index 2f7acde..8f8038f 100644
--- a/Source/cmBuildNameCommand.h
+++ b/Source/cmBuildNameCommand.h
@@ -21,7 +21,7 @@ public:
virtual cmCommand* Clone() { return new cmBuildNameCommand; }
virtual bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus &status);
- virtual const char* GetName() const {return "build_name";}
+ virtual std::string GetName() const {return "build_name";}
virtual bool IsScriptable() const { return true; }
virtual bool IsDiscouraged() const { return true; }
};
diff --git a/Source/cmCMakeHostSystemInformationCommand.h b/Source/cmCMakeHostSystemInformationCommand.h
index 27ba638..463b180 100644
--- a/Source/cmCMakeHostSystemInformationCommand.h
+++ b/Source/cmCMakeHostSystemInformationCommand.h
@@ -48,7 +48,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const
+ virtual std::string GetName() const
{
return "cmake_host_system_information";
}
diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h
index 0cdd4c5..31b7271 100644
--- a/Source/cmCMakeMinimumRequired.h
+++ b/Source/cmCMakeMinimumRequired.h
@@ -45,7 +45,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "cmake_minimum_required";}
+ virtual std::string GetName() const {return "cmake_minimum_required";}
cmTypeMacro(cmCMakeMinimumRequired, cmCommand);
diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h
index 7e3f4e6..8dc8fbe 100644
--- a/Source/cmCMakePolicyCommand.h
+++ b/Source/cmCMakePolicyCommand.h
@@ -46,7 +46,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "cmake_policy";}
+ virtual std::string GetName() const {return "cmake_policy";}
cmTypeMacro(cmCMakePolicyCommand, cmCommand);
private:
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index acedc1a..ee9b664 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1153,7 +1153,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string* output,
int* retVal, const char* dir, int timeout, std::ostream& ofs)
{
// First generate the command and arguments
- std::vector<cmStdString> args = cmSystemTools::ParseArguments(command);
+ std::vector<std::string> args = cmSystemTools::ParseArguments(command);
if(args.size() < 1)
{
@@ -1161,7 +1161,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string* output,
}
std::vector<const char*> argv;
- for(std::vector<cmStdString>::const_iterator a = args.begin();
+ for(std::vector<std::string>::const_iterator a = args.begin();
a != args.end(); ++a)
{
argv.push_back(a->c_str());
@@ -1637,7 +1637,7 @@ int cmCTest::GenerateCTestNotesOutput(std::ostream& os,
}
//----------------------------------------------------------------------
-int cmCTest::GenerateNotesFile(const std::vector<cmStdString> &files)
+int cmCTest::GenerateNotesFile(const VectorOfStrings &files)
{
cmGeneratedFileStream ofs;
if ( !this->OpenOutputFile(this->CurrentTag, "Notes.xml", ofs) )
@@ -1658,7 +1658,7 @@ int cmCTest::GenerateNotesFile(const char* cfiles)
return 1;
}
- std::vector<cmStdString> files;
+ VectorOfStrings files;
cmCTestLog(this, OUTPUT, "Create notes file" << std::endl);
@@ -1675,7 +1675,7 @@ int cmCTest::GenerateNotesFile(const char* cfiles)
std::string cmCTest::Base64GzipEncodeFile(std::string file)
{
std::string tarFile = file + "_temp.tar.gz";
- std::vector<cmStdString> files;
+ std::vector<std::string> files;
files.push_back(file);
if(!cmSystemTools::CreateTar(tarFile.c_str(), files, true, false, false))
@@ -1722,9 +1722,9 @@ std::string cmCTest::Base64EncodeFile(std::string file)
//----------------------------------------------------------------------
-bool cmCTest::SubmitExtraFiles(const std::vector<cmStdString> &files)
+bool cmCTest::SubmitExtraFiles(const VectorOfStrings &files)
{
- std::vector<cmStdString>::const_iterator it;
+ VectorOfStrings::const_iterator it;
for ( it = files.begin();
it != files.end();
++ it )
@@ -1749,7 +1749,7 @@ bool cmCTest::SubmitExtraFiles(const char* cfiles)
return 1;
}
- std::vector<cmStdString> files;
+ VectorOfStrings files;
cmCTestLog(this, OUTPUT, "Submit extra files" << std::endl);
@@ -2126,7 +2126,7 @@ void cmCTest::HandleCommandLineArguments(size_t &i,
if(this->CheckArgument(arg, "--overwrite") && i < args.size() - 1)
{
i++;
- this->AddCTestConfigurationOverwrite(args[i].c_str());
+ this->AddCTestConfigurationOverwrite(args[i]);
}
if(this->CheckArgument(arg, "-A", "--add-notes") && i < args.size() - 1)
{
@@ -2593,13 +2593,9 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf)
}
//----------------------------------------------------------------------
-void cmCTest::PopulateCustomVector(cmMakefile* mf, const char* def,
- VectorOfStrings& vec)
+void cmCTest::PopulateCustomVector(cmMakefile* mf, const std::string& def,
+ std::vector<std::string>& vec)
{
- if ( !def)
- {
- return;
- }
const char* dval = mf->GetDefinition(def);
if ( !dval )
{
@@ -2620,12 +2616,9 @@ void cmCTest::PopulateCustomVector(cmMakefile* mf, const char* def,
}
//----------------------------------------------------------------------
-void cmCTest::PopulateCustomInteger(cmMakefile* mf, const char* def, int& val)
+void cmCTest::PopulateCustomInteger(cmMakefile* mf, const std::string& def,
+ int& val)
{
- if ( !def)
- {
- return;
- }
const char* dval = mf->GetDefinition(def);
if ( !dval )
{
@@ -2702,7 +2695,7 @@ std::string cmCTest::GetShortPathToFile(const char* cfname)
}
//----------------------------------------------------------------------
-std::string cmCTest::GetCTestConfiguration(const char *name)
+std::string cmCTest::GetCTestConfiguration(const std::string& name)
{
if ( this->CTestConfigurationOverwrites.find(name) !=
this->CTestConfigurationOverwrites.end() )
@@ -2847,9 +2840,8 @@ void cmCTest::AddSubmitFile(Part part, const char* name)
}
//----------------------------------------------------------------------
-void cmCTest::AddCTestConfigurationOverwrite(const char* encstr)
+void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr)
{
- std::string overStr = encstr;
size_t epos = overStr.find("=");
if ( epos == overStr.npos )
{
@@ -2877,7 +2869,7 @@ void cmCTest::SetConfigType(const char* ct)
//----------------------------------------------------------------------
bool cmCTest::SetCTestConfigurationFromCMakeVariable(cmMakefile* mf,
- const char* dconfig, const char* cmake_var)
+ const char* dconfig, const std::string& cmake_var)
{
const char* ctvar;
ctvar = mf->GetDefinition(cmake_var);
@@ -2900,7 +2892,7 @@ bool cmCTest::RunCommand(
const char* dir,
double timeout)
{
- std::vector<cmStdString> args = cmSystemTools::ParseArguments(command);
+ std::vector<std::string> args = cmSystemTools::ParseArguments(command);
if(args.size() < 1)
{
@@ -2908,7 +2900,7 @@ bool cmCTest::RunCommand(
}
std::vector<const char*> argv;
- for(std::vector<cmStdString>::const_iterator a = args.begin();
+ for(std::vector<std::string>::const_iterator a = args.begin();
a != args.end(); ++a)
{
argv.push_back(a->c_str());
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index becb0f5..836e41d 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -70,8 +70,8 @@ public:
{
PartInfo(): Enabled(false) {}
- void SetName(const char* name) { this->Name = name; }
- const char* GetName() const { return this->Name.c_str(); }
+ void SetName(const std::string& name) { this->Name = name; }
+ const std::string& GetName() const { return this->Name; }
void Enable() { this->Enabled = true; }
operator bool() const { return this->Enabled; }
@@ -101,8 +101,8 @@ public:
if the string does not name a valid part. */
Part GetPartFromName(const char* name);
- typedef std::vector<cmStdString> VectorOfStrings;
- typedef std::set<cmStdString> SetOfStrings;
+ typedef std::vector<cmsys::String> VectorOfStrings;
+ typedef std::set<std::string> SetOfStrings;
///! Process Command line arguments
int Run(std::vector<std::string> &, std::string* output = 0);
@@ -172,7 +172,7 @@ public:
std::string GetTestModelString();
static int GetTestModelFromString(const char* str);
static std::string CleanString(const std::string& str);
- std::string GetCTestConfiguration(const char *name);
+ std::string GetCTestConfiguration(const std::string& name);
void SetCTestConfiguration(const char *name, const char* value);
void EmptyCTestConfiguration();
@@ -185,9 +185,9 @@ public:
//! Set the notes files to be created.
void SetNotesFiles(const char* notes);
- void PopulateCustomVector(cmMakefile* mf, const char* definition,
- VectorOfStrings& vec);
- void PopulateCustomInteger(cmMakefile* mf, const char* def,
+ void PopulateCustomVector(cmMakefile* mf, const std::string& definition,
+ std::vector<std::string>& vec);
+ void PopulateCustomInteger(cmMakefile* mf, const std::string& def,
int& val);
///! Get the current time as string
@@ -332,7 +332,7 @@ public:
* Set the CTest variable from CMake variable
*/
bool SetCTestConfigurationFromCMakeVariable(cmMakefile* mf,
- const char* dconfig, const char* cmake_var);
+ const char* dconfig, const std::string& cmake_var);
//! Make string safe to be send as an URL
static std::string MakeURLSafe(const std::string&);
@@ -349,14 +349,14 @@ public:
//! Add overwrite to ctest configuration.
// The format is key=value
- void AddCTestConfigurationOverwrite(const char* encstr);
+ void AddCTestConfigurationOverwrite(const std::string& encstr);
//! Create XML file that contains all the notes specified
- int GenerateNotesFile(const std::vector<cmStdString> &files);
+ int GenerateNotesFile(const VectorOfStrings &files);
//! Submit extra files to the server
bool SubmitExtraFiles(const char* files);
- bool SubmitExtraFiles(const std::vector<cmStdString> &files);
+ bool SubmitExtraFiles(const VectorOfStrings &files);
//! Set the output log file name
void SetOutputLogFileName(const char* name);
@@ -391,7 +391,7 @@ public:
//! Read the custom configuration files and apply them to the current ctest
int ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf);
- std::vector<cmStdString> &GetInitialCommandLineArguments()
+ std::vector<std::string> &GetInitialCommandLineArguments()
{ return this->InitialCommandLineArguments; };
//! Set the track to submit to
@@ -447,13 +447,13 @@ private:
void DetermineNextDayStop();
// these are helper classes
- typedef std::map<cmStdString,cmCTestGenericHandler*> t_TestingHandlers;
+ typedef std::map<std::string,cmCTestGenericHandler*> t_TestingHandlers;
t_TestingHandlers TestingHandlers;
bool ShowOnly;
//! Map of configuration properties
- typedef std::map<cmStdString, cmStdString> CTestConfigurationMap;
+ typedef std::map<std::string, std::string> CTestConfigurationMap;
std::string CTestConfigFile;
// TODO: The ctest configuration should be a hierarchy of
@@ -463,7 +463,7 @@ private:
CTestConfigurationMap CTestConfiguration;
CTestConfigurationMap CTestConfigurationOverwrites;
PartInfo Parts[PartCount];
- typedef std::map<cmStdString, Part> PartMapType;
+ typedef std::map<std::string, Part> PartMapType;
PartMapType PartMap;
std::string CurrentTag;
@@ -556,7 +556,7 @@ private:
int DartVersion;
bool DropSiteCDash;
- std::vector<cmStdString> InitialCommandLineArguments;
+ std::vector<std::string> InitialCommandLineArguments;
int SubmitIndex;
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 9e0064e..159f9c3 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -82,19 +82,19 @@ bool cmCacheManager::LoadCache(cmMakefile* mf)
}
-bool cmCacheManager::LoadCache(const char* path)
+bool cmCacheManager::LoadCache(const std::string& path)
{
return this->LoadCache(path,true);
}
-bool cmCacheManager::LoadCache(const char* path,
+bool cmCacheManager::LoadCache(const std::string& path,
bool internal)
{
- std::set<cmStdString> emptySet;
+ std::set<std::string> emptySet;
return this->LoadCache(path, internal, emptySet, emptySet);
}
-static bool ParseEntryWithoutType(const char* entry,
+static bool ParseEntryWithoutType(const std::string& entry,
std::string& var,
std::string& value)
{
@@ -132,7 +132,7 @@ static bool ParseEntryWithoutType(const char* entry,
return flag;
}
-bool cmCacheManager::ParseEntry(const char* entry,
+bool cmCacheManager::ParseEntry(const std::string& entry,
std::string& var,
std::string& value,
CacheEntryType& type)
@@ -178,7 +178,7 @@ bool cmCacheManager::ParseEntry(const char* entry,
return flag;
}
-void cmCacheManager::CleanCMakeFiles(const char* path)
+void cmCacheManager::CleanCMakeFiles(const std::string& path)
{
std::string glob = path;
glob += cmake::GetCMakeFilesDirectory();
@@ -193,10 +193,10 @@ void cmCacheManager::CleanCMakeFiles(const char* path)
}
}
-bool cmCacheManager::LoadCache(const char* path,
+bool cmCacheManager::LoadCache(const std::string& path,
bool internal,
- std::set<cmStdString>& excludes,
- std::set<cmStdString>& includes)
+ std::set<std::string>& excludes,
+ std::set<std::string>& includes)
{
std::string cacheFile = path;
cacheFile += "/CMakeCache.txt";
@@ -428,7 +428,7 @@ bool cmCacheManager::SaveCache(cmMakefile* mf)
}
-bool cmCacheManager::SaveCache(const char* path)
+bool cmCacheManager::SaveCache(const std::string& path)
{
std::string cacheFile = path;
cacheFile += "/CMakeCache.txt";
@@ -500,7 +500,7 @@ bool cmCacheManager::SaveCache(const char* path)
fout << "########################\n";
fout << "\n";
- for( std::map<cmStdString, CacheEntry>::const_iterator i =
+ for( std::map<std::string, CacheEntry>::const_iterator i =
this->Cache.begin(); i != this->Cache.end(); ++i)
{
const CacheEntry& ce = (*i).second;
@@ -578,7 +578,7 @@ bool cmCacheManager::SaveCache(const char* path)
return true;
}
-bool cmCacheManager::DeleteCache(const char* path)
+bool cmCacheManager::DeleteCache(const std::string& path)
{
std::string cacheFile = path;
cmSystemTools::ConvertToUnixSlashes(cacheFile);
@@ -650,7 +650,7 @@ void cmCacheManager::OutputHelpString(std::ostream& fout,
}
}
-void cmCacheManager::RemoveCacheEntry(const char* key)
+void cmCacheManager::RemoveCacheEntry(const std::string& key)
{
CacheEntryMap::iterator i = this->Cache.find(key);
if(i != this->Cache.end())
@@ -660,7 +660,8 @@ void cmCacheManager::RemoveCacheEntry(const char* key)
}
-cmCacheManager::CacheEntry *cmCacheManager::GetCacheEntry(const char* key)
+cmCacheManager::CacheEntry *cmCacheManager::GetCacheEntry(
+ const std::string& key)
{
CacheEntryMap::iterator i = this->Cache.find(key);
if(i != this->Cache.end())
@@ -676,7 +677,7 @@ cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator(
return CacheIterator(*this, key);
}
-const char* cmCacheManager::GetCacheValue(const char* key) const
+const char* cmCacheManager::GetCacheValue(const std::string& key) const
{
CacheEntryMap::const_iterator i = this->Cache.find(key);
if(i != this->Cache.end() &&
@@ -692,7 +693,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const
{
out << "=================================================" << std::endl;
out << "CMakeCache Contents:" << std::endl;
- for(std::map<cmStdString, CacheEntry>::const_iterator i =
+ for(std::map<std::string, CacheEntry>::const_iterator i =
this->Cache.begin(); i != this->Cache.end(); ++i)
{
if((*i).second.Type != INTERNAL)
@@ -708,7 +709,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const
}
-void cmCacheManager::AddCacheEntry(const char* key,
+void cmCacheManager::AddCacheEntry(const std::string& key,
const char* value,
const char* helpString,
CacheEntryType type)
@@ -767,7 +768,7 @@ void cmCacheManager::CacheIterator::Begin()
this->Position = this->Container.Cache.begin();
}
-bool cmCacheManager::CacheIterator::Find(const char* key)
+bool cmCacheManager::CacheIterator::Find(const std::string& key)
{
this->Position = this->Container.Cache.find(key);
return !this->IsAtEnd();
@@ -807,13 +808,13 @@ bool cmCacheManager::CacheIterator::GetValueAsBool() const
//----------------------------------------------------------------------------
const char*
-cmCacheManager::CacheEntry::GetProperty(const char* prop) const
+cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const
{
- if(strcmp(prop, "TYPE") == 0)
+ if(prop == "TYPE")
{
return cmCacheManagerTypes[this->Type];
}
- else if(strcmp(prop, "VALUE") == 0)
+ else if(prop == "VALUE")
{
return this->Value.c_str();
}
@@ -823,14 +824,14 @@ cmCacheManager::CacheEntry::GetProperty(const char* prop) const
}
//----------------------------------------------------------------------------
-void cmCacheManager::CacheEntry::SetProperty(const char* prop,
+void cmCacheManager::CacheEntry::SetProperty(const std::string& prop,
const char* value)
{
- if(strcmp(prop, "TYPE") == 0)
+ if(prop == "TYPE")
{
this->Type = cmCacheManager::StringToType(value? value : "STRING");
}
- else if(strcmp(prop, "VALUE") == 0)
+ else if(prop == "VALUE")
{
this->Value = value? value : "";
}
@@ -841,15 +842,15 @@ void cmCacheManager::CacheEntry::SetProperty(const char* prop,
}
//----------------------------------------------------------------------------
-void cmCacheManager::CacheEntry::AppendProperty(const char* prop,
+void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop,
const char* value,
bool asString)
{
- if(strcmp(prop, "TYPE") == 0)
+ if(prop == "TYPE")
{
this->Type = cmCacheManager::StringToType(value? value : "STRING");
}
- else if(strcmp(prop, "VALUE") == 0)
+ else if(prop == "VALUE")
{
if(value)
{
@@ -867,7 +868,8 @@ void cmCacheManager::CacheEntry::AppendProperty(const char* prop,
}
//----------------------------------------------------------------------------
-const char* cmCacheManager::CacheIterator::GetProperty(const char* prop) const
+const char* cmCacheManager::CacheIterator::GetProperty(
+ const std::string& prop) const
{
if(!this->IsAtEnd())
{
@@ -877,7 +879,8 @@ const char* cmCacheManager::CacheIterator::GetProperty(const char* prop) const
}
//----------------------------------------------------------------------------
-void cmCacheManager::CacheIterator::SetProperty(const char* p, const char* v)
+void cmCacheManager::CacheIterator::SetProperty(const std::string& p,
+ const char* v)
{
if(!this->IsAtEnd())
{
@@ -886,7 +889,7 @@ void cmCacheManager::CacheIterator::SetProperty(const char* p, const char* v)
}
//----------------------------------------------------------------------------
-void cmCacheManager::CacheIterator::AppendProperty(const char* p,
+void cmCacheManager::CacheIterator::AppendProperty(const std::string& p,
const char* v,
bool asString)
{
@@ -897,7 +900,8 @@ void cmCacheManager::CacheIterator::AppendProperty(const char* p,
}
//----------------------------------------------------------------------------
-bool cmCacheManager::CacheIterator::GetPropertyAsBool(const char* prop) const
+bool cmCacheManager::CacheIterator::GetPropertyAsBool(
+ const std::string& prop) const
{
if(const char* value = this->GetProperty(prop))
{
@@ -907,13 +911,14 @@ bool cmCacheManager::CacheIterator::GetPropertyAsBool(const char* prop) const
}
//----------------------------------------------------------------------------
-void cmCacheManager::CacheIterator::SetProperty(const char* p, bool v)
+void cmCacheManager::CacheIterator::SetProperty(const std::string& p, bool v)
{
this->SetProperty(p, v ? "ON" : "OFF");
}
//----------------------------------------------------------------------------
-bool cmCacheManager::CacheIterator::PropertyExists(const char* prop) const
+bool cmCacheManager::CacheIterator::PropertyExists(
+ const std::string& prop) const
{
return this->GetProperty(prop)? true:false;
}
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index f487e8e..d9a9112 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -39,9 +39,9 @@ private:
std::string Value;
CacheEntryType Type;
cmPropertyMap Properties;
- const char* GetProperty(const char*) const;
- void SetProperty(const char* property, const char* value);
- void AppendProperty(const char* property, const char* value,
+ const char* GetProperty(const std::string&) const;
+ void SetProperty(const std::string& property, const char* value);
+ void AppendProperty(const std::string& property, const char* value,
bool asString=false);
bool Initialized;
CacheEntry() : Value(""), Type(UNINITIALIZED), Initialized(false)
@@ -53,26 +53,26 @@ public:
{
public:
void Begin();
- bool Find(const char*);
+ bool Find(const std::string&);
bool IsAtEnd() const;
void Next();
- const char *GetName() const {
- return this->Position->first.c_str(); }
- const char* GetProperty(const char*) const ;
- bool GetPropertyAsBool(const char*) const ;
- bool PropertyExists(const char*) const;
- void SetProperty(const char* property, const char* value);
- void AppendProperty(const char* property, const char* value,
+ std::string GetName() const {
+ return this->Position->first; }
+ const char* GetProperty(const std::string&) const ;
+ bool GetPropertyAsBool(const std::string&) const ;
+ bool PropertyExists(const std::string&) const;
+ void SetProperty(const std::string& property, const char* value);
+ void AppendProperty(const std::string& property, const char* value,
bool asString=false);
- void SetProperty(const char* property, bool value);
- const char* GetValue() const { return this->GetEntry().Value.c_str(); }
+ void SetProperty(const std::string& property, bool value);
+ std::string GetValue() const { return this->GetEntry().Value; }
bool GetValueAsBool() const;
void SetValue(const char*);
CacheEntryType GetType() const { return this->GetEntry().Type; }
void SetType(CacheEntryType ty) { this->GetEntry().Type = ty; }
bool Initialized() { return this->GetEntry().Initialized; }
cmCacheManager &Container;
- std::map<cmStdString, CacheEntry>::iterator Position;
+ std::map<std::string, CacheEntry>::iterator Position;
CacheIterator(cmCacheManager &cm) : Container(cm) {
this->Begin();
}
@@ -108,19 +108,19 @@ public:
///! Load a cache for given makefile. Loads from ouput home.
bool LoadCache(cmMakefile*);
///! Load a cache for given makefile. Loads from path/CMakeCache.txt.
- bool LoadCache(const char* path);
- bool LoadCache(const char* path, bool internal);
- bool LoadCache(const char* path, bool internal,
- std::set<cmStdString>& excludes,
- std::set<cmStdString>& includes);
+ bool LoadCache(const std::string& path);
+ bool LoadCache(const std::string& path, bool internal);
+ bool LoadCache(const std::string& path, bool internal,
+ std::set<std::string>& excludes,
+ std::set<std::string>& includes);
///! Save cache for given makefile. Saves to ouput home CMakeCache.txt.
bool SaveCache(cmMakefile*) ;
///! Save cache for given makefile. Saves to ouput path/CMakeCache.txt
- bool SaveCache(const char* path) ;
+ bool SaveCache(const std::string& path) ;
///! Delete the cache given
- bool DeleteCache(const char* path);
+ bool DeleteCache(const std::string& path);
///! Print the cache to a stream
void PrintCache(std::ostream&) const;
@@ -129,20 +129,20 @@ public:
cmCacheManager::CacheIterator GetCacheIterator(const char *key=0);
///! Remove an entry from the cache
- void RemoveCacheEntry(const char* key);
+ void RemoveCacheEntry(const std::string& key);
///! Get the number of entries in the cache
int GetSize() {
return static_cast<int>(this->Cache.size()); }
///! Break up a line like VAR:type="value" into var, type and value
- static bool ParseEntry(const char* entry,
+ static bool ParseEntry(const std::string& entry,
std::string& var,
std::string& value,
CacheEntryType& type);
///! Get a value from the cache given a key
- const char* GetCacheValue(const char* key) const;
+ const char* GetCacheValue(const std::string& key) const;
/** Get the version of CMake that wrote the cache. */
unsigned int GetCacheMajorVersion() const
@@ -153,20 +153,20 @@ public:
protected:
///! Add an entry into the cache
- void AddCacheEntry(const char* key, const char* value,
+ void AddCacheEntry(const std::string& key, const char* value,
const char* helpString, CacheEntryType type);
///! Get a cache entry object for a key
- CacheEntry *GetCacheEntry(const char *key);
+ CacheEntry *GetCacheEntry(const std::string& key);
///! Clean out the CMakeFiles directory if no CMakeCache.txt
- void CleanCMakeFiles(const char* path);
+ void CleanCMakeFiles(const std::string& path);
// Cache version info
unsigned int CacheMajorVersion;
unsigned int CacheMinorVersion;
private:
cmake* CMakeInstance;
- typedef std::map<cmStdString, CacheEntry> CacheEntryMap;
+ typedef std::map<std::string, CacheEntry> CacheEntryMap;
static void OutputHelpString(std::ostream& fout,
const std::string& helpString);
static void OutputKey(std::ostream& fout, std::string const& key);
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index e148857..b15869a 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -124,7 +124,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const = 0;
+ virtual std::string GetName() const = 0;
/**
* Enable the command.
@@ -166,7 +166,7 @@ public:
/**
* Set the error message
*/
- void SetError(const char* e)
+ void SetError(const std::string& e)
{
this->Error = this->GetName();
this->Error += " ";
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index dbeeb07..6284cb7 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -49,14 +49,14 @@ void cmCommandArgumentParserHelper::SetLineFile(long line, const char* file)
this->FileName = file;
}
-char* cmCommandArgumentParserHelper::AddString(const char* str)
+char* cmCommandArgumentParserHelper::AddString(const std::string& str)
{
- if ( !str || !*str )
+ if ( str.empty() )
{
return this->EmptyVariable;
}
- char* stVal = new char[strlen(str)+1];
- strcpy(stVal, str);
+ char* stVal = new char[str.size()+1];
+ strcpy(stVal, str.c_str());
this->Variables.push_back(stVal);
return stVal;
}
@@ -153,7 +153,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
{
return this->AddString(cmSystemTools::EscapeQuotes(value).c_str());
}
- return this->AddString(value);
+ return this->AddString(value ? value : "");
}
char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var)
@@ -166,7 +166,7 @@ char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var)
// then return an empty string
if(!ret && this->RemoveEmpty)
{
- return this->AddString(ret);
+ return this->AddString("");
}
// if the ret was not 0, then return it
if(ret)
diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h
index f8c672f..d375ae6 100644
--- a/Source/cmCommandArgumentParserHelper.h
+++ b/Source/cmCommandArgumentParserHelper.h
@@ -77,8 +77,8 @@ public:
char BSLASHVariable[3];
private:
- cmStdString::size_type InputBufferPos;
- cmStdString InputBuffer;
+ std::string::size_type InputBufferPos;
+ std::string InputBuffer;
std::vector<char> OutputBuffer;
int CurrentLine;
int Verbose;
@@ -86,7 +86,7 @@ private:
void Print(const char* place, const char* str);
void SafePrintMissing(const char* str, int line, int cnt);
- char* AddString(const char* str);
+ char* AddString(const std::string& str);
void CleanupParser();
void SetError(std::string const& msg);
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 1be5980..2d1da55 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -172,7 +172,7 @@ satisfy dependencies.
//----------------------------------------------------------------------------
cmComputeLinkDepends
-::cmComputeLinkDepends(cmTarget const* target, const char* config,
+::cmComputeLinkDepends(cmTarget const* target, const std::string& config,
cmTarget const* head)
{
// Store context information.
@@ -184,7 +184,8 @@ cmComputeLinkDepends
this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance();
// The configuration being linked.
- this->Config = (config && *config)? config : 0;
+ this->HasConfig = !config.empty();
+ this->Config = (this->HasConfig)? config : std::string();
this->LinkType = this->Target->ComputeLinkType(this->Config);
// Enable debug mode if requested.
@@ -254,7 +255,8 @@ cmComputeLinkDepends::Compute()
"---------------------------------------"
"---------------------------------------\n");
fprintf(stderr, "Link dependency analysis for target %s, config %s\n",
- this->Target->GetName(), this->Config?this->Config:"noconfig");
+ this->Target->GetName().c_str(),
+ this->HasConfig?this->Config.c_str():"noconfig");
this->DisplayConstraintGraph();
}
@@ -278,12 +280,12 @@ cmComputeLinkDepends::Compute()
}
//----------------------------------------------------------------------------
-std::map<cmStdString, int>::iterator
+std::map<std::string, int>::iterator
cmComputeLinkDepends::AllocateLinkEntry(std::string const& item)
{
- std::map<cmStdString, int>::value_type
+ std::map<std::string, int>::value_type
index_entry(item, static_cast<int>(this->EntryList.size()));
- std::map<cmStdString, int>::iterator
+ std::map<std::string, int>::iterator
lei = this->LinkEntryIndex.insert(index_entry).first;
this->EntryList.push_back(LinkEntry());
this->InferredDependSets.push_back(0);
@@ -296,7 +298,7 @@ int cmComputeLinkDepends::AddLinkEntry(int depender_index,
std::string const& item)
{
// Check if the item entry has already been added.
- std::map<cmStdString, int>::iterator lei = this->LinkEntryIndex.find(item);
+ std::map<std::string, int>::iterator lei = this->LinkEntryIndex.find(item);
if(lei != this->LinkEntryIndex.end())
{
// Yes. We do not need to follow the item's dependencies again.
@@ -422,7 +424,7 @@ cmComputeLinkDepends
void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
{
// Check if the target already has an entry.
- std::map<cmStdString, int>::iterator lei =
+ std::map<std::string, int>::iterator lei =
this->LinkEntryIndex.find(dep.Item);
if(lei == this->LinkEntryIndex.end())
{
@@ -620,7 +622,7 @@ cmComputeLinkDepends::AddLinkEntries(int depender_index,
//----------------------------------------------------------------------------
cmTarget const* cmComputeLinkDepends::FindTargetToLink(int depender_index,
- const char* name)
+ const std::string& name)
{
// Look for a target in the scope of the depender.
cmMakefile* mf = this->Makefile;
@@ -968,14 +970,14 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl)
//----------------------------------------------------------------------------
void cmComputeLinkDepends::DisplayFinalEntries()
{
- fprintf(stderr, "target [%s] links to:\n", this->Target->GetName());
+ fprintf(stderr, "target [%s] links to:\n", this->Target->GetName().c_str());
for(std::vector<LinkEntry>::const_iterator lei =
this->FinalLinkEntries.begin();
lei != this->FinalLinkEntries.end(); ++lei)
{
if(lei->Target)
{
- fprintf(stderr, " target [%s]\n", lei->Target->GetName());
+ fprintf(stderr, " target [%s]\n", lei->Target->GetName().c_str());
}
else
{
diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h
index 9776f55..13fc993 100644
--- a/Source/cmComputeLinkDepends.h
+++ b/Source/cmComputeLinkDepends.h
@@ -32,7 +32,7 @@ class cmake;
class cmComputeLinkDepends
{
public:
- cmComputeLinkDepends(cmTarget const* target, const char* config,
+ cmComputeLinkDepends(cmTarget const* target, const std::string& config,
cmTarget const* head);
~cmComputeLinkDepends();
@@ -68,7 +68,8 @@ private:
bool DebugMode;
// Configuration information.
- const char* Config;
+ bool HasConfig;
+ std::string Config;
cmTarget::LinkLibraryType LinkType;
// Output information.
@@ -76,18 +77,19 @@ private:
typedef cmTarget::LinkLibraryVectorType LinkLibraryVectorType;
- std::map<cmStdString, int>::iterator
+ std::map<std::string, int>::iterator
AllocateLinkEntry(std::string const& item);
int AddLinkEntry(int depender_index, std::string const& item);
void AddVarLinkEntries(int depender_index, const char* value);
void AddDirectLinkEntries();
void AddLinkEntries(int depender_index,
std::vector<std::string> const& libs);
- cmTarget const* FindTargetToLink(int depender_index, const char* name);
+ cmTarget const* FindTargetToLink(int depender_index,
+ const std::string& name);
// One entry for each unique item.
std::vector<LinkEntry> EntryList;
- std::map<cmStdString, int> LinkEntryIndex;
+ std::map<std::string, int> LinkEntryIndex;
// BFS of initial dependencies.
struct BFSEntry
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 6986965..62eaec2 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -239,7 +239,7 @@ because this need be done only for shared libraries without soname-s.
//----------------------------------------------------------------------------
cmComputeLinkInformation
-::cmComputeLinkInformation(cmTarget const* target, const char* config,
+::cmComputeLinkInformation(cmTarget const* target, const std::string& config,
cmTarget const* headTarget)
{
// Store context information.
@@ -268,7 +268,7 @@ cmComputeLinkInformation
// Get the language used for linking this target.
this->LinkLanguage = this->Target->GetLinkerLanguage(config, headTarget);
- if(!this->LinkLanguage)
+ if(this->LinkLanguage.empty())
{
// The Compute method will do nothing, so skip the rest of the
// initialization.
@@ -496,16 +496,17 @@ bool cmComputeLinkInformation::Compute()
}
// We require a link language for the target.
- if(!this->LinkLanguage)
+ if(this->LinkLanguage.empty())
{
cmSystemTools::
Error("CMake can not determine linker language for target: ",
- this->Target->GetName());
+ this->Target->GetName().c_str());
return false;
}
// Compute the ordered link line items.
- cmComputeLinkDepends cld(this->Target, this->Config, this->HeadTarget);
+ cmComputeLinkDepends cld(this->Target, this->Config.c_str(),
+ this->HeadTarget);
cld.SetOldLinkDirMode(this->OldLinkDirMode);
cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute();
@@ -624,7 +625,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
cmTarget const* tgt)
{
// Compute the proper name to use to link this library.
- const char* config = this->Config;
+ const std::string& config = this->Config;
bool impexe = (tgt && tgt->IsExecutableWithExports());
if(impexe && !this->UseImportLibrary && !this->LoaderFlag)
{
@@ -902,7 +903,7 @@ void cmComputeLinkInformation::ComputeItemParserInfo()
// be the library name. Match index 3 will be the library
// extension.
reg = "^(";
- for(std::set<cmStdString>::iterator p = this->LinkPrefixes.begin();
+ for(std::set<std::string>::iterator p = this->LinkPrefixes.begin();
p != this->LinkPrefixes.end(); ++p)
{
reg += *p;
@@ -1126,9 +1127,10 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item)
// Full path libraries should specify a valid library file name.
// See documentation of CMP0008.
+ std::string generator = this->GlobalGenerator->GetName();
if(this->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW &&
- (strstr(this->GlobalGenerator->GetName(), "Visual Studio") ||
- strstr(this->GlobalGenerator->GetName(), "Xcode")))
+ (generator.find("Visual Studio") != generator.npos ||
+ generator.find("Xcode") != generator.npos))
{
std::string file = cmSystemTools::GetFilenameName(item);
if(!this->ExtractAnyLibraryName.find(file.c_str()))
@@ -1640,7 +1642,7 @@ void cmComputeLinkInformation::PrintLinkPolicyDiagnosis(std::ostream& os)
// List the paths old behavior is adding.
os << "and other libraries with known full path:\n";
- std::set<cmStdString> emitted;
+ std::set<std::string> emitted;
for(std::vector<std::string>::const_iterator
i = this->OldLinkDirItems.begin();
i != this->OldLinkDirItems.end(); ++i)
@@ -1856,7 +1858,7 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath)
//----------------------------------------------------------------------------
static void cmCLI_ExpandListUnique(const char* str,
std::vector<std::string>& out,
- std::set<cmStdString>& emitted)
+ std::set<std::string>& emitted)
{
std::vector<std::string> tmp;
cmSystemTools::ExpandListArgument(str, tmp);
@@ -1894,7 +1896,7 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
this->Target->GetPropertyAsBool("INSTALL_RPATH_USE_LINK_PATH");
// Construct the RPATH.
- std::set<cmStdString> emitted;
+ std::set<std::string> emitted;
if(use_install_rpath)
{
const char* install_rpath = this->Target->GetProperty("INSTALL_RPATH");
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index 356e6ed..e345fe2 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -29,7 +29,7 @@ class cmOrderDirectories;
class cmComputeLinkInformation
{
public:
- cmComputeLinkInformation(cmTarget const* target, const char* config,
+ cmComputeLinkInformation(cmTarget const* target, const std::string& config,
cmTarget const* headTarget);
~cmComputeLinkInformation();
bool Compute();
@@ -50,7 +50,7 @@ public:
std::vector<std::string> const& GetDirectories();
std::vector<std::string> const& GetDepends();
std::vector<std::string> const& GetFrameworkPaths();
- const char* GetLinkLanguage() const { return this->LinkLanguage; }
+ std::string GetLinkLanguage() const { return this->LinkLanguage; }
std::vector<std::string> const& GetRuntimeSearchPath();
std::string const& GetRuntimeFlag() const { return this->RuntimeFlag; }
std::string const& GetRuntimeSep() const { return this->RuntimeSep; }
@@ -82,8 +82,8 @@ private:
cmake* CMakeInstance;
// Configuration information.
- const char* Config;
- const char* LinkLanguage;
+ std::string Config;
+ std::string LinkLanguage;
bool LinkDependsNoShared;
// Modes for dealing with dependent shared libraries.
@@ -126,7 +126,7 @@ private:
std::vector<std::string> StaticLinkExtensions;
std::vector<std::string> SharedLinkExtensions;
std::vector<std::string> LinkExtensions;
- std::set<cmStdString> LinkPrefixes;
+ std::set<std::string> LinkPrefixes;
cmsys::RegularExpression ExtractStaticLibraryName;
cmsys::RegularExpression ExtractSharedLibraryName;
cmsys::RegularExpression ExtractAnyLibraryName;
@@ -153,7 +153,7 @@ private:
// Framework info.
void ComputeFrameworkInfo();
void AddFrameworkPath(std::string const& p);
- std::set<cmStdString> FrameworkPathsEmmitted;
+ std::set<std::string> FrameworkPathsEmmitted;
cmsys::RegularExpression SplitFramework;
// Linker search path computation.
@@ -165,14 +165,14 @@ private:
void LoadImplicitLinkInfo();
void AddImplicitLinkInfo();
void AddImplicitLinkInfo(std::string const& lang);
- std::set<cmStdString> ImplicitLinkDirs;
- std::set<cmStdString> ImplicitLinkLibs;
+ std::set<std::string> ImplicitLinkDirs;
+ std::set<std::string> ImplicitLinkLibs;
// Additional paths configured by the runtime linker
std::vector<std::string> RuntimeLinkDirs;
// Linker search path compatibility mode.
- std::set<cmStdString> OldLinkDirMask;
+ std::set<std::string> OldLinkDirMask;
std::vector<std::string> OldLinkDirItems;
std::vector<std::string> OldUserFlagItems;
bool OldLinkDirMode;
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 6511510..10041db 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -211,10 +211,10 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
// dependencies in all targets, because the generated build-systems can't
// deal with config-specific dependencies.
{
- std::set<cmStdString> emitted;
+ std::set<std::string> emitted;
{
std::vector<std::string> tlibs;
- depender->GetDirectLinkLibraries(0, tlibs, depender);
+ depender->GetDirectLinkLibraries("", tlibs, depender);
// A target should not depend on itself.
emitted.insert(depender->GetName());
for(std::vector<std::string>::const_iterator lib = tlibs.begin();
@@ -255,11 +255,11 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
// Loop over all utility dependencies.
{
- std::set<cmStdString> const& tutils = depender->GetUtilities();
- std::set<cmStdString> emitted;
+ std::set<std::string> const& tutils = depender->GetUtilities();
+ std::set<std::string> emitted;
// A target should not depend on itself.
emitted.insert(depender->GetName());
- for(std::set<cmStdString>::const_iterator util = tutils.begin();
+ for(std::set<std::string>::const_iterator util = tutils.begin();
util != tutils.end(); ++util)
{
// Don't emit the same utility twice for this target.
@@ -274,8 +274,8 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
//----------------------------------------------------------------------------
void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
cmTarget const* dependee,
- const char *config,
- std::set<cmStdString> &emitted)
+ const std::string& config,
+ std::set<std::string> &emitted)
{
cmTarget const* depender = this->Targets[depender_index];
if(cmTarget::LinkInterface const* iface =
@@ -298,9 +298,9 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
//----------------------------------------------------------------------------
void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
- const char* dependee_name,
+ const std::string& dependee_name,
bool linking,
- std::set<cmStdString> &emitted)
+ std::set<std::string> &emitted)
{
cmTarget const* depender = this->Targets[depender_index];
cmTarget const* dependee =
@@ -317,7 +317,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
if(dependee)
{
- this->AddInterfaceDepends(depender_index, dependee, 0, emitted);
+ this->AddInterfaceDepends(depender_index, dependee, "", emitted);
std::vector<std::string> configs;
depender->GetMakefile()->GetConfigurations(configs);
for (std::vector<std::string>::const_iterator it = configs.begin();
@@ -333,7 +333,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
//----------------------------------------------------------------------------
void cmComputeTargetDepends::AddTargetDepend(int depender_index,
- const char* dependee_name,
+ const std::string& dependee_name,
bool linking)
{
// Get the depender.
@@ -406,8 +406,8 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
if(dependee->IsImported())
{
// Skip imported targets but follow their utility dependencies.
- std::set<cmStdString> const& utils = dependee->GetUtilities();
- for(std::set<cmStdString>::const_iterator i = utils.begin();
+ std::set<std::string> const& utils = dependee->GetUtilities();
+ for(std::set<std::string>::const_iterator i = utils.begin();
i != utils.end(); ++i)
{
if(cmTarget const* transitive_dependee =
@@ -434,22 +434,23 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
//----------------------------------------------------------------------------
void
-cmComputeTargetDepends::DisplayGraph(Graph const& graph, const char* name)
+cmComputeTargetDepends::DisplayGraph(Graph const& graph,
+ const std::string& name)
{
- fprintf(stderr, "The %s target dependency graph is:\n", name);
+ fprintf(stderr, "The %s target dependency graph is:\n", name.c_str());
int n = static_cast<int>(graph.size());
for(int depender_index = 0; depender_index < n; ++depender_index)
{
EdgeList const& nl = graph[depender_index];
cmTarget const* depender = this->Targets[depender_index];
fprintf(stderr, "target %d is [%s]\n",
- depender_index, depender->GetName());
+ depender_index, depender->GetName().c_str());
for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
int dependee_index = *ni;
cmTarget const* dependee = this->Targets[dependee_index];
fprintf(stderr, " depends on target %d [%s] (%s)\n", dependee_index,
- dependee->GetName(), ni->IsStrong()? "strong" : "weak");
+ dependee->GetName().c_str(), ni->IsStrong()? "strong" : "weak");
}
}
fprintf(stderr, "\n");
@@ -471,7 +472,7 @@ cmComputeTargetDepends
{
int i = *ni;
fprintf(stderr, " contains target %d [%s]\n",
- i, this->Targets[i]->GetName());
+ i, this->Targets[i]->GetName().c_str());
}
}
fprintf(stderr, "\n");
diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h
index 6cd6da0..7553816 100644
--- a/Source/cmComputeTargetDepends.h
+++ b/Source/cmComputeTargetDepends.h
@@ -45,16 +45,18 @@ private:
void CollectTargets();
void CollectDepends();
void CollectTargetDepends(int depender_index);
- void AddTargetDepend(int depender_index, const char* dependee_name,
+ void AddTargetDepend(int depender_index,
+ const std::string& dependee_name,
bool linking);
void AddTargetDepend(int depender_index, cmTarget const* dependee,
bool linking);
bool ComputeFinalDepends(cmComputeComponentGraph const& ccg);
- void AddInterfaceDepends(int depender_index, const char* dependee_name,
- bool linking, std::set<cmStdString> &emitted);
+ void AddInterfaceDepends(int depender_index,
+ const std::string& dependee_name,
+ bool linking, std::set<std::string> &emitted);
void AddInterfaceDepends(int depender_index, cmTarget const* dependee,
- const char *config,
- std::set<cmStdString> &emitted);
+ const std::string& config,
+ std::set<std::string> &emitted);
cmGlobalGenerator* GlobalGenerator;
bool DebugMode;
bool NoCycles;
@@ -71,7 +73,7 @@ private:
typedef cmGraphAdjacencyList Graph;
Graph InitialGraph;
Graph FinalGraph;
- void DisplayGraph(Graph const& graph, const char* name);
+ void DisplayGraph(Graph const& graph, const std::string& name);
// Deal with connected components.
void DisplayComponents(cmComputeComponentGraph const& ccg);
diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h
index 86de92c..8155ef7 100644
--- a/Source/cmConfigureFileCommand.h
+++ b/Source/cmConfigureFileCommand.h
@@ -34,7 +34,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "configure_file";}
+ virtual std::string GetName() const { return "configure_file";}
/**
* This determines if the command is invoked when in script mode.
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 7b52069..ab7b024 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -28,7 +28,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
const char* sourceDirectory = argv[2].c_str();
const char* projectName = 0;
- const char* targetName = 0;
+ std::string targetName;
std::vector<std::string> cmakeFlags;
std::vector<std::string> compileDefs;
std::string outputVariable;
@@ -249,7 +249,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
si != sources.end(); ++si)
{
std::string ext = cmSystemTools::GetFilenameLastExtension(*si);
- if(const char* lang = gg->GetLanguageFromExtension(ext.c_str()))
+ std::string lang = gg->GetLanguageFromExtension(ext.c_str());
+ if(!lang.empty())
{
testLangs.insert(lang);
}
@@ -356,7 +357,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
cmExportTryCompileFileGenerator tcfg;
tcfg.SetExportFile((this->BinaryDirectory + fname).c_str());
tcfg.SetExports(targets);
- tcfg.SetConfig(this->Makefile->GetDefinition(
+ tcfg.SetConfig(this->Makefile->GetSafeDefinition(
"CMAKE_TRY_COMPILE_CONFIGURATION"));
if(!tcfg.GenerateImportFile())
@@ -449,7 +450,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
fprintf(fout, "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n",
this->BinaryDirectory.c_str());
/* Create the actual executable. */
- fprintf(fout, "add_executable(%s", targetName);
+ fprintf(fout, "add_executable(%s", targetName.c_str());
for(std::vector<std::string>::iterator si = sources.begin();
si != sources.end(); ++si)
{
@@ -465,12 +466,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
if (useOldLinkLibs)
{
fprintf(fout,
- "target_link_libraries(%s ${LINK_LIBRARIES})\n",targetName);
+ "target_link_libraries(%s ${LINK_LIBRARIES})\n",
+ targetName.c_str());
}
else
{
fprintf(fout, "target_link_libraries(%s %s)\n",
- targetName,
+ targetName.c_str(),
libsToLink.c_str());
}
fclose(fout);
@@ -564,7 +566,7 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
cmsys::Directory dir;
dir.Load(binDir);
size_t fileNum;
- std::set<cmStdString> deletedFiles;
+ std::set<std::string> deletedFiles;
for (fileNum = 0; fileNum < dir.GetNumberOfFiles(); ++fileNum)
{
if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".") &&
@@ -609,7 +611,7 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
}
}
-void cmCoreTryCompile::FindOutputFile(const char* targetName)
+void cmCoreTryCompile::FindOutputFile(const std::string& targetName)
{
this->FindErrorMessage = "";
this->OutputFile = "";
diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h
index 5c67f13..3272462 100644
--- a/Source/cmCoreTryCompile.h
+++ b/Source/cmCoreTryCompile.h
@@ -44,7 +44,7 @@ public:
TryCompileCode. The result is stored in OutputFile. If nothing is found,
the error message is stored in FindErrorMessage.
*/
- void FindOutputFile(const char* targetName);
+ void FindOutputFile(const std::string& targetName);
cmTypeMacro(cmCoreTryCompile, cmCommand);
diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h
index 8b1e4de..2f6b541 100644
--- a/Source/cmCreateTestSourceList.h
+++ b/Source/cmCreateTestSourceList.h
@@ -40,7 +40,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "create_test_sourcelist";}
+ virtual std::string GetName() const {return "create_test_sourcelist";}
cmTypeMacro(cmCreateTestSourceList, cmCommand);
};
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx
index 7f4b10f..0d3c6bb 100644
--- a/Source/cmCryptoHash.cxx
+++ b/Source/cmCryptoHash.cxx
@@ -35,18 +35,18 @@ cmsys::auto_ptr<cmCryptoHash> cmCryptoHash::New(const char* algo)
}
//----------------------------------------------------------------------------
-std::string cmCryptoHash::HashString(const char* input)
+std::string cmCryptoHash::HashString(const std::string& input)
{
this->Initialize();
- this->Append(reinterpret_cast<unsigned char const*>(input),
- static_cast<int>(strlen(input)));
+ this->Append(reinterpret_cast<unsigned char const*>(&input[0]),
+ static_cast<int>(input.size()));
return this->Finalize();
}
//----------------------------------------------------------------------------
-std::string cmCryptoHash::HashFile(const char* file)
+std::string cmCryptoHash::HashFile(const std::string& file)
{
- cmsys::ifstream fin(file, std::ios::in | cmsys_ios_binary);
+ cmsys::ifstream fin(file.c_str(), std::ios::in | cmsys_ios_binary);
if(!fin)
{
return "";
diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h
index 1bea9ab..88cd240 100644
--- a/Source/cmCryptoHash.h
+++ b/Source/cmCryptoHash.h
@@ -21,8 +21,8 @@ class cmCryptoHash
public:
virtual ~cmCryptoHash() {}
static cmsys::auto_ptr<cmCryptoHash> New(const char* algo);
- std::string HashString(const char* input);
- std::string HashFile(const char* file);
+ std::string HashString(const std::string& input);
+ std::string HashFile(const std::string& file);
protected:
virtual void Initialize()=0;
virtual void Append(unsigned char const*, int)=0;
diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h
index 6851105..67c305e 100644
--- a/Source/cmCustomCommand.h
+++ b/Source/cmCustomCommand.h
@@ -72,7 +72,7 @@ public:
/** Backtrace of the command that created this custom command. */
cmListFileBacktrace const& GetBacktrace() const;
- typedef std::pair<cmStdString, cmStdString> ImplicitDependsPair;
+ typedef std::pair<std::string, std::string> ImplicitDependsPair;
class ImplicitDependsList: public std::vector<ImplicitDependsPair> {};
void SetImplicitDepends(ImplicitDependsList const&);
void AppendImplicitDepends(ImplicitDependsList const&);
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index f24dfa2..d8a756d 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -18,7 +18,7 @@
//----------------------------------------------------------------------------
cmCustomCommandGenerator::cmCustomCommandGenerator(
- cmCustomCommand const& cc, const char* config, cmMakefile* mf):
+ cmCustomCommand const& cc, const std::string& config, cmMakefile* mf):
CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()),
OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()),
GE(new cmGeneratorExpression(cc.GetBacktrace()))
diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h
index 4e89f27..17d644a 100644
--- a/Source/cmCustomCommandGenerator.h
+++ b/Source/cmCustomCommandGenerator.h
@@ -22,14 +22,15 @@ class cmGeneratorExpression;
class cmCustomCommandGenerator
{
cmCustomCommand const& CC;
- const char* Config;
+ std::string Config;
cmMakefile* Makefile;
cmLocalGenerator* LG;
bool OldStyle;
bool MakeVars;
cmGeneratorExpression* GE;
public:
- cmCustomCommandGenerator(cmCustomCommand const& cc, const char* config,
+ cmCustomCommandGenerator(cmCustomCommand const& cc,
+ const std::string& config,
cmMakefile* mf);
~cmCustomCommandGenerator();
unsigned int GetNumberOfCommands() const;
diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h
index 8dc4d96..bc5c8a4 100644
--- a/Source/cmDefinePropertyCommand.h
+++ b/Source/cmDefinePropertyCommand.h
@@ -32,7 +32,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "define_property";}
+ virtual std::string GetName() const { return "define_property";}
cmTypeMacro(cmDefinePropertyCommand, cmCommand);
private:
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index 9d28700..babf1c4 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -28,7 +28,7 @@ void cmDefinitions::Reset(cmDefinitions* parent)
//----------------------------------------------------------------------------
cmDefinitions::Def const&
-cmDefinitions::GetInternal(const char* key)
+cmDefinitions::GetInternal(const std::string& key)
{
MapType::const_iterator i = this->Map.find(key);
if(i != this->Map.end())
@@ -46,7 +46,7 @@ cmDefinitions::GetInternal(const char* key)
//----------------------------------------------------------------------------
cmDefinitions::Def const&
-cmDefinitions::SetInternal(const char* key, Def const& def)
+cmDefinitions::SetInternal(const std::string& key, Def const& def)
{
if(this->Up || def.Exists)
{
@@ -71,23 +71,23 @@ cmDefinitions::SetInternal(const char* key, Def const& def)
}
//----------------------------------------------------------------------------
-const char* cmDefinitions::Get(const char* key)
+const char* cmDefinitions::Get(const std::string& key)
{
Def const& def = this->GetInternal(key);
return def.Exists? def.c_str() : 0;
}
//----------------------------------------------------------------------------
-const char* cmDefinitions::Set(const char* key, const char* value)
+const char* cmDefinitions::Set(const std::string& key, const char* value)
{
Def const& def = this->SetInternal(key, Def(value));
return def.Exists? def.c_str() : 0;
}
//----------------------------------------------------------------------------
-std::set<cmStdString> cmDefinitions::LocalKeys() const
+std::set<std::string> cmDefinitions::LocalKeys() const
{
- std::set<cmStdString> keys;
+ std::set<std::string> keys;
// Consider local definitions.
for(MapType::const_iterator mi = this->Map.begin();
mi != this->Map.end(); ++mi)
@@ -110,12 +110,12 @@ cmDefinitions cmDefinitions::Closure() const
cmDefinitions::cmDefinitions(ClosureTag const&, cmDefinitions const* root):
Up(0)
{
- std::set<cmStdString> undefined;
+ std::set<std::string> undefined;
this->ClosureImpl(undefined, root);
}
//----------------------------------------------------------------------------
-void cmDefinitions::ClosureImpl(std::set<cmStdString>& undefined,
+void cmDefinitions::ClosureImpl(std::set<std::string>& undefined,
cmDefinitions const* defs)
{
// Consider local definitions.
@@ -145,17 +145,17 @@ void cmDefinitions::ClosureImpl(std::set<cmStdString>& undefined,
}
//----------------------------------------------------------------------------
-std::set<cmStdString> cmDefinitions::ClosureKeys() const
+std::set<std::string> cmDefinitions::ClosureKeys() const
{
- std::set<cmStdString> defined;
- std::set<cmStdString> undefined;
+ std::set<std::string> defined;
+ std::set<std::string> undefined;
this->ClosureKeys(defined, undefined);
return defined;
}
//----------------------------------------------------------------------------
-void cmDefinitions::ClosureKeys(std::set<cmStdString>& defined,
- std::set<cmStdString>& undefined) const
+void cmDefinitions::ClosureKeys(std::set<std::string>& defined,
+ std::set<std::string>& undefined) const
{
// Consider local definitions.
for(MapType::const_iterator mi = this->Map.begin();
@@ -165,7 +165,7 @@ void cmDefinitions::ClosureKeys(std::set<cmStdString>& defined,
if(defined.find(mi->first) == defined.end() &&
undefined.find(mi->first) == undefined.end())
{
- std::set<cmStdString>& m = mi->second.Exists? defined : undefined;
+ std::set<std::string>& m = mi->second.Exists? defined : undefined;
m.insert(mi->first);
}
}
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index 4834d84..d615fb0 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -35,28 +35,32 @@ public:
/** Get the value associated with a key; null if none.
Store the result locally if it came from a parent. */
- const char* Get(const char* key);
+ const char* Get(const std::string& key);
/** Set (or unset if null) a value associated with a key. */
- const char* Set(const char* key, const char* value);
+ const char* Set(const std::string& key, const char* value);
/** Get the set of all local keys. */
- std::set<cmStdString> LocalKeys() const;
+ std::set<std::string> LocalKeys() const;
/** Compute the closure of all defined keys with values.
This flattens the scope. The result has no parent. */
cmDefinitions Closure() const;
/** Compute the set of all defined keys. */
- std::set<cmStdString> ClosureKeys() const;
+ std::set<std::string> ClosureKeys() const;
private:
// String with existence boolean.
- struct Def: public cmStdString
+ struct Def: public std::string
{
- Def(): cmStdString(), Exists(false) {}
- Def(const char* v): cmStdString(v?v:""), Exists(v?true:false) {}
- Def(Def const& d): cmStdString(d), Exists(d.Exists) {}
+ private:
+ typedef std::string std_string;
+ public:
+ Def(): std_string(), Exists(false) {}
+ Def(const char* v): std_string(v?v:""), Exists(v?true:false) {}
+ Def(const std_string& v): std_string(v), Exists(true) {}
+ Def(Def const& d): std_string(d), Exists(d.Exists) {}
bool Exists;
};
static Def NoDef;
@@ -65,22 +69,22 @@ private:
cmDefinitions* Up;
// Local definitions, set or unset.
- typedef std::map<cmStdString, Def> MapType;
+ typedef std::map<std::string, Def> MapType;
MapType Map;
// Internal query and update methods.
- Def const& GetInternal(const char* key);
- Def const& SetInternal(const char* key, Def const& def);
+ Def const& GetInternal(const std::string& key);
+ Def const& SetInternal(const std::string& key, Def const& def);
// Implementation of Closure() method.
struct ClosureTag {};
cmDefinitions(ClosureTag const&, cmDefinitions const* root);
- void ClosureImpl(std::set<cmStdString>& undefined,
+ void ClosureImpl(std::set<std::string>& undefined,
cmDefinitions const* defs);
// Implementation of ClosureKeys() method.
- void ClosureKeys(std::set<cmStdString>& defined,
- std::set<cmStdString>& undefined) const;
+ void ClosureKeys(std::set<std::string>& defined,
+ std::set<std::string>& undefined) const;
};
#endif
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index 1a0e93f..51150f2 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -297,7 +297,7 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends,
}
//----------------------------------------------------------------------------
-void cmDepends::SetIncludePathFromLanguage(const char* lang)
+void cmDepends::SetIncludePathFromLanguage(const std::string& lang)
{
// Look for the new per "TARGET_" variant first:
const char * includePath = 0;
diff --git a/Source/cmDepends.h b/Source/cmDepends.h
index d787edd..b293c5b 100644
--- a/Source/cmDepends.h
+++ b/Source/cmDepends.h
@@ -41,7 +41,7 @@ public:
void SetLocalGenerator(cmLocalGenerator* lg) { this->LocalGenerator = lg; }
/** Set the specific language to be scanned. */
- void SetLanguage(const char* lang) { this->Language = lang; }
+ void SetLanguage(const std::string& lang) { this->Language = lang; }
/** Set the target build directory. */
void SetTargetDirectory(const char* dir) { this->TargetDirectory = dir; }
@@ -114,7 +114,7 @@ protected:
// The include file search path.
std::vector<std::string> IncludePath;
- void SetIncludePathFromLanguage(const char* lang);
+ void SetIncludePathFromLanguage(const std::string& lang);
private:
cmDepends(cmDepends const&); // Purposely not implemented.
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 4fc5efb..57a66da 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -37,7 +37,7 @@ cmDependsC::cmDependsC()
//----------------------------------------------------------------------------
cmDependsC::cmDependsC(cmLocalGenerator* lg,
const char* targetDir,
- const char* lang,
+ const std::string& lang,
const std::map<std::string, DependencyVector>* validDeps)
: cmDepends(lg, targetDir)
, ValidDeps(validDeps)
@@ -91,7 +91,7 @@ cmDependsC::~cmDependsC()
{
this->WriteCacheFile();
- for (std::map<cmStdString, cmIncludeLines*>::iterator it=
+ for (std::map<std::string, cmIncludeLines*>::iterator it=
this->FileCache.begin(); it!=this->FileCache.end(); ++it)
{
delete it->second;
@@ -116,7 +116,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
return false;
}
- std::set<cmStdString> dependencies;
+ std::set<std::string> dependencies;
bool haveDeps = false;
if (this->ValidDeps != 0)
@@ -149,7 +149,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
this->Encountered.insert(*srcIt);
}
- std::set<cmStdString> scanned;
+ std::set<std::string> scanned;
// Use reserve to allocate enough memory for tempPathStr
// so that during the loops no memory is allocated or freed
@@ -182,7 +182,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
}
else
{
- std::map<cmStdString, cmStdString>::iterator
+ std::map<std::string, std::string>::iterator
headerLocationIt=this->HeaderLocationCache.find(current.FileName);
if (headerLocationIt!=this->HeaderLocationCache.end())
{
@@ -224,7 +224,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
scanned.insert(fullName);
// Check whether this file is already in the cache
- std::map<cmStdString, cmIncludeLines*>::iterator fileIt=
+ std::map<std::string, cmIncludeLines*>::iterator fileIt=
this->FileCache.find(fullName);
if (fileIt!=this->FileCache.end())
{
@@ -270,7 +270,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
// convert the dependencies to paths relative to the home output
// directory. We must do the same here.
internalDepends << obj << std::endl;
- for(std::set<cmStdString>::const_iterator i=dependencies.begin();
+ for(std::set<std::string>::const_iterator i=dependencies.begin();
i != dependencies.end(); ++i)
{
makeDepends << obj << ": " <<
@@ -392,7 +392,7 @@ void cmDependsC::WriteCacheFile() const
cacheOut << this->IncludeRegexComplainString << "\n\n";
cacheOut << this->IncludeRegexTransformString << "\n\n";
- for (std::map<cmStdString, cmIncludeLines*>::const_iterator fileIt=
+ for (std::map<std::string, cmIncludeLines*>::const_iterator fileIt=
this->FileCache.begin();
fileIt!=this->FileCache.end(); ++fileIt)
{
@@ -421,7 +421,7 @@ void cmDependsC::WriteCacheFile() const
//----------------------------------------------------------------------------
void cmDependsC::Scan(std::istream& is, const char* directory,
- const cmStdString& fullName)
+ const std::string& fullName)
{
cmIncludeLines* newCacheEntry=new cmIncludeLines;
newCacheEntry->Used=true;
diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h
index 16dfad7..07d3c21 100644
--- a/Source/cmDependsC.h
+++ b/Source/cmDependsC.h
@@ -25,7 +25,8 @@ public:
/** Checking instances need to know the build directory name and the
relative path from the build directory to the target file. */
cmDependsC();
- cmDependsC(cmLocalGenerator* lg, const char* targetDir, const char* lang,
+ cmDependsC(cmLocalGenerator* lg, const char* targetDir,
+ const std::string& lang,
const std::map<std::string, DependencyVector>* validDeps);
/** Virtual destructor to cleanup subclasses properly. */
@@ -40,7 +41,7 @@ protected:
// Method to scan a single file.
void Scan(std::istream& is, const char* directory,
- const cmStdString& fullName);
+ const std::string& fullName);
// Regular expression to identify C preprocessor include directives.
cmsys::RegularExpression IncludeRegexLine;
@@ -56,7 +57,7 @@ protected:
// Regex to transform #include lines.
std::string IncludeRegexTransformString;
cmsys::RegularExpression IncludeRegexTransform;
- typedef std::map<cmStdString, cmStdString> TransformRulesType;
+ typedef std::map<std::string, std::string> TransformRulesType;
TransformRulesType TransformRules;
void SetupTransforms();
void ParseTransform(std::string const& xform);
@@ -66,8 +67,8 @@ public:
// Data structures for dependency graph walk.
struct UnscannedEntry
{
- cmStdString FileName;
- cmStdString QuotedLocation;
+ std::string FileName;
+ std::string QuotedLocation;
};
struct cmIncludeLines
@@ -78,13 +79,13 @@ public:
};
protected:
const std::map<std::string, DependencyVector>* ValidDeps;
- std::set<cmStdString> Encountered;
+ std::set<std::string> Encountered;
std::queue<UnscannedEntry> Unscanned;
- std::map<cmStdString, cmIncludeLines *> FileCache;
- std::map<cmStdString, cmStdString> HeaderLocationCache;
+ std::map<std::string, cmIncludeLines *> FileCache;
+ std::map<std::string, std::string> HeaderLocationCache;
- cmStdString CacheFileName;
+ std::string CacheFileName;
void WriteCacheFile() const;
void ReadCacheFile();
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index d5472a1..b3fbaa2 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -34,11 +34,11 @@ public:
std::string Source;
// Set of provided and required modules.
- std::set<cmStdString> Provides;
- std::set<cmStdString> Requires;
+ std::set<std::string> Provides;
+ std::set<std::string> Requires;
// Set of files included in the translation unit.
- std::set<cmStdString> Includes;
+ std::set<std::string> Includes;
};
//----------------------------------------------------------------------------
@@ -98,24 +98,24 @@ class cmDependsFortranInternals
{
public:
// The set of modules provided by this target.
- std::set<cmStdString> TargetProvides;
+ std::set<std::string> TargetProvides;
// Map modules required by this target to locations.
- typedef std::map<cmStdString, cmStdString> TargetRequiresMap;
+ typedef std::map<std::string, std::string> TargetRequiresMap;
TargetRequiresMap TargetRequires;
// Information about each object file.
- typedef std::map<cmStdString, cmDependsFortranSourceInfo> ObjectInfoMap;
+ typedef std::map<std::string, cmDependsFortranSourceInfo> ObjectInfoMap;
ObjectInfoMap ObjectInfo;
cmDependsFortranSourceInfo& CreateObjectInfo(const char* obj,
const char* src)
{
- std::map<cmStdString, cmDependsFortranSourceInfo>::iterator i =
+ std::map<std::string, cmDependsFortranSourceInfo>::iterator i =
this->ObjectInfo.find(obj);
if(i == this->ObjectInfo.end())
{
- std::map<cmStdString, cmDependsFortranSourceInfo>::value_type
+ std::map<std::string, cmDependsFortranSourceInfo>::value_type
entry(obj, cmDependsFortranSourceInfo());
i = this->ObjectInfo.insert(entry).first;
i->second.Source = src;
@@ -260,8 +260,8 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
cmGeneratedFileStream fiStream(fiName.c_str());
fiStream << "# The fortran modules provided by this target.\n";
fiStream << "provides\n";
- std::set<cmStdString> const& provides = this->Internal->TargetProvides;
- for(std::set<cmStdString>::const_iterator i = provides.begin();
+ std::set<std::string> const& provides = this->Internal->TargetProvides;
+ for(std::set<std::string>::const_iterator i = provides.begin();
i != provides.end(); ++i)
{
fiStream << " " << *i << "\n";
@@ -275,7 +275,7 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
cmGeneratedFileStream fcStream(fcName.c_str());
fcStream << "# Remove fortran modules provided by this target.\n";
fcStream << "FILE(REMOVE";
- for(std::set<cmStdString>::const_iterator i = provides.begin();
+ for(std::set<std::string>::const_iterator i = provides.begin();
i != provides.end(); ++i)
{
std::string mod_upper = mod_dir;
@@ -319,14 +319,14 @@ void cmDependsFortran::LocateModules()
infoI != objInfo.end(); ++infoI)
{
cmDependsFortranSourceInfo const& info = infoI->second;
- for(std::set<cmStdString>::const_iterator i = info.Provides.begin();
+ for(std::set<std::string>::const_iterator i = info.Provides.begin();
i != info.Provides.end(); ++i)
{
// Include this module in the set provided by this target.
this->Internal->TargetProvides.insert(*i);
}
- for(std::set<cmStdString>::const_iterator i = info.Requires.begin();
+ for(std::set<std::string>::const_iterator i = info.Requires.begin();
i != info.Requires.end(); ++i)
{
// Include this module in the set required by this target.
@@ -368,8 +368,8 @@ void cmDependsFortran::LocateModules()
void cmDependsFortran::MatchLocalModules()
{
const char* stampDir = this->TargetDirectory.c_str();
- std::set<cmStdString> const& provides = this->Internal->TargetProvides;
- for(std::set<cmStdString>::const_iterator i = provides.begin();
+ std::set<std::string> const& provides = this->Internal->TargetProvides;
+ for(std::set<std::string>::const_iterator i = provides.begin();
i != provides.end(); ++i)
{
this->ConsiderModule(i->c_str(), stampDir);
@@ -445,7 +445,7 @@ cmDependsFortran
// Write the include dependencies to the output stream.
internalDepends << obj << std::endl;
internalDepends << " " << src << std::endl;
- for(std::set<cmStdString>::const_iterator i = info.Includes.begin();
+ for(std::set<std::string>::const_iterator i = info.Includes.begin();
i != info.Includes.end(); ++i)
{
makeDepends << obj << ": " <<
@@ -458,11 +458,11 @@ cmDependsFortran
makeDepends << std::endl;
// Write module requirements to the output stream.
- for(std::set<cmStdString>::const_iterator i = info.Requires.begin();
+ for(std::set<std::string>::const_iterator i = info.Requires.begin();
i != info.Requires.end(); ++i)
{
// Require only modules not provided in the same source.
- if(std::set<cmStdString>::const_iterator(info.Provides.find(*i)) !=
+ if(std::set<std::string>::const_iterator(info.Provides.find(*i)) !=
info.Provides.end())
{
continue;
@@ -519,7 +519,7 @@ cmDependsFortran
}
// Write provided modules to the output stream.
- for(std::set<cmStdString>::const_iterator i = info.Provides.begin();
+ for(std::set<std::string>::const_iterator i = info.Provides.begin();
i != info.Provides.end(); ++i)
{
std::string proxy = stamp_dir;
@@ -538,7 +538,7 @@ cmDependsFortran
// Create a target to copy the module after the object file
// changes.
makeDepends << obj << ".provides.build:\n";
- for(std::set<cmStdString>::const_iterator i = info.Provides.begin();
+ for(std::set<std::string>::const_iterator i = info.Provides.begin();
i != info.Provides.end(); ++i)
{
// Include this module in the set provided by this target.
diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx
index c30d4bd..e23e4b7 100644
--- a/Source/cmDependsJavaParserHelper.cxx
+++ b/Source/cmDependsJavaParserHelper.cxx
@@ -36,10 +36,10 @@ cmDependsJavaParserHelper::~cmDependsJavaParserHelper()
}
void cmDependsJavaParserHelper::CurrentClass
-::AddFileNamesForPrinting(std::vector<cmStdString> *files,
+::AddFileNamesForPrinting(std::vector<std::string> *files,
const char* prefix, const char* sep)
{
- cmStdString rname = "";
+ std::string rname = "";
if ( prefix )
{
rname += prefix;
@@ -76,7 +76,7 @@ void cmDependsJavaParserHelper::AddClassFound(const char* sclass)
{
return;
}
- std::vector<cmStdString>::iterator it;
+ std::vector<std::string>::iterator it;
for ( it = this->ClassesFound.begin();
it != this->ClassesFound.end();
it ++ )
@@ -91,7 +91,7 @@ void cmDependsJavaParserHelper::AddClassFound(const char* sclass)
void cmDependsJavaParserHelper::AddPackagesImport(const char* sclass)
{
- std::vector<cmStdString>::iterator it;
+ std::vector<std::string>::iterator it;
for ( it = this->PackagesImport.begin();
it != this->PackagesImport.end();
it ++ )
@@ -256,8 +256,8 @@ void cmDependsJavaParserHelper::PrintClasses()
std::cerr << "Error when parsing. No classes on class stack" << std::endl;
abort();
}
- std::vector<cmStdString> files = this->GetFilesProduced();
- std::vector<cmStdString>::iterator sit;
+ std::vector<std::string> files = this->GetFilesProduced();
+ std::vector<std::string>::iterator sit;
for ( sit = files.begin();
sit != files.end();
++ sit )
@@ -266,9 +266,9 @@ void cmDependsJavaParserHelper::PrintClasses()
}
}
-std::vector<cmStdString> cmDependsJavaParserHelper::GetFilesProduced()
+std::vector<std::string> cmDependsJavaParserHelper::GetFilesProduced()
{
- std::vector<cmStdString> files;
+ std::vector<std::string> files;
CurrentClass* toplevel = &(*(this->ClassStack.begin()));
std::vector<CurrentClass>::iterator it;
for ( it = toplevel->NestedClasses->begin();
@@ -313,7 +313,7 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb)
std::cout << "Imports packages:";
if ( this->PackagesImport.size() > 0 )
{
- std::vector<cmStdString>::iterator it;
+ std::vector<std::string>::iterator it;
for ( it = this->PackagesImport.begin();
it != this->PackagesImport.end();
++ it )
@@ -325,7 +325,7 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb)
std::cout << "Depends on:";
if ( this->ClassesFound.size() > 0 )
{
- std::vector<cmStdString>::iterator it;
+ std::vector<std::string>::iterator it;
for ( it = this->ClassesFound.begin();
it != this->ClassesFound.end();
++ it )
@@ -419,8 +419,8 @@ int cmDependsJavaParserHelper::ParseFile(const char* file)
return 0;
}
- cmStdString fullfile = "";
- cmStdString line;
+ std::string fullfile = "";
+ std::string line;
while ( cmSystemTools::GetLineFromStream(ifs, line) )
{
fullfile += line + "\n";
diff --git a/Source/cmDependsJavaParserHelper.h b/Source/cmDependsJavaParserHelper.h
index 9807a04..5542018 100644
--- a/Source/cmDependsJavaParserHelper.h
+++ b/Source/cmDependsJavaParserHelper.h
@@ -59,15 +59,15 @@ public:
const char* GetCurrentCombine() { return this->CurrentCombine.c_str(); }
void UpdateCombine(const char* str1, const char* str2);
- std::vector<cmStdString>& GetClassesFound() { return this->ClassesFound; }
+ std::vector<std::string>& GetClassesFound() { return this->ClassesFound; }
- std::vector<cmStdString> GetFilesProduced();
+ std::vector<std::string> GetFilesProduced();
private:
class CurrentClass
{
public:
- cmStdString Name;
+ std::string Name;
std::vector<CurrentClass>* NestedClasses;
CurrentClass()
{
@@ -93,16 +93,16 @@ private:
{
(*this) = c;
}
- void AddFileNamesForPrinting(std::vector<cmStdString> *files,
+ void AddFileNamesForPrinting(std::vector<std::string> *files,
const char* prefix, const char* sep);
};
- cmStdString CurrentPackage;
- cmStdString::size_type InputBufferPos;
- cmStdString InputBuffer;
+ std::string CurrentPackage;
+ std::string::size_type InputBufferPos;
+ std::string InputBuffer;
std::vector<char> OutputBuffer;
- std::vector<cmStdString> ClassesFound;
- std::vector<cmStdString> PackagesImport;
- cmStdString CurrentCombine;
+ std::vector<std::string> ClassesFound;
+ std::vector<std::string> PackagesImport;
+ std::string CurrentCombine;
std::vector<CurrentClass> ClassStack;
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 9c27fc1..96b5f04 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -477,9 +477,9 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv,
}
//----------------------------------------------------------------------------
-void cmDocumentation::SetName(const char* name)
+void cmDocumentation::SetName(const std::string& name)
{
- this->NameString = name?name:"";
+ this->NameString = name;
}
//----------------------------------------------------------------------------
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index d5a7dd5..56a4151 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -56,7 +56,7 @@ public:
void SetShowGenerators(bool showGen) { this->ShowGenerators = showGen; }
/** Set the program name for standard document generation. */
- void SetName(const char* name);
+ void SetName(const std::string& name);
/** Set a section of the documentation. Typical sections include Name,
Usage, Description, Options */
diff --git a/Source/cmDocumentationSection.h b/Source/cmDocumentationSection.h
index 636860d..d796da8 100644
--- a/Source/cmDocumentationSection.h
+++ b/Source/cmDocumentationSection.h
@@ -34,8 +34,8 @@ public:
void Clear() { this->Entries.clear(); }
/** Return the name of this section. */
- const char* GetName() const
- { return this->Name.c_str(); }
+ std::string GetName() const
+ { return this->Name; }
/** Return a pointer to the first entry of this section. */
const std::vector<cmDocumentationEntry> &GetEntries() const
diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx
index 6a0ab7b..944a000 100644
--- a/Source/cmDynamicLoader.cxx
+++ b/Source/cmDynamicLoader.cxx
@@ -23,7 +23,7 @@ public:
static cmDynamicLoaderCache* GetInstance();
private:
- std::map<cmStdString, cmsys::DynamicLoader::LibraryHandle> CacheMap;
+ std::map<std::string, cmsys::DynamicLoader::LibraryHandle> CacheMap;
static cmDynamicLoaderCache* Instance;
};
@@ -47,7 +47,7 @@ void cmDynamicLoaderCache::CacheFile(const char* path,
bool cmDynamicLoaderCache::GetCacheFile(const char* path,
cmsys::DynamicLoader::LibraryHandle& p)
{
- std::map<cmStdString, cmsys::DynamicLoader::LibraryHandle>::iterator it
+ std::map<std::string, cmsys::DynamicLoader::LibraryHandle>::iterator it
= this->CacheMap.find(path);
if ( it != this->CacheMap.end() )
{
@@ -59,7 +59,7 @@ bool cmDynamicLoaderCache::GetCacheFile(const char* path,
bool cmDynamicLoaderCache::FlushCache(const char* path)
{
- std::map<cmStdString, cmsys::DynamicLoader::LibraryHandle>::iterator it
+ std::map<std::string, cmsys::DynamicLoader::LibraryHandle>::iterator it
= this->CacheMap.find(path);
bool ret = false;
if ( it != this->CacheMap.end() )
@@ -73,7 +73,7 @@ bool cmDynamicLoaderCache::FlushCache(const char* path)
void cmDynamicLoaderCache::FlushCache()
{
- for ( std::map<cmStdString,
+ for ( std::map<std::string,
cmsys::DynamicLoader::LibraryHandle>::iterator it
= this->CacheMap.begin();
it != this->CacheMap.end(); it++ )
diff --git a/Source/cmElseCommand.h b/Source/cmElseCommand.h
index d472e99..dde5fcc 100644
--- a/Source/cmElseCommand.h
+++ b/Source/cmElseCommand.h
@@ -45,7 +45,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "else";}
+ virtual std::string GetName() const { return "else";}
cmTypeMacro(cmElseCommand, cmCommand);
};
diff --git a/Source/cmElseIfCommand.h b/Source/cmElseIfCommand.h
index d811b35..c627cbe 100644
--- a/Source/cmElseIfCommand.h
+++ b/Source/cmElseIfCommand.h
@@ -45,7 +45,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "elseif";}
+ virtual std::string GetName() const { return "elseif";}
cmTypeMacro(cmElseIfCommand, cmCommand);
};
diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h
index a248042..2b09e11 100644
--- a/Source/cmEnableLanguageCommand.h
+++ b/Source/cmEnableLanguageCommand.h
@@ -43,7 +43,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "enable_language";}
+ virtual std::string GetName() const {return "enable_language";}
cmTypeMacro(cmEnableLanguageCommand, cmCommand);
};
diff --git a/Source/cmEnableTestingCommand.h b/Source/cmEnableTestingCommand.h
index e102f5e..d028c59 100644
--- a/Source/cmEnableTestingCommand.h
+++ b/Source/cmEnableTestingCommand.h
@@ -48,7 +48,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "enable_testing";}
+ virtual std::string GetName() const { return "enable_testing";}
cmTypeMacro(cmEnableTestingCommand, cmCommand);
diff --git a/Source/cmEndForEachCommand.h b/Source/cmEndForEachCommand.h
index 44d29b5..c3be387 100644
--- a/Source/cmEndForEachCommand.h
+++ b/Source/cmEndForEachCommand.h
@@ -52,7 +52,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "endforeach";}
+ virtual std::string GetName() const { return "endforeach";}
cmTypeMacro(cmEndForEachCommand, cmCommand);
};
diff --git a/Source/cmEndFunctionCommand.h b/Source/cmEndFunctionCommand.h
index 4fdca6b..3a42c17 100644
--- a/Source/cmEndFunctionCommand.h
+++ b/Source/cmEndFunctionCommand.h
@@ -52,7 +52,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "endfunction";}
+ virtual std::string GetName() const { return "endfunction";}
cmTypeMacro(cmEndFunctionCommand, cmCommand);
};
diff --git a/Source/cmEndIfCommand.h b/Source/cmEndIfCommand.h
index 634da60..a8248c8 100644
--- a/Source/cmEndIfCommand.h
+++ b/Source/cmEndIfCommand.h
@@ -45,7 +45,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "endif";}
+ virtual std::string GetName() const { return "endif";}
cmTypeMacro(cmEndIfCommand, cmCommand);
};
diff --git a/Source/cmEndMacroCommand.h b/Source/cmEndMacroCommand.h
index db15f27..fdc04ee 100644
--- a/Source/cmEndMacroCommand.h
+++ b/Source/cmEndMacroCommand.h
@@ -52,7 +52,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "endmacro";}
+ virtual std::string GetName() const { return "endmacro";}
cmTypeMacro(cmEndMacroCommand, cmCommand);
};
diff --git a/Source/cmEndWhileCommand.h b/Source/cmEndWhileCommand.h
index 41138d1..ec1cb65 100644
--- a/Source/cmEndWhileCommand.h
+++ b/Source/cmEndWhileCommand.h
@@ -52,7 +52,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "endwhile";}
+ virtual std::string GetName() const { return "endwhile";}
cmTypeMacro(cmEndWhileCommand, cmCommand);
};
diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h
index 6d28cdc..23d10f9 100644
--- a/Source/cmExecProgramCommand.h
+++ b/Source/cmExecProgramCommand.h
@@ -42,7 +42,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const
+ virtual std::string GetName() const
{return "exec_program";}
/**
diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h
index bd0f783..6906a08 100644
--- a/Source/cmExecuteProcessCommand.h
+++ b/Source/cmExecuteProcessCommand.h
@@ -41,7 +41,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const
+ virtual std::string GetName() const
{return "execute_process";}
/**
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 308956a..f991f45 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -118,8 +118,9 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
void
cmExportBuildFileGenerator
::GenerateImportTargetsConfig(std::ostream& os,
- const char* config, std::string const& suffix,
- std::vector<std::string> &missingTargets)
+ const std::string& config,
+ std::string const& suffix,
+ std::vector<std::string> &missingTargets)
{
for(std::vector<cmTarget*>::const_iterator
tei = this->Exports.begin();
@@ -166,7 +167,8 @@ void cmExportBuildFileGenerator::SetExportSet(cmExportSet *exportSet)
//----------------------------------------------------------------------------
void
cmExportBuildFileGenerator
-::SetImportLocationProperty(const char* config, std::string const& suffix,
+::SetImportLocationProperty(const std::string& config,
+ std::string const& suffix,
cmTarget* target, ImportPropertyMap& properties)
{
// Get the makefile in which to lookup target information.
diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h
index cea2099..c1bdb5b 100644
--- a/Source/cmExportBuildFileGenerator.h
+++ b/Source/cmExportBuildFileGenerator.h
@@ -52,7 +52,7 @@ protected:
// Implement virtual methods from the superclass.
virtual bool GenerateMainFile(std::ostream& os);
virtual void GenerateImportTargetsConfig(std::ostream& os,
- const char* config,
+ const std::string& config,
std::string const& suffix,
std::vector<std::string> &missingTargets);
virtual void HandleMissingTarget(std::string& link_libs,
@@ -66,7 +66,7 @@ protected:
int occurrences);
/** Fill in properties indicating built file locations. */
- void SetImportLocationProperty(const char* config,
+ void SetImportLocationProperty(const std::string& config,
std::string const& suffix,
cmTarget* target,
ImportPropertyMap& properties);
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index db56aaf..bda8dda 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -168,7 +168,7 @@ bool cmExportCommand
return false;
}
- if(cmTarget* target = gg->FindTarget(0, currentTarget->c_str()))
+ if(cmTarget* target = gg->FindTarget(currentTarget->c_str()))
{
if(target->GetType() == cmTarget::OBJECT_LIBRARY)
{
diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h
index c0e445f..f9506bb 100644
--- a/Source/cmExportCommand.h
+++ b/Source/cmExportCommand.h
@@ -45,7 +45,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "export";}
+ virtual std::string GetName() const { return "export";}
cmTypeMacro(cmExportCommand, cmCommand);
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 4a161ee..3c3c6df 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -35,7 +35,7 @@ cmExportFileGenerator::cmExportFileGenerator()
}
//----------------------------------------------------------------------------
-void cmExportFileGenerator::AddConfiguration(const char* config)
+void cmExportFileGenerator::AddConfiguration(const std::string& config)
{
this->Configurations.push_back(config);
}
@@ -117,12 +117,12 @@ bool cmExportFileGenerator::GenerateImportFile()
//----------------------------------------------------------------------------
void cmExportFileGenerator::GenerateImportConfig(std::ostream& os,
- const char* config,
+ const std::string& config,
std::vector<std::string> &missingTargets)
{
// Construct the property configuration suffix.
std::string suffix = "_";
- if(config && *config)
+ if(!config.empty())
{
suffix += cmSystemTools::UpperCase(config);
}
@@ -136,7 +136,8 @@ void cmExportFileGenerator::GenerateImportConfig(std::ostream& os,
}
//----------------------------------------------------------------------------
-void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
+void cmExportFileGenerator::PopulateInterfaceProperty(
+ const std::string& propName,
cmTarget *target,
ImportPropertyMap &properties)
{
@@ -148,8 +149,9 @@ void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
}
//----------------------------------------------------------------------------
-void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
- const char *outputName,
+void cmExportFileGenerator::PopulateInterfaceProperty(
+ const std::string& propName,
+ const std::string& outputName,
cmTarget *target,
cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap &properties,
@@ -343,7 +345,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
true);
this->ReplaceInstallPrefix(dirs);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
- std::string exportDirs = cge->Evaluate(target->GetMakefile(), 0,
+ std::string exportDirs = cge->Evaluate(target->GetMakefile(), "",
false, target);
if (cge->GetHadContextSensitiveCondition())
@@ -391,7 +393,8 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
}
//----------------------------------------------------------------------------
-void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
+void cmExportFileGenerator::PopulateInterfaceProperty(
+ const std::string& propName,
cmTarget *target,
cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap &properties,
@@ -403,7 +406,7 @@ void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
//----------------------------------------------------------------------------
-void getPropertyContents(cmTarget const* tgt, const char *prop,
+void getPropertyContents(cmTarget const* tgt, const std::string& prop,
std::set<std::string> &ifaceProperties)
{
const char *p = tgt->GetProperty(prop);
@@ -423,7 +426,7 @@ void getPropertyContents(cmTarget const* tgt, const char *prop,
//----------------------------------------------------------------------------
void getCompatibleInterfaceProperties(cmTarget *target,
std::set<std::string> &ifaceProperties,
- const char *config)
+ const std::string& config)
{
cmComputeLinkInformation *info = target->GetLinkInformation(config);
@@ -487,7 +490,7 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
- getCompatibleInterfaceProperties(target, ifaceProperties, 0);
+ getCompatibleInterfaceProperties(target, ifaceProperties, "");
std::vector<std::string> configNames;
target->GetMakefile()->GetConfigurations(configNames);
@@ -684,7 +687,7 @@ cmExportFileGenerator::ReplaceInstallPrefix(std::string &)
//----------------------------------------------------------------------------
void
cmExportFileGenerator
-::SetImportLinkInterface(const char* config, std::string const& suffix,
+::SetImportLinkInterface(const std::string& config, std::string const& suffix,
cmGeneratorExpression::PreprocessContext preprocessRule,
cmTarget* target, ImportPropertyMap& properties,
std::vector<std::string>& missingTargets)
@@ -759,7 +762,8 @@ cmExportFileGenerator
//----------------------------------------------------------------------------
void
cmExportFileGenerator
-::SetImportDetailProperties(const char* config, std::string const& suffix,
+::SetImportDetailProperties(const std::string& config,
+ std::string const& suffix,
cmTarget* target, ImportPropertyMap& properties,
std::vector<std::string>& missingTargets
)
@@ -825,7 +829,7 @@ void
cmExportFileGenerator
::SetImportLinkProperty(std::string const& suffix,
cmTarget* target,
- const char* propName,
+ const std::string& propName,
std::vector<std::string> const& entries,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets
@@ -861,11 +865,11 @@ cmExportFileGenerator
//----------------------------------------------------------------------------
void cmExportFileGenerator::GenerateImportHeaderCode(std::ostream& os,
- const char* config)
+ const std::string& config)
{
os << "#----------------------------------------------------------------\n"
<< "# Generated CMake target import file";
- if(config)
+ if(!config.empty())
{
os << " for configuration \"" << config << "\".\n";
}
@@ -996,7 +1000,7 @@ cmExportFileGenerator
//----------------------------------------------------------------------------
void
cmExportFileGenerator
-::GenerateImportPropertyCode(std::ostream& os, const char* config,
+::GenerateImportPropertyCode(std::ostream& os, const std::string& config,
cmTarget const* target,
ImportPropertyMap const& properties)
{
@@ -1010,7 +1014,7 @@ cmExportFileGenerator
<< config << "\"\n";
os << "set_property(TARGET " << targetName
<< " APPEND PROPERTY IMPORTED_CONFIGURATIONS ";
- if(config && *config)
+ if(!config.empty())
{
os << cmSystemTools::UpperCase(config);
}
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index 57ab378..abd8ad5 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -50,32 +50,33 @@ public:
const char *GetMainExportFileName() const;
/** Set the namespace in which to place exported target names. */
- void SetNamespace(const char* ns) { this->Namespace = ns; }
+ void SetNamespace(const std::string& ns) { this->Namespace = ns; }
std::string GetNamespace() const { return this->Namespace; }
void SetExportOld(bool exportOld) { this->ExportOld = exportOld; }
/** Add a configuration to be exported. */
- void AddConfiguration(const char* config);
+ void AddConfiguration(const std::string& config);
/** Actually generate the export file. Returns whether there was an
error. */
bool GenerateImportFile();
protected:
- typedef std::map<cmStdString, cmStdString> ImportPropertyMap;
+ typedef std::map<std::string, std::string> ImportPropertyMap;
// Generate per-configuration target information to the given output
// stream.
- void GenerateImportConfig(std::ostream& os, const char* config,
+ void GenerateImportConfig(std::ostream& os, const std::string& config,
std::vector<std::string> &missingTargets);
// Methods to implement export file code generation.
- void GenerateImportHeaderCode(std::ostream& os, const char* config = 0);
+ void GenerateImportHeaderCode(std::ostream& os,
+ const std::string& config = "");
void GenerateImportFooterCode(std::ostream& os);
void GenerateImportVersionCode(std::ostream& os);
void GenerateImportTargetCode(std::ostream& os, cmTarget const* target);
- void GenerateImportPropertyCode(std::ostream& os, const char* config,
+ void GenerateImportPropertyCode(std::ostream& os, const std::string& config,
cmTarget const* target,
ImportPropertyMap const& properties);
void GenerateImportedFileChecksCode(std::ostream& os, cmTarget* target,
@@ -90,12 +91,12 @@ protected:
// Collect properties with detailed information about targets beyond
// their location on disk.
- void SetImportDetailProperties(const char* config,
+ void SetImportDetailProperties(const std::string& config,
std::string const& suffix, cmTarget* target,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);
void SetImportLinkProperty(std::string const& suffix,
- cmTarget* target, const char* propName,
+ cmTarget* target, const std::string& propName,
std::vector<std::string> const& entries,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);
@@ -105,7 +106,7 @@ protected:
/** Each subclass knows where the target files are located. */
virtual void GenerateImportTargetsConfig(std::ostream& os,
- const char* config,
+ const std::string& config,
std::string const& suffix,
std::vector<std::string> &missingTargets) = 0;
@@ -116,7 +117,7 @@ protected:
cmMakefile* mf,
cmTarget* depender,
cmTarget* dependee) = 0;
- void PopulateInterfaceProperty(const char *,
+ void PopulateInterfaceProperty(const std::string&,
cmTarget *target,
cmGeneratorExpression::PreprocessContext,
ImportPropertyMap &properties,
@@ -125,7 +126,7 @@ protected:
cmGeneratorExpression::PreprocessContext,
ImportPropertyMap &properties,
std::vector<std::string> &missingTargets);
- void PopulateInterfaceProperty(const char *propName, cmTarget *target,
+ void PopulateInterfaceProperty(const std::string& propName, cmTarget *target,
ImportPropertyMap &properties);
void PopulateCompatibleInterfaceProperties(cmTarget *target,
ImportPropertyMap &properties);
@@ -137,7 +138,8 @@ protected:
ImportPropertyMap &properties,
std::vector<std::string> &missingTargets);
- void SetImportLinkInterface(const char* config, std::string const& suffix,
+ void SetImportLinkInterface(const std::string& config,
+ std::string const& suffix,
cmGeneratorExpression::PreprocessContext preprocessRule,
cmTarget* target, ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);
@@ -174,7 +176,7 @@ protected:
std::set<cmTarget*> ExportedTargets;
private:
- void PopulateInterfaceProperty(const char *, const char *,
+ void PopulateInterfaceProperty(const std::string&, const std::string&,
cmTarget *target,
cmGeneratorExpression::PreprocessContext,
ImportPropertyMap &properties,
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index b579963..5e7d5e4 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -240,7 +240,8 @@ cmExportInstallFileGenerator::ReplaceInstallPrefix(std::string &input)
//----------------------------------------------------------------------------
bool
-cmExportInstallFileGenerator::GenerateImportFileConfig(const char* config,
+cmExportInstallFileGenerator::GenerateImportFileConfig(
+ const std::string& config,
std::vector<std::string> &missingTargets)
{
// Skip configurations not enabled for this export.
@@ -254,7 +255,7 @@ cmExportInstallFileGenerator::GenerateImportFileConfig(const char* config,
fileName += "/";
fileName += this->FileBase;
fileName += "-";
- if(config && *config)
+ if(!config.empty())
{
fileName += cmSystemTools::LowerCase(config);
}
@@ -296,7 +297,8 @@ cmExportInstallFileGenerator::GenerateImportFileConfig(const char* config,
void
cmExportInstallFileGenerator
::GenerateImportTargetsConfig(std::ostream& os,
- const char* config, std::string const& suffix,
+ const std::string& config,
+ std::string const& suffix,
std::vector<std::string> &missingTargets)
{
// Add each target in the set to the export.
@@ -355,7 +357,8 @@ cmExportInstallFileGenerator
//----------------------------------------------------------------------------
void
cmExportInstallFileGenerator
-::SetImportLocationProperty(const char* config, std::string const& suffix,
+::SetImportLocationProperty(const std::string& config,
+ std::string const& suffix,
cmInstallTargetGenerator* itgen,
ImportPropertyMap& properties,
std::set<std::string>& importedLocations
diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h
index 7c634a4..b851ad5 100644
--- a/Source/cmExportInstallFileGenerator.h
+++ b/Source/cmExportInstallFileGenerator.h
@@ -41,7 +41,7 @@ public:
/** Get the per-config file generated for each configuraiton. This
maps from the configuration name to the file temporary location
for installation. */
- std::map<cmStdString, cmStdString> const& GetConfigImportFiles()
+ std::map<std::string, std::string> const& GetConfigImportFiles()
{ return this->ConfigImportFiles; }
/** Compute the globbing expression used to load per-config import
@@ -52,7 +52,7 @@ protected:
// Implement virtual methods from the superclass.
virtual bool GenerateMainFile(std::ostream& os);
virtual void GenerateImportTargetsConfig(std::ostream& os,
- const char* config,
+ const std::string& config,
std::string const& suffix,
std::vector<std::string> &missingTargets);
virtual void HandleMissingTarget(std::string& link_libs,
@@ -72,11 +72,11 @@ protected:
/** Generate a per-configuration file for the targets. */
- bool GenerateImportFileConfig(const char* config,
+ bool GenerateImportFileConfig(const std::string& config,
std::vector<std::string> &missingTargets);
/** Fill in properties indicating installed file locations. */
- void SetImportLocationProperty(const char* config,
+ void SetImportLocationProperty(const std::string& config,
std::string const& suffix,
cmInstallTargetGenerator* itgen,
ImportPropertyMap& properties,
@@ -92,7 +92,7 @@ protected:
std::string ImportPrefix;
// The import file generated for each configuration.
- std::map<cmStdString, cmStdString> ConfigImportFiles;
+ std::map<std::string, std::string> ConfigImportFiles;
};
#endif
diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx
index 5d6f094..b04b937 100644
--- a/Source/cmExportLibraryDependenciesCommand.cxx
+++ b/Source/cmExportLibraryDependenciesCommand.cxx
@@ -83,9 +83,9 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
cmake* cm = this->Makefile->GetCMakeInstance();
cmGlobalGenerator* global = cm->GetGlobalGenerator();
const std::vector<cmLocalGenerator *>& locals = global->GetLocalGenerators();
- std::map<cmStdString, cmStdString> libDepsOld;
- std::map<cmStdString, cmStdString> libDepsNew;
- std::map<cmStdString, cmStdString> libTypes;
+ std::map<std::string, std::string> libDepsOld;
+ std::map<std::string, std::string> libDepsNew;
+ std::map<std::string, std::string> libTypes;
for(std::vector<cmLocalGenerator *>::const_iterator i = locals.begin();
i != locals.end(); ++i)
{
@@ -138,7 +138,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
break;
}
std::string lib = li->first;
- if(cmTarget* libtgt = global->FindTarget(0, lib.c_str()))
+ if(cmTarget* libtgt = global->FindTarget(lib.c_str()))
{
// Handle simple output name changes. This command is
// deprecated so we do not support full target name
@@ -175,7 +175,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
fout << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n";
fout << "if(" << vertest << ")\n";
fout << " # Information for CMake 2.6 and above.\n";
- for(std::map<cmStdString, cmStdString>::const_iterator
+ for(std::map<std::string, std::string>::const_iterator
i = libDepsNew.begin();
i != libDepsNew.end(); ++i)
{
@@ -186,7 +186,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
}
fout << "else()\n";
fout << " # Information for CMake 2.4 and lower.\n";
- for(std::map<cmStdString, cmStdString>::const_iterator
+ for(std::map<std::string, std::string>::const_iterator
i = libDepsOld.begin();
i != libDepsOld.end(); ++i)
{
@@ -195,7 +195,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n";
}
}
- for(std::map<cmStdString, cmStdString>::const_iterator i = libTypes.begin();
+ for(std::map<std::string, std::string>::const_iterator i = libTypes.begin();
i != libTypes.end(); ++i)
{
if(i->second != "general")
diff --git a/Source/cmExportLibraryDependenciesCommand.h b/Source/cmExportLibraryDependenciesCommand.h
index 29b568f..2ea4e79 100644
--- a/Source/cmExportLibraryDependenciesCommand.h
+++ b/Source/cmExportLibraryDependenciesCommand.h
@@ -21,7 +21,7 @@ public:
virtual cmCommand* Clone() { return new cmExportLibraryDependenciesCommand; }
virtual bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus &status);
- virtual const char* GetName() const { return "export_library_dependencies";}
+ virtual std::string GetName() const { return "export_library_dependencies";}
virtual bool IsDiscouraged() const { return true; }
virtual void FinalPass();
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index a8a91d6..fe8c8ec 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -46,8 +46,9 @@ bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os)
return true;
}
-std::string cmExportTryCompileFileGenerator::FindTargets(const char *propName,
- cmTarget const* tgt,
+std::string cmExportTryCompileFileGenerator::FindTargets(
+ const std::string& propName,
+ cmTarget const* tgt,
std::set<cmTarget const*> &emitted)
{
const char *prop = tgt->GetProperty(propName);
diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h
index 71ac0dd..ec70d81 100644
--- a/Source/cmExportTryCompileFileGenerator.h
+++ b/Source/cmExportTryCompileFileGenerator.h
@@ -23,14 +23,14 @@ public:
/** Set the list of targets to export. */
void SetExports(const std::vector<cmTarget const*> &exports)
{ this->Exports = exports; }
- void SetConfig(const char *config) { this->Config = config; }
+ void SetConfig(const std::string& config) { this->Config = config; }
protected:
// Implement virtual methods from the superclass.
virtual bool GenerateMainFile(std::ostream& os);
virtual void GenerateImportTargetsConfig(std::ostream&,
- const char*,
+ const std::string&,
std::string const&,
std::vector<std::string>&) {}
virtual void HandleMissingTarget(std::string&,
@@ -46,12 +46,12 @@ protected:
std::string InstallNameDir(cmTarget* target,
const std::string& config);
private:
- std::string FindTargets(const char *prop, cmTarget const* tgt,
+ std::string FindTargets(const std::string& prop, cmTarget const* tgt,
std::set<cmTarget const*> &emitted);
std::vector<cmTarget const*> Exports;
- const char *Config;
+ std::string Config;
};
#endif
diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h
index 4b76b33..8d6b2cd 100644
--- a/Source/cmExprParserHelper.h
+++ b/Source/cmExprParserHelper.h
@@ -49,8 +49,8 @@ public:
const char* GetError() { return this->ErrorString.c_str(); }
private:
- cmStdString::size_type InputBufferPos;
- cmStdString InputBuffer;
+ std::string::size_type InputBufferPos;
+ std::string InputBuffer;
std::vector<char> OutputBuffer;
int CurrentLine;
int Verbose;
diff --git a/Source/cmExternalMakefileProjectGenerator.cxx b/Source/cmExternalMakefileProjectGenerator.cxx
index 0d42c35..d89a1c8 100644
--- a/Source/cmExternalMakefileProjectGenerator.cxx
+++ b/Source/cmExternalMakefileProjectGenerator.cxx
@@ -20,13 +20,13 @@ void cmExternalMakefileProjectGenerator
}
std::string cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
- const char* globalGenerator,
- const char* extraGenerator)
+ const std::string& globalGenerator,
+ const std::string& extraGenerator)
{
std::string fullName;
- if (globalGenerator)
+ if (!globalGenerator.empty())
{
- if (extraGenerator && *extraGenerator)
+ if (!extraGenerator.empty())
{
fullName = extraGenerator;
fullName += " - ";
@@ -36,22 +36,22 @@ std::string cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
return fullName;
}
-const char* cmExternalMakefileProjectGenerator::GetGlobalGeneratorName(
- const char* fullName)
+std::string cmExternalMakefileProjectGenerator::GetGlobalGeneratorName(
+ const std::string& fullName)
{
// at least one global generator must be supported
assert(!this->SupportedGlobalGenerators.empty());
- if (fullName==0)
+ if (fullName.empty())
{
- return 0;
+ return "";
}
std::string currentName = fullName;
// if we get only the short name, take the first global generator as default
if (currentName == this->GetName())
{
- return this->SupportedGlobalGenerators[0].c_str();
+ return this->SupportedGlobalGenerators[0];
}
// otherwise search for the matching global generator
@@ -63,8 +63,8 @@ const char* cmExternalMakefileProjectGenerator::GetGlobalGeneratorName(
if (this->CreateFullGeneratorName(it->c_str(), this->GetName())
== currentName)
{
- return it->c_str();
+ return *it;
}
}
- return 0;
+ return "";
}
diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h
index bce441d..cba1c76 100644
--- a/Source/cmExternalMakefileProjectGenerator.h
+++ b/Source/cmExternalMakefileProjectGenerator.h
@@ -37,10 +37,10 @@ public:
virtual ~cmExternalMakefileProjectGenerator() {}
///! Get the name for this generator.
- virtual const char* GetName() const = 0;
+ virtual std::string GetName() const = 0;
/** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry,
- const char* fullName) const = 0;
+ const std::string& fullName) const = 0;
virtual void EnableLanguage(std::vector<std::string> const& languages,
cmMakefile *, bool optional);
@@ -53,12 +53,13 @@ public:
{return this->SupportedGlobalGenerators;}
///! Get the name of the global generator for the given full name
- const char* GetGlobalGeneratorName(const char* fullName);
+ std::string GetGlobalGeneratorName(const std::string& fullName);
/** Create a full name from the given global generator name and the
* extra generator name
*/
- static std::string CreateFullGeneratorName(const char* globalGenerator,
- const char* extraGenerator);
+ static std::string CreateFullGeneratorName(
+ const std::string& globalGenerator,
+ const std::string& extraGenerator);
///! Generate the project files, the Makefiles have already been generated
virtual void Generate() = 0;
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 548c88b..03f59c4 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -38,7 +38,7 @@ http://forums.codeblocks.org/index.php/topic,6789.0.html
//----------------------------------------------------------------------------
void cmExtraCodeBlocksGenerator
-::GetDocumentation(cmDocumentationEntry& entry, const char*) const
+::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const
{
entry.Name = this->GetName();
entry.Brief = "Generates CodeBlocks project files.";
@@ -61,7 +61,7 @@ cmExtraCodeBlocksGenerator::cmExtraCodeBlocksGenerator()
void cmExtraCodeBlocksGenerator::Generate()
{
// for each sub project in the project create a codeblocks project
- for (std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator
+ for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator
it = this->GlobalGenerator->GetProjectMap().begin();
it!= this->GlobalGenerator->GetProjectMap().end();
++it)
@@ -243,7 +243,7 @@ void cmExtraCodeBlocksGenerator
Tree tree;
// build tree of virtual folders
- for (std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator
+ for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator
it = this->GlobalGenerator->GetProjectMap().begin();
it != this->GlobalGenerator->GetProjectMap().end();
++it)
@@ -411,14 +411,16 @@ void cmExtraCodeBlocksGenerator
// check whether it is a C/C++ implementation file
bool isCFile = false;
- if ((*si)->GetLanguage() && (*(*si)->GetLanguage() == 'C'))
+ std::string lang = (*si)->GetLanguage();
+ if (lang == "C" || lang == "CXX")
{
+ std::string srcext = (*si)->GetExtension();
for(std::vector<std::string>::const_iterator
ext = mf->GetSourceExtensions().begin();
ext != mf->GetSourceExtensions().end();
++ext)
{
- if ((*si)->GetExtension() == *ext)
+ if (srcext == *ext)
{
isCFile = true;
break;
@@ -536,7 +538,7 @@ std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile(
// Generate the xml code for one target.
void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
- const char* targetName,
+ const std::string& targetName,
cmTarget* target,
const char* make,
const cmMakefile* makefile,
@@ -756,10 +758,12 @@ int cmExtraCodeBlocksGenerator::GetCBTargetType(cmTarget* target)
// Create the command line for building the given target using the selected
// make
std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
- const std::string& make, const char* makefile, const char* target)
+ const std::string& make, const char* makefile,
+ const std::string& target)
{
std::string command = make;
- if (strcmp(this->GlobalGenerator->GetName(), "NMake Makefiles")==0)
+ std::string generator = this->GlobalGenerator->GetName();
+ if (generator == "NMake Makefiles")
{
// For Windows ConvertToOutputPath already adds quotes when required.
// These need to be escaped, see
@@ -770,7 +774,7 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
command += " VERBOSE=1 ";
command += target;
}
- else if (strcmp(this->GlobalGenerator->GetName(), "MinGW Makefiles")==0)
+ else if (generator == "MinGW Makefiles")
{
// no escaping of spaces in this case, see
// http://public.kitware.com/Bug/view.php?id=10014
@@ -781,7 +785,7 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
command += " VERBOSE=1 ";
command += target;
}
- else if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0)
+ else if (generator == "Ninja")
{
command += " -v ";
command += target;
diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h
index e0a64ca..0435ad8 100644
--- a/Source/cmExtraCodeBlocksGenerator.h
+++ b/Source/cmExtraCodeBlocksGenerator.h
@@ -28,14 +28,14 @@ class cmExtraCodeBlocksGenerator : public cmExternalMakefileProjectGenerator
public:
cmExtraCodeBlocksGenerator();
- virtual const char* GetName() const
+ virtual std::string GetName() const
{ return cmExtraCodeBlocksGenerator::GetActualName();}
- static const char* GetActualName() { return "CodeBlocks";}
+ static std::string GetActualName() { return "CodeBlocks";}
static cmExternalMakefileProjectGenerator* New()
{ return new cmExtraCodeBlocksGenerator; }
/** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry,
- const char* fullName) const;
+ const std::string& fullName) const;
virtual void Generate();
private:
@@ -49,9 +49,9 @@ private:
std::string GetCBCompilerId(const cmMakefile* mf);
int GetCBTargetType(cmTarget* target);
std::string BuildMakeCommand(const std::string& make, const char* makefile,
- const char* target);
+ const std::string& target);
void AppendTarget(cmGeneratedFileStream& fout,
- const char* targetName,
+ const std::string& targetName,
cmTarget* target,
const char* make,
const cmMakefile* makefile,
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index ff84fb7..5a9e125 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -28,7 +28,7 @@
//----------------------------------------------------------------------------
void cmExtraCodeLiteGenerator::GetDocumentation(cmDocumentationEntry& entry,
- const char*) const
+ const std::string&) const
{
entry.Name = this->GetName();
entry.Brief = "Generates CodeLite project files.";
@@ -60,7 +60,7 @@ void cmExtraCodeLiteGenerator::Generate()
// loop projects and locate the root project.
// and extract the information for creating the worspace
- for (std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator
+ for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator
it = this->GlobalGenerator->GetProjectMap().begin();
it!= this->GlobalGenerator->GetProjectMap().end();
++it)
@@ -85,7 +85,7 @@ void cmExtraCodeLiteGenerator::Generate()
}
// for each sub project in the workspace create a codelite project
- for (std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator
+ for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator
it = this->GlobalGenerator->GetProjectMap().begin();
it!= this->GlobalGenerator->GetProjectMap().end();
++it)
@@ -220,14 +220,16 @@ void cmExtraCodeLiteGenerator
{
// check whether it is a C/C++ implementation file
bool isCFile = false;
- if ((*si)->GetLanguage() && (*(*si)->GetLanguage() == 'C'))
+ std::string lang = (*si)->GetLanguage();
+ if (lang == "C" || lang == "CXX")
{
+ std::string srcext = (*si)->GetExtension();
for(std::vector<std::string>::const_iterator
ext = mf->GetSourceExtensions().begin();
ext != mf->GetSourceExtensions().end();
++ext)
{
- if ((*si)->GetExtension() == *ext)
+ if (srcext == *ext)
{
isCFile = true;
break;
diff --git a/Source/cmExtraCodeLiteGenerator.h b/Source/cmExtraCodeLiteGenerator.h
index 984313e..6b4965d 100644
--- a/Source/cmExtraCodeLiteGenerator.h
+++ b/Source/cmExtraCodeLiteGenerator.h
@@ -35,14 +35,14 @@ protected:
public:
cmExtraCodeLiteGenerator();
- virtual const char* GetName() const
+ virtual std::string GetName() const
{ return cmExtraCodeLiteGenerator::GetActualName();}
- static const char* GetActualName() { return "CodeLite";}
+ static std::string GetActualName() { return "CodeLite";}
static cmExternalMakefileProjectGenerator* New()
{ return new cmExtraCodeLiteGenerator; }
/** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry,
- const char* fullName) const;
+ const std::string& fullName) const;
virtual void Generate();
void CreateProjectFile(const std::vector<cmLocalGenerator*>& lgs);
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 74ba9a6..4aabc7e 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -45,7 +45,7 @@ cmExtraEclipseCDT4Generator
//----------------------------------------------------------------------------
void cmExtraEclipseCDT4Generator
-::GetDocumentation(cmDocumentationEntry& entry, const char*) const
+::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const
{
entry.Name = this->GetName();
entry.Brief = "Generates Eclipse CDT 4.0 project files.";
@@ -624,7 +624,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects(
this->AppendLinkedResource(fout, "[Subprojects]",
"virtual:/virtual", VirtualFolder);
- for (std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator
+ for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator
it = this->GlobalGenerator->GetProjectMap().begin();
it != this->GlobalGenerator->GetProjectMap().end();
++it)
diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h
index d88b247..ef99760 100644
--- a/Source/cmExtraEclipseCDT4Generator.h
+++ b/Source/cmExtraEclipseCDT4Generator.h
@@ -33,14 +33,14 @@ public:
return new cmExtraEclipseCDT4Generator;
}
- virtual const char* GetName() const {
+ virtual std::string GetName() const {
return cmExtraEclipseCDT4Generator::GetActualName();
}
- static const char* GetActualName() { return "Eclipse CDT4"; }
+ static std::string GetActualName() { return "Eclipse CDT4"; }
virtual void GetDocumentation(cmDocumentationEntry& entry,
- const char* fullName) const;
+ const std::string& fullName) const;
virtual void EnableLanguage(std::vector<std::string> const& languages,
cmMakefile *, bool optional);
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index a0d37d4..567542e 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -25,7 +25,7 @@
//----------------------------------------------------------------------------
void cmExtraKateGenerator
-::GetDocumentation(cmDocumentationEntry& entry, const char*) const
+::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const
{
entry.Name = this->GetName();
entry.Brief = "Generates Kate project files.";
@@ -52,7 +52,7 @@ void cmExtraKateGenerator::Generate()
this->ProjectName = this->GenerateProjectName(mf->GetProjectName(),
mf->GetSafeDefinition("CMAKE_BUILD_TYPE"),
this->GetPathBasename(mf->GetHomeOutputDirectory()));
- this->UseNinja = (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0);
+ this->UseNinja = (this->GlobalGenerator->GetName() == "Ninja");
this->CreateKateProjectFile(mf);
this->CreateDummyKateProjectFile(mf);
diff --git a/Source/cmExtraKateGenerator.h b/Source/cmExtraKateGenerator.h
index 6ced5fe..f800feb 100644
--- a/Source/cmExtraKateGenerator.h
+++ b/Source/cmExtraKateGenerator.h
@@ -28,14 +28,14 @@ class cmExtraKateGenerator : public cmExternalMakefileProjectGenerator
public:
cmExtraKateGenerator();
- virtual const char* GetName() const
+ virtual std::string GetName() const
{ return cmExtraKateGenerator::GetActualName();}
- static const char* GetActualName() { return "Kate";}
+ static std::string GetActualName() { return "Kate";}
static cmExternalMakefileProjectGenerator* New()
{ return new cmExtraKateGenerator; }
/** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry,
- const char* fullName) const;
+ const std::string& fullName) const;
virtual void Generate();
private:
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 604bfcc..f973a84 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -41,7 +41,7 @@ http://sublimetext.info/docs/en/reference/build_systems.html
//----------------------------------------------------------------------------
void cmExtraSublimeTextGenerator
-::GetDocumentation(cmDocumentationEntry& entry, const char*) const
+::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const
{
entry.Name = this->GetName();
entry.Brief = "Generates Sublime Text 2 project files.";
@@ -64,7 +64,7 @@ cmExtraSublimeTextGenerator::cmExtraSublimeTextGenerator()
void cmExtraSublimeTextGenerator::Generate()
{
// for each sub project in the project create a sublime text 2 project
- for (std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator
+ for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator
it = this->GlobalGenerator->GetProjectMap().begin();
it!= this->GlobalGenerator->GetProjectMap().end();
++it)
@@ -223,7 +223,7 @@ void cmExtraSublimeTextGenerator::
void cmExtraSublimeTextGenerator::
AppendTarget(cmGeneratedFileStream& fout,
- const char* targetName,
+ const std::string& targetName,
cmLocalGenerator* lg,
cmTarget* target,
const char* make,
@@ -290,7 +290,7 @@ void cmExtraSublimeTextGenerator::
// Ninja uses ninja.build files (look for a way to get the output file name
// from cmMakefile or something)
std::string makefileName;
- if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0)
+ if (this->GlobalGenerator->GetName() == "Ninja")
{
makefileName = "build.ninja";
}
@@ -315,11 +315,13 @@ void cmExtraSublimeTextGenerator::
// Create the command line for building the given target using the selected
// make
std::string cmExtraSublimeTextGenerator::BuildMakeCommand(
- const std::string& make, const char* makefile, const char* target)
+ const std::string& make, const char* makefile,
+ const std::string& target)
{
std::string command = "\"";
command += make + "\"";
- if (strcmp(this->GlobalGenerator->GetName(), "NMake Makefiles")==0)
+ std::string generator = this->GlobalGenerator->GetName();
+ if (generator == "NMake Makefiles")
{
std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
command += ", \"/NOLOGO\", \"/f\", \"";
@@ -328,7 +330,7 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand(
command += target;
command += "\"";
}
- else if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0)
+ else if (generator == "Ninja")
{
std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
command += ", \"-f\", \"";
@@ -340,7 +342,7 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand(
else
{
std::string makefileName;
- if (strcmp(this->GlobalGenerator->GetName(), "MinGW Makefiles")==0)
+ if (generator == "MinGW Makefiles")
{
// no escaping of spaces in this case, see
// http://public.kitware.com/Bug/view.php?id=10014
@@ -369,12 +371,12 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source,
std::string flags;
cmMakefile *makefile = lg->GetMakefile();
- const char* language = source->GetLanguage();
- if (language == NULL)
+ std::string language = source->GetLanguage();
+ if (language.empty())
{
language = "C";
}
- const char* config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
// Add language-specific flags.
lg->AddLanguageFlags(flags, language, config);
@@ -423,12 +425,8 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target,
{
std::set<std::string> defines;
cmMakefile *makefile = lg->GetMakefile();
- const char* language = source->GetLanguage();
- if (language == NULL)
- {
- language = "";
- }
- const char* config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ const std::string& language = source->GetLanguage();
+ const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
// Add the export symbol definition for shared library objects.
if(const char* exportMacro = target->GetExportMacro())
diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h
index 7902593..4173b7d 100644
--- a/Source/cmExtraSublimeTextGenerator.h
+++ b/Source/cmExtraSublimeTextGenerator.h
@@ -31,15 +31,15 @@ public:
typedef std::map<std::string, std::vector<std::string> > MapSourceFileFlags;
cmExtraSublimeTextGenerator();
- virtual const char* GetName() const
+ virtual std::string GetName() const
{ return cmExtraSublimeTextGenerator::GetActualName();}
- static const char* GetActualName()
+ static std::string GetActualName()
{ return "Sublime Text 2";}
static cmExternalMakefileProjectGenerator* New()
{ return new cmExtraSublimeTextGenerator; }
/** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry,
- const char* fullName) const;
+ const std::string& fullName) const;
virtual void Generate();
private:
@@ -60,12 +60,12 @@ private:
* specified target.
*/
std::string BuildMakeCommand(const std::string& make, const char* makefile,
- const char* target);
+ const std::string& target);
/** Appends the specified target to the generated project file as a Sublime
* Text build system.
*/
void AppendTarget(cmGeneratedFileStream& fout,
- const char* targetName,
+ const std::string& targetName,
cmLocalGenerator* lg,
cmTarget* target,
const char* make,
diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index 4dd81be..dd99c43 100644
--- a/Source/cmFLTKWrapUICommand.cxx
+++ b/Source/cmFLTKWrapUICommand.cxx
@@ -78,7 +78,7 @@ bool cmFLTKWrapUICommand
commandLines.push_back(commandLine);
// Add command for generating the .h and .cxx files
- const char* no_main_dependency = 0;
+ std::string no_main_dependency = "";
const char* no_comment = 0;
const char* no_working_dir = 0;
this->Makefile->AddCustomCommandToOutput(cxxres.c_str(),
diff --git a/Source/cmFLTKWrapUICommand.h b/Source/cmFLTKWrapUICommand.h
index b94390c..617fcd9 100644
--- a/Source/cmFLTKWrapUICommand.h
+++ b/Source/cmFLTKWrapUICommand.h
@@ -52,7 +52,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "fltk_wrap_ui";}
+ virtual std::string GetName() const { return "fltk_wrap_ui";}
private:
/**
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index ba45815..8d66fdf 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -46,7 +46,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "file";}
+ virtual std::string GetName() const { return "file";}
cmTypeMacro(cmFileCommand, cmCommand);
diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeComparison.cxx
index 02f10c0..5727470 100644
--- a/Source/cmFileTimeComparison.cxx
+++ b/Source/cmFileTimeComparison.cxx
@@ -43,13 +43,13 @@ private:
class HashString
{
public:
- size_t operator()(const cmStdString& s) const
+ size_t operator()(const std::string& s) const
{
return h(s.c_str());
}
cmsys::hash<const char*> h;
};
- typedef cmsys::hash_map<cmStdString,
+ typedef cmsys::hash_map<std::string,
cmFileTimeComparison_Type, HashString> FileStatsMap;
FileStatsMap Files;
#endif
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index ae15ee7..86fd54b 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -268,7 +268,7 @@ void cmFindBase::AddPrefixPaths(std::vector<std::string> const& in_paths,
}
//----------------------------------------------------------------------------
-void cmFindBase::AddCMakePrefixPath(const char* variable)
+void cmFindBase::AddCMakePrefixPath(const std::string& variable)
{
// Get a path from a CMake variable.
if(const char* varPath = this->Makefile->GetDefinition(variable))
@@ -280,11 +280,11 @@ void cmFindBase::AddCMakePrefixPath(const char* variable)
}
//----------------------------------------------------------------------------
-void cmFindBase::AddEnvPrefixPath(const char* variable)
+void cmFindBase::AddEnvPrefixPath(const std::string& variable)
{
// Get a path from the environment.
std::vector<std::string> tmp;
- cmSystemTools::GetPath(tmp, variable);
+ cmSystemTools::GetPath(tmp, variable.c_str());
this->AddPrefixPaths(tmp, EnvPath);
}
diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h
index 0562b1b..42d9bc1 100644
--- a/Source/cmFindBase.h
+++ b/Source/cmFindBase.h
@@ -42,14 +42,14 @@ protected:
bool CheckForVariableInCache();
// use by command during find
- cmStdString VariableDocumentation;
- cmStdString VariableName;
+ std::string VariableDocumentation;
+ std::string VariableName;
std::vector<std::string> Names;
bool NamesPerDir;
bool NamesPerDirAllowed;
// CMAKE_*_PATH CMAKE_SYSTEM_*_PATH FRAMEWORK|LIBRARY|INCLUDE|PROGRAM
- cmStdString EnvironmentPath; // LIB,INCLUDE
+ std::string EnvironmentPath; // LIB,INCLUDE
bool AlreadyInCache;
bool AlreadyInCacheWithoutMetaInfo;
@@ -63,8 +63,8 @@ private:
void AddUserGuessPath();
// Helpers.
- void AddCMakePrefixPath(const char* variable);
- void AddEnvPrefixPath(const char* variable);
+ void AddCMakePrefixPath(const std::string& variable);
+ void AddEnvPrefixPath(const std::string& variable);
void AddPrefixPaths(std::vector<std::string> const& in_paths,
PathType pathType);
};
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index e8c8da3..bd75e10 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -374,7 +374,7 @@ void cmFindCommon::AddUserPath(std::string const& p,
}
//----------------------------------------------------------------------------
-void cmFindCommon::AddCMakePath(const char* variable)
+void cmFindCommon::AddCMakePath(const std::string& variable)
{
// Get a path from a CMake variable.
if(const char* varPath = this->Makefile->GetDefinition(variable))
diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h
index 6109a9f..5a905cd 100644
--- a/Source/cmFindCommon.h
+++ b/Source/cmFindCommon.h
@@ -56,14 +56,14 @@ protected:
/** Compute the current default bundle/framework search policy. */
void SelectDefaultMacMode();
- cmStdString CMakePathName;
+ std::string CMakePathName;
RootPathMode FindRootPathMode;
bool CheckCommonArgument(std::string const& arg);
void AddPathSuffix(std::string const& arg);
void AddUserPath(std::string const& p,
std::vector<std::string>& paths);
- void AddCMakePath(const char* variable);
+ void AddCMakePath(const std::string& variable);
void AddEnvPath(const char* variable);
void AddPathsInternal(std::vector<std::string> const& in_paths,
PathType pathType);
@@ -81,7 +81,7 @@ protected:
std::vector<std::string> UserPaths;
std::vector<std::string> UserHints;
std::vector<std::string> SearchPaths;
- std::set<cmStdString> SearchPathsEmitted;
+ std::set<std::string> SearchPathsEmitted;
bool SearchFrameworkFirst;
bool SearchFrameworkOnly;
diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h
index 3f0baa2..daf1d65 100644
--- a/Source/cmFindFileCommand.h
+++ b/Source/cmFindFileCommand.h
@@ -33,7 +33,7 @@ public:
{
return new cmFindFileCommand;
}
- virtual const char* GetName() const { return "find_file";}
+ virtual std::string GetName() const { return "find_file";}
cmTypeMacro(cmFindFileCommand, cmFindPathCommand);
};
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index de52df7..9345d15 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -368,8 +368,8 @@ bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path,
// Search for a file matching the library name regex.
std::string dir = path;
cmSystemTools::ConvertToUnixSlashes(dir);
- std::set<cmStdString> const& files = this->GG->GetDirectoryContent(dir);
- for(std::set<cmStdString>::const_iterator fi = files.begin();
+ std::set<std::string> const& files = this->GG->GetDirectoryContent(dir);
+ for(std::set<std::string>::const_iterator fi = files.begin();
fi != files.end(); ++fi)
{
std::string const& origName = *fi;
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index a9ec40e..e257174 100644
--- a/Source/cmFindLibraryCommand.h
+++ b/Source/cmFindLibraryCommand.h
@@ -49,7 +49,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "find_library";}
+ virtual std::string GetName() const {return "find_library";}
cmTypeMacro(cmFindLibraryCommand, cmFindBase);
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 73eba51..7a4e7f4 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -535,7 +535,8 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components)
}
//----------------------------------------------------------------------------
-void cmFindPackageCommand::AddFindDefinition(const char* var, const char* val)
+void cmFindPackageCommand::AddFindDefinition(const std::string& var,
+ const char* val)
{
if(const char* old = this->Makefile->GetDefinition(var))
{
@@ -552,7 +553,7 @@ void cmFindPackageCommand::AddFindDefinition(const char* var, const char* val)
//----------------------------------------------------------------------------
void cmFindPackageCommand::RestoreFindDefinitions()
{
- for(std::map<cmStdString, OriginalDef>::iterator
+ for(std::map<std::string, OriginalDef>::iterator
i = this->OriginalDefs.begin(); i != this->OriginalDefs.end(); ++i)
{
OriginalDef const& od = i->second;
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index 0d80e48..2249459 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -49,7 +49,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "find_package";}
+ virtual std::string GetName() const { return "find_package";}
cmTypeMacro(cmFindPackageCommand, cmFindCommon);
private:
@@ -57,7 +57,7 @@ private:
void AppendToFoundProperty(bool found);
void SetModuleVariables(const std::string& components);
bool FindModule(bool& found);
- void AddFindDefinition(const char* var, const char* val);
+ void AddFindDefinition(const std::string& var, const char* val);
void RestoreFindDefinitions();
bool HandlePackageMode();
bool FindConfig();
@@ -96,19 +96,19 @@ private:
friend class cmFindPackageFileList;
struct OriginalDef { bool exists; std::string value; };
- std::map<cmStdString, OriginalDef> OriginalDefs;
+ std::map<std::string, OriginalDef> OriginalDefs;
- cmStdString Name;
- cmStdString Variable;
- cmStdString Version;
+ std::string Name;
+ std::string Variable;
+ std::string Version;
unsigned int VersionMajor;
unsigned int VersionMinor;
unsigned int VersionPatch;
unsigned int VersionTweak;
unsigned int VersionCount;
bool VersionExact;
- cmStdString FileFound;
- cmStdString VersionFound;
+ std::string FileFound;
+ std::string VersionFound;
unsigned int VersionFoundMajor;
unsigned int VersionFoundMinor;
unsigned int VersionFoundPatch;
diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx
index 8459995..caaf1d3 100644
--- a/Source/cmFindPathCommand.cxx
+++ b/Source/cmFindPathCommand.cxx
@@ -89,9 +89,9 @@ std::string
cmFindPathCommand::FindHeaderInFramework(std::string const& file,
std::string const& dir)
{
- cmStdString fileName = file;
- cmStdString frameWorkName;
- cmStdString::size_type pos = fileName.find("/");
+ std::string fileName = file;
+ std::string frameWorkName;
+ std::string::size_type pos = fileName.find("/");
// if there is a / in the name try to find the header as a framework
// For example bar/foo.h would look for:
// bar.framework/Headers/foo.h
@@ -128,7 +128,7 @@ cmFindPathCommand::FindHeaderInFramework(std::string const& file,
}
// if it is not found yet or not a framework header, then do a glob search
// for all frameworks in the directory: dir/*.framework/Headers/<file>
- cmStdString glob = dir;
+ std::string glob = dir;
glob += "*.framework/Headers/";
glob += file;
cmsys::Glob globIt;
@@ -136,7 +136,7 @@ cmFindPathCommand::FindHeaderInFramework(std::string const& file,
std::vector<std::string> files = globIt.GetFiles();
if(files.size())
{
- cmStdString fheader = cmSystemTools::CollapseFullPath(files[0].c_str());
+ std::string fheader = cmSystemTools::CollapseFullPath(files[0].c_str());
if(this->IncludeFileInPath)
{
return fheader;
diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h
index 8df4540..a51da79 100644
--- a/Source/cmFindPathCommand.h
+++ b/Source/cmFindPathCommand.h
@@ -49,7 +49,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "find_path";}
+ virtual std::string GetName() const {return "find_path";}
cmTypeMacro(cmFindPathCommand, cmFindBase);
bool IncludeFileInPath;
diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h
index 7f4811c..70f758f 100644
--- a/Source/cmFindProgramCommand.h
+++ b/Source/cmFindProgramCommand.h
@@ -48,7 +48,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "find_program";}
+ virtual std::string GetName() const { return "find_program";}
cmTypeMacro(cmFindProgramCommand, cmFindBase);
diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h
index e548ba8..9b7c85a 100644
--- a/Source/cmForEachCommand.h
+++ b/Source/cmForEachCommand.h
@@ -59,7 +59,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "foreach";}
+ virtual std::string GetName() const { return "foreach";}
cmTypeMacro(cmForEachCommand, cmCommand);
private:
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 85b89d9..9b981a3 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -64,7 +64,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return this->Args[0].c_str(); }
+ virtual std::string GetName() const { return this->Args[0]; }
cmTypeMacro(cmFunctionHelperCommand, cmCommand);
diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h
index a8bd3e7..2df435e 100644
--- a/Source/cmFunctionCommand.h
+++ b/Source/cmFunctionCommand.h
@@ -57,7 +57,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "function";}
+ virtual std::string GetName() const { return "function";}
cmTypeMacro(cmFunctionCommand, cmCommand);
};
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx
index 34efc15..78ad4b2 100644
--- a/Source/cmGeneratedFileStream.cxx
+++ b/Source/cmGeneratedFileStream.cxx
@@ -249,12 +249,7 @@ int cmGeneratedFileStreamBase::RenameFile(const char* oldname,
}
//----------------------------------------------------------------------------
-void cmGeneratedFileStream::SetName(const char* fname)
+void cmGeneratedFileStream::SetName(const std::string& fname)
{
- if ( !fname )
- {
- this->Name = "";
- return;
- }
this->Name = fname;
}
diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h
index 99f3b47..7adee7b 100644
--- a/Source/cmGeneratedFileStream.h
+++ b/Source/cmGeneratedFileStream.h
@@ -140,7 +140,7 @@ public:
* Set name of the file that will hold the actual output. This method allows
* the output file to be changed during the use of cmGeneratedFileStream.
*/
- void SetName(const char* fname);
+ void SetName(const std::string& fname);
private:
cmGeneratedFileStream(cmGeneratedFileStream const&); // not implemented
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index cd30546..e4187d2 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -33,17 +33,17 @@ cmGeneratorExpression::cmGeneratorExpression(
cmsys::auto_ptr<cmCompiledGeneratorExpression>
cmGeneratorExpression::Parse(std::string const& input)
{
- return this->Parse(input.c_str());
+ return cmsys::auto_ptr<cmCompiledGeneratorExpression>(
+ new cmCompiledGeneratorExpression(
+ this->Backtrace,
+ input));
}
//----------------------------------------------------------------------------
cmsys::auto_ptr<cmCompiledGeneratorExpression>
cmGeneratorExpression::Parse(const char* input)
{
- return cmsys::auto_ptr<cmCompiledGeneratorExpression>(
- new cmCompiledGeneratorExpression(
- this->Backtrace,
- input));
+ return this->Parse(std::string(input ? input : ""));
}
cmGeneratorExpression::~cmGeneratorExpression()
@@ -52,7 +52,7 @@ cmGeneratorExpression::~cmGeneratorExpression()
//----------------------------------------------------------------------------
const char *cmCompiledGeneratorExpression::Evaluate(
- cmMakefile* mf, const char* config, bool quiet,
+ cmMakefile* mf, const std::string& config, bool quiet,
cmTarget const* headTarget,
cmGeneratorExpressionDAGChecker *dagChecker) const
{
@@ -66,7 +66,7 @@ const char *cmCompiledGeneratorExpression::Evaluate(
//----------------------------------------------------------------------------
const char *cmCompiledGeneratorExpression::Evaluate(
- cmMakefile* mf, const char* config, bool quiet,
+ cmMakefile* mf, const std::string& config, bool quiet,
cmTarget const* headTarget,
cmTarget const* currentTarget,
cmGeneratorExpressionDAGChecker *dagChecker) const
@@ -97,7 +97,7 @@ const char *cmCompiledGeneratorExpression::Evaluate(
{
this->Output += (*it)->Evaluate(&context, dagChecker);
- for(std::set<cmStdString>::const_iterator
+ for(std::set<std::string>::const_iterator
p = context.SeenTargetProperties.begin();
p != context.SeenTargetProperties.end(); ++p)
{
@@ -122,13 +122,13 @@ const char *cmCompiledGeneratorExpression::Evaluate(
cmCompiledGeneratorExpression::cmCompiledGeneratorExpression(
cmListFileBacktrace const& backtrace,
- const char *input)
- : Backtrace(backtrace), Input(input ? input : ""),
+ const std::string& input)
+ : Backtrace(backtrace), Input(input),
HadContextSensitiveCondition(false)
{
cmGeneratorExpressionLexer l;
std::vector<cmGeneratorExpressionToken> tokens =
- l.Tokenize(this->Input.c_str());
+ l.Tokenize(this->Input);
this->NeedsEvaluation = l.GetSawGeneratorExpression();
if (this->NeedsEvaluation)
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 4992e93..5b97e8b 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -78,12 +78,12 @@ private:
class cmCompiledGeneratorExpression
{
public:
- const char* Evaluate(cmMakefile* mf, const char* config,
+ const char* Evaluate(cmMakefile* mf, const std::string& config,
bool quiet = false,
cmTarget const* headTarget = 0,
cmTarget const* currentTarget = 0,
cmGeneratorExpressionDAGChecker *dagChecker = 0) const;
- const char* Evaluate(cmMakefile* mf, const char* config,
+ const char* Evaluate(cmMakefile* mf, const std::string& config,
bool quiet,
cmTarget const* headTarget,
cmGeneratorExpressionDAGChecker *dagChecker) const;
@@ -92,7 +92,7 @@ public:
std::set<cmTarget*> const& GetTargets() const
{ return this->DependTargets; }
- std::set<cmStdString> const& GetSeenTargetProperties() const
+ std::set<std::string> const& GetSeenTargetProperties() const
{ return this->SeenTargetProperties; }
std::set<cmTarget const*> const& GetAllTargetsSeen() const
@@ -100,7 +100,7 @@ public:
~cmCompiledGeneratorExpression();
- std::string GetInput() const
+ std::string const& GetInput() const
{
return this->Input;
}
@@ -116,7 +116,7 @@ public:
private:
cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace,
- const char *input);
+ const std::string& input);
friend class cmGeneratorExpression;
@@ -130,7 +130,7 @@ private:
mutable std::set<cmTarget*> DependTargets;
mutable std::set<cmTarget const*> AllTargetsSeen;
- mutable std::set<cmStdString> SeenTargetProperties;
+ mutable std::set<std::string> SeenTargetProperties;
mutable std::string Output;
mutable bool HadContextSensitiveCondition;
};
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index e7e1d34..04f36b4 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -42,12 +42,12 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
)
#undef TEST_TRANSITIVE_PROPERTY_METHOD
{
- std::map<cmStdString, std::set<cmStdString> >::const_iterator it
+ std::map<std::string, std::set<std::string> >::const_iterator it
= top->Seen.find(target);
if (it != top->Seen.end())
{
- const std::set<cmStdString> &propSet = it->second;
- const std::set<cmStdString>::const_iterator i = propSet.find(property);
+ const std::set<std::string> &propSet = it->second;
+ const std::set<std::string>::const_iterator i = propSet.find(property);
if (i != propSet.end())
{
this->CheckResult = ALREADY_SEEN;
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index b6effa1..6cbbd2a 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -77,7 +77,7 @@ private:
const cmGeneratorExpressionDAGChecker * const Parent;
const std::string Target;
const std::string Property;
- std::map<cmStdString, std::set<cmStdString> > Seen;
+ std::map<std::string, 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 bf85870..90ce27c 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -33,7 +33,7 @@ cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile(
}
//----------------------------------------------------------------------------
-void cmGeneratorExpressionEvaluationFile::Generate(const char *config,
+void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
cmCompiledGeneratorExpression* inputExpression,
std::map<std::string, std::string> &outputFiles)
{
@@ -135,7 +135,7 @@ void cmGeneratorExpressionEvaluationFile::Generate()
if (allConfigs.empty())
{
- this->Generate(0, inputExpression.get(), outputFiles);
+ this->Generate("", inputExpression.get(), outputFiles);
}
else
{
diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h
index 20ee5cb..f939916 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.h
+++ b/Source/cmGeneratorExpressionEvaluationFile.h
@@ -32,7 +32,7 @@ public:
std::vector<std::string> GetFiles() const { return this->Files; }
private:
- void Generate(const char *config,
+ void Generate(const std::string& config,
cmCompiledGeneratorExpression* inputExpression,
std::map<std::string, std::string> &outputFiles);
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index bdefcfb..43c1794 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -689,7 +689,7 @@ static const struct ConfigurationNode : public cmGeneratorExpressionNode
cmGeneratorExpressionDAGChecker *) const
{
context->HadContextSensitiveCondition = true;
- return context->Config ? context->Config : "";
+ return context->Config;
}
} configurationNode;
@@ -718,13 +718,13 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
return std::string();
}
context->HadContextSensitiveCondition = true;
- if (!context->Config)
+ if (context->Config.empty())
{
return parameters.front().empty() ? "1" : "0";
}
if (cmsysString_strcasecmp(parameters.begin()->c_str(),
- context->Config) == 0)
+ context->Config.c_str()) == 0)
{
return "1";
}
@@ -990,8 +990,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
"link libraries for a static library");
return std::string();
}
- const char *lang = target->GetLinkerLanguage(context->Config);
- return lang ? lang : "";
+ return target->GetLinkerLanguage(context->Config);
}
cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace,
@@ -1555,89 +1554,58 @@ TargetFilesystemArtifact<false, true, true, false> targetSoNameFileDirNode;
static const
cmGeneratorExpressionNode* GetNode(const std::string &identifier)
{
- if (identifier == "0")
- return &zeroNode;
- else if (identifier == "1")
- return &oneNode;
- else if (identifier == "AND")
- return &andNode;
- else if (identifier == "OR")
- return &orNode;
- else if (identifier == "NOT")
- return &notNode;
- else if (identifier == "C_COMPILER_ID")
- return &cCompilerIdNode;
- else if (identifier == "CXX_COMPILER_ID")
- return &cxxCompilerIdNode;
- else if (identifier == "VERSION_GREATER")
- return &versionGreaterNode;
- else if (identifier == "VERSION_LESS")
- return &versionLessNode;
- else if (identifier == "VERSION_EQUAL")
- return &versionEqualNode;
- else if (identifier == "C_COMPILER_VERSION")
- return &cCompilerVersionNode;
- else if (identifier == "CXX_COMPILER_VERSION")
- return &cxxCompilerVersionNode;
- else if (identifier == "PLATFORM_ID")
- return &platformIdNode;
- else if (identifier == "CONFIGURATION")
- return &configurationNode;
- else if (identifier == "CONFIG")
- return &configurationTestNode;
- else if (identifier == "TARGET_FILE")
- return &targetFileNode;
- else if (identifier == "TARGET_LINKER_FILE")
- return &targetLinkerFileNode;
- else if (identifier == "TARGET_SONAME_FILE")
- return &targetSoNameFileNode;
- else if (identifier == "TARGET_FILE_NAME")
- return &targetFileNameNode;
- else if (identifier == "TARGET_LINKER_FILE_NAME")
- return &targetLinkerFileNameNode;
- else if (identifier == "TARGET_SONAME_FILE_NAME")
- return &targetSoNameFileNameNode;
- else if (identifier == "TARGET_FILE_DIR")
- return &targetFileDirNode;
- else if (identifier == "TARGET_LINKER_FILE_DIR")
- return &targetLinkerFileDirNode;
- else if (identifier == "TARGET_SONAME_FILE_DIR")
- return &targetSoNameFileDirNode;
- else if (identifier == "STREQUAL")
- return &strEqualNode;
- else if (identifier == "EQUAL")
- return &equalNode;
- else if (identifier == "LOWER_CASE")
- return &lowerCaseNode;
- else if (identifier == "UPPER_CASE")
- return &upperCaseNode;
- else if (identifier == "MAKE_C_IDENTIFIER")
- return &makeCIdentifierNode;
- else if (identifier == "BOOL")
- return &boolNode;
- else if (identifier == "ANGLE-R")
- return &angle_rNode;
- else if (identifier == "COMMA")
- return &commaNode;
- else if (identifier == "SEMICOLON")
- return &semicolonNode;
- else if (identifier == "TARGET_PROPERTY")
- return &targetPropertyNode;
- else if (identifier == "TARGET_NAME")
- return &targetNameNode;
- else if (identifier == "TARGET_POLICY")
- return &targetPolicyNode;
- else if (identifier == "BUILD_INTERFACE")
- return &buildInterfaceNode;
- else if (identifier == "INSTALL_INTERFACE")
- return &installInterfaceNode;
- else if (identifier == "INSTALL_PREFIX")
- return &installPrefixNode;
- else if (identifier == "JOIN")
- return &joinNode;
- else if (identifier == "LINK_ONLY")
- return &linkOnlyNode;
- return 0;
+ typedef std::map<std::string, const cmGeneratorExpressionNode*> NodeMap;
+ static NodeMap nodeMap;
+ if (nodeMap.empty())
+ {
+ nodeMap["0"] = &zeroNode;
+ nodeMap["1"] = &oneNode;
+ nodeMap["AND"] = &andNode;
+ nodeMap["OR"] = &orNode;
+ nodeMap["NOT"] = &notNode;
+ nodeMap["C_COMPILER_ID"] = &cCompilerIdNode;
+ nodeMap["CXX_COMPILER_ID"] = &cxxCompilerIdNode;
+ nodeMap["VERSION_GREATER"] = &versionGreaterNode;
+ nodeMap["VERSION_LESS"] = &versionLessNode;
+ nodeMap["VERSION_EQUAL"] = &versionEqualNode;
+ nodeMap["C_COMPILER_VERSION"] = &cCompilerVersionNode;
+ nodeMap["CXX_COMPILER_VERSION"] = &cxxCompilerVersionNode;
+ nodeMap["PLATFORM_ID"] = &platformIdNode;
+ nodeMap["CONFIGURATION"] = &configurationNode;
+ nodeMap["CONFIG"] = &configurationTestNode;
+ nodeMap["TARGET_FILE"] = &targetFileNode;
+ nodeMap["TARGET_LINKER_FILE"] = &targetLinkerFileNode;
+ nodeMap["TARGET_SONAME_FILE"] = &targetSoNameFileNode;
+ nodeMap["TARGET_FILE_NAME"] = &targetFileNameNode;
+ nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerFileNameNode;
+ nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameFileNameNode;
+ nodeMap["TARGET_FILE_DIR"] = &targetFileDirNode;
+ nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerFileDirNode;
+ nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameFileDirNode;
+ nodeMap["STREQUAL"] = &strEqualNode;
+ nodeMap["EQUAL"] = &equalNode;
+ nodeMap["LOWER_CASE"] = &lowerCaseNode;
+ nodeMap["UPPER_CASE"] = &upperCaseNode;
+ nodeMap["MAKE_C_IDENTIFIER"] = &makeCIdentifierNode;
+ nodeMap["BOOL"] = &boolNode;
+ nodeMap["ANGLE-R"] = &angle_rNode;
+ nodeMap["COMMA"] = &commaNode;
+ nodeMap["SEMICOLON"] = &semicolonNode;
+ nodeMap["TARGET_PROPERTY"] = &targetPropertyNode;
+ nodeMap["TARGET_NAME"] = &targetNameNode;
+ nodeMap["TARGET_POLICY"] = &targetPolicyNode;
+ nodeMap["BUILD_INTERFACE"] = &buildInterfaceNode;
+ nodeMap["INSTALL_INTERFACE"] = &installInterfaceNode;
+ nodeMap["INSTALL_PREFIX"] = &installPrefixNode;
+ nodeMap["JOIN"] = &joinNode;
+ nodeMap["LINK_ONLY"] = &linkOnlyNode;
+ }
+ NodeMap::const_iterator i = nodeMap.find(identifier);
+ if (i == nodeMap.end())
+ {
+ return 0;
+ }
+ return i->second;
}
diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h
index 49e52df..a7099cb 100644
--- a/Source/cmGeneratorExpressionEvaluator.h
+++ b/Source/cmGeneratorExpressionEvaluator.h
@@ -25,9 +25,9 @@ struct cmGeneratorExpressionContext
cmListFileBacktrace Backtrace;
std::set<cmTarget*> DependTargets;
std::set<cmTarget const*> AllTargets;
- std::set<cmStdString> SeenTargetProperties;
+ std::set<std::string> SeenTargetProperties;
cmMakefile *Makefile;
- const char *Config;
+ std::string Config;
cmTarget const* HeadTarget; // The target whose property is being evaluated.
cmTarget const* CurrentTarget; // The dependent of HeadTarget which appears
// directly or indirectly in the property.
diff --git a/Source/cmGeneratorExpressionLexer.cxx b/Source/cmGeneratorExpressionLexer.cxx
index 117a24e..1c83466 100644
--- a/Source/cmGeneratorExpressionLexer.cxx
+++ b/Source/cmGeneratorExpressionLexer.cxx
@@ -32,13 +32,11 @@ static void InsertText(const char *upto, const char *c,
//----------------------------------------------------------------------------
std::vector<cmGeneratorExpressionToken>
-cmGeneratorExpressionLexer::Tokenize(const char *input)
+cmGeneratorExpressionLexer::Tokenize(const std::string& input)
{
std::vector<cmGeneratorExpressionToken> result;
- if (!input)
- return result;
- const char *c = input;
+ const char *c = input.c_str();
const char *upto = c;
for ( ; *c; ++c)
diff --git a/Source/cmGeneratorExpressionLexer.h b/Source/cmGeneratorExpressionLexer.h
index 83d661d..1e2e8c2 100644
--- a/Source/cmGeneratorExpressionLexer.h
+++ b/Source/cmGeneratorExpressionLexer.h
@@ -43,7 +43,7 @@ class cmGeneratorExpressionLexer
public:
cmGeneratorExpressionLexer();
- std::vector<cmGeneratorExpressionToken> Tokenize(const char *input);
+ std::vector<cmGeneratorExpressionToken> Tokenize(const std::string& input);
bool GetSawGeneratorExpression() const
{
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index a7b2fb6..eb67f91 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -168,7 +168,7 @@ struct TagVisitor
this->BadObjLibFiles.push_back(sf);
}
}
- else if(sf->GetLanguage())
+ else if(!sf->GetLanguage().empty())
{
DoAccept<IsSameTag<Tag, ObjectSourcesTag>::Result>::Do(this->Data, sf);
}
@@ -228,13 +228,13 @@ int cmGeneratorTarget::GetType() const
}
//----------------------------------------------------------------------------
-const char *cmGeneratorTarget::GetName() const
+std::string cmGeneratorTarget::GetName() const
{
return this->Target->GetName();
}
//----------------------------------------------------------------------------
-const char *cmGeneratorTarget::GetProperty(const char *prop) const
+const char *cmGeneratorTarget::GetProperty(const std::string& prop) const
{
return this->Target->GetProperty(prop);
}
@@ -252,7 +252,8 @@ cmGeneratorTarget::GetSourceDepends(cmSourceFile* sf) const
}
static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt,
- const char *config, cmTarget *headTarget,
+ const std::string& config,
+ cmTarget *headTarget,
cmGeneratorExpressionDAGChecker *dagChecker,
std::vector<std::string>& result,
bool excludeImported)
@@ -390,12 +391,12 @@ void cmGeneratorTarget::GetResxSources(std::vector<cmSourceFile*>& srcs) const
}
//----------------------------------------------------------------------------
-bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
- const char *config) const
+bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
+ const std::string& config) const
{
assert(this->GetType() != cmTarget::INTERFACE_LIBRARY);
std::string config_upper;
- if(config && *config)
+ if(!config.empty())
{
config_upper = cmSystemTools::UpperCase(config);
}
@@ -422,7 +423,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
= this->Target->GetPropertyAsBool("NO_SYSTEM_FROM_IMPORTED");
std::vector<std::string> result;
- for (std::set<cmStdString>::const_iterator
+ for (std::set<std::string>::const_iterator
it = this->Target->GetSystemIncludeDirectories().begin();
it != this->Target->GetSystemIncludeDirectories().end(); ++it)
{
@@ -462,7 +463,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
}
}
}
- std::set<cmStdString> unique;
+ std::set<std::string> unique;
for(std::vector<std::string>::iterator li = result.begin();
li != result.end(); ++li)
{
@@ -470,7 +471,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
unique.insert(*li);
}
result.clear();
- for(std::set<cmStdString>::iterator li = unique.begin();
+ for(std::set<std::string>::iterator li = unique.begin();
li != unique.end(); ++li)
{
result.push_back(*li);
@@ -486,7 +487,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
}
//----------------------------------------------------------------------------
-bool cmGeneratorTarget::GetPropertyAsBool(const char *prop) const
+bool cmGeneratorTarget::GetPropertyAsBool(const std::string& prop) const
{
return this->Target->GetPropertyAsBool(prop);
}
@@ -594,7 +595,7 @@ private:
SourceEntry* CurrentEntry;
std::queue<cmSourceFile*> SourceQueue;
std::set<cmSourceFile*> SourcesQueued;
- typedef std::map<cmStdString, cmSourceFile*> NameMapType;
+ typedef std::map<std::string, cmSourceFile*> NameMapType;
NameMapType NameMap;
void QueueSource(cmSourceFile* sf);
@@ -742,7 +743,7 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
{
// This is really only for compatibility so we do not need to
// worry about configuration names and output names.
- std::string tLocation = t->GetLocation(0);
+ std::string tLocation = t->GetLocationForBuild();
tLocation = cmSystemTools::GetFilenamePath(tLocation);
std::string depLocation = cmSystemTools::GetFilenamePath(dep);
depLocation = cmSystemTools::CollapseFullPath(depLocation.c_str());
@@ -802,7 +803,7 @@ cmTargetTraceDependencies
{
const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge
= ge.Parse(*cli);
- cge->Evaluate(this->Makefile, 0, true);
+ cge->Evaluate(this->Makefile, "", true);
std::set<cmTarget*> geTargets = cge->GetTargets();
for(std::set<cmTarget*>::const_iterator it = geTargets.begin();
it != geTargets.end(); ++it)
@@ -863,11 +864,11 @@ void cmGeneratorTarget::TraceDependencies()
}
//----------------------------------------------------------------------------
-void cmGeneratorTarget::GetAppleArchs(const char* config,
+void cmGeneratorTarget::GetAppleArchs(const std::string& config,
std::vector<std::string>& archVec) const
{
const char* archs = 0;
- if(config && *config)
+ if(!config.empty())
{
std::string defVarName = "OSX_ARCHITECTURES_";
defVarName += cmSystemTools::UpperCase(config);
@@ -904,13 +905,14 @@ const char* cmGeneratorTarget::GetCreateRuleVariable() const
//----------------------------------------------------------------------------
std::vector<std::string>
-cmGeneratorTarget::GetIncludeDirectories(const char *config) const
+cmGeneratorTarget::GetIncludeDirectories(const std::string& config) const
{
return this->Target->GetIncludeDirectories(config);
}
//----------------------------------------------------------------------------
-void cmGeneratorTarget::GenerateTargetManifest(const char* config) const
+void cmGeneratorTarget::GenerateTargetManifest(
+ const std::string& config) const
{
if (this->Target->IsImported())
{
@@ -953,42 +955,42 @@ void cmGeneratorTarget::GenerateTargetManifest(const char* config) const
f = dir;
f += "/";
f += name;
- gg->AddToManifest(config? config:"", f);
+ gg->AddToManifest(config, f);
}
if(!soName.empty())
{
f = dir;
f += "/";
f += soName;
- gg->AddToManifest(config? config:"", f);
+ gg->AddToManifest(config, f);
}
if(!realName.empty())
{
f = dir;
f += "/";
f += realName;
- gg->AddToManifest(config? config:"", f);
+ gg->AddToManifest(config, f);
}
if(!pdbName.empty())
{
f = dir;
f += "/";
f += pdbName;
- gg->AddToManifest(config? config:"", f);
+ gg->AddToManifest(config, f);
}
if(!impName.empty())
{
f = this->Target->GetDirectory(config, true);
f += "/";
f += impName;
- gg->AddToManifest(config? config:"", f);
+ gg->AddToManifest(config, f);
}
}
bool cmStrictTargetComparison::operator()(cmTarget const* t1,
cmTarget const* t2) const
{
- int nameResult = strcmp(t1->GetName(), t2->GetName());
+ int nameResult = strcmp(t1->GetName().c_str(), t2->GetName().c_str());
if (nameResult == 0)
{
return strcmp(t1->GetMakefile()->GetStartOutputDirectory(),
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 1e6ce64..81a447f 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -27,9 +27,9 @@ public:
cmGeneratorTarget(cmTarget*);
int GetType() const;
- const char *GetName() const;
- const char *GetProperty(const char *prop) const;
- bool GetPropertyAsBool(const char *prop) const;
+ std::string GetName() const;
+ const char *GetProperty(const std::string& prop) const;
+ bool GetPropertyAsBool(const std::string& prop) const;
void GetSourceFiles(std::vector<cmSourceFile*>& files) const;
void GetObjectSources(std::vector<cmSourceFile*> &) const;
@@ -61,7 +61,7 @@ public:
void UseObjectLibraries(std::vector<std::string>& objs) const;
- void GetAppleArchs(const char* config,
+ void GetAppleArchs(const std::string& config,
std::vector<std::string>& archVec) const;
///! Return the rule variable used to create this type of target,
@@ -69,12 +69,14 @@ public:
const char* GetCreateRuleVariable() const;
/** Get the include directories for this target. */
- std::vector<std::string> GetIncludeDirectories(const char *config) const;
+ std::vector<std::string> GetIncludeDirectories(
+ const std::string& config) const;
- bool IsSystemIncludeDirectory(const char *dir, const char *config) const;
+ bool IsSystemIncludeDirectory(const std::string& dir,
+ const std::string& config) const;
/** Add the target output files to the global generator manifest. */
- void GenerateTargetManifest(const char* config) const;
+ void GenerateTargetManifest(const std::string& config) const;
/**
* Trace through the source files in this target and add al source files
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index e7ad91a..5aaf1c6 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -49,10 +49,10 @@ bool cmGetCMakePropertyCommand
}
else if ( args[1] == "COMPONENTS" )
{
- const std::set<cmStdString>* components
+ const std::set<std::string>* components
= this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
->GetInstallComponents();
- std::set<cmStdString>::const_iterator compIt;
+ std::set<std::string>::const_iterator compIt;
output = "";
for (compIt = components->begin(); compIt != components->end(); ++compIt)
{
diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h
index 6c58bb4..1511406 100644
--- a/Source/cmGetCMakePropertyCommand.h
+++ b/Source/cmGetCMakePropertyCommand.h
@@ -37,7 +37,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "get_cmake_property";}
+ virtual std::string GetName() const { return "get_cmake_property";}
cmTypeMacro(cmGetCMakePropertyCommand, cmCommand);
};
diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h
index aea04ad..6c5750a 100644
--- a/Source/cmGetDirectoryPropertyCommand.h
+++ b/Source/cmGetDirectoryPropertyCommand.h
@@ -37,7 +37,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "get_directory_property";}
+ virtual std::string GetName() const { return "get_directory_property";}
cmTypeMacro(cmGetDirectoryPropertyCommand, cmCommand);
};
diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h
index e2cd219..534de53 100644
--- a/Source/cmGetFilenameComponentCommand.h
+++ b/Source/cmGetFilenameComponentCommand.h
@@ -46,7 +46,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "get_filename_component";}
+ virtual std::string GetName() const { return "get_filename_component";}
cmTypeMacro(cmGetFilenameComponentCommand, cmCommand);
};
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 33c43ca..30bec16 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -295,7 +295,7 @@ bool cmGetPropertyCommand::HandleTargetMode()
if(cmTarget* target =
this->Makefile->FindTargetToUse(this->Name))
{
- return this->StoreResult(target->GetName());
+ return this->StoreResult(target->GetName().c_str());
}
}
return this->StoreResult((this->Variable + "-NOTFOUND").c_str());
diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h
index e1630ff..8c3738f 100644
--- a/Source/cmGetPropertyCommand.h
+++ b/Source/cmGetPropertyCommand.h
@@ -39,7 +39,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "get_property";}
+ virtual std::string GetName() const { return "get_property";}
cmTypeMacro(cmGetPropertyCommand, cmCommand);
private:
diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx
index 3d85e6d..a6e4fcc 100644
--- a/Source/cmGetSourceFilePropertyCommand.cxx
+++ b/Source/cmGetSourceFilePropertyCommand.cxx
@@ -35,7 +35,7 @@ bool cmGetSourceFilePropertyCommand
{
if(args[2] == "LANGUAGE")
{
- this->Makefile->AddDefinition(var, sf->GetLanguage());
+ this->Makefile->AddDefinition(var, sf->GetLanguage().c_str());
return true;
}
const char *prop = sf->GetPropertyForUser(args[2].c_str());
diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h
index 338318e..ab8ce36 100644
--- a/Source/cmGetSourceFilePropertyCommand.h
+++ b/Source/cmGetSourceFilePropertyCommand.h
@@ -32,7 +32,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "get_source_file_property";}
+ virtual std::string GetName() const { return "get_source_file_property";}
cmTypeMacro(cmGetSourceFilePropertyCommand, cmCommand);
};
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index 4aa49fe..b64f847 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -22,7 +22,7 @@ bool cmGetTargetPropertyCommand
}
std::string var = args[0].c_str();
const std::string& targetName = args[1];
- const char *prop = 0;
+ std::string prop;
if(args[2] == "ALIASED_TARGET")
{
@@ -38,7 +38,11 @@ bool cmGetTargetPropertyCommand
else if(cmTarget* tgt = this->Makefile->FindTargetToUse(targetName))
{
cmTarget& target = *tgt;
- prop = target.GetProperty(args[2].c_str());
+ const char* prop_cstr = target.GetProperty(args[2].c_str());
+ if(prop_cstr)
+ {
+ prop = prop_cstr;
+ }
}
else
{
@@ -70,9 +74,9 @@ bool cmGetTargetPropertyCommand
}
}
}
- if (prop)
+ if (!prop.empty())
{
- this->Makefile->AddDefinition(var.c_str(), prop);
+ this->Makefile->AddDefinition(var.c_str(), prop.c_str());
return true;
}
this->Makefile->AddDefinition(var.c_str(), (var+"-NOTFOUND").c_str());
diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h
index 4985b3c..a35c6fe 100644
--- a/Source/cmGetTargetPropertyCommand.h
+++ b/Source/cmGetTargetPropertyCommand.h
@@ -32,7 +32,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "get_target_property";}
+ virtual std::string GetName() const { return "get_target_property";}
cmTypeMacro(cmGetTargetPropertyCommand, cmCommand);
};
diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h
index 2dccabe..2819492 100644
--- a/Source/cmGetTestPropertyCommand.h
+++ b/Source/cmGetTestPropertyCommand.h
@@ -32,7 +32,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "get_test_property";}
+ virtual std::string GetName() const { return "get_test_property";}
cmTypeMacro(cmGetTestPropertyCommand, cmCommand);
};
diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h
index 70004ea..470dea4 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.h
+++ b/Source/cmGlobalBorlandMakefileGenerator.h
@@ -28,9 +28,9 @@ public:
<cmGlobalBorlandMakefileGenerator>(); }
///! Get the name for the generator.
- virtual const char* GetName() const {
+ virtual std::string GetName() const {
return cmGlobalBorlandMakefileGenerator::GetActualName();}
- static const char* GetActualName() {return "Borland Makefiles";}
+ static std::string GetActualName() {return "Borland Makefiles";}
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index f76c6d1..faed66a 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -89,19 +89,25 @@ bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts)
return false;
}
-std::string cmGlobalGenerator::SelectMakeProgram(const char* makeProgram,
- std::string makeDefault) const
+std::string cmGlobalGenerator::SelectMakeProgram(
+ const std::string& inMakeProgram,
+ const std::string& makeDefault) const
{
- if(cmSystemTools::IsOff(makeProgram))
+ std::string makeProgram = inMakeProgram;
+ if(cmSystemTools::IsOff(makeProgram.c_str()))
{
- makeProgram =
+ const char* makeProgramCSTR =
this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
- if(cmSystemTools::IsOff(makeProgram))
+ if(cmSystemTools::IsOff(makeProgramCSTR))
{
- makeProgram = makeDefault.c_str();
+ makeProgram = makeDefault;
}
- if(cmSystemTools::IsOff(makeProgram) &&
- !(makeProgram && *makeProgram))
+ else
+ {
+ makeProgram = makeProgramCSTR;
+ }
+ if(cmSystemTools::IsOff(makeProgram.c_str()) &&
+ !makeProgram.empty())
{
makeProgram = "CMAKE_MAKE_PROGRAM-NOTFOUND";
}
@@ -432,8 +438,8 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
fpath += "/CMakeSystem.cmake";
mf->ReadListFile(0,fpath.c_str());
}
- std::map<cmStdString, bool> needTestLanguage;
- std::map<cmStdString, bool> needSetLanguageEnabledMaps;
+ std::map<std::string, bool> needTestLanguage;
+ std::map<std::string, bool> needSetLanguageEnabledMaps;
// foreach language
// load the CMakeDetermine(LANG)Compiler.cmake file to find
// the compiler
@@ -722,7 +728,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
//----------------------------------------------------------------------------
void cmGlobalGenerator::PrintCompilerAdvice(std::ostream& os,
- std::string lang,
+ std::string const& lang,
const char* envVar) const
{
// Subclasses override this method if they do not support this advice.
@@ -744,7 +750,7 @@ void cmGlobalGenerator::PrintCompilerAdvice(std::ostream& os,
//----------------------------------------------------------------------------
void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
- std::string lang) const
+ std::string const& lang) const
{
std::string compilerIdVar = "CMAKE_" + lang + "_COMPILER_ID";
const char* compilerId = mf->GetDefinition(compilerIdVar.c_str());
@@ -817,17 +823,18 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
}
//----------------------------------------------------------------------------
-const char*
+std::string
cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source) const
{
- if(const char* lang = source.GetLanguage())
+ const std::string& lang = source.GetLanguage();
+ if(!lang.empty())
{
- std::map<cmStdString, cmStdString>::const_iterator it =
+ std::map<std::string, std::string>::const_iterator it =
this->LanguageToOutputExtension.find(lang);
if(it != this->LanguageToOutputExtension.end())
{
- return it->second.c_str();
+ return it->second;
}
}
else
@@ -840,7 +847,7 @@ cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source) const
{
if(this->OutputExtensions.count(ext))
{
- return ext.c_str();
+ return ext;
}
}
}
@@ -848,7 +855,7 @@ cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source) const
}
-const char* cmGlobalGenerator::GetLanguageFromExtension(const char* ext) const
+std::string cmGlobalGenerator::GetLanguageFromExtension(const char* ext) const
{
// if there is an extension and it starts with . then move past the
// . because the extensions are not stored with a . in the map
@@ -856,13 +863,13 @@ const char* cmGlobalGenerator::GetLanguageFromExtension(const char* ext) const
{
++ext;
}
- std::map<cmStdString, cmStdString>::const_iterator it
+ std::map<std::string, std::string>::const_iterator it
= this->ExtensionToLanguage.find(ext);
if(it != this->ExtensionToLanguage.end())
{
- return it->second.c_str();
+ return it->second;
}
- return 0;
+ return "";
}
/* SetLanguageEnabled() is now split in two parts:
@@ -877,13 +884,15 @@ files could change the object file extension
(CMAKE_<LANG>_OUTPUT_EXTENSION) before the CMake variables were copied
to the C++ maps.
*/
-void cmGlobalGenerator::SetLanguageEnabled(const char* l, cmMakefile* mf)
+void cmGlobalGenerator::SetLanguageEnabled(const std::string& l,
+ cmMakefile* mf)
{
this->SetLanguageEnabledFlag(l, mf);
this->SetLanguageEnabledMaps(l, mf);
}
-void cmGlobalGenerator::SetLanguageEnabledFlag(const char* l, cmMakefile* mf)
+void cmGlobalGenerator::SetLanguageEnabledFlag(const std::string& l,
+ cmMakefile* mf)
{
this->LanguageEnabled[l] = true;
@@ -895,7 +904,8 @@ void cmGlobalGenerator::SetLanguageEnabledFlag(const char* l, cmMakefile* mf)
this->FillExtensionToLanguageMap(l, mf);
}
-void cmGlobalGenerator::SetLanguageEnabledMaps(const char* l, cmMakefile* mf)
+void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l,
+ cmMakefile* mf)
{
// use LanguageToLinkerPreference to detect whether this functions has
// run before
@@ -969,7 +979,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const char* l, cmMakefile* mf)
}
-void cmGlobalGenerator::FillExtensionToLanguageMap(const char* l,
+void cmGlobalGenerator::FillExtensionToLanguageMap(const std::string& l,
cmMakefile* mf)
{
std::string extensionsVar = std::string("CMAKE_") +
@@ -984,16 +994,16 @@ void cmGlobalGenerator::FillExtensionToLanguageMap(const char* l,
}
}
-bool cmGlobalGenerator::IgnoreFile(const char* l) const
+bool cmGlobalGenerator::IgnoreFile(const char* ext) const
{
- if(this->GetLanguageFromExtension(l))
+ if(!this->GetLanguageFromExtension(ext).empty())
{
return false;
}
- return (this->IgnoreExtensions.count(l) > 0);
+ return (this->IgnoreExtensions.count(ext) > 0);
}
-bool cmGlobalGenerator::GetLanguageEnabled(const char* l) const
+bool cmGlobalGenerator::GetLanguageEnabled(const std::string& l) const
{
return (this->LanguageEnabled.find(l)!= this->LanguageEnabled.end());
}
@@ -1003,11 +1013,11 @@ void cmGlobalGenerator::ClearEnabledLanguages()
this->LanguageEnabled.clear();
}
-bool cmGlobalGenerator::IsDependedOn(const char* project,
+bool cmGlobalGenerator::IsDependedOn(const std::string& project,
cmTarget const* targetIn)
{
// Get all local gens for this project
- std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator it =
+ std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator it =
this->ProjectMap.find(project);
if (it == this->ProjectMap.end())
{
@@ -1512,8 +1522,8 @@ void cmGlobalGenerator::ComputeTargetObjects(cmGeneratorTarget*) const
void cmGlobalGenerator::CheckLocalGenerators()
{
- std::map<cmStdString, cmStdString> notFoundMap;
-// std::set<cmStdString> notFoundMap;
+ std::map<std::string, std::string> notFoundMap;
+// std::set<std::string> notFoundMap;
// after it is all done do a ConfigureFinalPass
cmCacheManager* manager = 0;
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
@@ -1593,7 +1603,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
if(notFoundMap.size())
{
std::string notFoundVars;
- for(std::map<cmStdString, cmStdString>::const_iterator
+ for(std::map<std::string, std::string>::const_iterator
ii = notFoundMap.begin();
ii != notFoundMap.end();
++ii)
@@ -1610,9 +1620,10 @@ void cmGlobalGenerator::CheckLocalGenerators()
}
}
-int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
- const char *projectName,
- const char *target, bool fast,
+int cmGlobalGenerator::TryCompile(const std::string& srcdir,
+ const std::string& bindir,
+ const std::string& projectName,
+ const std::string& target, bool fast,
std::string *output, cmMakefile *mf)
{
// if this is not set, then this is a first time configure
@@ -1636,7 +1647,7 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
}
std::string newTarget;
- if (target && strlen(target))
+ if (!target.empty())
{
newTarget += target;
#if 0
@@ -1651,27 +1662,30 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
#endif // WIN32
#endif
}
- const char* config = mf->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION");
+ std::string config =
+ mf->GetSafeDefinition("CMAKE_TRY_COMPILE_CONFIGURATION");
return this->Build(srcdir,bindir,projectName,
newTarget.c_str(),
- output,0,config,false,fast,
+ output,"",config,false,fast,
this->TryCompileTimeout);
}
void cmGlobalGenerator::GenerateBuildCommand(
- std::vector<std::string>& makeCommand, const char*, const char*, const char*,
- const char*, const char*, bool, std::vector<std::string> const&)
+ std::vector<std::string>& makeCommand, const std::string&,
+ const std::string&, const std::string&, const std::string&,
+ const std::string&, bool,
+ std::vector<std::string> const&)
{
makeCommand.push_back(
"cmGlobalGenerator::GenerateBuildCommand not implemented");
}
int cmGlobalGenerator::Build(
- const char *, const char *bindir,
- const char *projectName, const char *target,
+ const std::string&, const std::string& bindir,
+ const std::string& projectName, const std::string& target,
std::string *output,
- const char *makeCommandCSTR,
- const char *config,
+ const std::string& makeCommandCSTR,
+ const std::string& config,
bool clean, bool fast,
double timeout,
cmSystemTools::OutputOption outputflag,
@@ -1681,7 +1695,7 @@ int cmGlobalGenerator::Build(
* Run an executable command and put the stdout in output.
*/
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
- cmSystemTools::ChangeDirectory(bindir);
+ cmSystemTools::ChangeDirectory(bindir.c_str());
if(output)
{
*output += "Change Dir: ";
@@ -1783,19 +1797,20 @@ int cmGlobalGenerator::Build(
//----------------------------------------------------------------------------
std::string cmGlobalGenerator::GenerateCMakeBuildCommand(
- const char* target, const char* config, const char* native,
+ const std::string& target, const std::string& config,
+ const std::string& native,
bool ignoreErrors)
{
std::string makeCommand = cmSystemTools::GetCMakeCommand();
makeCommand = cmSystemTools::ConvertToOutputPath(makeCommand.c_str());
makeCommand += " --build .";
- if(config && *config)
+ if(!config.empty())
{
makeCommand += " --config \"";
makeCommand += config;
makeCommand += "\"";
}
- if(target && *target)
+ if(!target.empty())
{
makeCommand += " --target \"";
makeCommand += target;
@@ -1812,7 +1827,7 @@ std::string cmGlobalGenerator::GenerateCMakeBuildCommand(
sep = " ";
}
}
- if(native && *native)
+ if(!native.empty())
{
makeCommand += sep;
makeCommand += native;
@@ -1951,16 +1966,16 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
void
cmGlobalGenerator::GetEnabledLanguages(std::vector<std::string>& lang) const
{
- for(std::map<cmStdString, bool>::const_iterator i =
+ for(std::map<std::string, bool>::const_iterator i =
this->LanguageEnabled.begin(); i != this->LanguageEnabled.end(); ++i)
{
lang.push_back(i->first);
}
}
-int cmGlobalGenerator::GetLinkerPreference(const char* lang) const
+int cmGlobalGenerator::GetLinkerPreference(const std::string& lang) const
{
- std::map<cmStdString, int>::const_iterator it =
+ std::map<std::string, int>::const_iterator it =
this->LanguageToLinkerPreference.find(lang);
if (it != this->LanguageToLinkerPreference.end())
{
@@ -2037,7 +2052,7 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap()
///! Find a local generator by its startdirectory
cmLocalGenerator*
-cmGlobalGenerator::FindLocalGenerator(const char* start_dir) const
+cmGlobalGenerator::FindLocalGenerator(const std::string& start_dir) const
{
for(std::vector<cmLocalGenerator*>::const_iterator it =
this->LocalGenerators.begin(); it != this->LocalGenerators.end(); ++it)
@@ -2052,60 +2067,41 @@ cmGlobalGenerator::FindLocalGenerator(const char* start_dir) const
}
//----------------------------------------------------------------------------
-void cmGlobalGenerator::AddAlias(const char *name, cmTarget *tgt)
+void cmGlobalGenerator::AddAlias(const std::string& name, cmTarget *tgt)
{
this->AliasTargets[name] = tgt;
}
//----------------------------------------------------------------------------
-bool cmGlobalGenerator::IsAlias(const char *name) const
+bool cmGlobalGenerator::IsAlias(const std::string& name) const
{
return this->AliasTargets.find(name) != this->AliasTargets.end();
}
//----------------------------------------------------------------------------
cmTarget*
-cmGlobalGenerator::FindTarget(const char* project, const char* name,
+cmGlobalGenerator::FindTarget(const std::string& name,
bool excludeAliases) const
{
- // if project specific
- if(project)
+ if (!excludeAliases)
{
- std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator
- gens = this->ProjectMap.find(project);
- for(unsigned int i = 0; i < gens->second.size(); ++i)
+ std::map<std::string, cmTarget*>::const_iterator ai
+ = this->AliasTargets.find(name);
+ if (ai != this->AliasTargets.end())
{
- cmTarget* ret = (gens->second)[i]->GetMakefile()->FindTarget(name,
- excludeAliases);
- if(ret)
- {
- return ret;
- }
+ return ai->second;
}
}
- // if all projects/directories
- else
+ std::map<std::string,cmTarget *>::const_iterator i =
+ this->TotalTargets.find ( name );
+ if ( i != this->TotalTargets.end() )
{
- if (!excludeAliases)
- {
- std::map<cmStdString, cmTarget*>::const_iterator ai
- = this->AliasTargets.find(name);
- if (ai != this->AliasTargets.end())
- {
- return ai->second;
- }
- }
- std::map<cmStdString,cmTarget *>::const_iterator i =
- this->TotalTargets.find ( name );
- if ( i != this->TotalTargets.end() )
- {
- return i->second;
- }
- i = this->ImportedTargets.find(name);
- if ( i != this->ImportedTargets.end() )
- {
- return i->second;
- }
+ return i->second;
+ }
+ i = this->ImportedTargets.find(name);
+ if ( i != this->ImportedTargets.end() )
+ {
+ return i->second;
}
return 0;
}
@@ -2119,7 +2115,7 @@ cmGlobalGenerator::NameResolvesToFramework(const std::string& libname) const
return true;
}
- if(cmTarget* tgt = this->FindTarget(0, libname.c_str()))
+ if(cmTarget* tgt = this->FindTarget(libname.c_str()))
{
if(tgt->IsFrameworkOnApple())
{
@@ -2308,7 +2304,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
{
if(!cmakeCfgIntDir || !*cmakeCfgIntDir || cmakeCfgIntDir[0] == '.')
{
- std::set<cmStdString>* componentsSet = &this->InstallComponents;
+ std::set<std::string>* componentsSet = &this->InstallComponents;
cpackCommandLines.erase(cpackCommandLines.begin(),
cpackCommandLines.end());
depends.erase(depends.begin(), depends.end());
@@ -2316,7 +2312,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
if ( componentsSet->size() > 0 )
{
ostr << "Available install components are:";
- std::set<cmStdString>::iterator it;
+ std::set<std::string>::iterator it;
for (
it = componentsSet->begin();
it != componentsSet->end();
@@ -2477,7 +2473,7 @@ void cmGlobalGenerator::EnableMinGWLanguage(cmMakefile *mf)
//----------------------------------------------------------------------------
cmTarget cmGlobalGenerator::CreateGlobalTarget(
- const char* name, const char* message,
+ const std::string& name, const char* message,
const cmCustomCommandLines* commandLines,
std::vector<std::string> depends,
const char* workingDirectory)
@@ -2530,7 +2526,7 @@ cmGlobalGenerator::GenerateRuleFile(std::string const& output) const
std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage(
std::string const& l) const
{
- std::map<cmStdString, cmStdString>::const_iterator it =
+ std::map<std::string, std::string>::const_iterator it =
this->LanguageToOriginalSharedLibFlags.find(l);
if(it != this->LanguageToOriginalSharedLibFlags.end())
{
@@ -2540,8 +2536,10 @@ std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage(
}
//----------------------------------------------------------------------------
-void cmGlobalGenerator::AppendDirectoryForConfig(const char*, const char*,
- const char*, std::string&)
+void cmGlobalGenerator::AppendDirectoryForConfig(const std::string&,
+ const std::string&,
+ const std::string&,
+ std::string&)
{
// Subclasses that support multiple configurations should implement
// this method to append the subdirectory for the given build
@@ -2608,9 +2606,9 @@ void cmGlobalGenerator::SetExternalMakefileProjectGenerator(
}
}
-const char* cmGlobalGenerator::GetExtraGeneratorName() const
+std::string cmGlobalGenerator::GetExtraGeneratorName() const
{
- return this->ExtraGenerator==0 ? 0 : this->ExtraGenerator->GetName();
+ return this->ExtraGenerator? this->ExtraGenerator->GetName() : std::string();
}
void cmGlobalGenerator::FileReplacedDuringGenerate(const std::string& filename)
@@ -2668,7 +2666,7 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets,
bool cmGlobalGenerator::IsRootOnlyTarget(cmTarget* target) const
{
return (target->GetType() == cmTarget::GLOBAL_TARGET ||
- strcmp(target->GetName(), this->GetAllTargetName()) == 0);
+ target->GetName() == this->GetAllTargetName());
}
//----------------------------------------------------------------------------
@@ -2691,7 +2689,7 @@ void cmGlobalGenerator::AddTargetDepends(cmTarget const* target,
//----------------------------------------------------------------------------
-void cmGlobalGenerator::AddToManifest(const char* config,
+void cmGlobalGenerator::AddToManifest(const std::string& config,
std::string const& f)
{
// Add to the main manifest for this configuration.
@@ -2704,7 +2702,7 @@ void cmGlobalGenerator::AddToManifest(const char* config,
}
//----------------------------------------------------------------------------
-std::set<cmStdString> const&
+std::set<std::string> const&
cmGlobalGenerator::GetDirectoryContent(std::string const& dir, bool needDisk)
{
DirectoryContent& dc = this->DirectoryContentMap[dir];
@@ -2810,7 +2808,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile,
fname = line.substr(33, line.npos);
// Look for a hash for this file's rule.
- std::map<cmStdString, RuleHash>::const_iterator rhi =
+ std::map<std::string, RuleHash>::const_iterator rhi =
this->RuleHashes.find(fname);
if(rhi != this->RuleHashes.end())
{
@@ -2855,7 +2853,7 @@ void cmGlobalGenerator::WriteRuleHashes(std::string const& pfile)
{
cmGeneratedFileStream fout(pfile.c_str());
fout << "# Hashes of file build rules.\n";
- for(std::map<cmStdString, RuleHash>::const_iterator
+ for(std::map<std::string, RuleHash>::const_iterator
rhi = this->RuleHashes.begin(); rhi != this->RuleHashes.end(); ++rhi)
{
fout.write(rhi->second.Data, 32);
@@ -2876,7 +2874,7 @@ void cmGlobalGenerator::WriteSummary()
cmGeneratedFileStream fout(fname.c_str());
// Generate summary information files for each target.
- for(std::map<cmStdString,cmTarget *>::const_iterator ti =
+ for(std::map<std::string,cmTarget *>::const_iterator ti =
this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti)
{
if ((ti->second)->GetType() == cmTarget::INTERFACE_LIBRARY)
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index b66f01e..91e71a8 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -51,11 +51,11 @@ public:
virtual cmLocalGenerator *CreateLocalGenerator();
///! Get the name for this generator
- virtual const char *GetName() const { return "Generic"; };
+ virtual std::string GetName() const { return "Generic"; };
/** Check whether the given name matches the current generator. */
- virtual bool MatchesGeneratorName(const char* name) const
- { return strcmp(this->GetName(), name) == 0; }
+ virtual bool MatchesGeneratorName(const std::string& name) const
+ { return this->GetName() == name; }
/** Set the generator-specific toolset name. Returns true if toolset
is supported and false otherwise. */
@@ -77,8 +77,8 @@ public:
/**
* Set/Get and Clear the enabled languages.
*/
- void SetLanguageEnabled(const char*, cmMakefile* mf);
- bool GetLanguageEnabled(const char*) const;
+ void SetLanguageEnabled(const std::string&, cmMakefile* mf);
+ bool GetLanguageEnabled(const std::string&) const;
void ClearEnabledLanguages();
void GetEnabledLanguages(std::vector<std::string>& lang) const;
/**
@@ -105,8 +105,9 @@ public:
* Try running cmake and building a file. This is used for dynamically
* loaded commands, not as part of the usual build process.
*/
- virtual int TryCompile(const char *srcdir, const char *bindir,
- const char *projectName, const char *targetName,
+ virtual int TryCompile(const std::string& srcdir, const std::string& bindir,
+ const std::string& projectName,
+ const std::string& targetName,
bool fast, std::string *output, cmMakefile* mf);
@@ -116,10 +117,10 @@ public:
* empty then all is assumed. clean indicates if a "make clean" should be
* done first.
*/
- int Build(const char *srcdir, const char *bindir,
- const char *projectName, const char *targetName,
+ int Build(const std::string& srcdir, const std::string& bindir,
+ const std::string& projectName, const std::string& targetName,
std::string *output,
- const char *makeProgram, const char *config,
+ const std::string& makeProgram, const std::string& config,
bool clean, bool fast,
double timeout,
cmSystemTools::OutputOption outputflag=cmSystemTools::OUTPUT_NONE,
@@ -128,16 +129,16 @@ public:
virtual void GenerateBuildCommand(
std::vector<std::string>& makeCommand,
- const char* makeProgram,
- const char *projectName, const char *projectDir,
- const char *targetName, const char* config, bool fast,
+ const std::string& makeProgram,
+ const std::string& projectName, const std::string& projectDir,
+ const std::string& targetName, const std::string& config, bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
/** Generate a "cmake --build" call for a given target and config. */
- std::string GenerateCMakeBuildCommand(const char* target,
- const char* config,
- const char* native,
+ std::string GenerateCMakeBuildCommand(const std::string& target,
+ const std::string& config,
+ const std::string& native,
bool ignoreErrors);
///! Set the CMake instance
@@ -162,17 +163,17 @@ public:
void SetExternalMakefileProjectGenerator(
cmExternalMakefileProjectGenerator *extraGenerator);
- const char* GetExtraGeneratorName() const;
+ std::string GetExtraGeneratorName() const;
void AddInstallComponent(const char* component);
- const std::set<cmStdString>* GetInstallComponents() const
+ const std::set<std::string>* GetInstallComponents() const
{ return &this->InstallComponents; }
cmExportSetMap& GetExportSets() {return this->ExportSets;}
/** Add a file to the manifest of generated targets for a configuration. */
- void AddToManifest(const char* config, std::string const& f);
+ void AddToManifest(const std::string& config, std::string const& f);
void EnableInstallTarget();
@@ -182,13 +183,13 @@ public:
bool GetToolSupportsColor() const { return this->ToolSupportsColor; }
///! return the language for the given extension
- const char* GetLanguageFromExtension(const char* ext) const;
+ std::string GetLanguageFromExtension(const char* ext) const;
///! is an extension to be ignored
bool IgnoreFile(const char* ext) const;
///! What is the preference for linkers and this language (None or Prefered)
- int GetLinkerPreference(const char* lang) const;
+ int GetLinkerPreference(const std::string& lang) const;
///! What is the object file extension for a given source file?
- const char* GetLanguageOutputExtension(cmSourceFile const&) const;
+ std::string GetLanguageOutputExtension(cmSourceFile const&) const;
///! What is the configurations directory variable called?
virtual const char* GetCMakeCFGIntDir() const { return "."; }
@@ -210,11 +211,11 @@ public:
virtual void FindMakeProgram(cmMakefile*);
///! Find a target by name by searching the local generators.
- cmTarget* FindTarget(const char* project, const char* name,
+ cmTarget* FindTarget(const std::string& name,
bool excludeAliases = false) const;
- void AddAlias(const char *name, cmTarget *tgt);
- bool IsAlias(const char *name) const;
+ void AddAlias(const std::string& name, cmTarget *tgt);
+ bool IsAlias(const std::string& name) const;
/** Determine if a name resolves to a framework on disk or a built target
that is a framework. */
@@ -222,16 +223,16 @@ public:
/** If check to see if the target is linked to by any other
target in the project */
- bool IsDependedOn(const char* project, cmTarget const* target);
+ bool IsDependedOn(const std::string& project, cmTarget const* target);
///! Find a local generator by its startdirectory
- cmLocalGenerator* FindLocalGenerator(const char* start_dir) const;
+ cmLocalGenerator* FindLocalGenerator(const std::string& start_dir) const;
/** Append the subdirectory for the given configuration. If anything is
appended the given prefix and suffix will be appended around it, which
is useful for leading or trailing slashes. */
- virtual void AppendDirectoryForConfig(const char* prefix,
- const char* config,
- const char* suffix,
+ virtual void AppendDirectoryForConfig(const std::string& prefix,
+ const std::string& config,
+ const std::string& suffix,
std::string& dir);
/** Get the manifest of all targets that will be built for each
@@ -243,7 +244,7 @@ public:
from disk at most once and cached. During the generation step
the content will include the target files to be built even if
they do not yet exist. */
- std::set<cmStdString> const& GetDirectoryContent(std::string const& dir,
+ std::set<std::string> const& GetDirectoryContent(std::string const& dir,
bool needDisk = true);
void AddTarget(cmTarget* t);
@@ -275,7 +276,7 @@ public:
/** Get per-target generator information. */
cmGeneratorTarget* GetGeneratorTarget(cmTarget const*) const;
- const std::map<cmStdString, std::vector<cmLocalGenerator*> >& GetProjectMap()
+ const std::map<std::string, std::vector<cmLocalGenerator*> >& GetProjectMap()
const {return this->ProjectMap;}
// track files replaced during a Generate
@@ -286,12 +287,12 @@ public:
std::string const& content);
/** Return whether the given binary directory is unused. */
- bool BinaryDirectoryIsNew(const char* dir)
+ bool BinaryDirectoryIsNew(const std::string& dir)
{
return this->BinaryDirectories.insert(dir).second;
}
/** Supported systems creates a GUID for the given name */
- virtual void CreateGUID(const char*) {}
+ virtual void CreateGUID(const std::string&) {}
/** Return true if the generated build tree may contain multiple builds.
i.e. "Can I build Debug and Release in the same tree?" */
@@ -332,9 +333,9 @@ protected:
bool IsRootOnlyTarget(cmTarget* target) const;
void AddTargetDepends(cmTarget const* target,
TargetDependSet& projectTargets);
- void SetLanguageEnabledFlag(const char* l, cmMakefile* mf);
- void SetLanguageEnabledMaps(const char* l, cmMakefile* mf);
- void FillExtensionToLanguageMap(const char* l, cmMakefile* mf);
+ void SetLanguageEnabledFlag(const std::string& l, cmMakefile* mf);
+ void SetLanguageEnabledMaps(const std::string& l, cmMakefile* mf);
+ void FillExtensionToLanguageMap(const std::string& l, cmMakefile* mf);
virtual bool ComputeTargetDepends();
@@ -344,8 +345,8 @@ protected:
cmTarget const*> > AutogensType;
void CreateQtAutoGeneratorsTargets(AutogensType& autogens);
- std::string SelectMakeProgram(const char* makeProgram,
- std::string makeDefault = "") const;
+ std::string SelectMakeProgram(const std::string& makeProgram,
+ const std::string& makeDefault = "") const;
// Fill the ProjectMap, this must be called after LocalGenerators
// has been populated.
@@ -355,7 +356,7 @@ protected:
bool IsExcluded(cmLocalGenerator* root, cmTarget const& target) const;
void FillLocalGeneratorToTargetMap();
void CreateDefaultGlobalTargets(cmTargets* targets);
- cmTarget CreateGlobalTarget(const char* name, const char* message,
+ cmTarget CreateGlobalTarget(const std::string& name, const char* message,
const cmCustomCommandLines* commandLines,
std::vector<std::string> depends, const char* workingDir);
@@ -363,18 +364,18 @@ protected:
bool UseLinkScript;
bool ForceUnixPaths;
bool ToolSupportsColor;
- cmStdString FindMakeProgramFile;
- cmStdString ConfiguredFilesPath;
+ std::string FindMakeProgramFile;
+ std::string ConfiguredFilesPath;
cmake *CMakeInstance;
std::vector<cmLocalGenerator *> LocalGenerators;
cmLocalGenerator* CurrentLocalGenerator;
// map from project name to vector of local generators in that project
- std::map<cmStdString, std::vector<cmLocalGenerator*> > ProjectMap;
+ std::map<std::string, std::vector<cmLocalGenerator*> > ProjectMap;
std::map<cmLocalGenerator*, std::set<cmTarget const*> >
LocalGeneratorToTargetMap;
// Set of named installation components requested by the project.
- std::set<cmStdString> InstallComponents;
+ std::set<std::string> InstallComponents;
bool InstallTargetEnabled;
// Sets of named target exports
cmExportSetMap ExportSets;
@@ -386,9 +387,9 @@ protected:
cmTargetManifest TargetManifest;
// All targets in the entire project.
- std::map<cmStdString,cmTarget *> TotalTargets;
- std::map<cmStdString,cmTarget *> AliasTargets;
- std::map<cmStdString,cmTarget *> ImportedTargets;
+ std::map<std::string,cmTarget *> TotalTargets;
+ std::map<std::string,cmTarget *> AliasTargets;
+ std::map<std::string,cmTarget *> ImportedTargets;
std::vector<cmGeneratorExpressionEvaluationFile*> EvaluationFiles;
virtual const char* GetPredefinedTargetsFolder();
@@ -400,18 +401,18 @@ private:
float FirstTimeProgress;
// If you add a new map here, make sure it is copied
// in EnableLanguagesFromGenerator
- std::map<cmStdString, bool> IgnoreExtensions;
- std::map<cmStdString, bool> LanguageEnabled;
- std::set<cmStdString> LanguagesReady; // Ready for try_compile
- std::map<cmStdString, cmStdString> OutputExtensions;
- std::map<cmStdString, cmStdString> LanguageToOutputExtension;
- std::map<cmStdString, cmStdString> ExtensionToLanguage;
- std::map<cmStdString, int> LanguageToLinkerPreference;
- std::map<cmStdString, cmStdString> LanguageToOriginalSharedLibFlags;
+ std::map<std::string, bool> IgnoreExtensions;
+ std::map<std::string, bool> LanguageEnabled;
+ std::set<std::string> LanguagesReady; // Ready for try_compile
+ std::map<std::string, std::string> OutputExtensions;
+ std::map<std::string, std::string> LanguageToOutputExtension;
+ std::map<std::string, std::string> ExtensionToLanguage;
+ std::map<std::string, int> LanguageToLinkerPreference;
+ std::map<std::string, std::string> LanguageToOriginalSharedLibFlags;
// Record hashes for rules and outputs.
struct RuleHash { char Data[32]; };
- std::map<cmStdString, RuleHash> RuleHashes;
+ std::map<std::string, RuleHash> RuleHashes;
void CheckRuleHashes();
void CheckRuleHashes(std::string const& pfile, std::string const& home);
void WriteRuleHashes(std::string const& pfile);
@@ -420,9 +421,10 @@ private:
void WriteSummary(cmTarget* target);
void FinalizeTargetCompileInfo();
- virtual void PrintCompilerAdvice(std::ostream& os, std::string lang,
+ virtual void PrintCompilerAdvice(std::ostream& os, std::string const& lang,
const char* envVar) const;
- void CheckCompilerIdCompatibility(cmMakefile* mf, std::string lang) const;
+ void CheckCompilerIdCompatibility(cmMakefile* mf,
+ std::string const& lang) const;
cmExternalMakefileProjectGenerator* ExtraGenerator;
@@ -446,18 +448,18 @@ private:
virtual const char* GetBuildIgnoreErrorsFlag() const { return 0; }
// Cache directory content and target files to be built.
- struct DirectoryContent: public std::set<cmStdString>
+ struct DirectoryContent: public std::set<std::string>
{
- typedef std::set<cmStdString> derived;
+ typedef std::set<std::string> derived;
bool LoadedFromDisk;
DirectoryContent(): LoadedFromDisk(false) {}
DirectoryContent(DirectoryContent const& dc):
derived(dc), LoadedFromDisk(dc.LoadedFromDisk) {}
};
- std::map<cmStdString, DirectoryContent> DirectoryContentMap;
+ std::map<std::string, DirectoryContent> DirectoryContentMap;
// Set of binary directories on disk.
- std::set<cmStdString> BinaryDirectories;
+ std::set<std::string> BinaryDirectories;
// track targets to issue CMP0042 warning for.
std::set<std::string> CMP0042WarnTargets;
diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h
index fd1d65f..3c2cd60 100644
--- a/Source/cmGlobalGeneratorFactory.h
+++ b/Source/cmGlobalGeneratorFactory.h
@@ -29,7 +29,8 @@ public:
virtual ~cmGlobalGeneratorFactory() {}
/** Create a GlobalGenerator */
- virtual cmGlobalGenerator* CreateGlobalGenerator(const char* n) const = 0;
+ virtual cmGlobalGenerator* CreateGlobalGenerator(
+ const std::string& n) const = 0;
/** Get the documentation entry for this factory */
virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0;
@@ -43,8 +44,9 @@ class cmGlobalGeneratorSimpleFactory : public cmGlobalGeneratorFactory
{
public:
/** Create a GlobalGenerator */
- virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const {
- if (strcmp(name, T::GetActualName())) return 0;
+ virtual cmGlobalGenerator* CreateGlobalGenerator(
+ const std::string& name) const {
+ if (name != T::GetActualName()) return 0;
return new T; }
/** Get the documentation entry for this factory */
diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h
index 28893bf..344e013 100644
--- a/Source/cmGlobalJOMMakefileGenerator.h
+++ b/Source/cmGlobalJOMMakefileGenerator.h
@@ -27,11 +27,11 @@ public:
return new cmGlobalGeneratorSimpleFactory
<cmGlobalJOMMakefileGenerator>(); }
///! Get the name for the generator.
- virtual const char* GetName() const {
+ virtual std::string GetName() const {
return cmGlobalJOMMakefileGenerator::GetActualName();}
// use NMake Makefiles in the name so that scripts/tests that depend on the
// name NMake Makefiles will work
- static const char* GetActualName() {return "NMake Makefiles JOM";}
+ static std::string GetActualName() {return "NMake Makefiles JOM";}
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index ed0e15b..71e08cc 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -25,7 +25,7 @@
//----------------------------------------------------------------------------
void cmGlobalKdevelopGenerator
-::GetDocumentation(cmDocumentationEntry& entry, const char*) const
+::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const
{
entry.Name = this->GetName();
entry.Brief = "Generates KDevelop 3 project files.";
@@ -44,7 +44,7 @@ void cmGlobalKdevelopGenerator::Generate()
{
// for each sub project in the project create
// a kdevelop project
- for (std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator
+ for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator
it = this->GlobalGenerator->GetProjectMap().begin();
it!= this->GlobalGenerator->GetProjectMap().end();
++it)
@@ -76,7 +76,7 @@ void cmGlobalKdevelopGenerator::Generate()
{
if (ti->second.GetType()==cmTarget::EXECUTABLE)
{
- executable = ti->second.GetLocation(0);
+ executable = ti->second.GetLocation("");
break;
}
}
@@ -103,7 +103,7 @@ bool cmGlobalKdevelopGenerator
std::string projectDir = projectDirIn + "/";
std::string filename = outputDir+ "/" + projectname +".kdevelop.filelist";
- std::set<cmStdString> files;
+ std::set<std::string> files;
std::string tmp;
for (std::vector<cmLocalGenerator*>::const_iterator it=lgs.begin();
@@ -217,7 +217,7 @@ bool cmGlobalKdevelopGenerator
}
fileToOpen="";
- for (std::set<cmStdString>::const_iterator it=files.begin();
+ for (std::set<std::string>::const_iterator it=files.begin();
it!=files.end(); it++)
{
// get the full path to the file
diff --git a/Source/cmGlobalKdevelopGenerator.h b/Source/cmGlobalKdevelopGenerator.h
index a1ad39d..0d59fc5 100644
--- a/Source/cmGlobalKdevelopGenerator.h
+++ b/Source/cmGlobalKdevelopGenerator.h
@@ -33,14 +33,14 @@ class cmGlobalKdevelopGenerator : public cmExternalMakefileProjectGenerator
public:
cmGlobalKdevelopGenerator();
- virtual const char* GetName() const
+ virtual std::string GetName() const
{ return cmGlobalKdevelopGenerator::GetActualName();}
- static const char* GetActualName() { return "KDevelop3";}
+ static std::string GetActualName() { return "KDevelop3";}
static cmExternalMakefileProjectGenerator* New()
{ return new cmGlobalKdevelopGenerator; }
/** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry,
- const char* fullName) const;
+ const std::string& fullName) const;
virtual void Generate();
private:
diff --git a/Source/cmGlobalMSYSMakefileGenerator.h b/Source/cmGlobalMSYSMakefileGenerator.h
index 659de11..c4825bd 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.h
+++ b/Source/cmGlobalMSYSMakefileGenerator.h
@@ -28,9 +28,9 @@ public:
<cmGlobalMSYSMakefileGenerator>(); }
///! Get the name for the generator.
- virtual const char* GetName() const {
+ virtual std::string GetName() const {
return cmGlobalMSYSMakefileGenerator::GetActualName();}
- static const char* GetActualName() {return "MSYS Makefiles";}
+ static std::string GetActualName() {return "MSYS Makefiles";}
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
diff --git a/Source/cmGlobalMinGWMakefileGenerator.h b/Source/cmGlobalMinGWMakefileGenerator.h
index 7951e98..4289422 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.h
+++ b/Source/cmGlobalMinGWMakefileGenerator.h
@@ -27,9 +27,9 @@ public:
return new cmGlobalGeneratorSimpleFactory
<cmGlobalMinGWMakefileGenerator>(); }
///! Get the name for the generator.
- virtual const char* GetName() const {
+ virtual std::string GetName() const {
return cmGlobalMinGWMakefileGenerator::GetActualName();}
- static const char* GetActualName() {return "MinGW Makefiles";}
+ static std::string GetActualName() {return "MinGW Makefiles";}
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h
index 5756fbd..2ff44e3 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.h
+++ b/Source/cmGlobalNMakeMakefileGenerator.h
@@ -27,9 +27,9 @@ public:
return new cmGlobalGeneratorSimpleFactory
<cmGlobalNMakeMakefileGenerator>(); }
///! Get the name for the generator.
- virtual const char* GetName() const {
+ virtual std::string GetName() const {
return cmGlobalNMakeMakefileGenerator::GetActualName();}
- static const char* GetActualName() {return "NMake Makefiles";}
+ static std::string GetActualName() {return "NMake Makefiles";}
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 731bc00..785b902 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -551,11 +551,11 @@ bool cmGlobalNinjaGenerator::UsingMinGW = false;
// cmGlobalGenerator::Build()
void cmGlobalNinjaGenerator
::GenerateBuildCommand(std::vector<std::string>& makeCommand,
- const char* makeProgram,
- const char* /*projectName*/,
- const char* /*projectDir*/,
- const char* targetName,
- const char* /*config*/,
+ const std::string& makeProgram,
+ const std::string& /*projectName*/,
+ const std::string& /*projectDir*/,
+ const std::string& targetName,
+ const std::string& /*config*/,
bool /*fast*/,
std::vector<std::string> const& makeOptions)
{
@@ -565,9 +565,9 @@ void cmGlobalNinjaGenerator
makeCommand.insert(makeCommand.end(),
makeOptions.begin(), makeOptions.end());
- if(targetName && *targetName)
+ if(!targetName.empty())
{
- if(strcmp(targetName, "clean") == 0)
+ if(targetName == "clean")
{
makeCommand.push_back("-t");
makeCommand.push_back("clean");
@@ -834,8 +834,8 @@ void
cmGlobalNinjaGenerator
::AppendTargetOutputs(cmTarget const* target, cmNinjaDeps& outputs)
{
- const char* configName =
- target->GetMakefile()->GetDefinition("CMAKE_BUILD_TYPE");
+ std::string configName =
+ target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
cmLocalNinjaGenerator *ng =
static_cast<cmLocalNinjaGenerator *>(this->LocalGenerators[0]);
@@ -886,7 +886,7 @@ cmGlobalNinjaGenerator
if (target->GetType() == cmTarget::GLOBAL_TARGET) {
// Global targets only depend on other utilities, which may not appear in
// the TargetDepends set (e.g. "all").
- std::set<cmStdString> const& utils = target->GetUtilities();
+ std::set<std::string> const& utils = target->GetUtilities();
std::copy(utils.begin(), utils.end(), std::back_inserter(outputs));
} else {
cmTargetDependSet const& targetDeps =
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 0d5fb44..7725cf3 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -173,11 +173,11 @@ public:
virtual cmLocalGenerator* CreateLocalGenerator();
/// Overloaded methods. @see cmGlobalGenerator::GetName().
- virtual const char* GetName() const {
+ virtual std::string GetName() const {
return cmGlobalNinjaGenerator::GetActualName(); }
/// @return the name of this generator.
- static const char* GetActualName() { return "Ninja"; }
+ static std::string GetActualName() { return "Ninja"; }
/// Overloaded methods. @see cmGlobalGenerator::GetDocumentation()
static void GetDocumentation(cmDocumentationEntry& entry);
@@ -193,11 +193,11 @@ public:
/// Overloaded methods. @see cmGlobalGenerator::GenerateBuildCommand()
virtual void GenerateBuildCommand(
std::vector<std::string>& makeCommand,
- const char* makeProgram,
- const char* projectName,
- const char* projectDir,
- const char* targetName,
- const char* config,
+ const std::string& makeProgram,
+ const std::string& projectName,
+ const std::string& projectDir,
+ const std::string& targetName,
+ const std::string& config,
bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 0b37a07..2cdc976 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -72,7 +72,7 @@ std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const
{
// If generating for an extra IDE, the edit_cache target cannot
// launch a terminal-interactive tool, so always use cmake-gui.
- if(this->GetExtraGeneratorName())
+ if(!this->GetExtraGeneratorName().empty())
{
return cmSystemTools::GetCMakeGUICommand();
}
@@ -477,24 +477,26 @@ cmGlobalUnixMakefileGenerator3
for(cmGeneratorTargetsType::iterator l = targets.begin();
l != targets.end(); ++l)
{
- if((l->second->GetType() == cmTarget::EXECUTABLE) ||
- (l->second->GetType() == cmTarget::STATIC_LIBRARY) ||
- (l->second->GetType() == cmTarget::SHARED_LIBRARY) ||
- (l->second->GetType() == cmTarget::MODULE_LIBRARY) ||
- (l->second->GetType() == cmTarget::OBJECT_LIBRARY) ||
- (l->second->GetType() == cmTarget::UTILITY))
+ cmGeneratorTarget* gtarget = l->second;
+ int type = gtarget->GetType();
+ if((type == cmTarget::EXECUTABLE) ||
+ (type == cmTarget::STATIC_LIBRARY) ||
+ (type == cmTarget::SHARED_LIBRARY) ||
+ (type == cmTarget::MODULE_LIBRARY) ||
+ (type == cmTarget::OBJECT_LIBRARY) ||
+ (type == cmTarget::UTILITY))
{
- if(l->second->Target->IsImported())
+ if(gtarget->Target->IsImported())
{
continue;
}
// Add this to the list of depends rules in this directory.
- if((!check_all || !l->second->GetPropertyAsBool("EXCLUDE_FROM_ALL")) &&
+ if((!check_all || !gtarget->GetPropertyAsBool("EXCLUDE_FROM_ALL")) &&
(!check_relink ||
- l->second->Target
+ gtarget->Target
->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str())))
{
- std::string tname = lg->GetRelativeTargetDirectory(*l->second->Target);
+ std::string tname = lg->GetRelativeTargetDirectory(*gtarget->Target);
tname += "/";
tname += pass;
depends.push_back(tname);
@@ -565,11 +567,11 @@ cmGlobalUnixMakefileGenerator3
//----------------------------------------------------------------------------
void cmGlobalUnixMakefileGenerator3
::GenerateBuildCommand(std::vector<std::string>& makeCommand,
- const char* makeProgram,
- const char* /*projectName*/,
- const char* /*projectDir*/,
- const char* targetName,
- const char* /*config*/,
+ const std::string& makeProgram,
+ const std::string& /*projectName*/,
+ const std::string& /*projectDir*/,
+ const std::string& targetName,
+ const std::string& /*config*/,
bool fast,
std::vector<std::string> const& makeOptions)
{
@@ -579,13 +581,13 @@ void cmGlobalUnixMakefileGenerator3
// Since we have full control over the invocation of nmake, let us
// make it quiet.
- if ( strcmp(this->GetName(), "NMake Makefiles") == 0 )
+ if ( this->GetName() == "NMake Makefiles" )
{
makeCommand.push_back("/NOLOGO");
}
makeCommand.insert(makeCommand.end(),
makeOptions.begin(), makeOptions.end());
- if ( targetName && strlen(targetName))
+ if (!targetName.empty())
{
cmLocalUnixMakefileGenerator3 *lg;
if (this->LocalGenerators.size())
@@ -624,7 +626,7 @@ void cmGlobalUnixMakefileGenerator3
void
cmGlobalUnixMakefileGenerator3
::WriteConvenienceRules(std::ostream& ruleFileStream,
- std::set<cmStdString> &emitted)
+ std::set<std::string> &emitted)
{
std::vector<std::string> depends;
std::vector<std::string> commands;
@@ -643,46 +645,48 @@ cmGlobalUnixMakefileGenerator3
for(cmGeneratorTargetsType::iterator t = targets.begin();
t != targets.end(); ++t)
{
- if(t->second->Target->IsImported())
+ cmGeneratorTarget* gtarget = t->second;
+ if(gtarget->Target->IsImported())
{
continue;
}
// Don't emit the same rule twice (e.g. two targets with the same
// simple name)
- if(t->second->GetName() &&
- strlen(t->second->GetName()) &&
- emitted.insert(t->second->GetName()).second &&
+ int type = gtarget->GetType();
+ std::string name = gtarget->GetName();
+ if(!name.empty() &&
+ emitted.insert(name).second &&
// Handle user targets here. Global targets are handled in
// the local generator on a per-directory basis.
- ((t->second->GetType() == cmTarget::EXECUTABLE) ||
- (t->second->GetType() == cmTarget::STATIC_LIBRARY) ||
- (t->second->GetType() == cmTarget::SHARED_LIBRARY) ||
- (t->second->GetType() == cmTarget::MODULE_LIBRARY) ||
- (t->second->GetType() == cmTarget::OBJECT_LIBRARY) ||
- (t->second->GetType() == cmTarget::UTILITY)))
+ ((type == cmTarget::EXECUTABLE) ||
+ (type == cmTarget::STATIC_LIBRARY) ||
+ (type == cmTarget::SHARED_LIBRARY) ||
+ (type == cmTarget::MODULE_LIBRARY) ||
+ (type == cmTarget::OBJECT_LIBRARY) ||
+ (type == cmTarget::UTILITY)))
{
// Add a rule to build the target by name.
lg->WriteDivider(ruleFileStream);
ruleFileStream
<< "# Target rules for targets named "
- << t->second->GetName() << "\n\n";
+ << name << "\n\n";
// Write the rule.
commands.clear();
std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
tmp += "Makefile2";
commands.push_back(lg->GetRecursiveMakeCall
- (tmp.c_str(),t->second->GetName()));
+ (tmp.c_str(),name));
depends.clear();
depends.push_back("cmake_check_build_system");
lg->WriteMakeRule(ruleFileStream,
"Build rule for target.",
- t->second->GetName(), depends, commands,
+ name, depends, commands,
true);
// Add a fast rule to build the target
std::string localName =
- lg->GetRelativeTargetDirectory(*t->second->Target);
+ lg->GetRelativeTargetDirectory(*gtarget->Target);
std::string makefileName;
makefileName = localName;
makefileName += "/build.make";
@@ -690,7 +694,7 @@ cmGlobalUnixMakefileGenerator3
commands.clear();
std::string makeTargetName = localName;
makeTargetName += "/build";
- localName = t->second->GetName();
+ localName = name;
localName += "/fast";
commands.push_back(lg->GetRecursiveMakeCall
(makefileName.c_str(), makeTargetName.c_str()));
@@ -699,12 +703,12 @@ cmGlobalUnixMakefileGenerator3
// Add a local name for the rule to relink the target before
// installation.
- if(t->second->Target
+ if(gtarget->Target
->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))
{
- makeTargetName = lg->GetRelativeTargetDirectory(*t->second->Target);
+ makeTargetName = lg->GetRelativeTargetDirectory(*gtarget->Target);
makeTargetName += "/preinstall";
- localName = t->second->GetName();
+ localName = name;
localName += "/preinstall";
depends.clear();
commands.clear();
@@ -742,26 +746,28 @@ cmGlobalUnixMakefileGenerator3
for(cmGeneratorTargetsType::iterator t = targets.begin();
t != targets.end(); ++t)
{
- if(t->second->Target->IsImported())
+ cmGeneratorTarget* gtarget = t->second;
+ if(gtarget->Target->IsImported())
{
continue;
}
- if (t->second->GetName()
- && strlen(t->second->GetName())
- && ((t->second->GetType() == cmTarget::EXECUTABLE)
- || (t->second->GetType() == cmTarget::STATIC_LIBRARY)
- || (t->second->GetType() == cmTarget::SHARED_LIBRARY)
- || (t->second->GetType() == cmTarget::MODULE_LIBRARY)
- || (t->second->GetType() == cmTarget::OBJECT_LIBRARY)
- || (t->second->GetType() == cmTarget::UTILITY)))
+ int type = gtarget->GetType();
+ std::string name = gtarget->GetName();
+ if (!name.empty()
+ && ( (type == cmTarget::EXECUTABLE)
+ || (type == cmTarget::STATIC_LIBRARY)
+ || (type == cmTarget::SHARED_LIBRARY)
+ || (type == cmTarget::MODULE_LIBRARY)
+ || (type == cmTarget::OBJECT_LIBRARY)
+ || (type == cmTarget::UTILITY)))
{
std::string makefileName;
// Add a rule to build the target by name.
- localName = lg->GetRelativeTargetDirectory(*t->second->Target);
+ localName = lg->GetRelativeTargetDirectory(*gtarget->Target);
makefileName = localName;
makefileName += "/build.make";
- bool needRequiresStep = this->NeedRequiresStep(*t->second->Target);
+ bool needRequiresStep = this->NeedRequiresStep(*gtarget->Target);
lg->WriteDivider(ruleFileStream);
ruleFileStream
@@ -803,7 +809,7 @@ cmGlobalUnixMakefileGenerator3
cmLocalGenerator::SHELL);
progCmd << " ";
std::vector<unsigned long>& progFiles =
- this->ProgressMap[t->second->Target].Marks;
+ this->ProgressMap[gtarget->Target].Marks;
for (std::vector<unsigned long>::iterator i = progFiles.begin();
i != progFiles.end(); ++i)
{
@@ -812,15 +818,15 @@ cmGlobalUnixMakefileGenerator3
commands.push_back(progCmd.str());
}
progressDir = "Built target ";
- progressDir += t->second->GetName();
+ progressDir += name;
lg->AppendEcho(commands,progressDir.c_str());
- this->AppendGlobalTargetDepends(depends,*t->second->Target);
+ this->AppendGlobalTargetDepends(depends,*gtarget->Target);
lg->WriteMakeRule(ruleFileStream, "All Build rule for target.",
localName.c_str(), depends, commands, true);
// add the all/all dependency
- if(!this->IsExcluded(this->LocalGenerators[0], *t->second->Target))
+ if(!this->IsExcluded(this->LocalGenerators[0], *gtarget->Target))
{
depends.clear();
depends.push_back(localName);
@@ -845,7 +851,7 @@ cmGlobalUnixMakefileGenerator3
//
std::set<cmTarget const*> emitted;
progCmd << " "
- << this->CountProgressMarksInTarget(t->second->Target, emitted);
+ << this->CountProgressMarksInTarget(gtarget->Target, emitted);
commands.push_back(progCmd.str());
}
std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
@@ -863,7 +869,7 @@ cmGlobalUnixMakefileGenerator3
}
depends.clear();
depends.push_back("cmake_check_build_system");
- localName = lg->GetRelativeTargetDirectory(*t->second->Target);
+ localName = lg->GetRelativeTargetDirectory(*gtarget->Target);
localName += "/rule";
lg->WriteMakeRule(ruleFileStream,
"Build rule for subdir invocation for target.",
@@ -874,13 +880,13 @@ cmGlobalUnixMakefileGenerator3
depends.clear();
depends.push_back(localName);
lg->WriteMakeRule(ruleFileStream, "Convenience name for target.",
- t->second->GetName(), depends, commands, true);
+ name, depends, commands, true);
// Add rules to prepare the target for installation.
- if(t->second->Target
+ if(gtarget->Target
->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))
{
- localName = lg->GetRelativeTargetDirectory(*t->second->Target);
+ localName = lg->GetRelativeTargetDirectory(*gtarget->Target);
localName += "/preinstall";
depends.clear();
commands.clear();
@@ -890,7 +896,7 @@ cmGlobalUnixMakefileGenerator3
"Pre-install relink rule for target.",
localName.c_str(), depends, commands, true);
- if(!this->IsExcluded(this->LocalGenerators[0], *t->second->Target))
+ if(!this->IsExcluded(this->LocalGenerators[0], *gtarget->Target))
{
depends.clear();
depends.push_back(localName);
@@ -901,7 +907,7 @@ cmGlobalUnixMakefileGenerator3
}
// add the clean rule
- localName = lg->GetRelativeTargetDirectory(*t->second->Target);
+ localName = lg->GetRelativeTargetDirectory(*gtarget->Target);
makeTargetName = localName;
makeTargetName += "/clean";
depends.clear();
@@ -975,7 +981,7 @@ cmGlobalUnixMakefileGenerator3::ProgressMapCompare
::operator()(cmTarget const* l, cmTarget const* r) const
{
// Order by target name.
- if(int c = strcmp(l->GetName(), r->GetName()))
+ if(int c = strcmp(l->GetName().c_str(), r->GetName().c_str()))
{
return c < 0;
}
@@ -1051,7 +1057,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
lg->AppendEcho(commands,"... depend");
// Keep track of targets already listed.
- std::set<cmStdString> emittedTargets;
+ std::set<std::string> emittedTargets;
// for each local generator
unsigned int i;
@@ -1068,26 +1074,29 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
cmTargets& targets = lg2->GetMakefile()->GetTargets();
for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
{
- if((t->second.GetType() == cmTarget::EXECUTABLE) ||
- (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
- (t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
- (t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
- (t->second.GetType() == cmTarget::OBJECT_LIBRARY) ||
- (t->second.GetType() == cmTarget::GLOBAL_TARGET) ||
- (t->second.GetType() == cmTarget::UTILITY))
+ cmTarget const& target = t->second;
+ cmTarget::TargetType type = target.GetType();
+ if((type == cmTarget::EXECUTABLE) ||
+ (type == cmTarget::STATIC_LIBRARY) ||
+ (type == cmTarget::SHARED_LIBRARY) ||
+ (type == cmTarget::MODULE_LIBRARY) ||
+ (type == cmTarget::OBJECT_LIBRARY) ||
+ (type == cmTarget::GLOBAL_TARGET) ||
+ (type == cmTarget::UTILITY))
{
- if(emittedTargets.insert(t->second.GetName()).second)
+ std::string name = target.GetName();
+ if(emittedTargets.insert(name).second)
{
path = "... ";
- path += t->second.GetName();
+ path += name;
lg->AppendEcho(commands,path.c_str());
}
}
}
}
}
- std::vector<cmStdString> const& localHelp = lg->GetLocalHelp();
- for(std::vector<cmStdString>::const_iterator o = localHelp.begin();
+ std::vector<std::string> const& localHelp = lg->GetLocalHelp();
+ for(std::vector<std::string>::const_iterator o = localHelp.begin();
o != localHelp.end(); ++o)
{
path = "... ";
@@ -1104,9 +1113,9 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
bool cmGlobalUnixMakefileGenerator3
::NeedRequiresStep(cmTarget const& target)
{
- std::set<cmStdString> languages;
+ std::set<std::string> languages;
target.GetLanguages(languages);
- for(std::set<cmStdString>::const_iterator l = languages.begin();
+ for(std::set<std::string>::const_iterator l = languages.begin();
l != languages.end(); ++l)
{
std::string var = "CMAKE_NEEDS_REQUIRES_STEP_";
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index 9173751..8115176 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -60,9 +60,9 @@ public:
<cmGlobalUnixMakefileGenerator3>(); }
///! Get the name for the generator.
- virtual const char* GetName() const {
+ virtual std::string GetName() const {
return cmGlobalUnixMakefileGenerator3::GetActualName();}
- static const char* GetActualName() {return "Unix Makefiles";}
+ static std::string GetActualName() {return "Unix Makefiles";}
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
@@ -96,7 +96,7 @@ public:
// write the top level target rules
void WriteConvenienceRules(std::ostream& ruleFileStream,
- std::set<cmStdString> &emitted);
+ std::set<std::string> &emitted);
/** Get the command to use for a target that has no rule. This is
used for multiple output dependencies and for cmake_force. */
@@ -109,11 +109,11 @@ public:
// change the build command for speed
virtual void GenerateBuildCommand(
std::vector<std::string>& makeCommand,
- const char* makeProgram,
- const char* projectName,
- const char* projectDir,
- const char* targetName,
- const char* config,
+ const std::string& makeProgram,
+ const std::string& projectName,
+ const std::string& projectDir,
+ const std::string& targetName,
+ const std::string& config,
bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 6983ef9..840e888 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -21,13 +21,14 @@
static const char vs10generatorName[] = "Visual Studio 10 2010";
// Map generator name without year to name with year.
-static const char* cmVS10GenName(const char* name, std::string& genName)
+static const char* cmVS10GenName(const std::string& name, std::string& genName)
{
- if(strncmp(name, vs10generatorName, sizeof(vs10generatorName)-6) != 0)
+ if(strncmp(name.c_str(), vs10generatorName,
+ sizeof(vs10generatorName)-6) != 0)
{
return 0;
}
- const char* p = name + sizeof(vs10generatorName) - 6;
+ const char* p = name.c_str() + sizeof(vs10generatorName) - 6;
if(cmHasLiteralPrefix(p, " 2010"))
{
p += 5;
@@ -40,27 +41,27 @@ class cmGlobalVisualStudio10Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
- virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const
+ virtual cmGlobalGenerator* CreateGlobalGenerator(
+ const std::string& name) const
{
std::string genName;
const char* p = cmVS10GenName(name, genName);
if(!p)
{ return 0; }
- name = genName.c_str();
if(strcmp(p, "") == 0)
{
return new cmGlobalVisualStudio10Generator(
- name, NULL, NULL);
+ genName, "", "");
}
if(strcmp(p, " Win64") == 0)
{
return new cmGlobalVisualStudio10Generator(
- name, "x64", "CMAKE_FORCE_WIN64");
+ genName, "x64", "CMAKE_FORCE_WIN64");
}
if(strcmp(p, " IA64") == 0)
{
return new cmGlobalVisualStudio10Generator(
- name, "Itanium", "CMAKE_FORCE_IA64");
+ genName, "Itanium", "CMAKE_FORCE_IA64");
}
return 0;
}
@@ -87,8 +88,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory()
//----------------------------------------------------------------------------
cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
- const char* name, const char* platformName,
- const char* additionalPlatformDefinition)
+ const std::string& name, const std::string& platformName,
+ const std::string& additionalPlatformDefinition)
: cmGlobalVisualStudio8Generator(name, platformName,
additionalPlatformDefinition)
{
@@ -102,7 +103,8 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
//----------------------------------------------------------------------------
bool
-cmGlobalVisualStudio10Generator::MatchesGeneratorName(const char* name) const
+cmGlobalVisualStudio10Generator::MatchesGeneratorName(
+ const std::string& name) const
{
std::string genName;
if(cmVS10GenName(name, genName))
@@ -310,11 +312,11 @@ std::string cmGlobalVisualStudio10Generator::FindDevEnvCommand()
//----------------------------------------------------------------------------
void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
std::vector<std::string>& makeCommand,
- const char* makeProgram,
- const char* projectName,
- const char* projectDir,
- const char* targetName,
- const char* config,
+ const std::string& makeProgram,
+ const std::string& projectName,
+ const std::string& projectDir,
+ const std::string& targetName,
+ const std::string& config,
bool fast,
std::vector<std::string> const& makeOptions)
{
@@ -334,7 +336,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
cmSlnData slnData;
{
std::string slnFile;
- if(projectDir && *projectDir)
+ if(!projectDir.empty())
{
slnFile = projectDir;
slnFile += "/";
@@ -369,25 +371,26 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
makeCommand.push_back(makeProgramSelected);
+ std::string realTarget = targetName;
// msbuild.exe CxxOnly.sln /t:Build /p:Configuration=Debug /target:ALL_BUILD
- if(!targetName || strlen(targetName) == 0)
+ if(realTarget.empty())
{
- targetName = "ALL_BUILD";
+ realTarget = "ALL_BUILD";
}
- if ( targetName && strcmp(targetName, "clean") == 0 )
+ if ( realTarget == "clean" )
{
makeCommand.push_back(std::string(projectName)+".sln");
makeCommand.push_back("/t:Clean");
}
else
{
- std::string targetProject(targetName);
+ std::string targetProject(realTarget);
targetProject += ".vcxproj";
if (targetProject.find('/') == std::string::npos)
{
// it might be in a subdir
if (cmSlnProjectEntry const* proj =
- slnData.GetProjectByName(targetName))
+ slnData.GetProjectByName(realTarget))
{
targetProject = proj->GetRelativePath();
cmSystemTools::ConvertToUnixSlashes(targetProject);
@@ -396,7 +399,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
makeCommand.push_back(targetProject);
}
std::string configArg = "/p:Configuration=";
- if(config && strlen(config))
+ if(!config.empty())
{
configArg += config;
}
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 976d41f..999a9d5 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -24,21 +24,22 @@ class cmGlobalVisualStudio10Generator :
public cmGlobalVisualStudio8Generator
{
public:
- cmGlobalVisualStudio10Generator(const char* name,
- const char* platformName, const char* additionalPlatformDefinition);
+ cmGlobalVisualStudio10Generator(const std::string& name,
+ const std::string& platformName,
+ const std::string& additionalPlatformDefinition);
static cmGlobalGeneratorFactory* NewFactory();
- virtual bool MatchesGeneratorName(const char* name) const;
+ virtual bool MatchesGeneratorName(const std::string& name) const;
virtual bool SetGeneratorToolset(std::string const& ts);
virtual void GenerateBuildCommand(
std::vector<std::string>& makeCommand,
- const char* makeProgram,
- const char* projectName,
- const char* projectDir,
- const char* targetName,
- const char* config,
+ const std::string& makeProgram,
+ const std::string& projectName,
+ const std::string& projectDir,
+ const std::string& targetName,
+ const std::string& config,
bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 1f0c47a..4caa7f2 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -16,13 +16,14 @@
static const char vs11generatorName[] = "Visual Studio 11 2012";
// Map generator name without year to name with year.
-static const char* cmVS11GenName(const char* name, std::string& genName)
+static const char* cmVS11GenName(const std::string& name, std::string& genName)
{
- if(strncmp(name, vs11generatorName, sizeof(vs11generatorName)-6) != 0)
+ if(strncmp(name.c_str(), vs11generatorName,
+ sizeof(vs11generatorName)-6) != 0)
{
return 0;
}
- const char* p = name + sizeof(vs11generatorName) - 6;
+ const char* p = name.c_str() + sizeof(vs11generatorName) - 6;
if(cmHasLiteralPrefix(p, " 2012"))
{
p += 5;
@@ -35,27 +36,27 @@ class cmGlobalVisualStudio11Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
- virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const
+ virtual cmGlobalGenerator* CreateGlobalGenerator(
+ const std::string& name) const
{
std::string genName;
const char* p = cmVS11GenName(name, genName);
if(!p)
{ return 0; }
- name = genName.c_str();
if(strcmp(p, "") == 0)
{
return new cmGlobalVisualStudio11Generator(
- name, NULL, NULL);
+ genName, "", "");
}
if(strcmp(p, " Win64") == 0)
{
return new cmGlobalVisualStudio11Generator(
- name, "x64", "CMAKE_FORCE_WIN64");
+ genName, "x64", "CMAKE_FORCE_WIN64");
}
if(strcmp(p, " ARM") == 0)
{
return new cmGlobalVisualStudio11Generator(
- name, "ARM", NULL);
+ genName, "ARM", "");
}
if(*p++ != ' ')
@@ -107,8 +108,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory()
//----------------------------------------------------------------------------
cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
- const char* name, const char* platformName,
- const char* additionalPlatformDefinition)
+ const std::string& name, const std::string& platformName,
+ const std::string& additionalPlatformDefinition)
: cmGlobalVisualStudio10Generator(name, platformName,
additionalPlatformDefinition)
{
@@ -121,7 +122,8 @@ cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
//----------------------------------------------------------------------------
bool
-cmGlobalVisualStudio11Generator::MatchesGeneratorName(const char* name) const
+cmGlobalVisualStudio11Generator::MatchesGeneratorName(
+ const std::string& name) const
{
std::string genName;
if(cmVS11GenName(name, genName))
diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h
index 7ef77e7..48ea489 100644
--- a/Source/cmGlobalVisualStudio11Generator.h
+++ b/Source/cmGlobalVisualStudio11Generator.h
@@ -20,11 +20,12 @@ class cmGlobalVisualStudio11Generator:
public cmGlobalVisualStudio10Generator
{
public:
- cmGlobalVisualStudio11Generator(const char* name,
- const char* platformName, const char* additionalPlatformDefinition);
+ cmGlobalVisualStudio11Generator(const std::string& name,
+ const std::string& platformName,
+ const std::string& additionalPlatformDefinition);
static cmGlobalGeneratorFactory* NewFactory();
- virtual bool MatchesGeneratorName(const char* name) const;
+ virtual bool MatchesGeneratorName(const std::string& name) const;
virtual void WriteSLNHeader(std::ostream& fout);
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index 3074794..6cd9f12 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -16,13 +16,14 @@
static const char vs12generatorName[] = "Visual Studio 12 2013";
// Map generator name without year to name with year.
-static const char* cmVS12GenName(const char* name, std::string& genName)
+static const char* cmVS12GenName(const std::string& name, std::string& genName)
{
- if(strncmp(name, vs12generatorName, sizeof(vs12generatorName)-6) != 0)
+ if(strncmp(name.c_str(), vs12generatorName,
+ sizeof(vs12generatorName)-6) != 0)
{
return 0;
}
- const char* p = name + sizeof(vs12generatorName) - 6;
+ const char* p = name.c_str() + sizeof(vs12generatorName) - 6;
if(cmHasLiteralPrefix(p, " 2013"))
{
p += 5;
@@ -35,27 +36,27 @@ class cmGlobalVisualStudio12Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
- virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const
+ virtual cmGlobalGenerator* CreateGlobalGenerator(
+ const std::string& name) const
{
std::string genName;
const char* p = cmVS12GenName(name, genName);
if(!p)
{ return 0; }
- name = genName.c_str();
if(strcmp(p, "") == 0)
{
return new cmGlobalVisualStudio12Generator(
- name, NULL, NULL);
+ genName, "", "");
}
if(strcmp(p, " Win64") == 0)
{
return new cmGlobalVisualStudio12Generator(
- name, "x64", "CMAKE_FORCE_WIN64");
+ genName, "x64", "CMAKE_FORCE_WIN64");
}
if(strcmp(p, " ARM") == 0)
{
return new cmGlobalVisualStudio12Generator(
- name, "ARM", NULL);
+ genName, "ARM", "");
}
return 0;
}
@@ -82,8 +83,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory()
//----------------------------------------------------------------------------
cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(
- const char* name, const char* platformName,
- const char* additionalPlatformDefinition)
+ const std::string& name, const std::string& platformName,
+ const std::string& additionalPlatformDefinition)
: cmGlobalVisualStudio11Generator(name, platformName,
additionalPlatformDefinition)
{
@@ -96,7 +97,8 @@ cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(
//----------------------------------------------------------------------------
bool
-cmGlobalVisualStudio12Generator::MatchesGeneratorName(const char* name) const
+cmGlobalVisualStudio12Generator::MatchesGeneratorName(
+ const std::string& name) const
{
std::string genName;
if(cmVS12GenName(name, genName))
diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h
index 5a4a78d..4557f28 100644
--- a/Source/cmGlobalVisualStudio12Generator.h
+++ b/Source/cmGlobalVisualStudio12Generator.h
@@ -20,11 +20,12 @@ class cmGlobalVisualStudio12Generator:
public cmGlobalVisualStudio11Generator
{
public:
- cmGlobalVisualStudio12Generator(const char* name,
- const char* platformName, const char* additionalPlatformDefinition);
+ cmGlobalVisualStudio12Generator(const std::string& name,
+ const std::string& platformName,
+ const std::string& additionalPlatformDefinition);
static cmGlobalGeneratorFactory* NewFactory();
- virtual bool MatchesGeneratorName(const char* name) const;
+ virtual bool MatchesGeneratorName(const std::string& name) const;
virtual void WriteSLNHeader(std::ostream& fout);
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index 6c458c3..7397bbb 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -116,11 +116,11 @@ std::string cmGlobalVisualStudio6Generator::FindMSDevCommand()
void
cmGlobalVisualStudio6Generator::GenerateBuildCommand(
std::vector<std::string>& makeCommand,
- const char* makeProgram,
- const char* projectName,
- const char* /*projectDir*/,
- const char* targetName,
- const char* config,
+ const std::string& makeProgram,
+ const std::string& projectName,
+ const std::string& /*projectDir*/,
+ const std::string& targetName,
+ const std::string& config,
bool /*fast*/,
std::vector<std::string> const& makeOptions
)
@@ -134,21 +134,22 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand(
makeCommand.push_back("/MAKE");
std::string targetArg;
bool clean = false;
- if ( targetName && strcmp(targetName, "clean") == 0 )
+ std::string realTarget = targetName;
+ if ( realTarget == "clean" )
{
clean = true;
- targetName = "ALL_BUILD";
+ realTarget = "ALL_BUILD";
}
- if (targetName && strlen(targetName))
+ if (!realTarget.empty())
{
- targetArg += targetName;
+ targetArg += realTarget;
}
else
{
targetArg += "ALL_BUILD";
}
targetArg += " - ";
- if(config && strlen(config))
+ if(!config.empty())
{
targetArg += config;
}
@@ -259,7 +260,7 @@ void cmGlobalVisualStudio6Generator
// output the DSW file
void cmGlobalVisualStudio6Generator::OutputDSWFile()
{
- std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
+ std::map<std::string, std::vector<cmLocalGenerator*> >::iterator it;
for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it)
{
this->OutputDSWFile(it->second[0], it->second);
@@ -270,7 +271,7 @@ void cmGlobalVisualStudio6Generator::OutputDSWFile()
// Note, that dependencies from executables to
// the libraries it uses are also done here
void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout,
- const char* dspname,
+ const std::string& dspname,
const char* dir,
cmTarget const& target)
{
@@ -315,9 +316,9 @@ void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout,
// Note, that dependencies from executables to
// the libraries it uses are also done here
void cmGlobalVisualStudio6Generator::WriteExternalProject(std::ostream& fout,
- const char* name,
+ const std::string& name,
const char* location,
- const std::set<cmStdString>& dependencies)
+ const std::set<std::string>& dependencies)
{
fout << "#########################################################"
"######################\n\n";
@@ -328,7 +329,7 @@ void cmGlobalVisualStudio6Generator::WriteExternalProject(std::ostream& fout,
fout << "{{{\n";
- std::set<cmStdString>::const_iterator i, end;
+ std::set<std::string>::const_iterator i, end;
// write dependencies.
i = dependencies.begin();
end = dependencies.end();
@@ -417,12 +418,12 @@ void cmGlobalVisualStudio6Generator
//----------------------------------------------------------------------------
void
cmGlobalVisualStudio6Generator
-::AppendDirectoryForConfig(const char* prefix,
- const char* config,
- const char* suffix,
+::AppendDirectoryForConfig(const std::string& prefix,
+ const std::string& config,
+ const std::string& suffix,
std::string& dir)
{
- if(config)
+ if(!config.empty())
{
dir += prefix;
dir += config;
diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h
index 5521410..2797e11 100644
--- a/Source/cmGlobalVisualStudio6Generator.h
+++ b/Source/cmGlobalVisualStudio6Generator.h
@@ -31,9 +31,9 @@ public:
<cmGlobalVisualStudio6Generator>(); }
///! Get the name for the generator.
- virtual const char* GetName() const {
+ virtual std::string GetName() const {
return cmGlobalVisualStudio6Generator::GetActualName();}
- static const char* GetActualName() {return "Visual Studio 6";}
+ static std::string GetActualName() {return "Visual Studio 6";}
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
@@ -54,11 +54,11 @@ public:
*/
virtual void GenerateBuildCommand(
std::vector<std::string>& makeCommand,
- const char* makeProgram,
- const char* projectName,
- const char* projectDir,
- const char* targetName,
- const char* config,
+ const std::string& makeProgram,
+ const std::string& projectName,
+ const std::string& projectDir,
+ const std::string& targetName,
+ const std::string& config,
bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
@@ -81,9 +81,9 @@ public:
std::vector<cmLocalGenerator*>& generators);
/** Append the subdirectory for the given configuration. */
- virtual void AppendDirectoryForConfig(const char* prefix,
- const char* config,
- const char* suffix,
+ virtual void AppendDirectoryForConfig(const std::string& prefix,
+ const std::string& config,
+ const std::string& suffix,
std::string& dir);
///! What is the configurations directory variable called?
@@ -99,10 +99,11 @@ private:
void WriteDSWFile(std::ostream& fout);
void WriteDSWHeader(std::ostream& fout);
void WriteProject(std::ostream& fout,
- const char* name, const char* path, cmTarget const& t);
+ const std::string& name, const char* path,
+ cmTarget const& t);
void WriteExternalProject(std::ostream& fout,
- const char* name, const char* path,
- const std::set<cmStdString>& dependencies);
+ const std::string& name, const char* path,
+ const std::set<std::string>& dependencies);
void WriteDSWFooter(std::ostream& fout);
virtual std::string WriteUtilityDepend(cmTarget const* target);
std::string MSDevCommand;
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 22e4f08..4bea5ac 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -17,7 +17,8 @@
//----------------------------------------------------------------------------
cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator(
- const char* platformName) : cmGlobalVisualStudio7Generator(platformName)
+ const std::string& platformName)
+ : cmGlobalVisualStudio7Generator(platformName)
{
this->ProjectConfigurationSectionName = "ProjectConfiguration";
}
@@ -155,7 +156,7 @@ cmGlobalVisualStudio71Generator
// the libraries it uses are also done here
void
cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
- const char* dspname,
+ const std::string& dspname,
const char* dir,
cmTarget const& t)
{
@@ -208,7 +209,7 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
void
cmGlobalVisualStudio71Generator
::WriteProjectDepends(std::ostream& fout,
- const char*,
+ const std::string&,
const char*, cmTarget const& target)
{
VSDependSet const& depends = this->VSTargetDepends[&target];
@@ -234,10 +235,10 @@ cmGlobalVisualStudio71Generator
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio71Generator
::WriteExternalProject(std::ostream& fout,
- const char* name,
+ const std::string& name,
const char* location,
const char* typeGuid,
- const std::set<cmStdString>& depends)
+ const std::set<std::string>& depends)
{
fout << "Project(\"{"
<< (typeGuid ? typeGuid : this->ExternalProjectType(location))
@@ -252,7 +253,7 @@ void cmGlobalVisualStudio71Generator
if(!depends.empty())
{
fout << "\tProjectSection(ProjectDependencies) = postProject\n";
- std::set<cmStdString>::const_iterator it;
+ std::set<std::string>::const_iterator it;
for(it = depends.begin(); it != depends.end(); ++it)
{
if(it->size() > 0)
@@ -277,12 +278,12 @@ void cmGlobalVisualStudio71Generator
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio71Generator
::WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType,
+ std::ostream& fout, const std::string& name, cmTarget::TargetType,
const std::set<std::string>& configsPartOfDefaultBuild,
- const char* platformMapping)
+ std::string const& platformMapping)
{
- const char* platformName =
- platformMapping ? platformMapping : this->GetPlatformName();
+ const std::string& platformName =
+ !platformMapping.empty() ? platformMapping : this->GetPlatformName();
std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h
index 04e3a55..2b5259a 100644
--- a/Source/cmGlobalVisualStudio71Generator.h
+++ b/Source/cmGlobalVisualStudio71Generator.h
@@ -23,15 +23,15 @@
class cmGlobalVisualStudio71Generator : public cmGlobalVisualStudio7Generator
{
public:
- cmGlobalVisualStudio71Generator(const char* platformName = NULL);
+ cmGlobalVisualStudio71Generator(const std::string& platformName = "");
static cmGlobalGeneratorFactory* NewFactory() {
return new cmGlobalGeneratorSimpleFactory
<cmGlobalVisualStudio71Generator>(); }
///! Get the name for the generator.
- virtual const char* GetName() const {
+ virtual std::string GetName() const {
return cmGlobalVisualStudio71Generator::GetActualName();}
- static const char* GetActualName() {return "Visual Studio 7 .NET 2003";}
+ static std::string GetActualName() {return "Visual Studio 7 .NET 2003";}
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
@@ -59,20 +59,20 @@ protected:
std::vector<cmLocalGenerator*>& generators);
virtual void WriteSolutionConfigurations(std::ostream& fout);
virtual void WriteProject(std::ostream& fout,
- const char* name, const char* path,
+ const std::string& name, const char* path,
cmTarget const& t);
virtual void WriteProjectDepends(std::ostream& fout,
- const char* name, const char* path,
+ const std::string& name, const char* path,
cmTarget const& t);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const std::string& name, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
- const char* platformMapping = NULL);
+ const std::string& platformMapping = "");
virtual void WriteExternalProject(std::ostream& fout,
- const char* name,
+ const std::string& name,
const char* path,
const char* typeGuid,
- const std::set<cmStdString>& depends);
+ const std::set<std::string>& depends);
virtual void WriteSLNHeader(std::ostream& fout);
std::string ProjectConfigurationSectionName;
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index bb63289..320b440 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -19,16 +19,19 @@
#include <cmsys/Encoding.hxx>
cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator(
- const char* platformName)
+ const std::string& platformName)
{
this->IntelProjectVersion = 0;
this->DevEnvCommandInitialized = false;
- if (!platformName)
+ if (platformName.empty())
{
- platformName = "Win32";
+ this->PlatformName = "Win32";
+ }
+ else
+ {
+ this->PlatformName = platformName;
}
- this->PlatformName = platformName;
}
cmGlobalVisualStudio7Generator::~cmGlobalVisualStudio7Generator()
@@ -183,11 +186,11 @@ const char* cmGlobalVisualStudio7Generator::ExternalProjectType(
//----------------------------------------------------------------------------
void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
std::vector<std::string>& makeCommand,
- const char* makeProgram,
- const char* projectName,
- const char* /*projectDir*/,
- const char* targetName,
- const char* config,
+ const std::string& makeProgram,
+ const std::string& projectName,
+ const std::string& /*projectDir*/,
+ const std::string& targetName,
+ const std::string& config,
bool /*fast*/,
std::vector<std::string> const& makeOptions)
{
@@ -208,11 +211,12 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
makeCommand.push_back(makeProgramSelected);
makeCommand.push_back(std::string(projectName) + ".sln");
+ std::string realTarget = targetName;
bool clean = false;
- if ( targetName && strcmp(targetName, "clean") == 0 )
+ if ( realTarget == "clean" )
{
clean = true;
- targetName = "ALL_BUILD";
+ realTarget = "ALL_BUILD";
}
if(clean)
{
@@ -223,7 +227,7 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
makeCommand.push_back("/build");
}
- if(config && strlen(config))
+ if(!config.empty())
{
makeCommand.push_back(config);
}
@@ -233,9 +237,9 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
}
makeCommand.push_back("/project");
- if (targetName && strlen(targetName))
+ if (!realTarget.empty())
{
- makeCommand.push_back(targetName);
+ makeCommand.push_back(realTarget);
}
else
{
@@ -259,7 +263,7 @@ cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator()
void cmGlobalVisualStudio7Generator::AddPlatformDefinitions(cmMakefile* mf)
{
cmGlobalVisualStudioGenerator::AddPlatformDefinitions(mf);
- mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName());
+ mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName().c_str());
mf->AddDefinition("CMAKE_VS_INTEL_Fortran_PROJECT_VERSION",
this->GetIntelProjectVersion());
}
@@ -352,7 +356,7 @@ void cmGlobalVisualStudio7Generator
// output the SLN file
void cmGlobalVisualStudio7Generator::OutputSLNFile()
{
- std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
+ std::map<std::string, std::vector<cmLocalGenerator*> >::iterator it;
for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it)
{
this->OutputSLNFile(it->second[0], it->second);
@@ -380,9 +384,10 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
{
std::set<std::string> allConfigurations(this->Configurations.begin(),
this->Configurations.end());
+ const char* mapping = target->GetProperty("VS_PLATFORM_MAPPING");
this->WriteProjectConfigurations(
- fout, target->GetName(), target->GetType(),
- allConfigurations, target->GetProperty("VS_PLATFORM_MAPPING"));
+ fout, target->GetName().c_str(), target->GetType(),
+ allConfigurations, mapping ? mapping : "");
}
else
{
@@ -653,7 +658,7 @@ cmGlobalVisualStudio7Generator::ConvertToSolutionPath(const char* path)
// Note, that dependencies from executables to
// the libraries it uses are also done here
void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout,
- const char* dspname,
+ const std::string& dspname,
const char* dir, cmTarget const& target)
{
// check to see if this is a fortran build
@@ -693,7 +698,7 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout,
void
cmGlobalVisualStudio7Generator
::WriteProjectDepends(std::ostream& fout,
- const char* dspname,
+ const std::string& dspname,
const char*, cmTarget const& target)
{
int depcount = 0;
@@ -729,12 +734,12 @@ cmGlobalVisualStudio7Generator
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio7Generator
::WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType,
+ std::ostream& fout, const std::string& name, cmTarget::TargetType,
const std::set<std::string>& configsPartOfDefaultBuild,
- const char* platformMapping)
+ const std::string& platformMapping)
{
- const char* platformName =
- platformMapping ? platformMapping : this->GetPlatformName();
+ const std::string& platformName =
+ !platformMapping.empty() ? platformMapping : this->GetPlatformName();
std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
@@ -757,10 +762,10 @@ void cmGlobalVisualStudio7Generator
// Note, that dependencies from executables to
// the libraries it uses are also done here
void cmGlobalVisualStudio7Generator::WriteExternalProject(std::ostream& fout,
- const char* name,
+ const std::string& name,
const char* location,
const char* typeGuid,
- const std::set<cmStdString>&)
+ const std::set<std::string>&)
{
std::string d = cmSystemTools::ConvertToOutputPath(location);
fout << "Project("
@@ -907,7 +912,7 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget const* target)
return pname;
}
-std::string cmGlobalVisualStudio7Generator::GetGUID(const char* name)
+std::string cmGlobalVisualStudio7Generator::GetGUID(const std::string& name)
{
std::string guidStoreName = name;
guidStoreName += "_GUID_CMAKE";
@@ -918,12 +923,12 @@ std::string cmGlobalVisualStudio7Generator::GetGUID(const char* name)
return std::string(storedGUID);
}
cmSystemTools::Error("Unknown Target referenced : ",
- name);
+ name.c_str());
return "";
}
-void cmGlobalVisualStudio7Generator::CreateGUID(const char* name)
+void cmGlobalVisualStudio7Generator::CreateGUID(const std::string& name)
{
std::string guidStoreName = name;
guidStoreName += "_GUID_CMAKE";
@@ -960,12 +965,12 @@ void cmGlobalVisualStudio7Generator
//----------------------------------------------------------------------------
void
cmGlobalVisualStudio7Generator
-::AppendDirectoryForConfig(const char* prefix,
- const char* config,
- const char* suffix,
+::AppendDirectoryForConfig(const std::string& prefix,
+ const std::string& config,
+ const std::string& suffix,
std::string& dir)
{
- if(config)
+ if(!config.empty())
{
dir += prefix;
dir += config;
@@ -974,8 +979,9 @@ cmGlobalVisualStudio7Generator
}
std::set<std::string>
-cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project,
- cmTarget const* target)
+cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
+ const std::string& project,
+ cmTarget const* target)
{
std::set<std::string> activeConfigs;
// if it is a utilitiy target then only make it part of the
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index f69bd84..0d2e410 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -26,7 +26,7 @@ struct cmIDEFlagTable;
class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator
{
public:
- cmGlobalVisualStudio7Generator(const char* platformName = NULL);
+ cmGlobalVisualStudio7Generator(const std::string& platformName = "");
~cmGlobalVisualStudio7Generator();
static cmGlobalGeneratorFactory* NewFactory() {
@@ -34,12 +34,12 @@ public:
<cmGlobalVisualStudio7Generator>(); }
///! Get the name for the generator.
- virtual const char* GetName() const {
+ virtual std::string GetName() const {
return cmGlobalVisualStudio7Generator::GetActualName();}
- static const char* GetActualName() {return "Visual Studio 7";}
+ static std::string GetActualName() {return "Visual Studio 7";}
///! Get the name for the platform.
- const char* GetPlatformName() const { return this->PlatformName.c_str(); }
+ const std::string& GetPlatformName() const { return this->PlatformName; }
///! Create a local generator appropriate to this Global Generator
virtual cmLocalGenerator *CreateLocalGenerator();
@@ -62,11 +62,11 @@ public:
*/
virtual void GenerateBuildCommand(
std::vector<std::string>& makeCommand,
- const char* makeProgram,
- const char* projectName,
- const char* projectDir,
- const char* targetName,
- const char* config,
+ const std::string& makeProgram,
+ const std::string& projectName,
+ const std::string& projectDir,
+ const std::string& targetName,
+ const std::string& config,
bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
@@ -89,13 +89,13 @@ public:
std::vector<std::string> *GetConfigurations();
///! Create a GUID or get an existing one.
- void CreateGUID(const char* name);
- std::string GetGUID(const char* name);
+ void CreateGUID(const std::string& name);
+ std::string GetGUID(const std::string& name);
/** Append the subdirectory for the given configuration. */
- virtual void AppendDirectoryForConfig(const char* prefix,
- const char* config,
- const char* suffix,
+ virtual void AppendDirectoryForConfig(const std::string& prefix,
+ const std::string& config,
+ const std::string& suffix,
std::string& dir);
///! What is the configurations directory variable called?
@@ -123,15 +123,15 @@ protected:
virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
virtual void WriteProject(std::ostream& fout,
- const char* name, const char* path,
+ const std::string& name, const char* path,
cmTarget const& t);
virtual void WriteProjectDepends(std::ostream& fout,
- const char* name, const char* path,
+ const std::string& name, const char* path,
cmTarget const&t);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const std::string& name, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
- const char* platformMapping = NULL);
+ const std::string& platformMapping = "");
virtual void WriteSLNGlobalSections(std::ostream& fout,
cmLocalGenerator* root);
virtual void WriteSLNFooter(std::ostream& fout);
@@ -153,18 +153,18 @@ protected:
void GenerateConfigurations(cmMakefile* mf);
virtual void WriteExternalProject(std::ostream& fout,
- const char* name,
+ const std::string& name,
const char* path,
const char* typeGuid,
- const std::set<cmStdString>&
+ const std::set<std::string>&
dependencies);
std::string ConvertToSolutionPath(const char* path);
- std::set<std::string> IsPartOfDefaultBuild(const char* project,
+ std::set<std::string> IsPartOfDefaultBuild(const std::string& project,
cmTarget const* target);
std::vector<std::string> Configurations;
- std::map<cmStdString, cmStdString> GUIDMap;
+ std::map<std::string, std::string> GUIDMap;
virtual void WriteFolders(std::ostream& fout);
virtual void WriteFoldersContent(std::ostream& fout);
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 12c240b..ab4380c 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -23,17 +23,19 @@ class cmGlobalVisualStudio8Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
- virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const {
- if(strstr(name, vs8generatorName) != name)
+ virtual cmGlobalGenerator* CreateGlobalGenerator(
+ const std::string& name) const {
+ if(strncmp(name.c_str(), vs8generatorName,
+ sizeof(vs8generatorName) - 1) != 0)
{
return 0;
}
- const char* p = name + sizeof(vs8generatorName) - 1;
+ const char* p = name.c_str() + sizeof(vs8generatorName) - 1;
if(p[0] == '\0')
{
return new cmGlobalVisualStudio8Generator(
- name, NULL, NULL);
+ name, "", "");
}
if(p[0] != ' ')
@@ -57,7 +59,7 @@ public:
}
cmGlobalVisualStudio8Generator* ret = new cmGlobalVisualStudio8Generator(
- name, p, NULL);
+ name, p, "");
ret->WindowsCEVersion = parser.GetOSVersion();
return ret;
}
@@ -90,14 +92,14 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio8Generator::NewFactory()
//----------------------------------------------------------------------------
cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(
- const char* name, const char* platformName,
- const char* additionalPlatformDefinition)
+ const std::string& name, const std::string& platformName,
+ const std::string& additionalPlatformDefinition)
: cmGlobalVisualStudio71Generator(platformName)
{
this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms";
this->Name = name;
- if (additionalPlatformDefinition)
+ if (!additionalPlatformDefinition.empty())
{
this->AdditionalPlatformDefinition = additionalPlatformDefinition;
}
@@ -314,7 +316,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
// file as the main dependency because it would get
// overwritten by the CreateVCProjBuildRule.
// (this could be avoided with per-target source files)
- const char* no_main_dependency = 0;
+ std::string no_main_dependency = "";
if(cmSourceFile* file =
mf->AddCustomCommandToOutput(
stamps, listFiles,
@@ -338,7 +340,7 @@ void cmGlobalVisualStudio8Generator::Generate()
if(this->AddCheckTarget())
{
// All targets depend on the build-system check target.
- for(std::map<cmStdString,cmTarget *>::const_iterator
+ for(std::map<std::string,cmTarget *>::const_iterator
ti = this->TotalTargets.begin();
ti != this->TotalTargets.end(); ++ti)
{
@@ -372,9 +374,9 @@ cmGlobalVisualStudio8Generator
void
cmGlobalVisualStudio8Generator
::WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const std::string& name, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
- const char* platformMapping)
+ std::string const& platformMapping)
{
std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = this->Configurations.begin();
@@ -382,7 +384,8 @@ cmGlobalVisualStudio8Generator
{
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->GetPlatformName() << ".ActiveCfg = " << *i << "|"
- << (platformMapping ? platformMapping : this->GetPlatformName())
+ << (!platformMapping.empty()?
+ platformMapping : this->GetPlatformName())
<< "\n";
std::set<std::string>::const_iterator
ci = configsPartOfDefaultBuild.find(*i);
@@ -390,7 +393,8 @@ cmGlobalVisualStudio8Generator
{
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->GetPlatformName() << ".Build.0 = " << *i << "|"
- << (platformMapping ? platformMapping : this->GetPlatformName())
+ << (!platformMapping.empty()?
+ platformMapping : this->GetPlatformName())
<< "\n";
}
bool needsDeploy = (type == cmTarget::EXECUTABLE ||
@@ -399,7 +403,8 @@ cmGlobalVisualStudio8Generator
{
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->GetPlatformName() << ".Deploy.0 = " << *i << "|"
- << (platformMapping ? platformMapping : this->GetPlatformName())
+ << (!platformMapping.empty()?
+ platformMapping : this->GetPlatformName())
<< "\n";
}
}
@@ -415,7 +420,7 @@ bool cmGlobalVisualStudio8Generator::ComputeTargetDepends()
//----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator::WriteProjectDepends(
- std::ostream& fout, const char*, const char*, cmTarget const& t)
+ std::ostream& fout, const std::string&, const char*, cmTarget const& t)
{
TargetDependSet const& unordered = this->GetTargetDirectDepends(t);
OrderedTargetDependSet depends(unordered);
@@ -426,7 +431,7 @@ void cmGlobalVisualStudio8Generator::WriteProjectDepends(
{
continue;
}
- std::string guid = this->GetGUID((*i)->GetName());
+ std::string guid = this->GetGUID((*i)->GetName().c_str());
fout << "\t\t{" << guid << "} = {" << guid << "}\n";
}
}
@@ -436,11 +441,11 @@ bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies(
cmTarget& target)
{
// Look for utility dependencies that magically link.
- for(std::set<cmStdString>::const_iterator ui =
+ for(std::set<std::string>::const_iterator ui =
target.GetUtilities().begin();
ui != target.GetUtilities().end(); ++ui)
{
- if(cmTarget* depTarget = this->FindTarget(0, ui->c_str()))
+ if(cmTarget* depTarget = this->FindTarget(ui->c_str()))
{
if(depTarget->GetType() != cmTarget::INTERFACE_LIBRARY
&& depTarget->GetProperty("EXTERNAL_MSPROJECT"))
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index 5b952c4..2459c05 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -23,12 +23,13 @@
class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator
{
public:
- cmGlobalVisualStudio8Generator(const char* name,
- const char* platformName, const char* additionalPlatformDefinition);
+ cmGlobalVisualStudio8Generator(const std::string& name,
+ const std::string& platformName,
+ const std::string& additionalPlatformDefinition);
static cmGlobalGeneratorFactory* NewFactory();
///! Get the name for the generator.
- virtual const char* GetName() const {return this->Name.c_str();}
+ virtual std::string GetName() const {return this->Name;}
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
@@ -79,11 +80,12 @@ protected:
virtual void WriteSLNHeader(std::ostream& fout);
virtual void WriteSolutionConfigurations(std::ostream& fout);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const std::string& name, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
- const char* platformMapping = NULL);
+ const std::string& platformMapping = "");
virtual bool ComputeTargetDepends();
- virtual void WriteProjectDepends(std::ostream& fout, const char* name,
+ virtual void WriteProjectDepends(std::ostream& fout,
+ const std::string& name,
const char* path, cmTarget const& t);
std::string Name;
diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx
index ccc27ad..c0051c7 100644
--- a/Source/cmGlobalVisualStudio9Generator.cxx
+++ b/Source/cmGlobalVisualStudio9Generator.cxx
@@ -22,17 +22,19 @@ class cmGlobalVisualStudio9Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
- virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const {
- if(strstr(name, vs9generatorName) != name)
+ virtual cmGlobalGenerator* CreateGlobalGenerator(
+ const std::string& name) const {
+ if(strncmp(name.c_str(), vs9generatorName,
+ sizeof(vs9generatorName) - 1) != 0)
{
return 0;
}
- const char* p = name + sizeof(vs9generatorName) - 1;
+ const char* p = name.c_str() + sizeof(vs9generatorName) - 1;
if(p[0] == '\0')
{
return new cmGlobalVisualStudio9Generator(
- name, NULL, NULL);
+ name, "", "");
}
if(p[0] != ' ')
@@ -96,8 +98,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory()
//----------------------------------------------------------------------------
cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator(
- const char* name, const char* platformName,
- const char* additionalPlatformDefinition)
+ const std::string& name, const std::string& platformName,
+ const std::string& additionalPlatformDefinition)
: cmGlobalVisualStudio8Generator(name, platformName,
additionalPlatformDefinition)
{
diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h
index 202aa8d..fb87bbe 100644
--- a/Source/cmGlobalVisualStudio9Generator.h
+++ b/Source/cmGlobalVisualStudio9Generator.h
@@ -24,8 +24,9 @@ class cmGlobalVisualStudio9Generator :
public cmGlobalVisualStudio8Generator
{
public:
- cmGlobalVisualStudio9Generator(const char* name,
- const char* platformName, const char* additionalPlatformDefinition);
+ cmGlobalVisualStudio9Generator(const std::string& name,
+ const std::string& platformName,
+ const std::string& additionalPlatformDefinition);
static cmGlobalGeneratorFactory* NewFactory();
///! create the correct local generator
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 0c5f35b..69c893c 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -22,7 +22,7 @@
//----------------------------------------------------------------------------
cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator()
{
- this->AdditionalPlatformDefinition = NULL;
+ this->AdditionalPlatformDefinition = "";
}
//----------------------------------------------------------------------------
@@ -53,7 +53,7 @@ void cmGlobalVisualStudioGenerator::Generate()
const char* no_working_dir = 0;
std::vector<std::string> no_depends;
cmCustomCommandLines no_commands;
- std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
+ std::map<std::string, std::vector<cmLocalGenerator*> >::iterator it;
for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it)
{
std::vector<cmLocalGenerator*>& gen = it->second;
@@ -128,7 +128,7 @@ cmGlobalVisualStudioGenerator
// Count the number of object files with each name. Note that
// windows file names are not case sensitive.
- std::map<cmStdString, int> counts;
+ std::map<std::string, int> counts;
std::vector<cmSourceFile*> objectSources;
gt->GetObjectSources(objectSources);
for(std::vector<cmSourceFile*>::const_iterator
@@ -380,7 +380,7 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
{
return false;
}
- std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
+ std::map<std::string, std::vector<cmLocalGenerator*> >::iterator it;
for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it)
{
std::vector<cmLocalGenerator*>& gen = it->second;
@@ -518,7 +518,7 @@ void cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf)
//----------------------------------------------------------------------------
void cmGlobalVisualStudioGenerator::AddPlatformDefinitions(cmMakefile* mf)
{
- if(this->AdditionalPlatformDefinition)
+ if(!this->AdditionalPlatformDefinition.empty())
{
mf->AddDefinition(this->AdditionalPlatformDefinition, "TRUE");
}
@@ -852,7 +852,7 @@ bool
cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmTarget const& target)
{
// check to see if this is a fortran build
- std::set<cmStdString> languages;
+ std::set<std::string> languages;
target.GetLanguages(languages);
if(languages.size() == 1)
{
@@ -870,15 +870,15 @@ cmGlobalVisualStudioGenerator::TargetCompare
::operator()(cmTarget const* l, cmTarget const* r) const
{
// Make sure ALL_BUILD is first so it is the default active project.
- if(strcmp(r->GetName(), "ALL_BUILD") == 0)
+ if(r->GetName() == "ALL_BUILD")
{
return false;
}
- if(strcmp(l->GetName(), "ALL_BUILD") == 0)
+ if(l->GetName() == "ALL_BUILD")
{
return true;
}
- return strcmp(l->GetName(), r->GetName()) < 0;
+ return strcmp(l->GetName().c_str(), r->GetName().c_str()) < 0;
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 9186d65..7e8dcf8 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -99,22 +99,23 @@ protected:
virtual void AddPlatformDefinitions(cmMakefile* mf);
virtual bool ComputeTargetDepends();
- class VSDependSet: public std::set<cmStdString> {};
+ class VSDependSet: public std::set<std::string> {};
class VSDependMap: public std::map<cmTarget const*, VSDependSet> {};
VSDependMap VSTargetDepends;
void ComputeVSTargetDepends(cmTarget&);
- bool CheckTargetLinks(cmTarget& target, const char* name);
- std::string GetUtilityForTarget(cmTarget& target, const char*);
+ bool CheckTargetLinks(cmTarget& target, const std::string& name);
+ std::string GetUtilityForTarget(cmTarget& target, const std::string&);
virtual std::string WriteUtilityDepend(cmTarget const*) = 0;
std::string GetUtilityDepend(cmTarget const* target);
- typedef std::map<cmTarget const*, cmStdString> UtilityDependsMap;
+ typedef std::map<cmTarget const*, std::string> UtilityDependsMap;
UtilityDependsMap UtilityDepends;
- const char* AdditionalPlatformDefinition;
+ std::string AdditionalPlatformDefinition;
private:
virtual std::string GetVSMakeProgram() = 0;
- void PrintCompilerAdvice(std::ostream&, std::string, const char*) const {}
+ void PrintCompilerAdvice(std::ostream&, std::string const&,
+ const char*) const {}
void ComputeTargetObjects(cmGeneratorTarget* gt) const;
void FollowLinkDepends(cmTarget const* target,
diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h
index d5350ef..2057a42 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.h
+++ b/Source/cmGlobalWatcomWMakeGenerator.h
@@ -27,9 +27,9 @@ public:
return new cmGlobalGeneratorSimpleFactory
<cmGlobalWatcomWMakeGenerator>(); }
///! Get the name for the generator.
- virtual const char* GetName() const {
+ virtual std::string GetName() const {
return cmGlobalWatcomWMakeGenerator::GetActualName();}
- static const char* GetActualName() {return "Watcom WMake";}
+ static std::string GetActualName() {return "Watcom WMake";}
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 004f7ac..30a2a1e 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -34,17 +34,17 @@ class cmXcodeVersionParser : public cmXMLParser
{
public:
cmXcodeVersionParser(): Version("1.5") {}
- void StartElement(const char* , const char** )
+ void StartElement(const std::string&, const char**)
{
this->Data = "";
}
- void EndElement(const char* name)
+ void EndElement(const std::string& name)
{
- if(strcmp(name, "key") == 0)
+ if(name == "key")
{
this->Key = this->Data;
}
- else if(strcmp(name, "string") == 0)
+ else if(name == "string")
{
if(this->Key == "CFBundleShortVersionString")
{
@@ -116,7 +116,8 @@ public:
class cmGlobalXCodeGenerator::Factory : public cmGlobalGeneratorFactory
{
public:
- virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const;
+ virtual cmGlobalGenerator* CreateGlobalGenerator(
+ const std::string& name) const;
virtual void GetDocumentation(cmDocumentationEntry& entry) const {
cmGlobalXCodeGenerator::GetDocumentation(entry); }
@@ -152,9 +153,9 @@ cmGlobalGeneratorFactory* cmGlobalXCodeGenerator::NewFactory()
//----------------------------------------------------------------------------
cmGlobalGenerator* cmGlobalXCodeGenerator::Factory
-::CreateGlobalGenerator(const char* name) const
+::CreateGlobalGenerator(const std::string& name) const
{
- if (strcmp(name, GetActualName()))
+ if (name != GetActualName())
return 0;
#if defined(CMAKE_BUILD_WITH_CMAKE)
cmXcodeVersionParser parser;
@@ -260,11 +261,11 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const&
void
cmGlobalXCodeGenerator::GenerateBuildCommand(
std::vector<std::string>& makeCommand,
- const char* makeProgram,
- const char* projectName,
- const char* /*projectDir*/,
- const char* targetName,
- const char* config,
+ const std::string& makeProgram,
+ const std::string& projectName,
+ const std::string& /*projectDir*/,
+ const std::string& targetName,
+ const std::string& config,
bool /*fast*/,
std::vector<std::string> const& makeOptions)
{
@@ -283,10 +284,11 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
makeCommand.push_back(projectArg);
bool clean = false;
- if ( targetName && strcmp(targetName, "clean") == 0 )
+ std::string realTarget = targetName;
+ if ( realTarget == "clean" )
{
clean = true;
- targetName = "ALL_BUILD";
+ realTarget = "ALL_BUILD";
}
if(clean)
{
@@ -297,14 +299,9 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
makeCommand.push_back("build");
}
makeCommand.push_back("-target");
- // if it is a null string for config don't use it
- if(config && *config == 0)
+ if (!realTarget.empty())
{
- config = 0;
- }
- if (targetName && strlen(targetName))
- {
- makeCommand.push_back(targetName);
+ makeCommand.push_back(realTarget);
}
else
{
@@ -318,7 +315,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
else
{
makeCommand.push_back("-configuration");
- makeCommand.push_back(config?config:"Debug");
+ makeCommand.push_back(!config.empty()?config:"Debug");
}
makeCommand.insert(makeCommand.end(),
makeOptions.begin(), makeOptions.end());
@@ -336,7 +333,7 @@ cmLocalGenerator *cmGlobalXCodeGenerator::CreateLocalGenerator()
//----------------------------------------------------------------------------
void cmGlobalXCodeGenerator::Generate()
{
- std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
+ std::map<std::string, std::vector<cmLocalGenerator*> >::iterator it;
// make sure extra targets are added before calling
// the parent generate which will call trace depends
for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it)
@@ -569,7 +566,7 @@ void cmGlobalXCodeGenerator::addObject(cmXCodeObject *obj)
{
if(obj->GetType() == cmXCodeObject::OBJECT)
{
- cmStdString id = obj->GetId();
+ std::string id = obj->GetId();
// If this is a duplicate id, it's an error:
//
@@ -613,7 +610,7 @@ cmGlobalXCodeGenerator::CreateObject(cmXCodeObject::Type type)
//----------------------------------------------------------------------------
cmXCodeObject*
-cmGlobalXCodeGenerator::CreateString(const char* s)
+cmGlobalXCodeGenerator::CreateString(const std::string& s)
{
cmXCodeObject* obj = this->CreateObject(cmXCodeObject::STRING);
obj->SetString(s);
@@ -630,17 +627,17 @@ cmXCodeObject* cmGlobalXCodeGenerator
}
//----------------------------------------------------------------------------
-cmStdString
+std::string
GetGroupMapKeyFromPath(cmTarget& cmtarget, const std::string& fullpath)
{
- cmStdString key(cmtarget.GetName());
+ std::string key(cmtarget.GetName());
key += "-";
key += fullpath;
return key;
}
//----------------------------------------------------------------------------
-cmStdString
+std::string
GetGroupMapKey(cmTarget& cmtarget, cmSourceFile* sf)
{
return GetGroupMapKeyFromPath(cmtarget, sf->GetFullPath());
@@ -696,12 +693,8 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
flags += flagsBuild.GetString();
}
- const char* lang =
+ std::string lang =
this->CurrentLocalGenerator->GetSourceFileLanguage(*sf);
- if (!lang)
- {
- lang = "";
- }
cmXCodeObject* buildFile =
this->CreateXCodeSourceFileFromPath(sf->GetFullPath(), cmtarget, lang);
@@ -847,7 +840,7 @@ cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
fileRef->SetComment(fname.c_str());
this->FileRefs[fname] = fileRef;
}
- cmStdString key = GetGroupMapKeyFromPath(cmtarget, fullpath);
+ std::string key = GetGroupMapKeyFromPath(cmtarget, fullpath);
cmXCodeObject* group = this->GroupMap[key];
cmXCodeObject* children = group->GetObject("children");
if (!children->HasObject(fileRef))
@@ -906,12 +899,8 @@ cmXCodeObject*
cmGlobalXCodeGenerator::CreateXCodeFileReference(cmSourceFile* sf,
cmTarget& cmtarget)
{
- const char* lang =
+ std::string lang =
this->CurrentLocalGenerator->GetSourceFileLanguage(*sf);
- if (!lang)
- {
- lang = "";
- }
return this->CreateXCodeFileReferenceFromPath(
sf->GetFullPath(), cmtarget, lang);
@@ -1017,7 +1006,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
gtgt->GetTargetSourceFileFlags(*i);
if(filetype &&
- strcmp(filetype->GetString(), "compiled.mach-o.objfile") == 0)
+ filetype->GetString() == "compiled.mach-o.objfile")
{
externalObjFiles.push_back(xsf);
}
@@ -1036,7 +1025,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
// Include this file in the build if it has a known language
// and has not been listed as an ignored extension for this
// generator.
- if(this->CurrentLocalGenerator->GetSourceFileLanguage(**i) &&
+ if(!this->CurrentLocalGenerator->GetSourceFileLanguage(**i).empty() &&
!this->IgnoreFile((*i)->GetExtension().c_str()))
{
sourceFiles.push_back(xsf);
@@ -1134,7 +1123,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
std::vector<cmXCodeObject*> contentBuildPhases;
if (isFrameworkTarget || isBundleTarget || isCFBundleTarget)
{
- typedef std::map<cmStdString, std::vector<cmSourceFile*> >
+ typedef std::map<std::string, std::vector<cmSourceFile*> >
mapOfVectorOfSourceFiles;
mapOfVectorOfSourceFiles bundleFiles;
for(std::vector<cmSourceFile*>::const_iterator i = classes.begin();
@@ -1223,7 +1212,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
void cmGlobalXCodeGenerator::ForceLinkerLanguages()
{
// This makes sure all targets link using the proper language.
- for(std::map<cmStdString, cmTarget*>::const_iterator
+ for(std::map<std::string, cmTarget*>::const_iterator
ti = this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti)
{
this->ForceLinkerLanguage(*ti->second);
@@ -1241,8 +1230,8 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget)
return;
}
- const char* llang = cmtarget.GetLinkerLanguage("NOCONFIG");
- if(!llang) { return; }
+ std::string llang = cmtarget.GetLinkerLanguage("NOCONFIG");
+ if(llang.empty()) { return; }
// If the language is compiled as a source trust Xcode to link with it.
cmTarget::LinkImplementation const* impl =
@@ -1270,7 +1259,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget)
}
if(cmSourceFile* sf = mf->GetOrCreateSource(fname.c_str()))
{
- sf->SetProperty("LANGUAGE", llang);
+ sf->SetProperty("LANGUAGE", llang.c_str());
cmtarget.AddSourceFile(sf);
}
}
@@ -1484,7 +1473,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
// collect multiple outputs of custom commands into a set
// which will be used for every configuration
- std::map<cmStdString, cmStdString> multipleOutputPairs;
+ std::map<std::string, std::string> multipleOutputPairs;
for(std::vector<cmCustomCommand>::const_iterator i = commands.begin();
i != commands.end(); ++i)
{
@@ -1554,9 +1543,9 @@ void cmGlobalXCodeGenerator
cmTarget& target,
std::vector<cmCustomCommand>
const & commands,
- const char* configName,
- const std::map<cmStdString,
- cmStdString>& multipleOutputPairs
+ const std::string& configName,
+ const std::map<std::string,
+ std::string>& multipleOutputPairs
)
{
std::string makefileName=makefileBasename;
@@ -1578,7 +1567,7 @@ void cmGlobalXCodeGenerator
// have all depend on all outputs
makefileStream << "all: ";
- std::map<const cmCustomCommand*, cmStdString> tname;
+ std::map<const cmCustomCommand*, std::string> tname;
int count = 0;
for(std::vector<cmCustomCommand>::const_iterator i = commands.begin();
i != commands.end(); ++i)
@@ -1676,7 +1665,7 @@ void cmGlobalXCodeGenerator
makefileStream <<
"\n# Dependencies of multiple outputs to their primary outputs \n";
- for(std::map<cmStdString, cmStdString>::const_iterator o =
+ for(std::map<std::string, std::string>::const_iterator o =
multipleOutputPairs.begin(); o != multipleOutputPairs.end(); ++o)
{
makefileStream << o->first << ": " << o->second << "\n";
@@ -1685,7 +1674,7 @@ void cmGlobalXCodeGenerator
makefileStream <<
"\n"
"cmake_check_multiple_outputs:\n";
- for(std::map<cmStdString, cmStdString>::const_iterator o =
+ for(std::map<std::string, std::string>::const_iterator o =
multipleOutputPairs.begin(); o != multipleOutputPairs.end(); ++o)
{
makefileStream << "\t@if [ ! -f "
@@ -1697,8 +1686,8 @@ void cmGlobalXCodeGenerator
//----------------------------------------------------------------------------
void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
- cmXCodeObject* buildSettings,
- const char* configName)
+ cmXCodeObject* buildSettings,
+ const std::string& configName)
{
if(target.GetType() == cmTarget::INTERFACE_LIBRARY)
{
@@ -1714,12 +1703,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
(target.GetType() == cmTarget::EXECUTABLE) ||
shared);
- const char* lang = target.GetLinkerLanguage(configName);
+ std::string lang = target.GetLinkerLanguage(configName);
std::string cflags;
- if(lang)
+ if(!lang.empty())
{
// for c++ projects get the c flags as well
- if(strcmp(lang, "CXX") == 0)
+ if(lang == "CXX")
{
this->CurrentLocalGenerator->AddLanguageFlags(cflags, "C", configName);
this->CurrentLocalGenerator->AddCMP0018Flags(cflags, &target,
@@ -1745,7 +1734,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
cmSystemTools::Error
("CMake can not determine linker language for target: ",
- target.GetName());
+ target.GetName().c_str());
return;
}
@@ -1811,7 +1800,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CurrentLocalGenerator->
AppendFlags(extraLinkOptions, targetLinkFlags);
}
- if(configName && *configName)
+ if(!configName.empty())
{
std::string linkFlagsVar = "LINK_FLAGS_";
linkFlagsVar += cmSystemTools::UpperCase(configName);
@@ -2095,7 +2084,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
std::vector<std::string> includes;
this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt,
"C", configName);
- std::set<cmStdString> emitted;
+ std::set<std::string> emitted;
emitted.insert("/System/Library/Frameworks");
for(std::vector<std::string>::iterator i = includes.begin();
i != includes.end(); ++i)
@@ -2178,7 +2167,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
const char* debugStr = "YES";
// We can't set the Xcode flag differently depending on the language,
// so put them back in this case.
- if( (lang && strcmp(lang, "CXX") == 0) && gflag != gflagc )
+ if( (lang == "CXX") && gflag != gflagc )
{
cflags += " ";
cflags += gflagc;
@@ -2201,7 +2190,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CreateString("NO"));
buildSettings->AddAttribute("GCC_INLINES_ARE_PRIVATE_EXTERN",
this->CreateString("NO"));
- if(lang && strcmp(lang, "CXX") == 0)
+ if(lang == "CXX")
{
flags += " ";
flags += defFlags;
@@ -2364,18 +2353,18 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
if(i->first.find("XCODE_ATTRIBUTE_") == 0)
{
- cmStdString attribute = i->first.substr(16);
+ std::string attribute = i->first.substr(16);
// Handle [variant=<config>] condition explicitly here.
- cmStdString::size_type beginVariant =
+ std::string::size_type beginVariant =
attribute.find("[variant=");
- if (beginVariant != cmStdString::npos)
+ if (beginVariant != std::string::npos)
{
- cmStdString::size_type endVariant =
+ std::string::size_type endVariant =
attribute.find("]", beginVariant+9);
- if (endVariant != cmStdString::npos)
+ if (endVariant != std::string::npos)
{
// Compare the variant to the configuration.
- cmStdString variant =
+ std::string variant =
attribute.substr(beginVariant+9, endVariant-beginVariant-9);
if (variant == configName)
{
@@ -2428,7 +2417,7 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
cmXCodeObject* target =
this->CreateObject(cmXCodeObject::PBXAggregateTarget);
- target->SetComment(cmtarget.GetName());
+ target->SetComment(cmtarget.GetName().c_str());
cmXCodeObject* buildPhases =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
std::vector<cmXCodeObject*> emptyContentVector;
@@ -2629,7 +2618,7 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
fileRef->AddAttribute("refType", this->CreateString("0"));
fileRef->AddAttribute("sourceTree",
this->CreateString("BUILT_PRODUCTS_DIR"));
- fileRef->SetComment(cmtarget.GetName());
+ fileRef->SetComment(cmtarget.GetName().c_str());
target->AddAttribute("productReference",
this->CreateObjectReference(fileRef));
if(const char* productType = this->GetTargetProductType(cmtarget))
@@ -2662,8 +2651,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::FindXCodeTarget(cmTarget const* t)
}
//----------------------------------------------------------------------------
-std::string cmGlobalXCodeGenerator::GetOrCreateId(const char* name,
- const char* id)
+std::string cmGlobalXCodeGenerator::GetOrCreateId(const std::string& name,
+ const std::string& id)
{
std::string guidStoreName = name;
guidStoreName += "_GUID_CMAKE";
@@ -2676,7 +2665,7 @@ std::string cmGlobalXCodeGenerator::GetOrCreateId(const char* name,
}
this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(),
- id, "Stored Xcode object GUID", cmCacheManager::INTERNAL);
+ id.c_str(), "Stored Xcode object GUID", cmCacheManager::INTERNAL);
return id;
}
@@ -2745,7 +2734,7 @@ void cmGlobalXCodeGenerator
::AppendBuildSettingAttribute(cmXCodeObject* target,
const char* attribute,
const char* value,
- const char* configName)
+ const std::string& configName)
{
if(this->XcodeVersion < 21)
{
@@ -2768,9 +2757,9 @@ void cmGlobalXCodeGenerator
for(std::vector<cmXCodeObject*>::iterator i = list.begin();
i != list.end(); ++i)
{
- if(configName)
+ if(!configName.empty())
{
- if(strcmp((*i)->GetObject("name")->GetString(), configName) == 0)
+ if((*i)->GetObject("name")->GetString() == configName)
{
cmXCodeObject* settings = (*i)->GetObject("buildSettings");
this->AppendOrAddBuildSetting(settings, attribute, value);
@@ -2976,7 +2965,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
mf->FindSourceGroup(source.c_str(), sourceGroups);
cmXCodeObject* pbxgroup =
this->CreateOrGetPBXGroup(cmtarget, sourceGroup);
- cmStdString key = GetGroupMapKey(cmtarget, sf);
+ std::string key = GetGroupMapKey(cmtarget, sf);
this->GroupMap[key] = pbxgroup;
}
@@ -2991,7 +2980,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
mf->FindSourceGroup(source.c_str(), sourceGroups);
cmXCodeObject* pbxgroup =
this->CreateOrGetPBXGroup(cmtarget, sourceGroup);
- cmStdString key = GetGroupMapKeyFromPath(cmtarget, source);
+ std::string key = GetGroupMapKeyFromPath(cmtarget, source);
this->GroupMap[key] = pbxgroup;
}
}
@@ -2999,7 +2988,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
}
cmXCodeObject *cmGlobalXCodeGenerator
-::CreatePBXGroup(cmXCodeObject *parent, cmStdString name)
+::CreatePBXGroup(cmXCodeObject *parent, std::string name)
{
cmXCodeObject* parentChildren = NULL;
if(parent)
@@ -3023,8 +3012,8 @@ cmXCodeObject *cmGlobalXCodeGenerator
cmXCodeObject* cmGlobalXCodeGenerator
::CreateOrGetPBXGroup(cmTarget& cmtarget, cmSourceGroup* sg)
{
- cmStdString s;
- cmStdString target;
+ std::string s;
+ std::string target;
const char *targetFolder= cmtarget.GetProperty("FOLDER");
if(targetFolder) {
target = targetFolder;
@@ -3033,7 +3022,7 @@ cmXCodeObject* cmGlobalXCodeGenerator
target += cmtarget.GetName();
s = target + "/";
s += sg->GetFullName();
- std::map<cmStdString, cmXCodeObject* >::iterator it =
+ std::map<std::string, cmXCodeObject* >::iterator it =
this->GroupNameMap.find(s);
if(it != this->GroupNameMap.end())
{
@@ -3050,7 +3039,7 @@ cmXCodeObject* cmGlobalXCodeGenerator
{
std::vector<std::string> tgt_folders =
cmSystemTools::tokenize(target, "/");
- cmStdString curr_tgt_folder;
+ std::string curr_tgt_folder;
for(std::vector<std::string>::size_type i = 0; i < tgt_folders.size();i++)
{
if (i != 0)
@@ -3077,7 +3066,7 @@ cmXCodeObject* cmGlobalXCodeGenerator
// If it's the default source group (empty name) then put the source file
// directly in the tgroup...
//
- if (cmStdString(sg->GetFullName()) == "")
+ if (std::string(sg->GetFullName()) == "")
{
this->GroupNameMap[s] = tgroup;
return tgroup;
@@ -3088,12 +3077,12 @@ cmXCodeObject* cmGlobalXCodeGenerator
{
std::vector<std::string> folders =
cmSystemTools::tokenize(sg->GetFullName(), "\\");
- cmStdString curr_folder = target;
+ std::string curr_folder = target;
curr_folder += "/";
for(std::vector<std::string>::size_type i = 0; i < folders.size();i++)
{
curr_folder += folders[i];
- std::map<cmStdString, cmXCodeObject* >::iterator i_folder =
+ std::map<std::string, cmXCodeObject* >::iterator i_folder =
this->GroupNameMap.find(curr_folder);
//Create new folder
if(i_folder == this->GroupNameMap.end())
@@ -3473,14 +3462,14 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
makefileStream
<< "# For each target create a dummy rule "
"so the target does not have to exist\n";
- std::set<cmStdString> emitted;
+ std::set<std::string> emitted;
for(std::vector<cmXCodeObject*>::iterator i = targets.begin();
i != targets.end(); ++i)
{
cmXCodeObject* target = *i;
- std::map<cmStdString, cmXCodeObject::StringVec> const& deplibs =
+ std::map<std::string, cmXCodeObject::StringVec> const& deplibs =
target->GetDependLibraries();
- for(std::map<cmStdString, cmXCodeObject::StringVec>::const_iterator ci
+ for(std::map<std::string, cmXCodeObject::StringVec>::const_iterator ci
= deplibs.begin(); ci != deplibs.end(); ++ci)
{
for(cmXCodeObject::StringVec::const_iterator d = ci->second.begin();
@@ -3536,12 +3525,12 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
std::string trel = this->ConvertToRelativeForMake(tfull.c_str());
// Add this target to the post-build phases of its dependencies.
- std::map<cmStdString, cmXCodeObject::StringVec>::const_iterator
+ std::map<std::string, cmXCodeObject::StringVec>::const_iterator
y = target->GetDependTargets().find(*ct);
if(y != target->GetDependTargets().end())
{
- std::vector<cmStdString> const& deptgts = y->second;
- for(std::vector<cmStdString>::const_iterator d = deptgts.begin();
+ std::vector<std::string> const& deptgts = y->second;
+ for(std::vector<std::string>::const_iterator d = deptgts.begin();
d != deptgts.end(); ++d)
{
makefileStream << this->PostBuildMakeTarget(*d, *ct) << ": "
@@ -3553,12 +3542,12 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
makefileStream << trel << ":";
// List dependencies if any exist.
- std::map<cmStdString, cmXCodeObject::StringVec>::const_iterator
+ std::map<std::string, cmXCodeObject::StringVec>::const_iterator
x = target->GetDependLibraries().find(*ct);
if(x != target->GetDependLibraries().end())
{
- std::vector<cmStdString> const& deplibs = x->second;
- for(std::vector<cmStdString>::const_iterator d = deplibs.begin();
+ std::vector<std::string> const& deplibs = x->second;
+ for(std::vector<std::string>::const_iterator d = deplibs.begin();
d != deplibs.end(); ++d)
{
makefileStream << "\\\n\t" <<
@@ -3783,14 +3772,14 @@ std::string cmGlobalXCodeGenerator::XCodeEscapePath(const char* p)
//----------------------------------------------------------------------------
void
cmGlobalXCodeGenerator
-::AppendDirectoryForConfig(const char* prefix,
- const char* config,
- const char* suffix,
+::AppendDirectoryForConfig(const std::string& prefix,
+ const std::string& config,
+ const std::string& suffix,
std::string& dir)
{
if(this->XcodeVersion > 20)
{
- if(config)
+ if(!config.empty())
{
dir += prefix;
dir += config;
@@ -3800,12 +3789,13 @@ cmGlobalXCodeGenerator
}
//----------------------------------------------------------------------------
-std::string cmGlobalXCodeGenerator::LookupFlags(const char* varNamePrefix,
- const char* varNameLang,
- const char* varNameSuffix,
- const char* default_flags)
+std::string cmGlobalXCodeGenerator::LookupFlags(
+ const std::string& varNamePrefix,
+ const std::string& varNameLang,
+ const std::string& varNameSuffix,
+ const std::string& default_flags)
{
- if(varNameLang)
+ if(!varNameLang.empty())
{
std::string varName = varNamePrefix;
varName += varNameLang;
@@ -3966,7 +3956,7 @@ cmGlobalXCodeGenerator
// names since Xcode names them uniquely automatically with a numeric suffix
// to avoid exact duplicate file names. Note that Mac file names are not
// typically case sensitive, hence the LowerCase.
- std::map<cmStdString, int> counts;
+ std::map<std::string, int> counts;
std::vector<cmSourceFile*> objectSources;
gt->GetObjectSources(objectSources);
for(std::vector<cmSourceFile*>::const_iterator
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index c9d20c2..93315ba 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -33,9 +33,9 @@ public:
static cmGlobalGeneratorFactory* NewFactory();
///! Get the name for the generator.
- virtual const char* GetName() const {
+ virtual std::string GetName() const {
return cmGlobalXCodeGenerator::GetActualName();}
- static const char* GetActualName() {return "Xcode";}
+ static std::string GetActualName() {return "Xcode";}
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
@@ -55,11 +55,11 @@ public:
*/
virtual void GenerateBuildCommand(
std::vector<std::string>& makeCommand,
- const char* makeProgram,
- const char* projectName,
- const char* projectDir,
- const char* targetName,
- const char* config,
+ const std::string& makeProgram,
+ const std::string& projectName,
+ const std::string& projectDir,
+ const std::string& targetName,
+ const std::string& config,
bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
@@ -72,9 +72,9 @@ public:
virtual void Generate();
/** Append the subdirectory for the given configuration. */
- virtual void AppendDirectoryForConfig(const char* prefix,
- const char* config,
- const char* suffix,
+ virtual void AppendDirectoryForConfig(const std::string& prefix,
+ const std::string& config,
+ const std::string& suffix,
std::string& dir);
///! What is the configurations directory variable called?
@@ -95,7 +95,7 @@ private:
cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget,
cmSourceGroup* sg);
cmXCodeObject* CreatePBXGroup(cmXCodeObject *parent,
- cmStdString name);
+ std::string name);
void CreateGroups(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>&
generators);
@@ -123,19 +123,19 @@ private:
void CreateCustomRulesMakefile(const char* makefileBasename,
cmTarget& target,
std::vector<cmCustomCommand> const & commands,
- const char* configName,
- const std::map<cmStdString, cmStdString>&
+ const std::string& configName,
+ const std::map<std::string, std::string>&
multipleOutputPairs
);
cmXCodeObject* FindXCodeTarget(cmTarget const*);
- std::string GetOrCreateId(const char* name, const char* id);
+ std::string GetOrCreateId(const std::string& name, const std::string& id);
// create cmXCodeObject from these functions so that memory can be managed
// correctly. All objects created are stored in this->XCodeObjects.
cmXCodeObject* CreateObject(cmXCodeObject::PBXType ptype);
cmXCodeObject* CreateObject(cmXCodeObject::Type type);
- cmXCodeObject* CreateString(const char* s);
+ cmXCodeObject* CreateString(const std::string& s);
cmXCodeObject* CreateObjectReference(cmXCodeObject*);
cmXCodeObject* CreateXCodeTarget(cmTarget& target,
cmXCodeObject* buildPhases);
@@ -147,12 +147,13 @@ private:
void AppendOrAddBuildSetting(cmXCodeObject* settings, const char* attr,
const char* value);
void AppendBuildSettingAttribute(cmXCodeObject* target, const char* attr,
- const char* value, const char* configName);
+ const char* value,
+ const std::string& configName);
cmXCodeObject* CreateUtilityTarget(cmTarget& target);
void AddDependAndLinkInformation(cmXCodeObject* target);
void CreateBuildSettings(cmTarget& target,
cmXCodeObject* buildSettings,
- const char* buildType);
+ const std::string& buildType);
std::string ExtractFlag(const char* flag, std::string& flags);
// delete all objects in the this->XCodeObjects vector.
void ClearXCodeObjects();
@@ -190,10 +191,10 @@ private:
void CreateReRunCMakeFile(cmLocalGenerator* root,
std::vector<cmLocalGenerator*> const& gens);
- std::string LookupFlags(const char* varNamePrefix,
- const char* varNameLang,
- const char* varNameSuffix,
- const char* default_flags);
+ std::string LookupFlags(const std::string& varNamePrefix,
+ const std::string& varNameLang,
+ const std::string& varNameSuffix,
+ const std::string& default_flags);
class Factory;
class BuildObjectListOrString;
@@ -211,11 +212,12 @@ protected:
unsigned int XcodeVersion;
std::string VersionString;
- std::set<cmStdString> XCodeObjectIDs;
+ std::set<std::string> XCodeObjectIDs;
std::vector<cmXCodeObject*> XCodeObjects;
cmXCodeObject* RootObject;
private:
- void PrintCompilerAdvice(std::ostream&, std::string, const char*) const {}
+ void PrintCompilerAdvice(std::ostream&, std::string const&,
+ const char*) const {}
void ComputeTargetObjects(cmGeneratorTarget* gt) const;
std::string GetObjectsNormalDirectory(
@@ -235,14 +237,14 @@ private:
std::string CurrentReRunCMakeMakefile;
std::string CurrentXCodeHackMakefile;
std::string CurrentProject;
- std::set<cmStdString> TargetDoneSet;
+ std::set<std::string> TargetDoneSet;
std::vector<std::string> CurrentOutputDirectoryComponents;
std::vector<std::string> ProjectSourceDirectoryComponents;
std::vector<std::string> ProjectOutputDirectoryComponents;
- std::map<cmStdString, cmXCodeObject* > GroupMap;
- std::map<cmStdString, cmXCodeObject* > GroupNameMap;
- std::map<cmStdString, cmXCodeObject* > TargetGroup;
- std::map<cmStdString, cmXCodeObject* > FileRefs;
+ std::map<std::string, cmXCodeObject* > GroupMap;
+ std::map<std::string, cmXCodeObject* > GroupNameMap;
+ std::map<std::string, cmXCodeObject* > TargetGroup;
+ std::map<std::string, cmXCodeObject* > FileRefs;
std::vector<std::string> Architectures;
std::string PlatformToolset;
};
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index db964a9..22cba89 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -121,7 +121,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
__set_bool_if_set(this->GeneratePerTarget, "GRAPHVIZ_GENERATE_PER_TARGET");
__set_bool_if_set(this->GenerateDependers, "GRAPHVIZ_GENERATE_DEPENDERS");
- cmStdString ignoreTargetsRegexes;
+ std::string ignoreTargetsRegexes;
__set_if_set(ignoreTargetsRegexes, "GRAPHVIZ_IGNORE_TARGETS");
this->TargetsToIgnoreRegex.clear();
@@ -135,7 +135,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
itvIt != ignoreTargetsRegExVector.end();
++ itvIt )
{
- cmStdString currentRegexString(*itvIt);
+ std::string currentRegexString(*itvIt);
cmsys::RegularExpression currentRegex;
if (!currentRegex.compile(currentRegexString.c_str()))
{
@@ -160,7 +160,7 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName)
this->CollectTargetsAndLibs();
- for(std::map<cmStdString, const cmTarget*>::const_iterator ptrIt =
+ for(std::map<std::string, const cmTarget*>::const_iterator ptrIt =
this->TargetPtrs.begin();
ptrIt != this->TargetPtrs.end();
++ptrIt)
@@ -211,7 +211,7 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName)
this->CollectTargetsAndLibs();
- for(std::map<cmStdString, const cmTarget*>::const_iterator ptrIt =
+ for(std::map<std::string, const cmTarget*>::const_iterator ptrIt =
this->TargetPtrs.begin();
ptrIt != this->TargetPtrs.end();
++ptrIt)
@@ -265,7 +265,7 @@ void cmGraphVizWriter::WriteGlobalFile(const char* fileName)
std::set<std::string> insertedConnections;
std::set<std::string> insertedNodes;
- for(std::map<cmStdString, const cmTarget*>::const_iterator ptrIt =
+ for(std::map<std::string, const cmTarget*>::const_iterator ptrIt =
this->TargetPtrs.begin();
ptrIt != this->TargetPtrs.end();
++ptrIt)
@@ -300,12 +300,12 @@ void cmGraphVizWriter::WriteFooter(cmGeneratedFileStream& str) const
}
-void cmGraphVizWriter::WriteConnections(const char* targetName,
+void cmGraphVizWriter::WriteConnections(const std::string& targetName,
std::set<std::string>& insertedNodes,
std::set<std::string>& insertedConnections,
cmGeneratedFileStream& str) const
{
- std::map<cmStdString, const cmTarget* >::const_iterator targetPtrIt =
+ std::map<std::string, const cmTarget* >::const_iterator targetPtrIt =
this->TargetPtrs.find(targetName);
if (targetPtrIt == this->TargetPtrs.end()) // not found at all
@@ -331,7 +331,7 @@ void cmGraphVizWriter::WriteConnections(const char* targetName,
++ llit )
{
const char* libName = llit->first.c_str();
- std::map<cmStdString, cmStdString>::const_iterator libNameIt =
+ std::map<std::string, std::string>::const_iterator libNameIt =
this->TargetNamesNodes.find(libName);
// can happen e.g. if GRAPHVIZ_TARGET_IGNORE_REGEX is used
@@ -359,12 +359,12 @@ void cmGraphVizWriter::WriteConnections(const char* targetName,
}
-void cmGraphVizWriter::WriteDependerConnections(const char* targetName,
+void cmGraphVizWriter::WriteDependerConnections(const std::string& targetName,
std::set<std::string>& insertedNodes,
std::set<std::string>& insertedConnections,
cmGeneratedFileStream& str) const
{
- std::map<cmStdString, const cmTarget* >::const_iterator targetPtrIt =
+ std::map<std::string, const cmTarget* >::const_iterator targetPtrIt =
this->TargetPtrs.find(targetName);
if (targetPtrIt == this->TargetPtrs.end()) // not found at all
@@ -383,7 +383,7 @@ void cmGraphVizWriter::WriteDependerConnections(const char* targetName,
std::string myNodeName = this->TargetNamesNodes.find(targetName)->second;
// now search who links against me
- for(std::map<cmStdString, const cmTarget*>::const_iterator dependerIt =
+ for(std::map<std::string, const cmTarget*>::const_iterator dependerIt =
this->TargetPtrs.begin();
dependerIt != this->TargetPtrs.end();
++dependerIt)
@@ -411,7 +411,7 @@ void cmGraphVizWriter::WriteDependerConnections(const char* targetName,
if (libName == targetName)
{
// So this target links against targetName.
- std::map<cmStdString, cmStdString>::const_iterator dependerNodeNameIt =
+ std::map<std::string, std::string>::const_iterator dependerNodeNameIt =
this->TargetNamesNodes.find(dependerIt->first);
if(dependerNodeNameIt != this->TargetNamesNodes.end())
@@ -444,7 +444,7 @@ void cmGraphVizWriter::WriteDependerConnections(const char* targetName,
}
-void cmGraphVizWriter::WriteNode(const char* targetName,
+void cmGraphVizWriter::WriteNode(const std::string& targetName,
const cmTarget* target,
std::set<std::string>& insertedNodes,
cmGeneratedFileStream& str) const
@@ -452,7 +452,7 @@ void cmGraphVizWriter::WriteNode(const char* targetName,
if (insertedNodes.find(targetName) == insertedNodes.end())
{
insertedNodes.insert(targetName);
- std::map<cmStdString, cmStdString>::const_iterator nameIt =
+ std::map<std::string, std::string>::const_iterator nameIt =
this->TargetNamesNodes.find(targetName);
str << " \"" << nameIt->second.c_str() << "\" [ label=\""
@@ -540,7 +540,7 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt)
continue;
}
- std::map<cmStdString, const cmTarget*>::const_iterator tarIt =
+ std::map<std::string, const cmTarget*>::const_iterator tarIt =
this->TargetPtrs.find(libName);
if ( tarIt == this->TargetPtrs.end() )
{
@@ -558,7 +558,7 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt)
}
-bool cmGraphVizWriter::IgnoreThisTarget(const char* name)
+bool cmGraphVizWriter::IgnoreThisTarget(const std::string& name)
{
for(std::vector<cmsys::RegularExpression>::iterator itvIt
= this->TargetsToIgnoreRegex.begin();
diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h
index 17b97f8..a7acd0e 100644
--- a/Source/cmGraphVizWriter.h
+++ b/Source/cmGraphVizWriter.h
@@ -44,30 +44,30 @@ protected:
void WriteHeader(cmGeneratedFileStream& str) const;
- void WriteConnections(const char* targetName,
+ void WriteConnections(const std::string& targetName,
std::set<std::string>& insertedNodes,
std::set<std::string>& insertedConnections,
cmGeneratedFileStream& str) const;
- void WriteDependerConnections(const char* targetName,
+ void WriteDependerConnections(const std::string& targetName,
std::set<std::string>& insertedNodes,
std::set<std::string>& insertedConnections,
cmGeneratedFileStream& str) const;
- void WriteNode(const char* targetName, const cmTarget* target,
+ void WriteNode(const std::string& targetName, const cmTarget* target,
std::set<std::string>& insertedNodes,
cmGeneratedFileStream& str) const;
void WriteFooter(cmGeneratedFileStream& str) const;
- bool IgnoreThisTarget(const char* name);
+ bool IgnoreThisTarget(const std::string& name);
bool GenerateForTargetType(cmTarget::TargetType targetType) const;
- cmStdString GraphType;
- cmStdString GraphName;
- cmStdString GraphHeader;
- cmStdString GraphNodePrefix;
+ std::string GraphType;
+ std::string GraphName;
+ std::string GraphHeader;
+ std::string GraphNodePrefix;
bool GenerateForExecutables;
bool GenerateForStaticLibs;
@@ -81,9 +81,9 @@ protected:
const std::vector<cmLocalGenerator*>& LocalGenerators;
- std::map<cmStdString, const cmTarget*> TargetPtrs;
+ std::map<std::string, const cmTarget*> TargetPtrs;
// maps from the actual target names to node names in dot:
- std::map<cmStdString, cmStdString> TargetNamesNodes;
+ std::map<std::string, std::string> TargetNamesNodes;
bool HaveTargetsAndLibs;
};
diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx
index 34a9c7c..e03223f 100644
--- a/Source/cmIDEOptions.cxx
+++ b/Source/cmIDEOptions.cxx
@@ -108,7 +108,7 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table,
{
const char *new_value = flag+1+n;
- std::map<cmStdString,cmStdString>::iterator itr;
+ std::map<std::string,std::string>::iterator itr;
itr = this->FlagMap.find(entry->IDEName);
if(itr != this->FlagMap.end())
{
@@ -186,7 +186,7 @@ void cmIDEOptions::RemoveFlag(const char* flag)
//----------------------------------------------------------------------------
const char* cmIDEOptions::GetFlag(const char* flag)
{
- std::map<cmStdString, cmStdString>::iterator i = this->FlagMap.find(flag);
+ std::map<std::string, std::string>::iterator i = this->FlagMap.find(flag);
if(i != this->FlagMap.end())
{
return i->second.c_str();
diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h
index e78af3e..691893f 100644
--- a/Source/cmIDEOptions.h
+++ b/Source/cmIDEOptions.h
@@ -40,13 +40,13 @@ protected:
// Then parse the command line flags specified in CMAKE_CXX_FLAGS
// and CMAKE_C_FLAGS
// and overwrite or add new values to this map
- std::map<cmStdString, cmStdString> FlagMap;
+ std::map<std::string, std::string> FlagMap;
// Preprocessor definitions.
std::vector<std::string> Defines;
// Unrecognized flags that get no special handling.
- cmStdString FlagString;
+ std::string FlagString;
bool DoingDefine;
bool AllowDefine;
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index ee95c05..bd12327 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -593,7 +593,7 @@ namespace
if (argP1 != newArgs.end() && argP2 != newArgs.end() &&
*(argP1) == "MATCHES")
{
- def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile);
+ def = cmIfCommand::GetVariableOrString(*arg, makefile);
const char* rex = (argP2)->c_str();
cmStringCommand::ClearMatches(makefile);
cmsys::RegularExpression regEntry;
@@ -634,8 +634,8 @@ namespace
(*(argP1) == "LESS" || *(argP1) == "GREATER" ||
*(argP1) == "EQUAL"))
{
- def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile);
- def2 = cmIfCommand::GetVariableOrString((argP2)->c_str(), makefile);
+ def = cmIfCommand::GetVariableOrString(*arg, makefile);
+ def2 = cmIfCommand::GetVariableOrString(*argP2, makefile);
double lhs;
double rhs;
bool result;
@@ -665,8 +665,8 @@ namespace
*(argP1) == "STREQUAL" ||
*(argP1) == "STRGREATER"))
{
- def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile);
- def2 = cmIfCommand::GetVariableOrString((argP2)->c_str(), makefile);
+ def = cmIfCommand::GetVariableOrString(*arg, makefile);
+ def2 = cmIfCommand::GetVariableOrString(*argP2, makefile);
int val = strcmp(def,def2);
bool result;
if (*(argP1) == "STRLESS")
@@ -689,8 +689,8 @@ namespace
(*(argP1) == "VERSION_LESS" || *(argP1) == "VERSION_GREATER" ||
*(argP1) == "VERSION_EQUAL"))
{
- def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile);
- def2 = cmIfCommand::GetVariableOrString((argP2)->c_str(), makefile);
+ def = cmIfCommand::GetVariableOrString(*arg, makefile);
+ def2 = cmIfCommand::GetVariableOrString(*argP2, makefile);
cmSystemTools::CompareOp op = cmSystemTools::OP_EQUAL;
if(*argP1 == "VERSION_LESS")
{
@@ -907,13 +907,13 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args,
}
//=========================================================================
-const char* cmIfCommand::GetVariableOrString(const char* str,
+const char* cmIfCommand::GetVariableOrString(const std::string& str,
const cmMakefile* mf)
{
const char* def = mf->GetDefinition(str);
if(!def)
{
- def = str;
+ def = str.c_str();
}
return def;
}
diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h
index f2633ad..b9de845 100644
--- a/Source/cmIfCommand.h
+++ b/Source/cmIfCommand.h
@@ -63,7 +63,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "if";}
+ virtual std::string GetName() const { return "if";}
/**
* This determines if the command is invoked when in script mode.
@@ -79,7 +79,7 @@ public:
// Get a definition from the makefile. If it doesn't exist,
// return the original string.
- static const char* GetVariableOrString(const char* str,
+ static const char* GetVariableOrString(const std::string& str,
const cmMakefile* mf);
cmTypeMacro(cmIfCommand, cmCommand);
diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h
index 267723d..0dcd7de 100644
--- a/Source/cmIncludeCommand.h
+++ b/Source/cmIncludeCommand.h
@@ -46,7 +46,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "include";}
+ virtual std::string GetName() const {return "include";}
cmTypeMacro(cmIncludeCommand, cmCommand);
};
diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx
index e20fe02..df5508e 100644
--- a/Source/cmIncludeDirectoryCommand.cxx
+++ b/Source/cmIncludeDirectoryCommand.cxx
@@ -38,7 +38,7 @@ bool cmIncludeDirectoryCommand
std::vector<std::string> beforeIncludes;
std::vector<std::string> afterIncludes;
- std::set<cmStdString> systemIncludes;
+ std::set<std::string> systemIncludes;
for(; i != args.end(); ++i)
{
diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h
index c621dcb..6cc2c83 100644
--- a/Source/cmIncludeDirectoryCommand.h
+++ b/Source/cmIncludeDirectoryCommand.h
@@ -41,7 +41,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "include_directories";}
+ virtual std::string GetName() const { return "include_directories";}
cmTypeMacro(cmIncludeDirectoryCommand, cmCommand);
diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h
index 8ca674f..081f77a 100644
--- a/Source/cmIncludeExternalMSProjectCommand.h
+++ b/Source/cmIncludeExternalMSProjectCommand.h
@@ -42,7 +42,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "include_external_msproject";}
+ virtual std::string GetName() const {return "include_external_msproject";}
cmTypeMacro(cmIncludeExternalMSProjectCommand, cmCommand);
};
diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h
index 0c5fa6f..c58f018 100644
--- a/Source/cmIncludeRegularExpressionCommand.h
+++ b/Source/cmIncludeRegularExpressionCommand.h
@@ -41,7 +41,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "include_regular_expression";}
+ virtual std::string GetName() const {return "include_regular_expression";}
cmTypeMacro(cmIncludeRegularExpressionCommand, cmCommand);
};
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 0878aae..94d2091 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -97,7 +97,7 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args,
}
// Unknown mode.
- cmStdString e = "called with unknown mode ";
+ std::string e = "called with unknown mode ";
e += args[0];
this->SetError(e.c_str());
return false;
diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h
index 9db2490..8e14a08 100644
--- a/Source/cmInstallCommand.h
+++ b/Source/cmInstallCommand.h
@@ -41,7 +41,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "install";}
+ virtual std::string GetName() const { return "install";}
cmTypeMacro(cmInstallCommand, cmCommand);
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 1287ea6..d2737a1 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -142,7 +142,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os)
this->EFGen->SetExportOld(this->ExportOld);
if(this->ConfigurationTypes->empty())
{
- if(this->ConfigurationName && *this->ConfigurationName)
+ if(!this->ConfigurationName.empty())
{
this->EFGen->AddConfiguration(this->ConfigurationName);
}
@@ -177,7 +177,7 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os,
// Now create a configuration-specific install rule for the import
// file of each configuration.
std::vector<std::string> files;
- for(std::map<cmStdString, cmStdString>::const_iterator
+ for(std::map<std::string, std::string>::const_iterator
i = this->EFGen->GetConfigImportFiles().begin();
i != this->EFGen->GetConfigImportFiles().end(); ++i)
{
diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h
index 5583fe4..4551ab1 100644
--- a/Source/cmInstallFilesCommand.h
+++ b/Source/cmInstallFilesCommand.h
@@ -41,7 +41,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "install_files";}
+ virtual std::string GetName() const { return "install_files";}
/**
* This is called at the end after all the information
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index ec15044..6594218 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -80,8 +80,8 @@ void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os,
//----------------------------------------------------------------------------
void cmInstallFilesGenerator::GenerateScriptForConfig(std::ostream& os,
- const char* config,
- Indent const& indent)
+ const std::string& config,
+ Indent const& indent)
{
std::vector<std::string> files;
cmListFileBacktrace lfbt;
diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h
index 9dea296..23bf935 100644
--- a/Source/cmInstallFilesGenerator.h
+++ b/Source/cmInstallFilesGenerator.h
@@ -35,7 +35,7 @@ public:
protected:
virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
virtual void GenerateScriptForConfig(std::ostream& os,
- const char* config,
+ const std::string& config,
Indent const& indent);
void AddFilesInstallRule(std::ostream& os, Indent const& indent,
std::vector<std::string> const& files);
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index d105a0c..0fad9d6 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -163,7 +163,7 @@ void cmInstallGenerator::GenerateScript(std::ostream& os)
}
//----------------------------------------------------------------------------
-bool cmInstallGenerator::InstallsForConfig(const char* config)
+bool cmInstallGenerator::InstallsForConfig(const std::string& config)
{
return this->GeneratesForConfig(config);
}
diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h
index c89ab8a..c72e9e9 100644
--- a/Source/cmInstallGenerator.h
+++ b/Source/cmInstallGenerator.h
@@ -48,7 +48,7 @@ public:
std::string GetInstallDestination() const;
/** Test if this generator installs something for a given configuration. */
- bool InstallsForConfig(const char*);
+ bool InstallsForConfig(const std::string& config);
protected:
virtual void GenerateScript(std::ostream& os);
diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h
index 95acfa2..90c7ba3 100644
--- a/Source/cmInstallProgramsCommand.h
+++ b/Source/cmInstallProgramsCommand.h
@@ -41,7 +41,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "install_programs";}
+ virtual std::string GetName() const { return "install_programs";}
/**
* This is called at the end after all the information
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 7a39f45..ec2b518 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -59,8 +59,8 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
//----------------------------------------------------------------------------
void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
- const char* config,
- Indent const& indent)
+ const std::string& config,
+ Indent const& indent)
{
// Compute the build tree directory from which to copy the target.
std::string fromDirConfig;
@@ -319,7 +319,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
//----------------------------------------------------------------------------
std::string
-cmInstallTargetGenerator::GetInstallFilename(const char* config) const
+cmInstallTargetGenerator::GetInstallFilename(const std::string& config) const
{
NameType nameType = this->ImportLibrary? NameImplib : NameNormal;
return
@@ -330,7 +330,7 @@ cmInstallTargetGenerator::GetInstallFilename(const char* config) const
//----------------------------------------------------------------------------
std::string
cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target,
- const char* config,
+ const std::string& config,
NameType nameType)
{
std::string fname;
@@ -405,7 +405,7 @@ cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target,
//----------------------------------------------------------------------------
void
cmInstallTargetGenerator
-::AddTweak(std::ostream& os, Indent const& indent, const char* config,
+::AddTweak(std::ostream& os, Indent const& indent, const std::string& config,
std::string const& file, TweakMethod tweak)
{
cmOStringStream tw;
@@ -423,7 +423,7 @@ cmInstallTargetGenerator
//----------------------------------------------------------------------------
void
cmInstallTargetGenerator
-::AddTweak(std::ostream& os, Indent const& indent, const char* config,
+::AddTweak(std::ostream& os, Indent const& indent, const std::string& config,
std::vector<std::string> const& files, TweakMethod tweak)
{
if(files.size() == 1)
@@ -470,7 +470,7 @@ std::string cmInstallTargetGenerator::GetDestDirPath(std::string const& file)
//----------------------------------------------------------------------------
void cmInstallTargetGenerator::PreReplacementTweaks(std::ostream& os,
Indent const& indent,
- const char* config,
+ const std::string& config,
std::string const& file)
{
this->AddRPathCheckRule(os, indent, config, file);
@@ -478,9 +478,9 @@ void cmInstallTargetGenerator::PreReplacementTweaks(std::ostream& os,
//----------------------------------------------------------------------------
void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os,
- Indent const& indent,
- const char* config,
- std::string const& file)
+ Indent const& indent,
+ const std::string& config,
+ std::string const& file)
{
this->AddInstallNamePatchRule(os, indent, config, file);
this->AddChrpathPatchRule(os, indent, config, file);
@@ -492,7 +492,8 @@ void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os,
void
cmInstallTargetGenerator
::AddInstallNamePatchRule(std::ostream& os, Indent const& indent,
- const char* config, std::string const& toDestDirPath)
+ const std::string& config,
+ std::string const& toDestDirPath)
{
if(this->ImportLibrary ||
!(this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
@@ -513,7 +514,7 @@ cmInstallTargetGenerator
// Build a map of build-tree install_name to install-tree install_name for
// shared libraries linked to this target.
- std::map<cmStdString, cmStdString> install_name_remap;
+ std::map<std::string, std::string> install_name_remap;
if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config))
{
std::set<cmTarget const*> const& sharedLibs
@@ -590,7 +591,7 @@ cmInstallTargetGenerator
{
os << "\n" << indent << " -id \"" << new_id << "\"";
}
- for(std::map<cmStdString, cmStdString>::const_iterator
+ for(std::map<std::string, std::string>::const_iterator
i = install_name_remap.begin();
i != install_name_remap.end(); ++i)
{
@@ -605,7 +606,8 @@ cmInstallTargetGenerator
void
cmInstallTargetGenerator
::AddRPathCheckRule(std::ostream& os, Indent const& indent,
- const char* config, std::string const& toDestDirPath)
+ const std::string& config,
+ std::string const& toDestDirPath)
{
// Skip the chrpath if the target does not need it.
if(this->ImportLibrary || !this->Target->IsChrpathUsed(config))
@@ -642,7 +644,8 @@ cmInstallTargetGenerator
void
cmInstallTargetGenerator
::AddChrpathPatchRule(std::ostream& os, Indent const& indent,
- const char* config, std::string const& toDestDirPath)
+ const std::string& config,
+ std::string const& toDestDirPath)
{
// Skip the chrpath if the target does not need it.
if(this->ImportLibrary || !this->Target->IsChrpathUsed(config))
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index 18c3957..0f21da7 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/Source/cmInstallTargetGenerator.h
@@ -43,7 +43,7 @@ public:
void SetNamelinkMode(NamelinkModeType mode) { this->NamelinkMode = mode; }
NamelinkModeType GetNamelinkMode() const { return this->NamelinkMode; }
- std::string GetInstallFilename(const char* config) const;
+ std::string GetInstallFilename(const std::string& config) const;
enum NameType
{
@@ -54,7 +54,7 @@ public:
};
static std::string GetInstallFilename(cmTarget const* target,
- const char* config,
+ const std::string& config,
NameType nameType = NameNormal);
cmTarget* GetTarget() const { return this->Target; }
@@ -63,30 +63,33 @@ public:
protected:
virtual void GenerateScript(std::ostream& os);
virtual void GenerateScriptForConfig(std::ostream& os,
- const char* config,
+ const std::string& config,
Indent const& indent);
typedef void (cmInstallTargetGenerator::*TweakMethod)(
- std::ostream&, Indent const&, const char*, std::string const&
+ std::ostream&, Indent const&, const std::string&, std::string const&
);
void AddTweak(std::ostream& os, Indent const& indent,
- const char* config, std::string const& file,
+ const std::string& config, std::string const& file,
TweakMethod tweak);
void AddTweak(std::ostream& os, Indent const& indent,
- const char* config, std::vector<std::string> const& files,
+ const std::string& config,
+ std::vector<std::string> const& files,
TweakMethod tweak);
std::string GetDestDirPath(std::string const& file);
void PreReplacementTweaks(std::ostream& os, Indent const& indent,
- const char* config, std::string const& file);
+ const std::string& config,
+ std::string const& file);
void PostReplacementTweaks(std::ostream& os, Indent const& indent,
- const char* config, std::string const& file);
+ const std::string& config,
+ std::string const& file);
void AddInstallNamePatchRule(std::ostream& os, Indent const& indent,
- const char* config,
+ const std::string& config,
const std::string& toDestDirPath);
void AddChrpathPatchRule(std::ostream& os, Indent const& indent,
- const char* config,
+ const std::string& config,
std::string const& toDestDirPath);
void AddRPathCheckRule(std::ostream& os, Indent const& indent,
- const char* config,
+ const std::string& config,
std::string const& toDestDirPath);
void AddStripRule(std::ostream& os, Indent const& indent,
diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h
index 2aa34db..e6cbe6e 100644
--- a/Source/cmInstallTargetsCommand.h
+++ b/Source/cmInstallTargetsCommand.h
@@ -42,7 +42,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "install_targets";}
+ virtual std::string GetName() const { return "install_targets";}
/** This command is kept for compatibility with older CMake versions. */
virtual bool IsDiscouraged() const
diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h
index c6eb40c..8e04baf 100644
--- a/Source/cmLinkDirectoriesCommand.h
+++ b/Source/cmLinkDirectoriesCommand.h
@@ -43,7 +43,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "link_directories";}
+ virtual std::string GetName() const { return "link_directories";}
cmTypeMacro(cmLinkDirectoriesCommand, cmCommand);
private:
diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h
index 74de23c..c572439 100644
--- a/Source/cmLinkLibrariesCommand.h
+++ b/Source/cmLinkLibrariesCommand.h
@@ -42,7 +42,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "link_libraries";}
+ virtual std::string GetName() const { return "link_libraries";}
/** This command is kept for compatibility with older CMake versions. */
virtual bool IsDiscouraged() const
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index df64695..20e760a 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -74,12 +74,9 @@ bool cmListCommand
}
//----------------------------------------------------------------------------
-bool cmListCommand::GetListString(std::string& listString, const char* var)
+bool cmListCommand::GetListString(std::string& listString,
+ const std::string& var)
{
- if ( !var )
- {
- return false;
- }
// get the old value
const char* cacheValue
= this->Makefile->GetDefinition(var);
@@ -92,7 +89,8 @@ bool cmListCommand::GetListString(std::string& listString, const char* var)
}
//----------------------------------------------------------------------------
-bool cmListCommand::GetList(std::vector<std::string>& list, const char* var)
+bool cmListCommand::GetList(std::vector<std::string>& list,
+ const std::string& var)
{
std::string listString;
if ( !this->GetListString(listString, var) )
diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h
index 0cb5da2..5ea1d9f 100644
--- a/Source/cmListCommand.h
+++ b/Source/cmListCommand.h
@@ -44,7 +44,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "list";}
+ virtual std::string GetName() const { return "list";}
cmTypeMacro(cmListCommand, cmCommand);
protected:
@@ -60,8 +60,8 @@ protected:
bool HandleReverseCommand(std::vector<std::string> const& args);
- bool GetList(std::vector<std::string>& list, const char* var);
- bool GetListString(std::string& listString, const char* var);
+ bool GetList(std::vector<std::string>& list, const std::string& var);
+ bool GetListString(std::string& listString, const std::string& var);
};
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index dfd98fa..806d821 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -33,7 +33,7 @@ bool cmLoadCacheCommand
// and they can not be overridden.
bool excludeFiles=false;
unsigned int i;
- std::set<cmStdString> excludes;
+ std::set<std::string> excludes;
for(i=0; i<args.size(); i++)
{
@@ -55,7 +55,7 @@ bool cmLoadCacheCommand
// If this set is empty, no internal cache entries are
// brought in.
bool includeFiles=false;
- std::set<cmStdString> includes;
+ std::set<std::string> includes;
for(i=0; i<args.size(); i++)
{
diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h
index c8f7236..04207d0 100644
--- a/Source/cmLoadCacheCommand.h
+++ b/Source/cmLoadCacheCommand.h
@@ -40,12 +40,12 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "load_cache";}
+ virtual std::string GetName() const { return "load_cache";}
cmTypeMacro(cmLoadCacheCommand, cmCommand);
protected:
- std::set<cmStdString> VariablesToRead;
+ std::set<std::string> VariablesToRead;
std::string Prefix;
bool ReadWithPrefix(std::vector<std::string> const& args);
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index 21ee0fe..36e9980 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -69,7 +69,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return info.Name; }
+ virtual std::string GetName() const { return info.Name; }
static const char* LastName;
static void TrapsForSignals(int sig)
diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h
index 11bcf09..4581269 100644
--- a/Source/cmLoadCommandCommand.h
+++ b/Source/cmLoadCommandCommand.h
@@ -20,7 +20,7 @@ public:
virtual cmCommand* Clone() { return new cmLoadCommandCommand; }
virtual bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus &status);
- virtual const char* GetName() const {return "load_command";}
+ virtual std::string GetName() const {return "load_command";}
virtual bool IsDiscouraged() const { return true; }
cmTypeMacro(cmLoadCommandCommand, cmCommand);
};
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index b86a956..761db48 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -280,7 +280,7 @@ void cmLocalGenerator::GenerateTestFiles()
// Compute the set of configurations.
std::vector<std::string> configurationTypes;
- const char* config =
+ const std::string& config =
this->Makefile->GetConfigurations(configurationTypes, false);
std::string file = this->Makefile->GetStartOutputDirectory();
@@ -384,11 +384,11 @@ void cmLocalGenerator::GenerateInstallRules()
// Compute the set of configurations.
std::vector<std::string> configurationTypes;
- const char* config =
+ const std::string& config =
this->Makefile->GetConfigurations(configurationTypes, false);
// Choose a default install configuration.
- const char* default_config = config;
+ const char* default_config = config.c_str();
const char* default_order[] = {"RELEASE", "MINSIZEREL",
"RELWITHDEBINFO", "DEBUG", 0};
for(const char** c = default_order; *c && !default_config; ++c)
@@ -557,7 +557,7 @@ void cmLocalGenerator::GenerateTargetManifest()
}
if(configNames.empty())
{
- target.GenerateTargetManifest(0);
+ target.GenerateTargetManifest("");
}
else
{
@@ -572,7 +572,7 @@ void cmLocalGenerator::GenerateTargetManifest()
}
void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
- const char* lang,
+ const std::string& lang,
cmSourceFile& source,
cmGeneratorTarget& target)
{
@@ -604,7 +604,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
std::vector<std::string> commands;
cmSystemTools::ExpandList(rules, commands);
cmLocalGenerator::RuleVariables vars;
- vars.Language = lang;
+ vars.Language = lang.c_str();
vars.Source = sourceFile.c_str();
vars.Object = objectFile.c_str();
vars.ObjectDir = objectDir.c_str();
@@ -617,8 +617,8 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
// Parse the string to get the custom command line.
cmCustomCommandLine commandLine;
- std::vector<cmStdString> cmd = cmSystemTools::ParseArguments(i->c_str());
- for(std::vector<cmStdString>::iterator a = cmd.begin();
+ std::vector<std::string> cmd = cmSystemTools::ParseArguments(i->c_str());
+ for(std::vector<std::string>::iterator a = cmd.begin();
a != cmd.end(); ++a)
{
commandLine.push_back(*a);
@@ -653,10 +653,10 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
);
}
-void cmLocalGenerator::AddBuildTargetRule(const char* llang,
+void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
cmGeneratorTarget& target)
{
- cmStdString objs;
+ std::string objs;
std::vector<std::string> objVector;
// Add all the sources outputs to the depends of the target
std::vector<cmSourceFile*> classes;
@@ -703,7 +703,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang,
&target);
linkLibs = frameworkPath + linkPath + linkLibs;
cmLocalGenerator::RuleVariables vars;
- vars.Language = llang;
+ vars.Language = llang.c_str();
vars.Objects = objs.c_str();
vars.ObjectDir = ".";
vars.Target = targetName.c_str();
@@ -712,8 +712,8 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang,
vars.LinkFlags = linkFlags.c_str();
std::string langFlags;
- this->AddLanguageFlags(langFlags, llang, 0);
- this->AddArchitectureFlags(langFlags, &target, llang, 0);
+ this->AddLanguageFlags(langFlags, llang, "");
+ this->AddArchitectureFlags(langFlags, &target, llang, "");
vars.LanguageCompileFlags = langFlags.c_str();
cmCustomCommandLines commandLines;
@@ -728,8 +728,8 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang,
this->ExpandRuleVariables(*i, vars);
// Parse the string to get the custom command line.
cmCustomCommandLine commandLine;
- std::vector<cmStdString> cmd = cmSystemTools::ParseArguments(i->c_str());
- for(std::vector<cmStdString>::iterator a = cmd.begin();
+ std::vector<std::string> cmd = cmSystemTools::ParseArguments(i->c_str());
+ for(std::vector<std::string>::iterator a = cmd.begin();
a != cmd.end(); ++a)
{
commandLine.push_back(*a);
@@ -747,7 +747,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang,
this->Makefile->AddCustomCommandToOutput(
targetFullPath.c_str(),
objVector,
- 0,
+ "",
commandLines,
comment.c_str(),
this->Makefile->GetStartOutputDirectory()
@@ -758,7 +758,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang,
void cmLocalGenerator
-::CreateCustomTargetsAndCommands(std::set<cmStdString> const& lang)
+::CreateCustomTargetsAndCommands(std::set<std::string> const& lang)
{
cmGeneratorTargetsType tgts = this->Makefile->GetGeneratorTargets();
for(cmGeneratorTargetsType::iterator l = tgts.begin();
@@ -776,12 +776,12 @@ void cmLocalGenerator
case cmTarget::MODULE_LIBRARY:
case cmTarget::EXECUTABLE:
{
- const char* llang = target.Target->GetLinkerLanguage();
- if(!llang)
+ std::string llang = target.Target->GetLinkerLanguage();
+ if(llang.empty())
{
cmSystemTools::Error
("CMake can not determine linker language for target: ",
- target.Target->GetName());
+ target.Target->GetName().c_str());
return;
}
// if the language is not in the set lang then create custom
@@ -1156,8 +1156,11 @@ void
cmLocalGenerator::ExpandRuleVariables(std::string& s,
const RuleVariables& replaceValues)
{
- this->InsertRuleLauncher(s, replaceValues.CMTarget,
- replaceValues.RuleLauncher);
+ if(replaceValues.RuleLauncher)
+ {
+ this->InsertRuleLauncher(s, replaceValues.CMTarget,
+ replaceValues.RuleLauncher);
+ }
std::string::size_type start = s.find('<');
// no variables to expand
if(start == s.npos)
@@ -1201,7 +1204,7 @@ cmLocalGenerator::ExpandRuleVariables(std::string& s,
//----------------------------------------------------------------------------
const char* cmLocalGenerator::GetRuleLauncher(cmTarget* target,
- const char* prop)
+ const std::string& prop)
{
if(target)
{
@@ -1215,7 +1218,7 @@ const char* cmLocalGenerator::GetRuleLauncher(cmTarget* target,
//----------------------------------------------------------------------------
void cmLocalGenerator::InsertRuleLauncher(std::string& s, cmTarget* target,
- const char* prop)
+ const std::string& prop)
{
if(const char* val = this->GetRuleLauncher(target, prop))
{
@@ -1227,7 +1230,7 @@ void cmLocalGenerator::InsertRuleLauncher(std::string& s, cmTarget* target,
//----------------------------------------------------------------------------
std::string
-cmLocalGenerator::ConvertToOutputForExistingCommon(const char* remote,
+cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote,
std::string const& result,
OutputFormat format)
{
@@ -1235,10 +1238,10 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const char* remote,
// already exists, we can use a short-path to reference it without a
// space.
if(this->WindowsShell && result.find(' ') != result.npos &&
- cmSystemTools::FileExists(remote))
+ cmSystemTools::FileExists(remote.c_str()))
{
std::string tmp;
- if(cmSystemTools::GetShortPath(remote, tmp))
+ if(cmSystemTools::GetShortPath(remote.c_str(), tmp))
{
return this->Convert(tmp.c_str(), NONE, format, true);
}
@@ -1250,7 +1253,7 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const char* remote,
//----------------------------------------------------------------------------
std::string
-cmLocalGenerator::ConvertToOutputForExisting(const char* remote,
+cmLocalGenerator::ConvertToOutputForExisting(const std::string& remote,
RelativeRoot local,
OutputFormat format)
{
@@ -1264,7 +1267,7 @@ cmLocalGenerator::ConvertToOutputForExisting(const char* remote,
//----------------------------------------------------------------------------
std::string
cmLocalGenerator::ConvertToOutputForExisting(RelativeRoot remote,
- const char* local,
+ const std::string& local,
OutputFormat format)
{
// Perform standard conversion.
@@ -1287,10 +1290,11 @@ cmLocalGenerator::ConvertToIncludeReference(std::string const& path,
std::string cmLocalGenerator::GetIncludeFlags(
const std::vector<std::string> &includes,
cmGeneratorTarget* target,
- const char* lang, bool forResponseFile,
- const char *config)
+ const std::string& lang,
+ bool forResponseFile,
+ const std::string& config)
{
- if(!lang)
+ if(lang.empty())
{
return "";
}
@@ -1340,7 +1344,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
this->Makefile->GetDefinition(fwSearchFlagVar.c_str());
bool flagUsed = false;
- std::set<cmStdString> emitted;
+ std::set<std::string> emitted;
#ifdef __APPLE__
emitted.insert("/System/Library/Frameworks");
#endif
@@ -1366,7 +1370,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
if(!flagUsed || repeatFlag)
{
if(sysIncludeFlag && target &&
- target->IsSystemIncludeDirectory(i->c_str(), config))
+ target->IsSystemIncludeDirectory(*i, config))
{
includeFlags << sysIncludeFlag;
}
@@ -1401,7 +1405,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
//----------------------------------------------------------------------------
void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines,
cmTarget const* target,
- const char* config)
+ const std::string& config)
{
std::vector<std::string> targetDefines;
target->GetCompileDefinitions(targetDefines,
@@ -1412,7 +1416,7 @@ void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines,
//----------------------------------------------------------------------------
void cmLocalGenerator::AddCompileOptions(
std::string& flags, cmTarget* target,
- const char* lang, const char* config
+ const std::string& lang, const std::string& config
)
{
std::string langFlagRegexVar = std::string("CMAKE_")+lang+"_FLAG_REGEX";
@@ -1460,8 +1464,8 @@ void cmLocalGenerator::AddCompileOptions(
//----------------------------------------------------------------------------
void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
cmGeneratorTarget* target,
- const char* lang,
- const char *config,
+ const std::string& lang,
+ const std::string& config,
bool stripImplicitInclDirs
)
{
@@ -1484,7 +1488,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
}
// Do not repeat an include path.
- std::set<cmStdString> emitted;
+ std::set<std::string> emitted;
// Store the automatic include paths.
if(includeBinaryDir)
@@ -1686,15 +1690,15 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
linkFlags += this->Makefile->GetSafeDefinition(build.c_str());
linkFlags += " ";
}
- const char* linkLanguage = target->Target->GetLinkerLanguage();
- if(!linkLanguage)
+ std::string linkLanguage = target->Target->GetLinkerLanguage();
+ if(linkLanguage.empty())
{
cmSystemTools::Error
("CMake can not determine linker language for target: ",
- target->Target->GetName());
+ target->Target->GetName().c_str());
return;
}
- this->AddLanguageFlags(flags, linkLanguage, buildType.c_str());
+ this->AddLanguageFlags(flags, linkLanguage, buildType);
this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath,
*target, false, false);
if(cmSystemTools::IsOn
@@ -1810,7 +1814,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
// Collect library linking flags command line options.
std::string linkLibs;
- const char* linkLanguage = cli.GetLinkLanguage();
+ std::string linkLanguage = cli.GetLinkLanguage();
std::string libPathFlag =
this->Makefile->GetRequiredDefinition("CMAKE_LIBRARY_PATH_FLAG");
@@ -1940,8 +1944,8 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
//----------------------------------------------------------------------------
void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
cmGeneratorTarget* target,
- const char *lang,
- const char* config)
+ const std::string& lang,
+ const std::string& config)
{
// Only add Mac OS X specific flags on Darwin platforms (OSX and iphone):
if(!this->Makefile->IsOn("APPLE"))
@@ -1966,7 +1970,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
std::string("CMAKE_") + lang + "_OSX_DEPLOYMENT_TARGET_FLAG";
const char* deploymentTargetFlag =
this->Makefile->GetDefinition(deploymentTargetFlagVar.c_str());
- if(!archs.empty() && lang && (lang[0] =='C' || lang[0] == 'F'))
+ if(!archs.empty() && !lang.empty() && (lang[0] =='C' || lang[0] == 'F'))
{
for(std::vector<std::string>::iterator i = archs.begin();
i != archs.end(); ++i)
@@ -1997,8 +2001,8 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
//----------------------------------------------------------------------------
void cmLocalGenerator::AddLanguageFlags(std::string& flags,
- const char* lang,
- const char* config)
+ const std::string& lang,
+ const std::string& config)
{
// Add language-specific flags.
std::string flagsVar = "CMAKE_";
@@ -2008,8 +2012,8 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
}
//----------------------------------------------------------------------------
-bool cmLocalGenerator::GetRealDependency(const char* inName,
- const char* config,
+bool cmLocalGenerator::GetRealDependency(const std::string& inName,
+ const std::string& config,
std::string& dep)
{
// Older CMake code may specify the dependency using the target
@@ -2036,7 +2040,7 @@ bool cmLocalGenerator::GetRealDependency(const char* inName,
{
// make sure it is not just a coincidence that the target name
// found is part of the inName
- if(cmSystemTools::FileIsFullPath(inName))
+ if(cmSystemTools::FileIsFullPath(inName.c_str()))
{
std::string tLocation;
if(target->GetType() >= cmTarget::EXECUTABLE &&
@@ -2084,7 +2088,7 @@ bool cmLocalGenerator::GetRealDependency(const char* inName,
}
// The name was not that of a CMake target. It must name a file.
- if(cmSystemTools::FileIsFullPath(inName))
+ if(cmSystemTools::FileIsFullPath(inName.c_str()))
{
// This is a full path. Return it as given.
dep = inName;
@@ -2109,7 +2113,7 @@ bool cmLocalGenerator::GetRealDependency(const char* inName,
//----------------------------------------------------------------------------
void cmLocalGenerator::AddSharedFlags(std::string& flags,
- const char* lang,
+ const std::string& lang,
bool shared)
{
std::string flagsVar;
@@ -2125,7 +2129,8 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags,
}
static void AddVisibilityCompileOption(std::string &flags, cmTarget* target,
- cmLocalGenerator *lg, const char *lang)
+ cmLocalGenerator *lg,
+ const std::string& lang)
{
std::string l(lang);
std::string compileOption = "CMAKE_" + l + "_COMPILE_OPTIONS_VISIBILITY";
@@ -2179,7 +2184,7 @@ static void AddInlineVisibilityCompileOption(std::string &flags,
//----------------------------------------------------------------------------
void cmLocalGenerator
::AddVisibilityPresetFlags(std::string &flags, cmTarget* target,
- const char *lang)
+ const std::string& lang)
{
int targetType = target->GetType();
bool suitableTarget = ((targetType == cmTarget::SHARED_LIBRARY)
@@ -2191,13 +2196,13 @@ void cmLocalGenerator
return;
}
- if (!lang)
+ if (lang.empty())
{
return;
}
AddVisibilityCompileOption(flags, target, this, lang);
- if(strcmp(lang, "CXX") == 0)
+ if(lang == "CXX")
{
AddInlineVisibilityCompileOption(flags, target, this);
}
@@ -2206,7 +2211,7 @@ void cmLocalGenerator
//----------------------------------------------------------------------------
void cmLocalGenerator::AddCMP0018Flags(std::string &flags, cmTarget* target,
std::string const& lang,
- const char *config)
+ const std::string& config)
{
int targetType = target->GetType();
@@ -2321,14 +2326,14 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags,
//----------------------------------------------------------------------------
void cmLocalGenerator::AddConfigVariableFlags(std::string& flags,
- const char* var,
- const char* config)
+ const std::string& var,
+ const std::string& config)
{
// Add the flags from the variable itself.
std::string flagsVar = var;
this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar.c_str()));
// Add the flags from the build-type specific variable.
- if(config && *config)
+ if(!config.empty())
{
flagsVar += "_";
flagsVar += cmSystemTools::UpperCase(config);
@@ -2353,7 +2358,7 @@ void cmLocalGenerator::AppendFlags(std::string& flags,
//----------------------------------------------------------------------------
void cmLocalGenerator::AppendFlagEscape(std::string& flags,
- const char* rawFlag)
+ const std::string& rawFlag)
{
this->AppendFlags(flags, this->EscapeForShell(rawFlag).c_str());
}
@@ -2393,11 +2398,11 @@ void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
//----------------------------------------------------------------------------
void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
std::string &definesString,
- const char* lang)
+ const std::string& lang)
{
// Lookup the define flag for the current language.
std::string dflag = "-D";
- if(lang)
+ if(!lang.empty())
{
std::string defineFlagVar = "CMAKE_";
defineFlagVar += lang;
@@ -2457,7 +2462,7 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
//----------------------------------------------------------------------------
void cmLocalGenerator::AppendFeatureOptions(
- std::string& flags, const char* lang, const char* feature)
+ std::string& flags, const std::string& lang, const char* feature)
{
std::string optVar = "CMAKE_";
optVar += lang;
@@ -2508,7 +2513,8 @@ cmLocalGenerator::ConstructComment(const cmCustomCommand& cc,
//----------------------------------------------------------------------------
std::string
-cmLocalGenerator::ConvertToOptionallyRelativeOutputPath(const char* remote)
+cmLocalGenerator::ConvertToOptionallyRelativeOutputPath(
+ const std::string& remote)
{
return this->Convert(remote, START_OUTPUT, SHELL, true);
}
@@ -2528,7 +2534,7 @@ const char* cmLocalGenerator::GetRelativeRootPath(RelativeRoot relroot)
}
//----------------------------------------------------------------------------
-std::string cmLocalGenerator::Convert(const char* source,
+std::string cmLocalGenerator::Convert(const std::string& source,
RelativeRoot relative,
OutputFormat output,
bool optional)
@@ -2580,7 +2586,7 @@ std::string cmLocalGenerator::Convert(const char* source,
}
//----------------------------------------------------------------------------
-std::string cmLocalGenerator::ConvertToOutputFormat(const char* source,
+std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source,
OutputFormat output)
{
std::string result = source;
@@ -2622,7 +2628,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const char* source,
//----------------------------------------------------------------------------
std::string cmLocalGenerator::Convert(RelativeRoot remote,
- const char* local,
+ const std::string& local,
OutputFormat output,
bool optional)
{
@@ -2631,10 +2637,10 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote,
// The relative root must have a path (i.e. not FULL or NONE)
assert(remotePath != 0);
- if(local && (!optional || this->UseRelativePaths))
+ if(!local.empty() && (!optional || this->UseRelativePaths))
{
std::vector<std::string> components;
- cmSystemTools::SplitPath(local, components);
+ cmSystemTools::SplitPath(local.c_str(), components);
std::string result = this->ConvertToRelativePath(components, remotePath);
return this->ConvertToOutputFormat(result.c_str(), output);
}
@@ -2717,7 +2723,8 @@ static bool cmLocalGeneratorNotAbove(const char* a, const char* b)
//----------------------------------------------------------------------------
std::string
cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
- const char* in_remote, bool force)
+ const std::string& in_remote,
+ bool force)
{
// The path should never be quoted.
assert(in_remote[0] != '\"');
@@ -2726,7 +2733,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
assert(local.size() > 0 && !(local[local.size()-1] == ""));
// If the path is already relative then just return the path.
- if(!cmSystemTools::FileIsFullPath(in_remote))
+ if(!cmSystemTools::FileIsFullPath(in_remote.c_str()))
{
return in_remote;
}
@@ -2745,11 +2752,11 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
std::string local_path = cmSystemTools::JoinPath(local);
if(!((cmLocalGeneratorNotAbove(local_path.c_str(),
this->RelativePathTopBinary.c_str()) &&
- cmLocalGeneratorNotAbove(in_remote,
+ cmLocalGeneratorNotAbove(in_remote.c_str(),
this->RelativePathTopBinary.c_str())) ||
(cmLocalGeneratorNotAbove(local_path.c_str(),
this->RelativePathTopSource.c_str()) &&
- cmLocalGeneratorNotAbove(in_remote,
+ cmLocalGeneratorNotAbove(in_remote.c_str(),
this->RelativePathTopSource.c_str()))))
{
return in_remote;
@@ -2759,7 +2766,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
// Identify the longest shared path component between the remote
// path and the local path.
std::vector<std::string> remote;
- cmSystemTools::SplitPath(in_remote, remote);
+ cmSystemTools::SplitPath(in_remote.c_str(), remote);
unsigned int common=0;
while(common < remote.size() &&
common < local.size() &&
@@ -2830,7 +2837,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
void
cmLocalGenerator
::GenerateTargetInstallRules(
- std::ostream& os, const char* config,
+ std::ostream& os, const std::string& config,
std::vector<std::string> const& configurationTypes)
{
// Convert the old-style install specification from each target to
@@ -2977,11 +2984,11 @@ bool cmLocalGeneratorCheckObjectName(std::string& objName,
//----------------------------------------------------------------------------
std::string&
cmLocalGenerator
-::CreateSafeUniqueObjectFileName(const char* sin,
+::CreateSafeUniqueObjectFileName(const std::string& sin,
std::string const& dir_max)
{
// Look for an existing mapped name for this object file.
- std::map<cmStdString,cmStdString>::iterator it =
+ std::map<std::string,std::string>::iterator it =
this->UniqueObjectNamesMap.find(sin);
// If no entry exists create one.
@@ -3064,7 +3071,7 @@ cmLocalGenerator
#endif
// Insert the newly mapped object file name.
- std::map<cmStdString, cmStdString>::value_type e(sin, ssin);
+ std::map<std::string, std::string>::value_type e(sin, ssin);
it = this->UniqueObjectNamesMap.insert(e).first;
}
@@ -3137,7 +3144,8 @@ cmLocalGenerator
bool replaceExt = this->NeedBackwardsCompatibility_2_4();
if(!replaceExt)
{
- if(const char* lang = source.GetLanguage())
+ std::string lang = source.GetLanguage();
+ if(!lang.empty())
{
std::string repVar = "CMAKE_";
repVar += lang;
@@ -3171,7 +3179,7 @@ cmLocalGenerator
}
//----------------------------------------------------------------------------
-const char*
+std::string
cmLocalGenerator
::GetSourceFileLanguage(const cmSourceFile& source)
{
@@ -3179,7 +3187,7 @@ cmLocalGenerator
}
//----------------------------------------------------------------------------
-std::string cmLocalGenerator::EscapeForShellOldStyle(const char* str)
+std::string cmLocalGenerator::EscapeForShellOldStyle(const std::string& str)
{
std::string result;
#if defined(_WIN32) && !defined(__CYGWIN__)
@@ -3195,7 +3203,7 @@ std::string cmLocalGenerator::EscapeForShellOldStyle(const char* str)
}
return str;
#else
- for(const char* ch = str; *ch != '\0'; ++ch)
+ for(const char* ch = str.c_str(); *ch != '\0'; ++ch)
{
if(*ch == ' ')
{
@@ -3208,28 +3216,30 @@ std::string cmLocalGenerator::EscapeForShellOldStyle(const char* str)
}
//----------------------------------------------------------------------------
-static bool cmLocalGeneratorIsShellOperator(const char* str)
-{
- if(strcmp(str, "<") == 0 ||
- strcmp(str, ">") == 0 ||
- strcmp(str, "<<") == 0 ||
- strcmp(str, ">>") == 0 ||
- strcmp(str, "|") == 0 ||
- strcmp(str, "||") == 0 ||
- strcmp(str, "&&") == 0 ||
- strcmp(str, "&>") == 0 ||
- strcmp(str, "1>") == 0 ||
- strcmp(str, "2>") == 0 ||
- strcmp(str, "2>&1") == 0 ||
- strcmp(str, "1>&2") == 0)
+static bool cmLocalGeneratorIsShellOperator(const std::string& str)
+{
+ static std::set<std::string> shellOperators;
+ if(shellOperators.empty())
{
- return true;
+ 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 false;
+ return shellOperators.count(str) > 0;
}
//----------------------------------------------------------------------------
-std::string cmLocalGenerator::EscapeForShell(const char* str, bool makeVars,
+std::string cmLocalGenerator::EscapeForShell(const std::string& str,
+ bool makeVars,
bool forEcho)
{
// Do not escape shell operators.
@@ -3271,28 +3281,28 @@ std::string cmLocalGenerator::EscapeForShell(const char* str, bool makeVars,
// Compute the buffer size needed.
int size = (this->WindowsShell ?
- cmsysSystem_Shell_GetArgumentSizeForWindows(str, flags) :
- cmsysSystem_Shell_GetArgumentSizeForUnix(str, flags));
+ cmsysSystem_Shell_GetArgumentSizeForWindows(str.c_str(), flags) :
+ cmsysSystem_Shell_GetArgumentSizeForUnix(str.c_str(), flags));
// Compute the shell argument itself.
std::vector<char> arg(size);
if(this->WindowsShell)
{
- cmsysSystem_Shell_GetArgumentForWindows(str, &arg[0], flags);
+ cmsysSystem_Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags);
}
else
{
- cmsysSystem_Shell_GetArgumentForUnix(str, &arg[0], flags);
+ cmsysSystem_Shell_GetArgumentForUnix(str.c_str(), &arg[0], flags);
}
return std::string(&arg[0]);
}
//----------------------------------------------------------------------------
-std::string cmLocalGenerator::EscapeForCMake(const char* str)
+std::string cmLocalGenerator::EscapeForCMake(const std::string& str)
{
// Always double-quote the argument to take care of most escapes.
std::string result = "\"";
- for(const char* c = str; *c; ++c)
+ for(const char* c = str.c_str(); *c; ++c)
{
if(*c == '"')
{
@@ -3455,17 +3465,18 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
}
//----------------------------------------------------------------------------
-static void cmLGInfoProp(cmMakefile* mf, cmTarget* target, const char* prop)
+static void cmLGInfoProp(cmMakefile* mf, cmTarget* target,
+ const std::string& prop)
{
if(const char* val = target->GetProperty(prop))
{
- mf->AddDefinition(prop, val);
+ mf->AddDefinition(prop.c_str(), val);
}
}
//----------------------------------------------------------------------------
void cmLocalGenerator::GenerateAppleInfoPList(cmTarget* target,
- const char* targetName,
+ const std::string& targetName,
const char* fname)
{
// Find the Info.plist template.
@@ -3494,7 +3505,7 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmTarget* target,
// back to the directory-level values set by the user.
cmMakefile* mf = this->Makefile;
mf->PushScope();
- mf->AddDefinition("MACOSX_BUNDLE_EXECUTABLE_NAME", targetName);
+ mf->AddDefinition("MACOSX_BUNDLE_EXECUTABLE_NAME", targetName.c_str());
cmLGInfoProp(mf, target, "MACOSX_BUNDLE_INFO_STRING");
cmLGInfoProp(mf, target, "MACOSX_BUNDLE_ICON_FILE");
cmLGInfoProp(mf, target, "MACOSX_BUNDLE_GUI_IDENTIFIER");
@@ -3509,8 +3520,8 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmTarget* target,
//----------------------------------------------------------------------------
void cmLocalGenerator::GenerateFrameworkInfoPList(cmTarget* target,
- const char* targetName,
- const char* fname)
+ const std::string& targetName,
+ const char* fname)
{
// Find the Info.plist template.
const char* in = target->GetProperty("MACOSX_FRAMEWORK_INFO_PLIST");
@@ -3538,7 +3549,7 @@ void cmLocalGenerator::GenerateFrameworkInfoPList(cmTarget* target,
// back to the directory-level values set by the user.
cmMakefile* mf = this->Makefile;
mf->PushScope();
- mf->AddDefinition("MACOSX_FRAMEWORK_NAME", targetName);
+ mf->AddDefinition("MACOSX_FRAMEWORK_NAME", targetName.c_str());
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/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 2e05804..4d62833 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -106,11 +106,12 @@ public:
*/
enum RelativeRoot { NONE, FULL, HOME, START, HOME_OUTPUT, START_OUTPUT };
enum OutputFormat { UNCHANGED, MAKEFILE, SHELL, RESPONSE };
- std::string ConvertToOutputFormat(const char* source, OutputFormat output);
- std::string Convert(const char* remote, RelativeRoot local,
+ std::string ConvertToOutputFormat(const std::string& source,
+ OutputFormat output);
+ std::string Convert(const std::string& remote, RelativeRoot local,
OutputFormat output = UNCHANGED,
bool optional = false);
- std::string Convert(RelativeRoot remote, const char* local,
+ std::string Convert(RelativeRoot remote, const std::string& local,
OutputFormat output = UNCHANGED,
bool optional = false);
@@ -125,7 +126,7 @@ public:
* remote path must use forward slashes and not already be escaped
* or quoted.
*/
- std::string ConvertToOptionallyRelativeOutputPath(const char* remote);
+ std::string ConvertToOptionallyRelativeOutputPath(const std::string& remote);
///! set/get the parent generator
cmLocalGenerator* GetParent(){return this->Parent;}
@@ -137,24 +138,26 @@ public:
void AddArchitectureFlags(std::string& flags, cmGeneratorTarget* target,
- const char *lang, const char* config);
+ const std::string&lang, const std::string& config);
- void AddLanguageFlags(std::string& flags, const char* lang,
- const char* config);
+ void AddLanguageFlags(std::string& flags, const std::string& lang,
+ const std::string& config);
void AddCMP0018Flags(std::string &flags, cmTarget* target,
- std::string const& lang, const char *config);
+ std::string const& lang, const std::string& config);
void AddVisibilityPresetFlags(std::string &flags, cmTarget* target,
- const char *lang);
- void AddConfigVariableFlags(std::string& flags, const char* var,
- const char* config);
+ const std::string& lang);
+ void AddConfigVariableFlags(std::string& flags, const std::string& var,
+ const std::string& config);
///! Append flags to a string.
virtual void AppendFlags(std::string& flags, const char* newFlags);
- virtual void AppendFlagEscape(std::string& flags, const char* rawFlag);
+ virtual void AppendFlagEscape(std::string& flags,
+ const std::string& rawFlag);
///! Get the include flags for the current makefile and language
std::string GetIncludeFlags(const std::vector<std::string> &includes,
cmGeneratorTarget* target,
- const char* lang, bool forResponseFile = false,
- const char *config = 0);
+ const std::string& lang,
+ bool forResponseFile = false,
+ const std::string& config = "");
/**
* Encode a list of preprocessor definitions for the compiler
@@ -175,10 +178,10 @@ public:
*/
void JoinDefines(const std::set<std::string>& defines,
std::string &definesString,
- const char* lang);
+ const std::string& lang);
/** Lookup and append options associated with a particular feature. */
- void AppendFeatureOptions(std::string& flags, const char* lang,
+ void AppendFeatureOptions(std::string& flags, const std::string& lang,
const char* feature);
/** \brief Get absolute path to dependency \a name
@@ -193,18 +196,18 @@ public:
* the source directory of this generator. This should only be
* used for dependencies of custom commands.
*/
- bool GetRealDependency(const char* name, const char* config,
+ bool GetRealDependency(const std::string& name, const std::string& config,
std::string& dep);
///! for existing files convert to output path and short path if spaces
- std::string ConvertToOutputForExisting(const char* remote,
+ std::string ConvertToOutputForExisting(const std::string& remote,
RelativeRoot local = START_OUTPUT,
OutputFormat format = SHELL);
/** For existing path identified by RelativeRoot convert to output
path and short path if spaces. */
std::string ConvertToOutputForExisting(RelativeRoot remote,
- const char* local = 0,
+ const std::string& local = "",
OutputFormat format = SHELL);
virtual std::string ConvertToIncludeReference(std::string const& path,
@@ -223,16 +226,17 @@ public:
/** Get the include flags for the current makefile and language. */
void GetIncludeDirectories(std::vector<std::string>& dirs,
cmGeneratorTarget* target,
- const char* lang = "C", const char *config = 0,
+ const std::string& lang = "C",
+ const std::string& config = "",
bool stripImplicitInclDirs = true);
void AddCompileOptions(std::string& flags, cmTarget* target,
- const char* lang, const char* config);
+ const std::string& lang, const std::string& config);
void AddCompileDefinitions(std::set<std::string>& defines,
cmTarget const* target,
- const char* config);
+ const std::string& config);
/** Compute the language used to compile the given source file. */
- const char* GetSourceFileLanguage(const cmSourceFile& source);
+ std::string GetSourceFileLanguage(const cmSourceFile& source);
// Fill the vector with the target names for the object files,
// preprocessed files and assembly files.
@@ -282,14 +286,14 @@ public:
system to replace make variable references. Optionally adjust
escapes for the special case of passing to the native echo
command. */
- std::string EscapeForShell(const char* str, bool makeVars = false,
+ std::string EscapeForShell(const std::string& str, bool makeVars = false,
bool forEcho = false);
/** Backwards-compatibility version of EscapeForShell. */
- std::string EscapeForShellOldStyle(const char* str);
+ std::string EscapeForShellOldStyle(const std::string& str);
/** Escape the given string as an argument in a CMake script. */
- static std::string EscapeForCMake(const char* str);
+ static std::string EscapeForCMake(const std::string& str);
enum FortranFormat
{
@@ -307,7 +311,8 @@ public:
* or quoted.
*/
std::string ConvertToRelativePath(const std::vector<std::string>& local,
- const char* remote, bool force=false);
+ const std::string& remote,
+ bool force=false);
/**
* Get the relative path from the generator output directory to a
@@ -335,14 +340,14 @@ public:
/**
* Generate a Mac OS X application bundle Info.plist file.
*/
- void GenerateAppleInfoPList(cmTarget* target, const char* targetName,
+ void GenerateAppleInfoPList(cmTarget* target, const std::string& targetName,
const char* fname);
/**
* Generate a Mac OS X framework Info.plist file.
*/
void GenerateFrameworkInfoPList(cmTarget* target,
- const char* targetName,
+ const std::string& targetName,
const char* fname);
/** Construct a comment for a custom command. */
std::string ConstructComment(const cmCustomCommand& cc,
@@ -382,17 +387,18 @@ protected:
std::string ExpandRuleVariable(std::string const& variable,
const RuleVariables& replaceValues);
- const char* GetRuleLauncher(cmTarget* target, const char* prop);
+ const char* GetRuleLauncher(cmTarget* target, const std::string& prop);
void InsertRuleLauncher(std::string& s, cmTarget* target,
- const char* prop);
+ const std::string& prop);
/** Convert a target to a utility target for unsupported
* languages of a generator */
- void AddBuildTargetRule(const char* llang, cmGeneratorTarget& target);
+ void AddBuildTargetRule(const std::string& llang,
+ cmGeneratorTarget& target);
///! add a custom command to build a .o file that is part of a target
void AddCustomCommandToCreateObject(const char* ofname,
- const char* lang,
+ const std::string& lang,
cmSourceFile& source,
cmGeneratorTarget& target);
// Create Custom Targets and commands for unsupported languages
@@ -400,14 +406,14 @@ protected:
// generator directly. Any targets containing files that are not
// of the types listed will be compiled as custom commands and added
// to a custom target.
- void CreateCustomTargetsAndCommands(std::set<cmStdString> const&);
+ void CreateCustomTargetsAndCommands(std::set<std::string> const&);
// Handle old-style install rules stored in the targets.
void GenerateTargetInstallRules(
- std::ostream& os, const char* config,
+ std::ostream& os, const std::string& config,
std::vector<std::string> const& configurationTypes);
- std::string& CreateSafeUniqueObjectFileName(const char* sin,
+ std::string& CreateSafeUniqueObjectFileName(const std::string& sin,
std::string const& dir_max);
void ComputeObjectMaxPath();
@@ -437,9 +443,9 @@ protected:
std::vector<std::string> StartOutputDirectoryComponents;
cmLocalGenerator* Parent;
std::vector<cmLocalGenerator*> Children;
- std::map<cmStdString, cmStdString> UniqueObjectNamesMap;
+ std::map<std::string, std::string> UniqueObjectNamesMap;
std::string::size_type ObjectPathMax;
- std::set<cmStdString> ObjectMaxPathViolations;
+ std::set<std::string> ObjectMaxPathViolations;
bool WindowsShell;
bool WindowsVSIDE;
bool WatcomWMake;
@@ -469,11 +475,12 @@ protected:
cmIML_INT_uint64_t BackwardsCompatibility;
bool BackwardsCompatibilityFinal;
private:
- std::string ConvertToOutputForExistingCommon(const char* remote,
+ std::string ConvertToOutputForExistingCommon(const std::string& remote,
std::string const& result,
OutputFormat format);
- void AddSharedFlags(std::string& flags, const char* lang, bool shared);
+ void AddSharedFlags(std::string& flags, const std::string& lang,
+ bool shared);
bool GetShouldUseOldFlags(bool shared, const std::string &lang) const;
void AddPositionIndependentFlags(std::string& flags, std::string const& l,
int targetType);
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index 8b26806..2d870fb 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -55,8 +55,8 @@ public:
const cmake* GetCMakeInstance() const;
cmake* GetCMakeInstance();
- const char* GetConfigName() const
- { return this->ConfigName.c_str(); }
+ std::string const& GetConfigName() const
+ { return this->ConfigName; }
/// @return whether we are processing the top CMakeLists.txt file.
bool isRootMakefile() const;
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 93722d1..f7088c2 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -190,7 +190,7 @@ void cmLocalUnixMakefileGenerator3::AddLocalObjectFile(
void cmLocalUnixMakefileGenerator3::GetIndividualFileTargets
(std::vector<std::string>& targets)
{
- for (std::map<cmStdString, LocalObjectInfo>::iterator lo =
+ for (std::map<std::string, LocalObjectInfo>::iterator lo =
this->LocalObjectFiles.begin();
lo != this->LocalObjectFiles.end(); ++lo)
{
@@ -235,7 +235,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
// only write local targets unless at the top Keep track of targets already
// listed.
- std::set<cmStdString> emittedTargets;
+ std::set<std::string> emittedTargets;
if (this->Parent)
{
// write our targets, and while doing it collect up the object
@@ -256,7 +256,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
// now write out the object rules
// for each object file name
- for (std::map<cmStdString, LocalObjectInfo>::iterator lo =
+ for (std::map<std::string, LocalObjectInfo>::iterator lo =
this->LocalObjectFiles.begin();
lo != this->LocalObjectFiles.end(); ++lo)
{
@@ -371,7 +371,7 @@ cmLocalUnixMakefileGenerator3
//----------------------------------------------------------------------------
void cmLocalUnixMakefileGenerator3
::WriteLocalMakefileTargets(std::ostream& ruleFileStream,
- std::set<cmStdString> &emitted)
+ std::set<std::string> &emitted)
{
std::vector<std::string> depends;
std::vector<std::string> commands;
@@ -550,14 +550,14 @@ void
cmLocalUnixMakefileGenerator3
::WriteMakeRule(std::ostream& os,
const char* comment,
- const char* target,
+ const std::string& target,
const std::vector<std::string>& depends,
const std::vector<std::string>& commands,
bool symbolic,
bool in_help)
{
// Make sure there is a target.
- if(!target || !*target)
+ if(target.empty())
{
cmSystemTools::Error("No target for WriteMakeRule! called with comment: ",
comment);
@@ -859,11 +859,11 @@ void cmLocalUnixMakefileGenerator3
void
cmLocalUnixMakefileGenerator3
::WriteConvenienceRule(std::ostream& ruleFileStream,
- const char* realTarget,
- const char* helpTarget)
+ const std::string& realTarget,
+ const std::string& helpTarget)
{
// A rule is only needed if the names are different.
- if(strcmp(realTarget, helpTarget) != 0)
+ if(realTarget != helpTarget)
{
// The helper target depends on the real target.
std::vector<std::string> depends;
@@ -1196,12 +1196,12 @@ cmLocalUnixMakefileGenerator3
if(!filename)
{
// Get the set of source languages in the target.
- std::set<cmStdString> languages;
+ std::set<std::string> languages;
target.GetLanguages(languages);
fout << "\n"
<< "# Per-language clean rules from dependency scanning.\n"
<< "foreach(lang";
- for(std::set<cmStdString>::const_iterator l = languages.begin();
+ for(std::set<std::string>::const_iterator l = languages.begin();
l != languages.end(); ++l)
{
fout << " " << *l;
@@ -1299,7 +1299,7 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
//----------------------------------------------------------------------------
std::string
cmLocalUnixMakefileGenerator3
-::CreateMakeVariable(const char* sin, const char* s2in)
+::CreateMakeVariable(const std::string& sin, const std::string& s2in)
{
std::string s = sin;
std::string s2 = s2in;
@@ -1317,7 +1317,7 @@ cmLocalUnixMakefileGenerator3
// see if the variable has been defined before and return
// the modified version of the variable
- std::map<cmStdString, cmStdString>::iterator i =
+ std::map<std::string, std::string>::iterator i =
this->MakeVariableMap.find(unmodified);
if(i != this->MakeVariableMap.end())
{
@@ -1721,7 +1721,7 @@ void cmLocalUnixMakefileGenerator3
{
text = "Running external command ...";
}
- std::set<cmStdString>::const_iterator dit;
+ std::set<std::string>::const_iterator dit;
for ( dit = glIt->second.GetUtilities().begin();
dit != glIt->second.GetUtilities().end();
++ dit )
@@ -2034,7 +2034,7 @@ void cmLocalUnixMakefileGenerator3::WriteDisclaimer(std::ostream& os)
//----------------------------------------------------------------------------
std::string
cmLocalUnixMakefileGenerator3
-::GetRecursiveMakeCall(const char *makefile, const char* tgt)
+::GetRecursiveMakeCall(const char *makefile, const std::string& tgt)
{
// Call make on the given file.
std::string cmd;
@@ -2059,7 +2059,7 @@ cmLocalUnixMakefileGenerator3
}
// Add the target.
- if (tgt && tgt[0] != '\0')
+ if (!tgt.empty())
{
// The make target is always relative to the top of the build tree.
std::string tgt2 = this->Convert(tgt, HOME_OUTPUT);
@@ -2198,7 +2198,7 @@ cmLocalUnixMakefileGenerator3::GetImplicitDepends(cmTarget const& tgt)
//----------------------------------------------------------------------------
void
cmLocalUnixMakefileGenerator3::AddImplicitDepends(cmTarget const& tgt,
- const char* lang,
+ const std::string& lang,
const char* obj,
const char* src)
{
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 703369e..39f213b 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -55,7 +55,7 @@ public:
// Write out a make rule
void WriteMakeRule(std::ostream& os,
const char* comment,
- const char* target,
+ const std::string& target,
const std::vector<std::string>& depends,
const std::vector<std::string>& commands,
bool symbolic,
@@ -75,7 +75,7 @@ public:
/**
* Set the flag used to keep the make program silent.
*/
- void SetMakeSilentFlag(const char* s) { this->MakeSilentFlag = s; }
+ void SetMakeSilentFlag(const std::string& s) { this->MakeSilentFlag = s; }
std::string &GetMakeSilentFlag() { return this->MakeSilentFlag; }
/**
@@ -130,8 +130,9 @@ public:
* Set the string used to include one makefile into another default
* is include.
*/
- void SetIncludeDirective(const char* s) { this->IncludeDirective = s; }
- const char *GetIncludeDirective() { return this->IncludeDirective.c_str(); }
+ void SetIncludeDirective(const std::string& s)
+ { this->IncludeDirective = s; }
+ const std::string& GetIncludeDirective() { return this->IncludeDirective; }
/**
* Set max makefile variable size, default is 0 which means unlimited.
@@ -168,7 +169,8 @@ public:
void WriteDivider(std::ostream& os);
/** used to create a recursive make call */
- std::string GetRecursiveMakeCall(const char *makefile, const char* tgt);
+ std::string GetRecursiveMakeCall(const char *makefile,
+ const std::string& tgt);
// append flags to a string
virtual void AppendFlags(std::string& flags, const char* newFlags);
@@ -191,7 +193,8 @@ public:
static std::string ConvertToQuotedOutputPath(const char* p);
- std::string CreateMakeVariable(const char* sin, const char* s2in);
+ std::string CreateMakeVariable(const std::string& sin,
+ const std::string& s2in);
/** Called from command-line hook to bring dependencies up to date
for a target. */
@@ -210,14 +213,14 @@ public:
// File pairs for implicit dependency scanning. The key of the map
// is the depender and the value is the explicit dependee.
struct ImplicitDependFileMap:
- public std::map<cmStdString, cmDepends::DependencyVector> {};
+ public std::map<std::string, cmDepends::DependencyVector> {};
struct ImplicitDependLanguageMap:
- public std::map<cmStdString, ImplicitDependFileMap> {};
+ public std::map<std::string, ImplicitDependFileMap> {};
struct ImplicitDependTargetMap:
- public std::map<cmStdString, ImplicitDependLanguageMap> {};
+ public std::map<std::string, ImplicitDependLanguageMap> {};
ImplicitDependLanguageMap const& GetImplicitDepends(cmTarget const& tgt);
- void AddImplicitDepends(cmTarget const& tgt, const char* lang,
+ void AddImplicitDepends(cmTarget const& tgt, const std::string& lang,
const char* obj, const char* src);
void AppendGlobalTargetDepends(std::vector<std::string>& depends,
@@ -230,7 +233,7 @@ public:
std::string objNoTargetDir,
bool hasSourceExtension);
- std::vector<cmStdString> const& GetLocalHelp() { return this->LocalHelp; }
+ std::vector<std::string> const& GetLocalHelp() { return this->LocalHelp; }
/** Get whether to create rules to generate preprocessed and
assembly sources. This could be converted to a variable lookup
@@ -255,7 +258,7 @@ protected:
// write the target rules for the local Makefile into the stream
void WriteLocalMakefileTargets(std::ostream& ruleFileStream,
- std::set<cmStdString> &emitted);
+ std::set<std::string> &emitted);
// this method Writes the Directory information files
void WriteDirectoryInformationFile();
@@ -273,8 +276,8 @@ protected:
void WriteConvenienceRule(std::ostream& ruleFileStream,
- const char* realTarget,
- const char* helpTarget);
+ const std::string& realTarget,
+ const std::string& helpTarget);
void WriteTargetDependRule(std::ostream& ruleFileStream,
cmTarget& target);
@@ -358,7 +361,7 @@ private:
cmTarget* Target;
std::string Language;
LocalObjectEntry(): Target(0), Language() {}
- LocalObjectEntry(cmTarget* t, const char* lang):
+ LocalObjectEntry(cmTarget* t, const std::string& lang):
Target(t), Language(lang) {}
};
struct LocalObjectInfo: public std::vector<LocalObjectEntry>
@@ -369,16 +372,16 @@ private:
LocalObjectInfo():HasSourceExtension(false), HasPreprocessRule(false),
HasAssembleRule(false) {}
};
- std::map<cmStdString, LocalObjectInfo> LocalObjectFiles;
+ std::map<std::string, LocalObjectInfo> LocalObjectFiles;
void WriteObjectConvenienceRule(std::ostream& ruleFileStream,
const char* comment, const char* output,
LocalObjectInfo const& info);
- std::vector<cmStdString> LocalHelp;
+ std::vector<std::string> LocalHelp;
/* does the work for each target */
- std::map<cmStdString, cmStdString> MakeVariableMap;
- std::map<cmStdString, cmStdString> ShortMakeVariableMap;
+ std::map<std::string, std::string> MakeVariableMap;
+ std::map<std::string, std::string> ShortMakeVariableMap;
};
#endif
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index aedd6ed..aa70ab9 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -19,7 +19,7 @@
class cmVS10XMLParser : public cmXMLParser
{
public:
- virtual void EndElement(const char* /* name */)
+ virtual void EndElement(const std::string& /* name */)
{
}
virtual void CharacterDataHandler(const char* data, int length)
@@ -30,14 +30,14 @@ class cmVS10XMLParser : public cmXMLParser
this->DoGUID = false;
}
}
- virtual void StartElement(const char* name, const char**)
+ virtual void StartElement(const std::string& name, const char**)
{
// once the GUID is found do nothing
if(this->GUID.size())
{
return;
}
- if(strcmp("ProjectGUID", name) == 0 || strcmp("ProjectGuid", name) == 0)
+ if("ProjectGUID" == name || "ProjectGuid" == name)
{
this->DoGUID = true;
}
@@ -98,7 +98,7 @@ void cmLocalVisualStudio10Generator::Generate()
void cmLocalVisualStudio10Generator
-::ReadAndStoreExternalGUID(const char* name,
+::ReadAndStoreExternalGUID(const std::string& name,
const char* path)
{
cmVS10XMLParser parser;
diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h
index 41db735..b50e345 100644
--- a/Source/cmLocalVisualStudio10Generator.h
+++ b/Source/cmLocalVisualStudio10Generator.h
@@ -34,7 +34,7 @@ public:
* Generate the makefile for this directory.
*/
virtual void Generate();
- virtual void ReadAndStoreExternalGUID(const char* name,
+ virtual void ReadAndStoreExternalGUID(const std::string& name,
const char* path);
protected:
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index a5e8294..f1fd994 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -38,7 +38,7 @@ class cmLocalVisualStudio6Generator::EventWriter
{
public:
EventWriter(cmLocalVisualStudio6Generator* lg,
- const char* config, std::string& code):
+ const std::string& config, std::string& code):
LG(lg), Config(config), Code(code), First(true) {}
void Start(const char* event)
{
@@ -72,7 +72,7 @@ public:
}
private:
cmLocalVisualStudio6Generator* LG;
- const char* Config;
+ std::string Config;
std::string& Code;
bool First;
std::string Event;
@@ -80,7 +80,7 @@ private:
void cmLocalVisualStudio6Generator::AddHelperCommands()
{
- std::set<cmStdString> lang;
+ std::set<std::string> lang;
lang.insert("C");
lang.insert("CXX");
this->CreateCustomTargetsAndCommands(lang);
@@ -186,7 +186,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
//
extern std::string GetVS6TargetName(const std::string& targetName);
-void cmLocalVisualStudio6Generator::CreateSingleDSP(const char *lname,
+void cmLocalVisualStudio6Generator::CreateSingleDSP(const std::string& lname,
cmTarget &target)
{
// add to the list of projects
@@ -263,7 +263,7 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt)
void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
- const char *libName,
+ const std::string& libName,
cmTarget &target)
{
// For utility targets need custom command since pre- and post-
@@ -372,7 +372,7 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
void cmLocalVisualStudio6Generator
::WriteGroup(const cmSourceGroup *sg, cmTarget& target,
- std::ostream &fout, const char *libName)
+ std::ostream &fout, const std::string& libName)
{
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
@@ -413,23 +413,20 @@ void cmLocalVisualStudio6Generator
compileFlags += cflags;
}
- const char* lang = this->GetSourceFileLanguage(*(*sf));
- if(lang)
+ const std::string& lang = this->GetSourceFileLanguage(*(*sf));
+ if(lang == "CXX")
{
- if(strcmp(lang, "CXX") == 0)
- {
- // force a C++ file type
- compileFlags += " /TP ";
- }
- else if(strcmp(lang, "C") == 0)
- {
- // force to c file type
- compileFlags += " /TC ";
- }
+ // force a C++ file type
+ compileFlags += " /TP ";
+ }
+ else if(lang == "C")
+ {
+ // force to c file type
+ compileFlags += " /TC ";
}
// Add per-source and per-configuration preprocessor definitions.
- std::map<cmStdString, cmStdString> cdmap;
+ std::map<std::string, std::string> cdmap;
{
std::set<std::string> targetCompileDefinitions;
@@ -469,7 +466,7 @@ void cmLocalVisualStudio6Generator
}
bool excludedFromBuild =
- (lang && (*sf)->GetPropertyAsBool("HEADER_FILE_ONLY"));
+ (!lang.empty() && (*sf)->GetPropertyAsBool("HEADER_FILE_ONLY"));
// Check for extra object-file dependencies.
const char* dependsValue = (*sf)->GetProperty("OBJECT_DEPENDS");
@@ -529,7 +526,7 @@ void cmLocalVisualStudio6Generator
{
fout << "\n# ADD CPP " << compileFlags << "\n\n";
}
- std::map<cmStdString, cmStdString>::iterator cdi =
+ std::map<std::string, std::string>::iterator cdi =
cdmap.find(cmSystemTools::UpperCase(config));
if(cdi != cdmap.end() && !cdi->second.empty())
{
@@ -575,13 +572,13 @@ cmLocalVisualStudio6Generator
{
// Create a fake output that forces the rule to run.
char* output = new char[(strlen(this->Makefile->GetStartOutputDirectory()) +
- strlen(target.GetName()) + 30)];
+ target.GetName().size() + 30)];
sprintf(output,"%s/%s_force_%i", this->Makefile->GetStartOutputDirectory(),
- target.GetName(), count);
+ target.GetName().c_str(), count);
std::string comment = this->ConstructComment(origCommand, "<hack>");
// Add the rule with the given dependencies and commands.
- const char* no_main_dependency = 0;
+ std::string no_main_dependency = "";
if(cmSourceFile* outsf =
this->Makefile->AddCustomCommandToOutput(
output, depends, no_main_dependency,
@@ -702,7 +699,7 @@ void cmLocalVisualStudio6Generator::WriteDSPEndGroup(std::ostream& fout)
void cmLocalVisualStudio6Generator::SetBuildType(BuildType b,
- const char* libName,
+ const std::string& libName,
cmTarget& target)
{
std::string root= this->Makefile->GetRequiredDefinition("CMAKE_ROOT");
@@ -788,7 +785,7 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b,
//----------------------------------------------------------------------------
cmsys::auto_ptr<cmCustomCommand>
cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target,
- const char* config)
+ const std::string& config)
{
cmsys::auto_ptr<cmCustomCommand> pcc;
@@ -816,8 +813,8 @@ cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target,
// look for custom rules on a target and collect them together
std::string
cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target,
- const char* configName,
- const char * /* libName */)
+ const std::string& configName,
+ const std::string& /* libName */)
{
if (target.GetType() >= cmTarget::UTILITY )
{
@@ -866,7 +863,7 @@ inline std::string removeQuotes(const std::string& s)
std::string
cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target,
- const char *config)
+ const std::string& config)
{
std::string includeOptions;
@@ -929,7 +926,7 @@ cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target,
void cmLocalVisualStudio6Generator
::WriteDSPHeader(std::ostream& fout,
- const char *libName, cmTarget &target,
+ const std::string& libName, cmTarget &target,
std::vector<cmSourceGroup> &)
{
bool targetBuilds = (target.GetType() >= cmTarget::EXECUTABLE &&
@@ -1102,7 +1099,7 @@ void cmLocalVisualStudio6Generator
// Compute the proper name to use to link this library.
std::string lib;
std::string libDebug;
- cmTarget* tgt = this->GlobalGenerator->FindTarget(0, j->first.c_str());
+ cmTarget* tgt = this->GlobalGenerator->FindTarget(j->first.c_str());
if(tgt)
{
lib = cmSystemTools::GetFilenameWithoutExtension
@@ -1255,12 +1252,12 @@ void cmLocalVisualStudio6Generator
if(targetBuilds)
{
// Get the language to use for linking.
- const char* linkLanguage = target.GetLinkerLanguage();
- if(!linkLanguage)
+ const std::string& linkLanguage = target.GetLinkerLanguage();
+ if(linkLanguage.empty())
{
cmSystemTools::Error
("CMake can not determine linker language for target: ",
- target.GetName());
+ target.GetName().c_str());
return;
}
@@ -1677,12 +1674,12 @@ void cmLocalVisualStudio6Generator
if(target.GetType() >= cmTarget::EXECUTABLE &&
target.GetType() <= cmTarget::OBJECT_LIBRARY)
{
- const char* linkLanguage = target.GetLinkerLanguage();
- if(!linkLanguage)
+ const std::string& linkLanguage = target.GetLinkerLanguage();
+ if(linkLanguage.empty())
{
cmSystemTools::Error
("CMake can not determine linker language for target: ",
- target.GetName());
+ target.GetName().c_str());
return;
}
// if CXX is on and the target contains cxx code then add the cxx flags
@@ -1707,7 +1704,7 @@ void cmLocalVisualStudio6Generator
flagsRelWithDebInfo = this->Makefile->GetSafeDefinition(flagVar.c_str());
flagsRelWithDebInfo += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" ";
- this->AddCompileOptions(flags, &target, linkLanguage, 0);
+ this->AddCompileOptions(flags, &target, linkLanguage, "");
this->AddCompileOptions(flagsDebug, &target, linkLanguage, "Debug");
this->AddCompileOptions(flagsRelease, &target, linkLanguage, "Release");
this->AddCompileOptions(flagsMinSizeRel, &target, linkLanguage,
@@ -1733,7 +1730,7 @@ void cmLocalVisualStudio6Generator
std::set<std::string> minsizeDefinesSet;
std::set<std::string> debugrelDefinesSet;
- this->AddCompileDefinitions(definesSet, &target, 0);
+ this->AddCompileDefinitions(definesSet, &target, "");
this->AddCompileDefinitions(debugDefinesSet, &target, "DEBUG");
this->AddCompileDefinitions(releaseDefinesSet, &target, "RELEASE");
this->AddCompileDefinitions(minsizeDefinesSet, &target, "MINSIZEREL");
@@ -1745,11 +1742,11 @@ void cmLocalVisualStudio6Generator
std::string minsizeDefines = " ";
std::string debugrelDefines = " ";
- this->JoinDefines(definesSet, defines, 0);
- this->JoinDefines(debugDefinesSet, debugDefines, 0);
- this->JoinDefines(releaseDefinesSet, releaseDefines, 0);
- this->JoinDefines(minsizeDefinesSet, minsizeDefines, 0);
- this->JoinDefines(debugrelDefinesSet, debugrelDefines, 0);
+ this->JoinDefines(definesSet, defines, "");
+ this->JoinDefines(debugDefinesSet, debugDefines, "");
+ this->JoinDefines(releaseDefinesSet, releaseDefines, "");
+ this->JoinDefines(minsizeDefinesSet, minsizeDefines, "");
+ this->JoinDefines(debugrelDefinesSet, debugrelDefines, "");
flags += defines;
flagsDebug += debugDefines;
@@ -1803,7 +1800,7 @@ void cmLocalVisualStudio6Generator::WriteDSPFooter(std::ostream& fout)
//----------------------------------------------------------------------------
void cmLocalVisualStudio6Generator
::ComputeLinkOptions(cmTarget& target,
- const char* configName,
+ const std::string& configName,
const std::string extraOptions,
std::string& options)
{
diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h
index f45bc17..4771833 100644
--- a/Source/cmLocalVisualStudio6Generator.h
+++ b/Source/cmLocalVisualStudio6Generator.h
@@ -48,7 +48,7 @@ public:
/**
* Specify the type of the build: static, dll, or executable.
*/
- void SetBuildType(BuildType, const char* libName, cmTarget&);
+ void SetBuildType(BuildType, const std::string& libName, cmTarget&);
virtual std::string GetTargetDirectory(cmTarget const& target) const;
virtual std::string ComputeLongestObjectDirectory(cmTarget&) const;
@@ -56,15 +56,15 @@ private:
std::string DSPHeaderTemplate;
std::string DSPFooterTemplate;
- void CreateSingleDSP(const char *lname, cmTarget &tgt);
- void WriteDSPFile(std::ostream& fout, const char *libName,
+ void CreateSingleDSP(const std::string& lname, cmTarget &tgt);
+ void WriteDSPFile(std::ostream& fout, const std::string& libName,
cmTarget &tgt);
void WriteDSPBeginGroup(std::ostream& fout,
const char* group,
const char* filter);
void WriteDSPEndGroup(std::ostream& fout);
- void WriteDSPHeader(std::ostream& fout, const char *libName,
+ void WriteDSPHeader(std::ostream& fout, const std::string& libName,
cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
void WriteDSPFooter(std::ostream& fout);
@@ -77,20 +77,21 @@ private:
std::vector<std::string>& depends,
const cmCustomCommand& origCommand);
void WriteGroup(const cmSourceGroup *sg, cmTarget& target,
- std::ostream &fout, const char *libName);
+ std::ostream &fout, const std::string& libName);
class EventWriter;
friend class EventWriter;
cmsys::auto_ptr<cmCustomCommand>
- MaybeCreateOutputDir(cmTarget& target, const char* config);
+ MaybeCreateOutputDir(cmTarget& target, const std::string& config);
std::string CreateTargetRules(cmTarget &target,
- const char* configName,
- const char *libName);
- void ComputeLinkOptions(cmTarget& target, const char* configName,
+ const std::string& configName,
+ const std::string& libName);
+ void ComputeLinkOptions(cmTarget& target, const std::string& configName,
const std::string extraOptions,
std::string& options);
void OutputObjects(cmTarget& target, const char* tool,
std::string& options);
- std::string GetTargetIncludeOptions(cmTarget &target, const char *config);
+ std::string GetTargetIncludeOptions(cmTarget &target,
+ const std::string& config);
std::vector<std::string> Configurations;
std::string GetConfigName(std::string const& configuration) const;
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index d11bf55..4491140 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -59,7 +59,7 @@ cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator()
void cmLocalVisualStudio7Generator::AddHelperCommands()
{
- std::set<cmStdString> lang;
+ std::set<std::string> lang;
lang.insert("C");
lang.insert("CXX");
lang.insert("RC");
@@ -83,7 +83,7 @@ void cmLocalVisualStudio7Generator::AddHelperCommands()
if(path)
{
this->ReadAndStoreExternalGUID(
- l->second.GetName(), path);
+ l->second.GetName().c_str(), path);
}
else
{
@@ -141,7 +141,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
force_command.push_back(".");
cmCustomCommandLines force_commands;
force_commands.push_back(force_command);
- const char* no_main_dependency = 0;
+ std::string no_main_dependency = "";
std::string force = this->Makefile->GetStartOutputDirectory();
force += cmake::GetCMakeFilesDirectory();
force += "/";
@@ -228,7 +228,7 @@ void cmLocalVisualStudio7Generator::WriteStampFiles()
//----------------------------------------------------------------------------
void cmLocalVisualStudio7Generator
-::CreateSingleVCProj(const char *lname, cmTarget &target)
+::CreateSingleVCProj(const std::string& lname, cmTarget &target)
{
this->FortranProject =
static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
@@ -245,8 +245,7 @@ void cmLocalVisualStudio7Generator
}
// add to the list of projects
- std::string pname = lname;
- target.SetProperty("GENERATOR_FILE_NAME",lname);
+ target.SetProperty("GENERATOR_FILE_NAME",lname.c_str());
// create the dsp.cmake file
std::string fname;
fname = this->Makefile->GetStartOutputDirectory();
@@ -334,8 +333,8 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
}
void cmLocalVisualStudio7Generator::WriteConfigurations(std::ostream& fout,
- const char *libName,
- cmTarget &target)
+ const std::string& libName,
+ cmTarget &target)
{
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
@@ -589,7 +588,7 @@ class cmLocalVisualStudio7Generator::EventWriter
{
public:
EventWriter(cmLocalVisualStudio7Generator* lg,
- const char* config, std::ostream& os):
+ const std::string& config, std::ostream& os):
LG(lg), Config(config), Stream(os), First(true) {}
void Start(const char* tool)
{
@@ -630,16 +629,16 @@ public:
}
private:
cmLocalVisualStudio7Generator* LG;
- const char* Config;
+ std::string Config;
std::ostream& Stream;
bool First;
};
//----------------------------------------------------------------------------
void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
- const char* configName,
- const char *libName,
- cmTarget &target)
+ const std::string& configName,
+ const std::string& libName,
+ cmTarget &target)
{
const char* mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG");
if(!mfcFlag)
@@ -687,17 +686,18 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
std::string flags;
if(strcmp(configType, "10") != 0)
{
- const char* linkLanguage = (this->FortranProject? "Fortran":
+ const std::string& linkLanguage = (this->FortranProject?
+ std::string("Fortran"):
target.GetLinkerLanguage(configName));
- if(!linkLanguage)
+ if(linkLanguage.empty())
{
cmSystemTools::Error
("CMake can not determine linker language for target: ",
- target.GetName());
+ target.GetName().c_str());
return;
}
- if(strcmp(linkLanguage, "C") == 0 || strcmp(linkLanguage, "CXX") == 0
- || strcmp(linkLanguage, "Fortran") == 0)
+ if(linkLanguage == "C" || linkLanguage == "CXX"
+ || linkLanguage == "Fortran")
{
std::string baseFlagVar = "CMAKE_";
baseFlagVar += linkLanguage;
@@ -709,11 +709,11 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
flags += this->Makefile->GetRequiredDefinition(flagVar.c_str());
}
// set the correct language
- if(strcmp(linkLanguage, "C") == 0)
+ if(linkLanguage == "C")
{
flags += " /TC ";
}
- if(strcmp(linkLanguage, "CXX") == 0)
+ if(linkLanguage == "CXX")
{
flags += " /TP ";
}
@@ -745,7 +745,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
table,
this->ExtraFlagTable);
targetOptions.FixExceptionHandlingDefault();
- std::string asmLocation = std::string(configName) + "/";
+ std::string asmLocation = configName + "/";
targetOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str());
targetOptions.Parse(flags.c_str());
targetOptions.Parse(defineFlags.c_str());
@@ -944,7 +944,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
//----------------------------------------------------------------------------
std::string
cmLocalVisualStudio7Generator
-::GetBuildTypeLinkerFlags(std::string rootLinkerFlags, const char* configName)
+::GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
+ const std::string& configName)
{
std::string configTypeUpper = cmSystemTools::UpperCase(configName);
std::string extraLinkOptionsBuildTypeDef =
@@ -958,7 +959,8 @@ cmLocalVisualStudio7Generator
}
void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
- const char* configName, cmTarget &target, const Options& targetOptions)
+ const std::string& configName, cmTarget &target,
+ const Options& targetOptions)
{
cmGlobalVisualStudio7Generator* gg =
static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator);
@@ -1081,7 +1083,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
return;
}
cmComputeLinkInformation& cli = *pcli;
- const char* linkLanguage = cli.GetLinkLanguage();
+ std::string linkLanguage = cli.GetLinkLanguage();
// Compute the variable name to lookup standard libraries for this
// language.
@@ -1177,7 +1179,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
return;
}
cmComputeLinkInformation& cli = *pcli;
- const char* linkLanguage = cli.GetLinkLanguage();
+ std::string linkLanguage = cli.GetLinkLanguage();
bool isWin32Executable = target.GetPropertyAsBool("WIN32_EXECUTABLE");
@@ -1379,7 +1381,7 @@ cmLocalVisualStudio7Generator
}
void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
- const char *libName,
+ const std::string& libName,
cmTarget &target)
{
// get the configurations
@@ -1468,7 +1470,7 @@ public:
cmTarget& target,
cmSourceFile const& sf,
std::vector<std::string>* configs);
- std::map<cmStdString, cmLVS7GFileConfig> FileConfigMap;
+ std::map<std::string, cmLVS7GFileConfig> FileConfigMap;
};
cmLocalVisualStudio7GeneratorFCInfo
@@ -1546,14 +1548,14 @@ cmLocalVisualStudio7GeneratorFCInfo
}
}
- const char* lang =
+ std::string lang =
lg->GlobalGenerator->GetLanguageFromExtension
(sf.GetExtension().c_str());
- const char* sourceLang = lg->GetSourceFileLanguage(sf);
- const char* linkLanguage = target.GetLinkerLanguage(i->c_str());
+ const std::string& sourceLang = lg->GetSourceFileLanguage(sf);
+ const std::string& linkLanguage = target.GetLinkerLanguage(i->c_str());
bool needForceLang = false;
// source file does not match its extension language
- if(lang && sourceLang && strcmp(lang, sourceLang) != 0)
+ if(lang != sourceLang)
{
needForceLang = true;
lang = sourceLang;
@@ -1569,16 +1571,15 @@ cmLocalVisualStudio7GeneratorFCInfo
// if the source file does not match the linker language
// then force c or c++
- if(needForceLang || (linkLanguage && lang
- && strcmp(lang, linkLanguage) != 0))
+ if(needForceLang || (linkLanguage != lang))
{
- if(strcmp(lang, "CXX") == 0)
+ if(lang == "CXX")
{
// force a C++ file type
fc.CompileFlags += " /TP ";
needfc = true;
}
- else if(strcmp(lang, "C") == 0)
+ else if(lang == "C")
{
// force to c
fc.CompileFlags += " /TC ";
@@ -1627,7 +1628,7 @@ cmLocalVisualStudio7Generator
bool cmLocalVisualStudio7Generator
::WriteGroup(const cmSourceGroup *sg, cmTarget& target,
- std::ostream &fout, const char *libName,
+ std::ostream &fout, const std::string& libName,
std::vector<std::string> *configs)
{
const std::vector<const cmSourceFile *> &sourceFiles =
@@ -1713,7 +1714,7 @@ bool cmLocalVisualStudio7Generator
aCompilerTool = "VFCustomBuildTool";
}
}
- for(std::map<cmStdString, cmLVS7GFileConfig>::const_iterator
+ for(std::map<std::string, cmLVS7GFileConfig>::const_iterator
fci = fcinfo.FileConfigMap.begin();
fci != fcinfo.FileConfigMap.end(); ++fci)
{
@@ -1904,9 +1905,9 @@ void cmLocalVisualStudio7Generator::WriteVCProjEndGroup(std::ostream& fout)
// look for custom rules on a target and collect them together
void cmLocalVisualStudio7Generator
::OutputTargetRules(std::ostream& fout,
- const char* configName,
+ const std::string& configName,
cmTarget &target,
- const char * /*libName*/)
+ const std::string& /*libName*/)
{
if (target.GetType() > cmTarget::GLOBAL_TARGET)
{
@@ -1966,7 +1967,7 @@ void cmLocalVisualStudio7Generator::WriteProjectSCC(std::ostream& fout,
void
cmLocalVisualStudio7Generator
::WriteProjectStartFortran(std::ostream& fout,
- const char *libName,
+ const std::string& libName,
cmTarget & target)
{
@@ -2017,7 +2018,7 @@ cmLocalVisualStudio7Generator
}
this->WriteProjectSCC(fout, target);
fout<< "\tKeyword=\"" << keyword << "\">\n"
- << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\">\n"
+ << "\tProjectGUID=\"{" << gg->GetGUID(libName.c_str()) << "}\">\n"
<< "\t<Platforms>\n"
<< "\t\t<Platform\n\t\t\tName=\"" << this->PlatformName << "\"/>\n"
<< "\t</Platforms>\n";
@@ -2026,7 +2027,7 @@ cmLocalVisualStudio7Generator
void
cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
- const char *libName,
+ const std::string& libName,
cmTarget & target,
std::vector<cmSourceGroup> &)
{
@@ -2049,7 +2050,7 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
const char* projLabel = target.GetProperty("PROJECT_LABEL");
if(!projLabel)
{
- projLabel = libName;
+ projLabel = libName.c_str();
}
const char* keyword = target.GetProperty("VS_KEYWORD");
if(!keyword)
@@ -2061,7 +2062,7 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
fout << "\tName=\"" << projLabel << "\"\n";
if(this->Version >= VS8)
{
- fout << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\"\n";
+ fout << "\tProjectGUID=\"{" << gg->GetGUID(libName.c_str()) << "}\"\n";
}
this->WriteProjectSCC(fout, target);
if(const char* targetFrameworkVersion =
@@ -2101,7 +2102,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFooter(std::ostream& fout,
<< "</VisualStudioProject>\n";
}
-std::string cmLocalVisualStudio7GeneratorEscapeForXML(const char* s)
+std::string cmLocalVisualStudio7GeneratorEscapeForXML(const std::string& s)
{
std::string ret = s;
cmSystemTools::ReplaceString(ret, "&", "&amp;");
@@ -2112,7 +2113,7 @@ std::string cmLocalVisualStudio7GeneratorEscapeForXML(const char* s)
return ret;
}
-std::string cmLocalVisualStudio7Generator::EscapeForXML(const char* s)
+std::string cmLocalVisualStudio7Generator::EscapeForXML(const std::string& s)
{
return cmLocalVisualStudio7GeneratorEscapeForXML(s);
}
@@ -2145,10 +2146,10 @@ std::string cmLocalVisualStudio7Generator
class cmVS7XMLParser : public cmXMLParser
{
public:
- virtual void EndElement(const char* /* name */)
+ virtual void EndElement(const std::string& /* name */)
{
}
- virtual void StartElement(const char* name, const char** atts)
+ virtual void StartElement(const std::string& name, const char** atts)
{
// once the GUID is found do nothing
if(this->GUID.size())
@@ -2156,7 +2157,7 @@ public:
return;
}
int i =0;
- if(strcmp("VisualStudioProject", name) == 0)
+ if("VisualStudioProject" == name)
{
while(atts[i])
{
@@ -2193,7 +2194,7 @@ public:
};
void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID(
- const char* name,
+ const std::string& name,
const char* path)
{
cmVS7XMLParser parser;
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index 92e4d3c..6c04559 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -51,9 +51,9 @@ public:
/**
* Specify the type of the build: static, dll, or executable.
*/
- void SetBuildType(BuildType,const char *name);
+ void SetBuildType(BuildType,const std::string& name);
- void SetPlatformName(const char* n) { this->PlatformName = n;}
+ void SetPlatformName(const std::string& n) { this->PlatformName = n;}
void SetExtraFlagTable(cmVS7FlagTable const* table)
{ this->ExtraFlagTable = table; }
@@ -62,41 +62,41 @@ public:
void WriteStampFiles();
virtual std::string ComputeLongestObjectDirectory(cmTarget&) const;
- virtual void ReadAndStoreExternalGUID(const char* name,
+ virtual void ReadAndStoreExternalGUID(const std::string& name,
const char* path);
virtual void AddCMakeListsRules();
protected:
- void CreateSingleVCProj(const char *lname, cmTarget &tgt);
+ void CreateSingleVCProj(const std::string& lname, cmTarget &tgt);
private:
typedef cmVisualStudioGeneratorOptions Options;
typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo;
std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
- const char* configName);
+ const std::string& configName);
void FixGlobalTargets();
void WriteProjectFiles();
- void WriteVCProjHeader(std::ostream& fout, const char *libName,
+ void WriteVCProjHeader(std::ostream& fout, const std::string& libName,
cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
void WriteVCProjFooter(std::ostream& fout, cmTarget &target);
- void WriteVCProjFile(std::ostream& fout, const char *libName,
+ void WriteVCProjFile(std::ostream& fout, const std::string& libName,
cmTarget &tgt);
void WriteConfigurations(std::ostream& fout,
- const char *libName, cmTarget &tgt);
+ const std::string& libName, cmTarget &tgt);
void WriteConfiguration(std::ostream& fout,
- const char* configName,
- const char* libName, cmTarget &tgt);
- std::string EscapeForXML(const char* s);
+ const std::string& configName,
+ const std::string& libName, cmTarget &tgt);
+ std::string EscapeForXML(const std::string& s);
std::string ConvertToXMLOutputPath(const char* path);
std::string ConvertToXMLOutputPathSingle(const char* path);
- void OutputTargetRules(std::ostream& fout, const char* configName,
- cmTarget &target, const char *libName);
- void OutputBuildTool(std::ostream& fout, const char* configName,
+ void OutputTargetRules(std::ostream& fout, const std::string& configName,
+ cmTarget &target, const std::string& libName);
+ void OutputBuildTool(std::ostream& fout, const std::string& configName,
cmTarget& t, const Options& targetOptions);
void OutputLibraryDirectories(std::ostream& fout,
std::vector<std::string> const& dirs);
void WriteProjectSCC(std::ostream& fout, cmTarget& target);
- void WriteProjectStart(std::ostream& fout, const char *libName,
+ void WriteProjectStart(std::ostream& fout, const std::string& libName,
cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
- void WriteProjectStartFortran(std::ostream& fout, const char *libName,
+ void WriteProjectStartFortran(std::ostream& fout, const std::string& libName,
cmTarget &tgt);
void WriteVCProjBeginGroup(std::ostream& fout,
const char* group,
@@ -111,7 +111,8 @@ private:
bool WriteGroup(const cmSourceGroup *sg,
cmTarget& target, std::ostream &fout,
- const char *libName, std::vector<std::string> *configs);
+ const std::string& libName,
+ std::vector<std::string> *configs);
friend class cmLocalVisualStudio7GeneratorFCInfo;
friend class cmLocalVisualStudio7GeneratorInternals;
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index ef2bb1d..6e93d22 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -33,7 +33,7 @@ cmLocalVisualStudioGenerator::~cmLocalVisualStudioGenerator()
//----------------------------------------------------------------------------
cmsys::auto_ptr<cmCustomCommand>
cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target,
- const char* config,
+ const std::string& config,
bool isFortran)
{
cmsys::auto_ptr<cmCustomCommand> pcc;
@@ -80,8 +80,8 @@ const char* cmLocalVisualStudioGenerator::GetReportErrorLabel() const
std::string
cmLocalVisualStudioGenerator
::ConstructScript(cmCustomCommand const& cc,
- const char* configName,
- const char* newline_text)
+ const std::string& configName,
+ const std::string& newline_text)
{
bool useLocal = this->CustomCommandUseLocal();
const char* workingDirectory = cc.GetWorkingDirectory();
@@ -89,7 +89,7 @@ cmLocalVisualStudioGenerator
RelativeRoot relativeRoot = workingDirectory? NONE : START_OUTPUT;
// Avoid leading or trailing newlines.
- const char* newline = "";
+ std::string newline = "";
// Line to check for error between commands.
std::string check_error = newline_text;
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index 1a3499a..94a6293 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -47,8 +47,8 @@ public:
/** Construct a script from the given list of command lines. */
std::string ConstructScript(cmCustomCommand const& cc,
- const char* configName,
- const char* newline = "\n");
+ const std::string& configName,
+ const std::string& newline = "\n");
/** Label to which to jump in a batch file after a failed step in a
sequence of custom commands. */
@@ -67,7 +67,8 @@ protected:
/** Construct a custom command to make exe import lib dir. */
cmsys::auto_ptr<cmCustomCommand>
- MaybeCreateImplibDir(cmTarget& target, const char* config, bool isFortran);
+ MaybeCreateImplibDir(cmTarget& target, const std::string& config,
+ bool isFortran);
VSVersion Version;
};
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index a9a27b9..5857aef 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -37,7 +37,7 @@ cmLocalXCodeGenerator::GetTargetDirectory(cmTarget const&) const
//----------------------------------------------------------------------------
void cmLocalXCodeGenerator::AppendFlagEscape(std::string& flags,
- const char* rawFlag)
+ const std::string& rawFlag)
{
cmGlobalXCodeGenerator* gg =
static_cast<cmGlobalXCodeGenerator*>(this->GlobalGenerator);
@@ -54,7 +54,7 @@ void cmLocalXCodeGenerator::Generate()
iter != targets.end(); ++iter)
{
cmTarget* t = &iter->second;
- t->HasMacOSXRpathInstallNameDir(NULL);
+ t->HasMacOSXRpathInstallNameDir("");
}
}
@@ -68,6 +68,6 @@ void cmLocalXCodeGenerator::GenerateInstallRules()
iter != targets.end(); ++iter)
{
cmTarget* t = &iter->second;
- t->HasMacOSXRpathInstallNameDir(NULL);
+ t->HasMacOSXRpathInstallNameDir("");
}
}
diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h
index edd2f5b..3bfe3a3 100644
--- a/Source/cmLocalXCodeGenerator.h
+++ b/Source/cmLocalXCodeGenerator.h
@@ -28,7 +28,8 @@ public:
virtual ~cmLocalXCodeGenerator();
virtual std::string GetTargetDirectory(cmTarget const& target) const;
- virtual void AppendFlagEscape(std::string& flags, const char* rawFlag);
+ virtual void AppendFlagEscape(std::string& flags,
+ const std::string& rawFlag);
virtual void Generate();
virtual void GenerateInstallRules();
private:
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 499d3c6..9d253b8 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -65,7 +65,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return this->Args[0].c_str(); }
+ virtual std::string GetName() const { return this->Args[0]; }
cmTypeMacro(cmMacroHelperCommand, cmCommand);
diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h
index 4c585d8..5c1cc00 100644
--- a/Source/cmMacroCommand.h
+++ b/Source/cmMacroCommand.h
@@ -57,7 +57,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "macro";}
+ virtual std::string GetName() const { return "macro";}
cmTypeMacro(cmMacroCommand, cmCommand);
};
diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx
index 615e6f2..03ad37c 100644
--- a/Source/cmMakeDepend.cxx
+++ b/Source/cmMakeDepend.cxx
@@ -359,7 +359,7 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath)
}
// Add a directory to the search path
-void cmMakeDepend::AddSearchPath(const char* path)
+void cmMakeDepend::AddSearchPath(const std::string& path)
{
this->IncludeDirectories.push_back(path);
}
diff --git a/Source/cmMakeDepend.h b/Source/cmMakeDepend.h
index b6e3928..2c9d515 100644
--- a/Source/cmMakeDepend.h
+++ b/Source/cmMakeDepend.h
@@ -94,7 +94,7 @@ public:
/**
* Add a directory to the search path for include files.
*/
- virtual void AddSearchPath(const char*);
+ virtual void AddSearchPath(const std::string&);
/**
* Generate dependencies for the file given. Returns a pointer to
@@ -138,10 +138,10 @@ protected:
cmsys::RegularExpression IncludeFileRegularExpression;
cmsys::RegularExpression ComplainFileRegularExpression;
std::vector<std::string> IncludeDirectories;
- typedef std::map<cmStdString, cmStdString> FileToPathMapType;
- typedef std::map<cmStdString, FileToPathMapType>
+ typedef std::map<std::string, std::string> FileToPathMapType;
+ typedef std::map<std::string, FileToPathMapType>
DirectoryToFileToPathMapType;
- typedef std::map<cmStdString, cmDependInformation*>
+ typedef std::map<std::string, cmDependInformation*>
DependInformationMapType;
DependInformationMapType DependInformationMap;
DirectoryToFileToPathMapType DirectoryToFileToPathMap;
diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h
index 49a4009..71b97eb 100644
--- a/Source/cmMakeDirectoryCommand.h
+++ b/Source/cmMakeDirectoryCommand.h
@@ -44,7 +44,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "make_directory";}
+ virtual std::string GetName() const { return "make_directory";}
/**
* This determines if the command is invoked when in script mode.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 556e7a4..92177c8 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -45,8 +45,8 @@ class cmMakefile::Internals
{
public:
std::stack<cmDefinitions, std::list<cmDefinitions> > VarStack;
- std::stack<std::set<cmStdString> > VarInitStack;
- std::stack<std::set<cmStdString> > VarUsageStack;
+ std::stack<std::set<std::string> > VarInitStack;
+ std::stack<std::set<std::string> > VarUsageStack;
bool IsSourceFileTryCompile;
};
@@ -54,7 +54,7 @@ public:
cmMakefile::cmMakefile(): Internal(new Internals)
{
const cmDefinitions& defs = cmDefinitions();
- const std::set<cmStdString> globalKeys = defs.LocalKeys();
+ const std::set<std::string> globalKeys = defs.LocalKeys();
this->Internal->VarStack.push(defs);
this->Internal->VarInitStack.push(globalKeys);
this->Internal->VarUsageStack.push(globalKeys);
@@ -203,7 +203,7 @@ cmMakefile::~cmMakefile()
{
delete *i;
}
- for(std::map<cmStdString, cmTest*>::iterator i = this->Tests.begin();
+ for(std::map<std::string, cmTest*>::iterator i = this->Tests.begin();
i != this->Tests.end(); ++i)
{
delete i->second;
@@ -247,10 +247,10 @@ void cmMakefile::PrintStringVector(const char* s,
void cmMakefile
::PrintStringVector(const char* s,
- const std::vector<std::pair<cmStdString, bool> >& v) const
+ const std::vector<std::pair<std::string, bool> >& v) const
{
std::cout << s << ": ( \n";
- for(std::vector<std::pair<cmStdString, bool> >::const_iterator i
+ for(std::vector<std::pair<std::string, bool> >::const_iterator i
= v.begin(); i != v.end(); ++i)
{
std::cout << i->first.c_str() << " " << i->second;
@@ -878,7 +878,7 @@ void cmMakefile::ConfigureFinalPass()
//----------------------------------------------------------------------------
void
-cmMakefile::AddCustomCommandToTarget(const char* target,
+cmMakefile::AddCustomCommandToTarget(const std::string& target,
const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines,
cmTarget::CustomCommandType type,
@@ -950,7 +950,7 @@ cmMakefile::AddCustomCommandToTarget(const char* target,
cmSourceFile*
cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
const std::vector<std::string>& depends,
- const char* main_dependency,
+ const std::string& main_dependency,
const cmCustomCommandLines& commandLines,
const char* comment,
const char* workingDir,
@@ -980,7 +980,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
// Choose a source file on which to store the custom command.
cmSourceFile* file = 0;
- if(main_dependency && main_dependency[0])
+ if(!main_dependency.empty())
{
// The main dependency was specified. Use it unless a different
// custom command already used it.
@@ -1048,7 +1048,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
// Construct a complete list of dependencies.
std::vector<std::string> depends2(depends);
- if(main_dependency && main_dependency[0])
+ if(!main_dependency.empty())
{
depends2.push_back(main_dependency);
}
@@ -1102,9 +1102,9 @@ cmMakefile::UpdateOutputToSourceMap(std::string const& output,
//----------------------------------------------------------------------------
cmSourceFile*
-cmMakefile::AddCustomCommandToOutput(const char* output,
+cmMakefile::AddCustomCommandToOutput(const std::string& output,
const std::vector<std::string>& depends,
- const char* main_dependency,
+ const std::string& main_dependency,
const cmCustomCommandLines& commandLines,
const char* comment,
const char* workingDir,
@@ -1120,16 +1120,16 @@ cmMakefile::AddCustomCommandToOutput(const char* output,
//----------------------------------------------------------------------------
void
-cmMakefile::AddCustomCommandOldStyle(const char* target,
+cmMakefile::AddCustomCommandOldStyle(const std::string& target,
const std::vector<std::string>& outputs,
const std::vector<std::string>& depends,
- const char* source,
+ const std::string& source,
const cmCustomCommandLines& commandLines,
const char* comment)
{
// Translate the old-style signature to one of the new-style
// signatures.
- if(strcmp(source, target) == 0)
+ if(source == target)
{
// In the old-style signature if the source and target were the
// same then it added a post-build rule to the target. Preserve
@@ -1160,7 +1160,7 @@ cmMakefile::AddCustomCommandOldStyle(const char* target,
else
{
// The source may not be a real file. Do not use a main dependency.
- const char* no_main_dependency = 0;
+ std::string no_main_dependency = "";
std::vector<std::string> depends2 = depends;
depends2.push_back(source);
sf = this->AddCustomCommandToOutput(output, depends2, no_main_dependency,
@@ -1179,7 +1179,8 @@ cmMakefile::AddCustomCommandOldStyle(const char* target,
else
{
cmSystemTools::Error("Attempt to add a custom rule to a target "
- "that does not exist yet for target ", target);
+ "that does not exist yet for target ",
+ target.c_str());
return;
}
}
@@ -1187,7 +1188,7 @@ cmMakefile::AddCustomCommandOldStyle(const char* target,
}
//----------------------------------------------------------------------------
-void cmMakefile::AddUtilityCommand(const char* utilityName,
+void cmMakefile::AddUtilityCommand(const std::string& utilityName,
bool excludeFromAll,
const std::vector<std::string>& depends,
const char* workingDirectory,
@@ -1226,7 +1227,7 @@ void cmMakefile::AddUtilityCommand(const char* utilityName,
//----------------------------------------------------------------------------
cmTarget*
-cmMakefile::AddUtilityCommand(const char* utilityName,
+cmMakefile::AddUtilityCommand(const std::string& utilityName,
bool excludeFromAll,
const char* workingDirectory,
const std::vector<std::string>& depends,
@@ -1250,7 +1251,7 @@ cmMakefile::AddUtilityCommand(const char* utilityName,
force += cmake::GetCMakeFilesDirectory();
force += "/";
force += utilityName;
- const char* no_main_dependency = 0;
+ std::string no_main_dependency = "";
bool no_replace = false;
this->AddCustomCommandToOutput(force.c_str(), depends,
no_main_dependency,
@@ -1377,8 +1378,8 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
// VS6 IDE does not support definition values with spaces in
// combination with '"', '$', or ';'.
- if((strcmp(this->LocalGenerator->GetGlobalGenerator()->GetName(),
- "Visual Studio 6") == 0) &&
+ if((this->LocalGenerator->GetGlobalGenerator()->GetName() ==
+ "Visual Studio 6") &&
(def.find(" ") != def.npos && def.find_first_of("\"$;") != def.npos))
{
return false;
@@ -1453,7 +1454,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
return true;
}
-void cmMakefile::AddLinkLibrary(const char* lib,
+void cmMakefile::AddLinkLibrary(const std::string& lib,
cmTarget::LinkLibraryType llt)
{
cmTarget::LibraryID tmp;
@@ -1462,15 +1463,15 @@ void cmMakefile::AddLinkLibrary(const char* lib,
this->LinkLibraries.push_back(tmp);
}
-void cmMakefile::AddLinkLibraryForTarget(const char *target,
- const char* lib,
+void cmMakefile::AddLinkLibraryForTarget(const std::string& target,
+ const std::string& lib,
cmTarget::LinkLibraryType llt)
{
cmTargets::iterator i = this->Targets.find(target);
if ( i != this->Targets.end())
{
cmTarget* tgt =
- this->GetCMakeInstance()->GetGlobalGenerator()->FindTarget(0,lib);
+ this->GetCMakeInstance()->GetGlobalGenerator()->FindTarget(lib);
if(tgt)
{
// if it is not a static or shared library then you can not link to it
@@ -1500,8 +1501,8 @@ void cmMakefile::AddLinkLibraryForTarget(const char *target,
}
}
-void cmMakefile::AddLinkDirectoryForTarget(const char *target,
- const char* d)
+void cmMakefile::AddLinkDirectoryForTarget(const std::string& target,
+ const std::string& d)
{
cmTargets::iterator i = this->Targets.find(target);
if ( i != this->Targets.end())
@@ -1520,46 +1521,37 @@ void cmMakefile::AddLinkDirectoryForTarget(const char *target,
{
cmSystemTools::Error
("Attempt to add link directories to non-existent target: ",
- target, " for directory ", d);
+ target.c_str(), " for directory ", d.c_str());
}
}
-void cmMakefile::AddLinkLibrary(const char* lib)
+void cmMakefile::AddLinkLibrary(const std::string& lib)
{
this->AddLinkLibrary(lib,cmTarget::GENERAL);
}
-void cmMakefile::AddLinkDirectory(const char* dir)
+void cmMakefile::AddLinkDirectory(const std::string& dir)
{
// Don't add a link directory that is already present. Yes, this
// linear search results in n^2 behavior, but n won't be getting
// much bigger than 20. We cannot use a set because of order
// dependency of the link search path.
- if(!dir)
+ if(dir.empty())
{
return;
}
+ std::string newdir = dir;
// remove trailing slashes
- if(dir[strlen(dir)-1] == '/')
+ if(*dir.rbegin() == '/')
{
- std::string newdir = dir;
- newdir = newdir.substr(0, newdir.size()-1);
- if(std::find(this->LinkDirectories.begin(),
- this->LinkDirectories.end(),
- newdir.c_str()) == this->LinkDirectories.end())
- {
- this->LinkDirectories.push_back(newdir);
- }
+ newdir = dir.substr(0, dir.size()-1);
}
- else
+ if(std::find(this->LinkDirectories.begin(),
+ this->LinkDirectories.end(), newdir)
+ == this->LinkDirectories.end())
{
- if(std::find(this->LinkDirectories.begin(),
- this->LinkDirectories.end(), dir)
- == this->LinkDirectories.end())
- {
- this->LinkDirectories.push_back(dir);
- }
+ this->LinkDirectories.push_back(dir);
}
}
@@ -1656,7 +1648,7 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
}
}
-void cmMakefile::AddSubDirectory(const char* sub,
+void cmMakefile::AddSubDirectory(const std::string& sub,
bool excludeFromAll, bool preorder)
{
// the source path must be made full if it isn't already
@@ -1683,7 +1675,8 @@ void cmMakefile::AddSubDirectory(const char* sub,
}
-void cmMakefile::AddSubDirectory(const char* srcPath, const char *binPath,
+void cmMakefile::AddSubDirectory(const std::string& srcPath,
+ const std::string& binPath,
bool excludeFromAll, bool preorder,
bool immediate)
{
@@ -1753,9 +1746,9 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
//----------------------------------------------------------------------------
void
-cmMakefile::AddSystemIncludeDirectories(const std::set<cmStdString> &incs)
+cmMakefile::AddSystemIncludeDirectories(const std::set<std::string> &incs)
{
- for(std::set<cmStdString>::const_iterator li = incs.begin();
+ for(std::set<std::string>::const_iterator li = incs.begin();
li != incs.end(); ++li)
{
this->SystemIncludeDirectories.insert(*li);
@@ -1769,7 +1762,7 @@ cmMakefile::AddSystemIncludeDirectories(const std::set<cmStdString> &incs)
}
}
-void cmMakefile::AddDefinition(const char* name, const char* value)
+void cmMakefile::AddDefinition(const std::string& name, const char* value)
{
if (!value )
{
@@ -1798,14 +1791,15 @@ void cmMakefile::AddDefinition(const char* name, const char* value)
}
-void cmMakefile::AddCacheDefinition(const char* name, const char* value,
+void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
const char* doc,
cmCacheManager::CacheEntryType type,
bool force)
{
- const char* val = value;
+ bool haveVal = value ? true : false;
+ std::string val = haveVal ? value : "";
cmCacheManager::CacheIterator it =
- this->GetCacheManager()->GetCacheIterator(name);
+ this->GetCacheManager()->GetCacheIterator(name.c_str());
if(!it.IsAtEnd() && (it.GetType() == cmCacheManager::UNINITIALIZED) &&
it.Initialized())
{
@@ -1814,6 +1808,7 @@ void cmMakefile::AddCacheDefinition(const char* name, const char* value,
if(!force)
{
val = it.GetValue();
+ haveVal = true;
}
if ( type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH )
{
@@ -1836,16 +1831,18 @@ void cmMakefile::AddCacheDefinition(const char* name, const char* value,
this->GetCacheManager()->AddCacheEntry(name, nvalue.c_str(), doc, type);
val = it.GetValue();
+ haveVal = true;
}
}
- this->GetCacheManager()->AddCacheEntry(name, val, doc, type);
+ this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0, doc,
+ type);
// if there was a definition then remove it
this->Internal->VarStack.top().Set(name, 0);
}
-void cmMakefile::AddDefinition(const char* name, bool value)
+void cmMakefile::AddDefinition(const std::string& name, bool value)
{
this->Internal->VarStack.top().Set(name, value? "ON" : "OFF");
if (this->Internal->VarUsageStack.size() &&
@@ -1872,20 +1869,20 @@ void cmMakefile::CheckForUnusedVariables() const
return;
}
const cmDefinitions& defs = this->Internal->VarStack.top();
- const std::set<cmStdString>& locals = defs.LocalKeys();
- std::set<cmStdString>::const_iterator it = locals.begin();
+ const std::set<std::string>& locals = defs.LocalKeys();
+ std::set<std::string>::const_iterator it = locals.begin();
for (; it != locals.end(); ++it)
{
this->CheckForUnused("out of scope", it->c_str());
}
}
-void cmMakefile::MarkVariableAsUsed(const char* var)
+void cmMakefile::MarkVariableAsUsed(const std::string& var)
{
this->Internal->VarUsageStack.top().insert(var);
}
-bool cmMakefile::VariableInitialized(const char* var) const
+bool cmMakefile::VariableInitialized(const std::string& var) const
{
if(this->Internal->VarInitStack.top().find(var) !=
this->Internal->VarInitStack.top().end())
@@ -1895,7 +1892,7 @@ bool cmMakefile::VariableInitialized(const char* var) const
return false;
}
-bool cmMakefile::VariableUsed(const char* var) const
+bool cmMakefile::VariableUsed(const std::string& var) const
{
if(this->Internal->VarUsageStack.top().find(var) !=
this->Internal->VarUsageStack.top().end())
@@ -1905,11 +1902,12 @@ bool cmMakefile::VariableUsed(const char* var) const
return false;
}
-void cmMakefile::CheckForUnused(const char* reason, const char* name) const
+void cmMakefile::CheckForUnused(const char* reason,
+ const std::string& name) const
{
if (this->WarnUnused && !this->VariableUsed(name))
{
- cmStdString path;
+ std::string path;
cmListFileBacktrace bt;
if (this->CallStack.size())
{
@@ -1943,7 +1941,7 @@ void cmMakefile::CheckForUnused(const char* reason, const char* name) const
}
}
-void cmMakefile::RemoveDefinition(const char* name)
+void cmMakefile::RemoveDefinition(const std::string& name)
{
this->Internal->VarStack.top().Set(name, 0);
if (this->Internal->VarUsageStack.size() &&
@@ -1963,7 +1961,7 @@ void cmMakefile::RemoveDefinition(const char* name)
#endif
}
-void cmMakefile::RemoveCacheDefinition(const char* name)
+void cmMakefile::RemoveCacheDefinition(const std::string& name)
{
this->GetCacheManager()->RemoveCacheEntry(name);
}
@@ -1974,7 +1972,8 @@ void cmMakefile::SetProjectName(const char* p)
}
-void cmMakefile::AddGlobalLinkInformation(const char* name, cmTarget& target)
+void cmMakefile::AddGlobalLinkInformation(const std::string& name,
+ cmTarget& target)
{
// for these targets do not add anything
switch(target.GetType())
@@ -1995,13 +1994,14 @@ void cmMakefile::AddGlobalLinkInformation(const char* name, cmTarget& target)
}
-void cmMakefile::AddAlias(const char* lname, cmTarget *tgt)
+void cmMakefile::AddAlias(const std::string& lname, cmTarget *tgt)
{
this->AliasTargets[lname] = tgt;
this->LocalGenerator->GetGlobalGenerator()->AddAlias(lname, tgt);
}
-cmTarget* cmMakefile::AddLibrary(const char* lname, cmTarget::TargetType type,
+cmTarget* cmMakefile::AddLibrary(const std::string& lname,
+ cmTarget::TargetType type,
const std::vector<std::string> &srcs,
bool excludeFromAll)
{
@@ -2047,7 +2047,7 @@ cmTarget* cmMakefile::AddExecutable(const char *exeName,
//----------------------------------------------------------------------------
cmTarget*
-cmMakefile::AddNewTarget(cmTarget::TargetType type, const char* name)
+cmMakefile::AddNewTarget(cmTarget::TargetType type, const std::string& name)
{
cmTargets::iterator it =
this->Targets.insert(cmTargets::value_type(name, cmTarget())).first;
@@ -2059,9 +2059,8 @@ cmMakefile::AddNewTarget(cmTarget::TargetType type, const char* name)
}
cmSourceFile*
-cmMakefile::LinearGetSourceFileWithOutput(const char *cname) const
+cmMakefile::LinearGetSourceFileWithOutput(const std::string& name) const
{
- std::string name = cname;
std::string out;
// look through all the source files that have custom commands
@@ -2095,15 +2094,14 @@ cmMakefile::LinearGetSourceFileWithOutput(const char *cname) const
return 0;
}
-cmSourceFile *cmMakefile::GetSourceFileWithOutput(const char *cname) const
+cmSourceFile *cmMakefile::GetSourceFileWithOutput(
+ const std::string& name) const
{
- std::string name = cname;
-
// If the queried path is not absolute we use the backward compatible
// linear-time search for an output with a matching suffix.
- if(!cmSystemTools::FileIsFullPath(cname))
+ if(!cmSystemTools::FileIsFullPath(name.c_str()))
{
- return LinearGetSourceFileWithOutput(cname);
+ return LinearGetSourceFileWithOutput(name.c_str());
}
// Otherwise we use an efficient lookup map.
OutputToSourceMap::const_iterator o = this->OutputToSource.find(name);
@@ -2148,15 +2146,12 @@ cmMakefile::GetSourceGroup(const std::vector<std::string>&name) const
return sg;
}
- void cmMakefile::AddSourceGroup(const char* name,
+void cmMakefile::AddSourceGroup(const std::string& name,
const char* regex)
{
- if (name)
- {
- std::vector<std::string> nameVector;
- nameVector.push_back(name);
- AddSourceGroup(nameVector, regex);
- }
+ std::vector<std::string> nameVector;
+ nameVector.push_back(name);
+ AddSourceGroup(nameVector, regex);
}
void cmMakefile::AddSourceGroup(const std::vector<std::string>& name,
@@ -2329,13 +2324,13 @@ void cmMakefile::ExpandVariablesCMP0019()
}
}
-bool cmMakefile::IsOn(const char* name) const
+bool cmMakefile::IsOn(const std::string& name) const
{
const char* value = this->GetDefinition(name);
return cmSystemTools::IsOn(value);
}
-bool cmMakefile::IsSet(const char* name) const
+bool cmMakefile::IsSet(const std::string& name) const
{
const char* value = this->GetDefinition(name);
if ( !value )
@@ -2365,10 +2360,10 @@ bool cmMakefile::PlatformIs64Bit() const
return false;
}
-const char* cmMakefile::GetSONameFlag(const char* language) const
+const char* cmMakefile::GetSONameFlag(const std::string& language) const
{
std::string name = "CMAKE_SHARED_LIBRARY_SONAME";
- if(language)
+ if(!language.empty())
{
name += "_";
name += language;
@@ -2406,7 +2401,7 @@ bool cmMakefile::CanIWriteThisFile(const char* fileName) const
return true;
}
-const char* cmMakefile::GetRequiredDefinition(const char* name) const
+const char* cmMakefile::GetRequiredDefinition(const std::string& name) const
{
const char* ret = this->GetDefinition(name);
if(!ret)
@@ -2414,13 +2409,13 @@ const char* cmMakefile::GetRequiredDefinition(const char* name) const
cmSystemTools::Error("Error required internal CMake variable not "
"set, cmake may be not be built correctly.\n",
"Missing variable is:\n",
- name);
+ name.c_str());
return "";
}
return ret;
}
-bool cmMakefile::IsDefinitionSet(const char* name) const
+bool cmMakefile::IsDefinitionSet(const std::string& name) const
{
const char* def = this->Internal->VarStack.top().Get(name);
this->Internal->VarUsageStack.top().insert(name);
@@ -2442,7 +2437,7 @@ bool cmMakefile::IsDefinitionSet(const char* name) const
return def?true:false;
}
-const char* cmMakefile::GetDefinition(const char* name) const
+const char* cmMakefile::GetDefinition(const std::string& name) const
{
if (this->WarnUnused)
{
@@ -2483,7 +2478,7 @@ const char* cmMakefile::GetDefinition(const char* name) const
return def;
}
-const char* cmMakefile::GetSafeDefinition(const char* def) const
+const char* cmMakefile::GetSafeDefinition(const std::string& def) const
{
const char* ret = this->GetDefinition(def);
if(!ret)
@@ -2496,7 +2491,7 @@ const char* cmMakefile::GetSafeDefinition(const char* def) const
std::vector<std::string> cmMakefile
::GetDefinitions(int cacheonly /* = 0 */) const
{
- std::set<cmStdString> definitions;
+ std::set<std::string> definitions;
if ( !cacheonly )
{
definitions = this->Internal->VarStack.top().ClosureKeys();
@@ -2510,7 +2505,7 @@ std::vector<std::string> cmMakefile
std::vector<std::string> res;
- std::set<cmStdString>::iterator fit;
+ std::set<std::string>::iterator fit;
for ( fit = definitions.begin(); fit != definitions.end(); fit ++ )
{
res.push_back(*fit);
@@ -2743,7 +2738,7 @@ void cmMakefile::AddDefaultDefinitions()
}
//----------------------------------------------------------------------------
-const char*
+std::string
cmMakefile::GetConfigurations(std::vector<std::string>& configs,
bool single) const
{
@@ -2754,12 +2749,12 @@ cmMakefile::GetConfigurations(std::vector<std::string>& configs,
{
cmSystemTools::ExpandListArgument(configTypes, configs);
}
- return 0;
+ return "";
}
else
{
- const char* buildType = this->GetDefinition("CMAKE_BUILD_TYPE");
- if(single && buildType && *buildType)
+ const std::string& buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ if(single && !buildType.empty())
{
configs.push_back(buildType);
}
@@ -2965,7 +2960,7 @@ cmMakefile::LexicalPushPop::~LexicalPushPop()
this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
}
-void cmMakefile::SetHomeDirectory(const char* dir)
+void cmMakefile::SetHomeDirectory(const std::string& dir)
{
this->cmHomeDirectory = dir;
cmSystemTools::ConvertToUnixSlashes(this->cmHomeDirectory);
@@ -2976,7 +2971,7 @@ void cmMakefile::SetHomeDirectory(const char* dir)
}
}
-void cmMakefile::SetHomeOutputDirectory(const char* lib)
+void cmMakefile::SetHomeOutputDirectory(const std::string& lib)
{
this->HomeOutputDirectory = lib;
cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory);
@@ -3010,9 +3005,9 @@ void cmMakefile::SetArgcArgv(const std::vector<std::string>& args)
}
//----------------------------------------------------------------------------
-cmSourceFile* cmMakefile::GetSource(const char* sourceName) const
+cmSourceFile* cmMakefile::GetSource(const std::string& sourceName) const
{
- cmSourceFileLocation sfl(this, sourceName);
+ cmSourceFileLocation sfl(this, sourceName.c_str());
for(std::vector<cmSourceFile*>::const_iterator
sfi = this->SourceFiles.begin();
sfi != this->SourceFiles.end(); ++sfi)
@@ -3027,7 +3022,7 @@ cmSourceFile* cmMakefile::GetSource(const char* sourceName) const
}
//----------------------------------------------------------------------------
-cmSourceFile* cmMakefile::GetOrCreateSource(const char* sourceName,
+cmSourceFile* cmMakefile::GetOrCreateSource(const std::string& sourceName,
bool generated)
{
if(cmSourceFile* esf = this->GetSource(sourceName))
@@ -3036,7 +3031,7 @@ cmSourceFile* cmMakefile::GetOrCreateSource(const char* sourceName,
}
else
{
- cmSourceFile* sf = new cmSourceFile(this, sourceName);
+ cmSourceFile* sf = new cmSourceFile(this, sourceName.c_str());
if(generated)
{
sf->SetProperty("GENERATED", "1");
@@ -3069,23 +3064,25 @@ void cmMakefile::ExpandSourceListArguments(
}
}
-int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
- const char *projectName, const char *targetName,
+int cmMakefile::TryCompile(const std::string& srcdir,
+ const std::string& bindir,
+ const std::string& projectName,
+ const std::string& targetName,
bool fast,
const std::vector<std::string> *cmakeArgs,
std::string *output)
{
this->Internal->IsSourceFileTryCompile = fast;
// does the binary directory exist ? If not create it...
- if (!cmSystemTools::FileIsDirectory(bindir))
+ if (!cmSystemTools::FileIsDirectory(bindir.c_str()))
{
- cmSystemTools::MakeDirectory(bindir);
+ cmSystemTools::MakeDirectory(bindir.c_str());
}
// change to the tests directory and run cmake
// use the cmake object instead of calling cmake
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
- cmSystemTools::ChangeDirectory(bindir);
+ cmSystemTools::ChangeDirectory(bindir.c_str());
// make sure the same generator is used
// use this program as the cmake to be run, it should not
@@ -3548,17 +3545,9 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
return res;
}
-void cmMakefile::SetProperty(const char* prop, const char* value)
+void cmMakefile::SetProperty(const std::string& prop, const char* value)
{
- if (!prop)
- {
- return;
- }
-
- // handle special props
- std::string propname = prop;
-
- if ( propname == "LINK_DIRECTORIES" )
+ if ( prop == "LINK_DIRECTORIES" )
{
std::vector<std::string> varArgsExpanded;
if(value)
@@ -3568,7 +3557,7 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
this->SetLinkDirectories(varArgsExpanded);
return;
}
- if (propname == "INCLUDE_DIRECTORIES")
+ if (prop == "INCLUDE_DIRECTORIES")
{
this->IncludeDirectoriesEntries.clear();
if (!value)
@@ -3581,7 +3570,7 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
cmValueWithOrigin(value, lfbt));
return;
}
- if (propname == "COMPILE_OPTIONS")
+ if (prop == "COMPILE_OPTIONS")
{
this->CompileOptionsEntries.clear();
if (!value)
@@ -3593,7 +3582,7 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
this->CompileOptionsEntries.push_back(cmValueWithOrigin(value, lfbt));
return;
}
- if (propname == "COMPILE_DEFINITIONS")
+ if (prop == "COMPILE_DEFINITIONS")
{
this->CompileDefinitionsEntries.clear();
if (!value)
@@ -3607,13 +3596,13 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
return;
}
- if ( propname == "INCLUDE_REGULAR_EXPRESSION" )
+ if ( prop == "INCLUDE_REGULAR_EXPRESSION" )
{
this->SetIncludeRegularExpression(value);
return;
}
- if ( propname == "ADDITIONAL_MAKE_CLEAN_FILES" )
+ if ( prop == "ADDITIONAL_MAKE_CLEAN_FILES" )
{
// This property is not inherrited
if ( strcmp(this->GetCurrentDirectory(),
@@ -3626,18 +3615,11 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
this->Properties.SetProperty(prop,value,cmProperty::DIRECTORY);
}
-void cmMakefile::AppendProperty(const char* prop, const char* value,
+void cmMakefile::AppendProperty(const std::string& prop,
+ const char* value,
bool asString)
{
- if (!prop)
- {
- return;
- }
-
- // handle special props
- std::string propname = prop;
-
- if (propname == "INCLUDE_DIRECTORIES")
+ if (prop == "INCLUDE_DIRECTORIES")
{
cmListFileBacktrace lfbt;
this->GetBacktrace(lfbt);
@@ -3645,7 +3627,7 @@ void cmMakefile::AppendProperty(const char* prop, const char* value,
cmValueWithOrigin(value, lfbt));
return;
}
- if (propname == "COMPILE_OPTIONS")
+ if (prop == "COMPILE_OPTIONS")
{
cmListFileBacktrace lfbt;
this->GetBacktrace(lfbt);
@@ -3653,7 +3635,7 @@ void cmMakefile::AppendProperty(const char* prop, const char* value,
cmValueWithOrigin(value, lfbt));
return;
}
- if (propname == "COMPILE_DEFINITIONS")
+ if (prop == "COMPILE_DEFINITIONS")
{
cmListFileBacktrace lfbt;
this->GetBacktrace(lfbt);
@@ -3661,7 +3643,7 @@ void cmMakefile::AppendProperty(const char* prop, const char* value,
cmValueWithOrigin(value, lfbt));
return;
}
- if ( propname == "LINK_DIRECTORIES" )
+ if ( prop == "LINK_DIRECTORIES" )
{
std::vector<std::string> varArgsExpanded;
cmSystemTools::ExpandListArgument(value, varArgsExpanded);
@@ -3676,32 +3658,18 @@ void cmMakefile::AppendProperty(const char* prop, const char* value,
this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY,asString);
}
-const char *cmMakefile::GetPropertyOrDefinition(const char* prop) const
-{
- const char *ret = this->GetProperty(prop, cmProperty::DIRECTORY);
- if (!ret)
- {
- ret = this->GetDefinition(prop);
- }
- return ret;
-}
-
-const char *cmMakefile::GetProperty(const char* prop) const
+const char *cmMakefile::GetProperty(const std::string& prop) const
{
return this->GetProperty(prop, cmProperty::DIRECTORY);
}
-const char *cmMakefile::GetProperty(const char* prop,
+const char *cmMakefile::GetProperty(const std::string& prop,
cmProperty::ScopeType scope) const
{
- if(!prop)
- {
- return 0;
- }
// watch for specific properties
static std::string output;
output = "";
- if (!strcmp("PARENT_DIRECTORY",prop))
+ if (prop == "PARENT_DIRECTORY")
{
if(cmLocalGenerator* plg = this->LocalGenerator->GetParent())
{
@@ -3709,14 +3677,14 @@ const char *cmMakefile::GetProperty(const char* prop,
}
return output.c_str();
}
- else if (!strcmp("INCLUDE_REGULAR_EXPRESSION",prop) )
+ else if (prop == "INCLUDE_REGULAR_EXPRESSION" )
{
output = this->GetIncludeRegularExpression();
return output.c_str();
}
- else if (!strcmp("LISTFILE_STACK",prop))
+ else if (prop == "LISTFILE_STACK")
{
- for (std::deque<cmStdString>::const_iterator
+ for (std::deque<std::string>::const_iterator
i = this->ListFileStack.begin();
i != this->ListFileStack.end(); ++i)
{
@@ -3728,10 +3696,10 @@ const char *cmMakefile::GetProperty(const char* prop,
}
return output.c_str();
}
- else if (!strcmp("VARIABLES",prop) || !strcmp("CACHE_VARIABLES",prop))
+ else if (prop == "VARIABLES" || prop == "CACHE_VARIABLES")
{
int cacheonly = 0;
- if ( !strcmp("CACHE_VARIABLES",prop) )
+ if ( prop == "CACHE_VARIABLES" )
{
cacheonly = 1;
}
@@ -3746,17 +3714,17 @@ const char *cmMakefile::GetProperty(const char* prop,
}
return output.c_str();
}
- else if (!strcmp("MACROS",prop))
+ else if (prop == "MACROS")
{
this->GetListOfMacros(output);
return output.c_str();
}
- else if (!strcmp("DEFINITIONS",prop))
+ else if (prop == "DEFINITIONS")
{
output += this->DefineFlagsOrig;
return output.c_str();
}
- else if (!strcmp("LINK_DIRECTORIES",prop))
+ else if (prop == "LINK_DIRECTORIES")
{
cmOStringStream str;
for (std::vector<std::string>::const_iterator
@@ -3773,7 +3741,7 @@ const char *cmMakefile::GetProperty(const char* prop,
output = str.str();
return output.c_str();
}
- else if (!strcmp("INCLUDE_DIRECTORIES",prop))
+ else if (prop == "INCLUDE_DIRECTORIES")
{
std::string sep;
for (std::vector<cmValueWithOrigin>::const_iterator
@@ -3787,7 +3755,7 @@ const char *cmMakefile::GetProperty(const char* prop,
}
return output.c_str();
}
- else if (!strcmp("COMPILE_OPTIONS",prop))
+ else if (prop == "COMPILE_OPTIONS")
{
std::string sep;
for (std::vector<cmValueWithOrigin>::const_iterator
@@ -3801,7 +3769,7 @@ const char *cmMakefile::GetProperty(const char* prop,
}
return output.c_str();
}
- else if (!strcmp("COMPILE_DEFINITIONS",prop))
+ else if (prop == "COMPILE_DEFINITIONS")
{
std::string sep;
for (std::vector<cmValueWithOrigin>::const_iterator
@@ -3832,17 +3800,18 @@ const char *cmMakefile::GetProperty(const char* prop,
return retVal;
}
-bool cmMakefile::GetPropertyAsBool(const char* prop) const
+bool cmMakefile::GetPropertyAsBool(const std::string& prop) const
{
return cmSystemTools::IsOn(this->GetProperty(prop));
}
//----------------------------------------------------------------------------
-const char* cmMakefile::GetFeature(const char* feature, const char* config)
+const char* cmMakefile::GetFeature(const std::string& feature,
+ const std::string& config)
{
// TODO: Define accumulation policy for features (prepend, append, replace).
// Currently we always replace.
- if(config && *config)
+ if(!config.empty())
{
std::string featureConfig = feature;
featureConfig += "_";
@@ -3885,34 +3854,27 @@ cmTarget* cmMakefile::FindTarget(const std::string& name,
}
//----------------------------------------------------------------------------
-cmTest* cmMakefile::CreateTest(const char* testName)
+cmTest* cmMakefile::CreateTest(const std::string& testName)
{
- if ( !testName )
- {
- return 0;
- }
cmTest* test = this->GetTest(testName);
if ( test )
{
return test;
}
test = new cmTest(this);
- test->SetName(testName);
+ test->SetName(testName.c_str());
this->Tests[testName] = test;
return test;
}
//----------------------------------------------------------------------------
-cmTest* cmMakefile::GetTest(const char* testName) const
+cmTest* cmMakefile::GetTest(const std::string& testName) const
{
- if(testName)
+ std::map<std::string, cmTest*>::const_iterator
+ mi = this->Tests.find(testName);
+ if(mi != this->Tests.end())
{
- std::map<cmStdString, cmTest*>::const_iterator
- mi = this->Tests.find(testName);
- if(mi != this->Tests.end())
- {
- return mi->second;
- }
+ return mi->second;
}
return 0;
}
@@ -3947,7 +3909,7 @@ std::string cmMakefile::GetListFileStack() const
size_t depth = this->ListFileStack.size();
if (depth > 0)
{
- std::deque<cmStdString>::const_iterator it = this->ListFileStack.end();
+ std::deque<std::string>::const_iterator it = this->ListFileStack.end();
do
{
if (depth != this->ListFileStack.size())
@@ -3970,8 +3932,8 @@ std::string cmMakefile::GetListFileStack() const
void cmMakefile::PushScope()
{
cmDefinitions* parent = &this->Internal->VarStack.top();
- const std::set<cmStdString>& init = this->Internal->VarInitStack.top();
- const std::set<cmStdString>& usage = this->Internal->VarUsageStack.top();
+ const std::set<std::string>& init = this->Internal->VarInitStack.top();
+ const std::set<std::string>& usage = this->Internal->VarUsageStack.top();
this->Internal->VarStack.push(cmDefinitions(parent));
this->Internal->VarInitStack.push(init);
this->Internal->VarUsageStack.push(usage);
@@ -3980,12 +3942,12 @@ void cmMakefile::PushScope()
void cmMakefile::PopScope()
{
cmDefinitions* current = &this->Internal->VarStack.top();
- std::set<cmStdString> init = this->Internal->VarInitStack.top();
- std::set<cmStdString> usage = this->Internal->VarUsageStack.top();
- const std::set<cmStdString>& locals = current->LocalKeys();
+ std::set<std::string> init = this->Internal->VarInitStack.top();
+ std::set<std::string> usage = this->Internal->VarUsageStack.top();
+ const std::set<std::string>& locals = current->LocalKeys();
// Remove initialization and usage information for variables in the local
// scope.
- std::set<cmStdString>::const_iterator it = locals.begin();
+ std::set<std::string>::const_iterator it = locals.begin();
for (; it != locals.end(); ++it)
{
init.erase(*it);
@@ -4014,9 +3976,9 @@ void cmMakefile::PopScope()
}
}
-void cmMakefile::RaiseScope(const char *var, const char *varDef)
+void cmMakefile::RaiseScope(const std::string& var, const char *varDef)
{
- if (!var || !strlen(var))
+ if (var.empty())
{
return;
}
@@ -4025,10 +3987,10 @@ void cmMakefile::RaiseScope(const char *var, const char *varDef)
if(cmDefinitions* up = cur.GetParent())
{
// First localize the definition in the current scope.
- cur.Get(var);
+ cur.Get(var.c_str());
// Now update the definition in the parent scope.
- up->Set(var, varDef);
+ up->Set(var.c_str(), varDef);
}
else if(cmLocalGenerator* plg = this->LocalGenerator->GetParent())
{
@@ -4038,11 +4000,11 @@ void cmMakefile::RaiseScope(const char *var, const char *varDef)
cmMakefile* parent = plg->GetMakefile();
if (varDef)
{
- parent->AddDefinition(var, varDef);
+ parent->AddDefinition(var.c_str(), varDef);
}
else
{
- parent->RemoveDefinition(var);
+ parent->RemoveDefinition(var.c_str());
}
}
else
@@ -4070,7 +4032,8 @@ void cmMakefile::DefineProperties(cmake *cm)
//----------------------------------------------------------------------------
cmTarget*
-cmMakefile::AddImportedTarget(const char* name, cmTarget::TargetType type,
+cmMakefile::AddImportedTarget(const std::string& name,
+ cmTarget::TargetType type,
bool global)
{
// Create the target.
@@ -4097,7 +4060,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name,
{
// Look for an imported target. These take priority because they
// are more local in scope and do not have to be globally unique.
- std::map<cmStdString, cmTarget*>::const_iterator
+ std::map<std::string, cmTarget*>::const_iterator
imported = this->ImportedTargets.find(name);
if(imported != this->ImportedTargets.end())
{
@@ -4111,8 +4074,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name,
}
// Look for a target built in this project.
- return this->LocalGenerator->GetGlobalGenerator()->FindTarget(0,
- name.c_str(),
+ return this->LocalGenerator->GetGlobalGenerator()->FindTarget(name.c_str(),
excludeAliases);
}
@@ -4127,7 +4089,7 @@ bool cmMakefile::IsAlias(const std::string& name) const
//----------------------------------------------------------------------------
cmGeneratorTarget*
-cmMakefile::FindGeneratorTargetToUse(const char* name) const
+cmMakefile::FindGeneratorTargetToUse(const std::string& name) const
{
if (cmTarget *t = this->FindTargetToUse(name))
{
@@ -4229,8 +4191,8 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
}
//----------------------------------------------------------------------------
-bool cmMakefile::EnforceUniqueDir(const char* srcPath,
- const char* binPath) const
+bool cmMakefile::EnforceUniqueDir(const std::string& srcPath,
+ const std::string& binPath) const
{
// Make sure the binary directory is unique.
cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator();
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 45f3b9f..460a85c 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -69,11 +69,11 @@ public:
/* Check for unused variables in this scope */
void CheckForUnusedVariables() const;
/* Mark a variable as used */
- void MarkVariableAsUsed(const char* var);
+ void MarkVariableAsUsed(const std::string& var);
/* return true if a variable has been initialized */
- bool VariableInitialized(const char* ) const;
+ bool VariableInitialized(const std::string& ) const;
/* return true if a variable has been used */
- bool VariableUsed(const char* ) const;
+ bool VariableUsed(const std::string& ) const;
/** Return whether compatibility features needed for a version of
the cache or lower should be enabled. */
bool NeedCacheCompatibility(int major, int minor) const;
@@ -126,8 +126,8 @@ public:
* Try running cmake and building a file. This is used for dynalically
* loaded commands, not as part of the usual build process.
*/
- int TryCompile(const char *srcdir, const char *bindir,
- const char *projectName, const char *targetName,
+ int TryCompile(const std::string& srcdir, const std::string& bindir,
+ const std::string& projectName, const std::string& targetName,
bool fast,
const std::vector<std::string> *cmakeArgs,
std::string *output);
@@ -168,7 +168,7 @@ public:
void Print() const;
/** Add a custom command to the build. */
- void AddCustomCommandToTarget(const char* target,
+ void AddCustomCommandToTarget(const std::string& target,
const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines,
cmTarget::CustomCommandType type,
@@ -177,23 +177,23 @@ public:
cmSourceFile* AddCustomCommandToOutput(
const std::vector<std::string>& outputs,
const std::vector<std::string>& depends,
- const char* main_dependency,
+ const std::string& main_dependency,
const cmCustomCommandLines& commandLines,
const char* comment, const char* workingDir,
bool replace = false,
bool escapeOldStyle = true);
cmSourceFile* AddCustomCommandToOutput(
- const char* output,
+ const std::string& output,
const std::vector<std::string>& depends,
- const char* main_dependency,
+ const std::string& main_dependency,
const cmCustomCommandLines& commandLines,
const char* comment, const char* workingDir,
bool replace = false,
bool escapeOldStyle = true);
- void AddCustomCommandOldStyle(const char* target,
+ void AddCustomCommandOldStyle(const std::string& target,
const std::vector<std::string>& outputs,
const std::vector<std::string>& depends,
- const char* source,
+ const std::string& source,
const cmCustomCommandLines& commandLines,
const char* comment);
@@ -205,10 +205,11 @@ public:
void AddCompileOption(const char* option);
/** Create a new imported target with the name and type given. */
- cmTarget* AddImportedTarget(const char* name, cmTarget::TargetType type,
+ cmTarget* AddImportedTarget(const std::string& name,
+ cmTarget::TargetType type,
bool global);
- cmTarget* AddNewTarget(cmTarget::TargetType type, const char* name);
+ cmTarget* AddNewTarget(cmTarget::TargetType type, const std::string& name);
/**
* Add an executable to the build.
@@ -221,7 +222,7 @@ public:
* Add a utility to the build. A utiltity target is a command that
* is run every time the target is built.
*/
- void AddUtilityCommand(const char* utilityName, bool excludeFromAll,
+ void AddUtilityCommand(const std::string& utilityName, bool excludeFromAll,
const std::vector<std::string>& depends,
const char* workingDirectory,
const char* command,
@@ -229,7 +230,8 @@ public:
const char* arg2=0,
const char* arg3=0,
const char* arg4=0);
- cmTarget* AddUtilityCommand(const char* utilityName, bool excludeFromAll,
+ cmTarget* AddUtilityCommand(const std::string& utilityName,
+ bool excludeFromAll,
const char* workingDirectory,
const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines,
@@ -239,16 +241,16 @@ public:
/**
* Add a link library to the build.
*/
- void AddLinkLibrary(const char*);
- void AddLinkLibrary(const char*, cmTarget::LinkLibraryType type);
- void AddLinkLibraryForTarget(const char *tgt, const char*,
+ void AddLinkLibrary(const std::string&);
+ void AddLinkLibrary(const std::string&, cmTarget::LinkLibraryType type);
+ void AddLinkLibraryForTarget(const std::string& tgt, const std::string&,
cmTarget::LinkLibraryType type);
- void AddLinkDirectoryForTarget(const char *tgt, const char* d);
+ void AddLinkDirectoryForTarget(const std::string& tgt, const std::string& d);
/**
* Add a link directory to the build.
*/
- void AddLinkDirectory(const char*);
+ void AddLinkDirectory(const std::string&);
const std::vector<std::string>& GetLinkDirectories() const
{
@@ -262,9 +264,10 @@ public:
/**
* Add a subdirectory to the build.
*/
- void AddSubDirectory(const char*, bool excludeFromAll=false,
+ void AddSubDirectory(const std::string&, bool excludeFromAll=false,
bool preorder = false);
- void AddSubDirectory(const char* fullSrcDir,const char *fullBinDir,
+ void AddSubDirectory(const std::string& fullSrcDir,
+ const std::string& fullBinDir,
bool excludeFromAll, bool preorder,
bool immediate);
@@ -283,9 +286,9 @@ public:
* Add a variable definition to the build. This variable
* can be used in CMake to refer to lists, directories, etc.
*/
- void AddDefinition(const char* name, const char* value);
+ void AddDefinition(const std::string& name, const char* value);
///! Add a definition to this makefile and the global cmake cache.
- void AddCacheDefinition(const char* name, const char* value,
+ void AddCacheDefinition(const std::string& name, const char* value,
const char* doc,
cmCacheManager::CacheEntryType type,
bool force = false);
@@ -293,15 +296,15 @@ public:
/**
* Add bool variable definition to the build.
*/
- void AddDefinition(const char* name, bool);
+ 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.
*/
- void RemoveDefinition(const char* name);
+ void RemoveDefinition(const std::string& name);
///! Remove a definition from the cache.
- void RemoveCacheDefinition(const char* name);
+ void RemoveCacheDefinition(const std::string& name);
/**
* Specify the name of the project for this build.
@@ -317,22 +320,22 @@ public:
}
/** Get the configurations to be generated. */
- const char* GetConfigurations(std::vector<std::string>& configs,
+ std::string GetConfigurations(std::vector<std::string>& configs,
bool single = true) const;
/**
* Set the name of the library.
*/
- cmTarget* AddLibrary(const char *libname, cmTarget::TargetType type,
+ cmTarget* AddLibrary(const std::string& libname, cmTarget::TargetType type,
const std::vector<std::string> &srcs,
bool excludeFromAll = false);
- void AddAlias(const char *libname, cmTarget *tgt);
+ void AddAlias(const std::string& libname, cmTarget *tgt);
#if defined(CMAKE_BUILD_WITH_CMAKE)
/**
* Add a root source group for consideration when adding a new source.
*/
- void AddSourceGroup(const char* name, const char* regex=0);
+ void AddSourceGroup(const std::string& name, const char* regex=0);
/**
* Add a source group for consideration when adding a new source.
@@ -399,12 +402,12 @@ public:
* CMakeLists files by recursing up the tree starting at the StartDirectory
* and going up until it reaches the HomeDirectory.
*/
- void SetHomeDirectory(const char* dir);
+ void SetHomeDirectory(const std::string& dir);
const char* GetHomeDirectory() const
{
return this->cmHomeDirectory.c_str();
}
- void SetHomeOutputDirectory(const char* lib);
+ void SetHomeOutputDirectory(const std::string& lib);
const char* GetHomeOutputDirectory() const
{
return this->HomeOutputDirectory.c_str();
@@ -429,7 +432,7 @@ public:
* recursing up the tree starting at the StartDirectory and going up until
* it reaches the HomeDirectory.
*/
- void SetStartDirectory(const char* dir)
+ void SetStartDirectory(const std::string& dir)
{
this->cmStartDirectory = dir;
cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory);
@@ -442,7 +445,7 @@ public:
{
return this->cmStartDirectory.c_str();
}
- void SetStartOutputDirectory(const char* lib)
+ void SetStartOutputDirectory(const std::string& lib)
{
this->StartOutputDirectory = lib;
cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory);
@@ -494,7 +497,7 @@ public:
* Set a regular expression that include files that are not found
* must match in order to be considered a problem.
*/
- void SetComplainRegularExpression(const char* regex)
+ void SetComplainRegularExpression(const std::string& regex)
{
this->ComplainFileRegularExpression = regex;
}
@@ -534,12 +537,12 @@ public:
cmTarget* FindTargetToUse(const std::string& name,
bool excludeAliases = false) const;
bool IsAlias(const std::string& name) const;
- cmGeneratorTarget* FindGeneratorTargetToUse(const char* name) const;
+ cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const;
/**
* Mark include directories as system directories.
*/
- void AddSystemIncludeDirectories(const std::set<cmStdString> &incs);
+ void AddSystemIncludeDirectories(const std::set<std::string> &incs);
/** Expand out any arguements in the vector that have ; separated
* strings into multiple arguements. A new vector is created
@@ -555,14 +558,14 @@ public:
/** Get a cmSourceFile pointer for a given source name, if the name is
* not found, then a null pointer is returned.
*/
- cmSourceFile* GetSource(const char* sourceName) const;
+ cmSourceFile* GetSource(const std::string& sourceName) const;
/** Get a cmSourceFile pointer for a given source name, if the name is
* not found, then create the source file and return it. generated
* indicates if it is a generated file, this is used in determining
* how to create the source file instance e.g. name
*/
- cmSourceFile* GetOrCreateSource(const char* sourceName,
+ cmSourceFile* GetOrCreateSource(const std::string& sourceName,
bool generated = false);
/**
@@ -587,10 +590,10 @@ public:
* If the variable is not found in this makefile instance, the
* cache is then queried.
*/
- const char* GetDefinition(const char*) const;
- const char* GetSafeDefinition(const char*) const;
- const char* GetRequiredDefinition(const char* name) const;
- bool IsDefinitionSet(const char*) const;
+ const char* GetDefinition(const std::string&) const;
+ const char* GetSafeDefinition(const std::string&) const;
+ const char* GetRequiredDefinition(const std::string& name) const;
+ bool IsDefinitionSet(const std::string&) const;
/**
* Get the list of all variables in the current space. If argument
* cacheonly is specified and is greater than 0, then only cache
@@ -601,14 +604,14 @@ public:
/** Test a boolean cache entry to see if it is true or false,
* returns false if no entry defined.
*/
- bool IsOn(const char* name) const;
- bool IsSet(const char* name) const;
+ bool IsOn(const std::string& name) const;
+ bool IsSet(const std::string& name) const;
/** Return whether the target platform is 64-bit. */
bool PlatformIs64Bit() const;
/** Retrieve soname flag for the specified language if supported */
- const char* GetSONameFlag(const char* language) const;
+ const char* GetSONameFlag(const std::string& language) const;
/**
* Get a list of preprocessor define flags.
@@ -773,7 +776,7 @@ public:
* Is there a source file that has the provided source file as an output?
* if so then return it
*/
- cmSourceFile *GetSourceFileWithOutput(const char *outName) const;
+ cmSourceFile *GetSourceFileWithOutput(const std::string& outName) const;
/**
* Add a macro to the list of macros. The arguments should be name of the
@@ -782,12 +785,12 @@ public:
void AddMacro(const char* name, const char* signature);
///! Add a new cmTest to the list of tests for this makefile.
- cmTest* CreateTest(const char* testName);
+ cmTest* CreateTest(const std::string& testName);
/** Get a cmTest pointer for a given test name, if the name is
* not found, then a null pointer is returned.
*/
- cmTest* GetTest(const char* testName) const;
+ cmTest* GetTest(const std::string& testName) const;
/**
* Get a list of macros as a ; separated string
@@ -800,14 +803,16 @@ public:
std::string GetModulesFile(const char* name) const;
///! Set/Get a property of this directory
- void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char *prop, const char *value,bool asString=false);
- const char *GetProperty(const char *prop) const;
- const char *GetPropertyOrDefinition(const char *prop) const;
- const char *GetProperty(const char *prop, cmProperty::ScopeType scope) const;
- bool GetPropertyAsBool(const char *prop) const;
+ void SetProperty(const std::string& prop, const char *value);
+ void AppendProperty(const std::string& prop, const char *value,
+ bool asString=false);
+ const char *GetProperty(const std::string& prop) const;
+ const char *GetProperty(const std::string& prop,
+ cmProperty::ScopeType scope) const;
+ bool GetPropertyAsBool(const std::string& prop) const;
- const char* GetFeature(const char* feature, const char* config);
+ const char* GetFeature(const std::string& feature,
+ const std::string& config);
// Get the properties
cmPropertyMap &GetProperties() { return this->Properties; };
@@ -835,7 +840,7 @@ public:
// push and pop variable scopes
void PushScope();
void PopScope();
- void RaiseScope(const char *var, const char *value);
+ void RaiseScope(const std::string& var, const char *value);
/** Helper class to push and pop scopes automatically. */
class ScopePushPop
@@ -872,15 +877,15 @@ public:
void AddQtUiFileWithOptions(cmSourceFile *sf);
std::vector<cmSourceFile*> GetQtUiFilesWithOptions() const;
- std::set<cmStdString> const & GetSystemIncludeDirectories() const
+ std::set<std::string> const & GetSystemIncludeDirectories() const
{ return this->SystemIncludeDirectories; }
protected:
// add link libraries and directories to the target
- void AddGlobalLinkInformation(const char* name, cmTarget& target);
+ void AddGlobalLinkInformation(const std::string& name, cmTarget& target);
// Check for a an unused variable
- void CheckForUnused(const char* reason, const char* name) const;
+ void CheckForUnused(const char* reason, const std::string& name) const;
std::string Prefix;
std::vector<std::string> AuxSourceDirectories; //
@@ -900,14 +905,14 @@ protected:
std::vector<cmSourceFile*> SourceFiles;
// Tests
- std::map<cmStdString, cmTest*> Tests;
+ std::map<std::string, cmTest*> Tests;
// The link-library paths. Order matters, use std::vector (not std::set).
std::vector<std::string> LinkDirectories;
// The set of include directories that are marked as system include
// directories.
- std::set<cmStdString> SystemIncludeDirectories;
+ std::set<std::string> SystemIncludeDirectories;
std::vector<std::string> ListFiles; // list of command files loaded
std::vector<std::string> OutputFiles; // list of command files loaded
@@ -947,12 +952,13 @@ private:
bool ParseDefineFlag(std::string const& definition, bool remove);
- bool EnforceUniqueDir(const char* srcPath, const char* binPath) const;
+ bool EnforceUniqueDir(const std::string& srcPath,
+ const std::string& binPath) const;
friend class cmMakeDepend; // make depend needs direct access
// to the Sources array
void PrintStringVector(const char* s, const
- std::vector<std::pair<cmStdString, bool> >& v) const;
+ std::vector<std::pair<std::string, bool> >& v) const;
void PrintStringVector(const char* s,
const std::vector<std::string>& v) const;
@@ -963,10 +969,10 @@ private:
void PushFunctionBlockerBarrier();
void PopFunctionBlockerBarrier(bool reportError = true);
- typedef std::map<cmStdString, cmStdString> StringStringMap;
+ typedef std::map<std::string, std::string> StringStringMap;
StringStringMap MacrosMap;
- std::map<cmStdString, bool> SubDirectoryOrder;
+ std::map<std::string, bool> SubDirectoryOrder;
mutable cmsys::RegularExpression cmDefineRegex;
mutable cmsys::RegularExpression cmDefine01Regex;
@@ -982,7 +988,7 @@ private:
bool CheckSystemVars;
// stack of list files being read
- std::deque<cmStdString> ListFileStack;
+ std::deque<std::string> ListFileStack;
// stack of commands being invoked.
struct CallStackEntry
@@ -995,7 +1001,7 @@ private:
friend class cmMakefileCall;
std::vector<cmTarget*> ImportedTargetsOwned;
- std::map<cmStdString, cmTarget*> ImportedTargets;
+ std::map<std::string, cmTarget*> ImportedTargets;
// Internal policy stack management.
void PushPolicy(bool weak = false,
@@ -1029,12 +1035,12 @@ private:
bool GeneratingBuildSystem;
/**
- * Old version of GetSourceFileWithOutput(const char*) kept for
+ * Old version of GetSourceFileWithOutput(const std::string&) kept for
* backward-compatibility. It implements a linear search and support
* relative file paths. It is used as a fall back by
- * GetSourceFileWithOutput(const char*).
+ * GetSourceFileWithOutput(const std::string&).
*/
- cmSourceFile *LinearGetSourceFileWithOutput(const char *cname) const;
+ cmSourceFile *LinearGetSourceFileWithOutput(const std::string& cname) const;
// A map for fast output to input look up.
#if defined(CMAKE_BUILD_WITH_CMAKE)
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 1802054..ca8ff06 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -160,14 +160,14 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
cmLocalGenerator::SHELL);
// Get the language to use for linking this executable.
- const char* linkLanguage =
+ std::string linkLanguage =
this->Target->GetLinkerLanguage(this->ConfigName);
// Make sure we have a link language.
- if(!linkLanguage)
+ if(linkLanguage.empty())
{
cmSystemTools::Error("Cannot determine link language for target \"",
- this->Target->GetName(), "\".");
+ this->Target->GetName().c_str(), "\".");
return;
}
@@ -348,7 +348,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
cmLocalGenerator::RuleVariables vars;
vars.RuleLauncher = "RULE_LAUNCH_LINK";
vars.CMTarget = this->Target;
- vars.Language = linkLanguage;
+ vars.Language = linkLanguage.c_str();
vars.Objects = buildObjs.c_str();
std::string objectDir = this->Target->GetSupportDirectory();
objectDir = this->Convert(objectDir.c_str(),
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 39e00b2..d9425e6 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -125,19 +125,16 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules()
depends, commands, true);
// Write the main driver rule to build everything in this target.
- this->WriteTargetDriverRule(this->Target->GetName(), false);
+ this->WriteTargetDriverRule(this->Target->GetName().c_str(), false);
}
//----------------------------------------------------------------------------
void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
{
- const char* linkLanguage =
+ std::string linkLanguage =
this->Target->GetLinkerLanguage(this->ConfigName);
std::string linkRuleVar = "CMAKE_";
- if (linkLanguage)
- {
- linkRuleVar += linkLanguage;
- }
+ linkRuleVar += linkLanguage;
linkRuleVar += "_CREATE_STATIC_LIBRARY";
if(this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION") &&
@@ -160,13 +157,10 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
this->WriteFrameworkRules(relink);
return;
}
- const char* linkLanguage =
+ std::string linkLanguage =
this->Target->GetLinkerLanguage(this->ConfigName);
std::string linkRuleVar = "CMAKE_";
- if (linkLanguage)
- {
- linkRuleVar += linkLanguage;
- }
+ linkRuleVar += linkLanguage;
linkRuleVar += "_CREATE_SHARED_LIBRARY";
std::string extraFlags;
@@ -187,13 +181,10 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
//----------------------------------------------------------------------------
void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
{
- const char* linkLanguage =
+ std::string linkLanguage =
this->Target->GetLinkerLanguage(this->ConfigName);
std::string linkRuleVar = "CMAKE_";
- if (linkLanguage)
- {
- linkRuleVar += linkLanguage;
- }
+ linkRuleVar += linkLanguage;
linkRuleVar += "_CREATE_SHARED_MODULE";
std::string extraFlags;
@@ -213,13 +204,10 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
//----------------------------------------------------------------------------
void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink)
{
- const char* linkLanguage =
+ std::string linkLanguage =
this->Target->GetLinkerLanguage(this->ConfigName);
std::string linkRuleVar = "CMAKE_";
- if (linkLanguage)
- {
- linkRuleVar += linkLanguage;
- }
+ linkRuleVar += linkLanguage;
linkRuleVar += "_CREATE_MACOSX_FRAMEWORK";
std::string extraFlags;
@@ -237,7 +225,7 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink)
//----------------------------------------------------------------------------
void cmMakefileLibraryTargetGenerator::WriteLibraryRules
-(const char* linkRuleVar, const char* extraFlags, bool relink)
+(const std::string& linkRuleVar, const std::string& extraFlags, bool relink)
{
// TODO: Merge the methods that call this method to avoid
// code duplication.
@@ -248,20 +236,20 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
this->AppendLinkDepends(depends);
// Get the language to use for linking this library.
- const char* linkLanguage =
+ std::string linkLanguage =
this->Target->GetLinkerLanguage(this->ConfigName);
// Make sure we have a link language.
- if(!linkLanguage)
+ if(linkLanguage.empty())
{
cmSystemTools::Error("Cannot determine link language for target \"",
- this->Target->GetName(), "\".");
+ this->Target->GetName().c_str(), "\".");
return;
}
// Create set of linking flags.
std::string linkFlags;
- this->LocalGenerator->AppendFlags(linkFlags, extraFlags);
+ this->LocalGenerator->AppendFlags(linkFlags, extraFlags.c_str());
// Add OSX version flags, if any.
if(this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
@@ -589,7 +577,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
vars.RuleLauncher = "RULE_LAUNCH_LINK";
vars.CMTarget = this->Target;
- vars.Language = linkLanguage;
+ vars.Language = linkLanguage.c_str();
vars.Objects = buildObjs.c_str();
std::string objectDir = this->Target->GetSupportDirectory();
objectDir = this->Convert(objectDir.c_str(),
@@ -786,7 +774,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
//----------------------------------------------------------------------------
void
cmMakefileLibraryTargetGenerator
-::AppendOSXVerFlag(std::string& flags, const char* lang,
+::AppendOSXVerFlag(std::string& flags, const std::string& lang,
const char* name, bool so)
{
// Lookup the flag to specify the version.
diff --git a/Source/cmMakefileLibraryTargetGenerator.h b/Source/cmMakefileLibraryTargetGenerator.h
index 1487b56..68980c3 100644
--- a/Source/cmMakefileLibraryTargetGenerator.h
+++ b/Source/cmMakefileLibraryTargetGenerator.h
@@ -30,7 +30,8 @@ protected:
void WriteStaticLibraryRules();
void WriteSharedLibraryRules(bool relink);
void WriteModuleLibraryRules(bool relink);
- void WriteLibraryRules(const char *linkRule, const char *extraFlags,
+ void WriteLibraryRules(const std::string& linkRule,
+ const std::string& extraFlags,
bool relink);
// MacOSX Framework support methods
void WriteFrameworkRules(bool relink);
@@ -38,7 +39,7 @@ protected:
// Store the computd framework version for OS X Frameworks.
std::string FrameworkVersion;
- void AppendOSXVerFlag(std::string& flags, const char* lang,
+ void AppendOSXVerFlag(std::string& flags, const std::string& lang,
const char* name, bool so);
};
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index facbcc6..28a8f04 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -133,7 +133,8 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
this->Makefile->GetProperty
("ADDITIONAL_MAKE_CLEAN_FILES"))
{
- const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
+ const std::string& config =
+ this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
cmListFileBacktrace lfbt;
cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
@@ -342,21 +343,21 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l)
void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
{
// write language flags for target
- std::set<cmStdString> languages;
+ std::set<std::string> languages;
this->Target->GetLanguages(languages);
// put the compiler in the rules.make file so that if it changes
// things rebuild
- for(std::set<cmStdString>::const_iterator l = languages.begin();
+ for(std::set<std::string>::const_iterator l = languages.begin();
l != languages.end(); ++l)
{
- cmStdString compiler = "CMAKE_";
+ std::string compiler = "CMAKE_";
compiler += *l;
compiler += "_COMPILER";
*this->FlagFileStream << "# compile " << l->c_str() << " with " <<
this->Makefile->GetSafeDefinition(compiler.c_str()) << "\n";
}
- for(std::set<cmStdString>::const_iterator l = languages.begin();
+ for(std::set<std::string>::const_iterator l = languages.begin();
l != languages.end(); ++l)
{
*this->FlagFileStream << *l << "_FLAGS = " << this->GetFlags(*l) << "\n\n";
@@ -422,8 +423,9 @@ cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()
void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source)
{
// Identify the language of the source file.
- const char* lang = this->LocalGenerator->GetSourceFileLanguage(source);
- if(!lang)
+ const std::string& lang =
+ this->LocalGenerator->GetSourceFileLanguage(source);
+ if(lang.empty())
{
// don't know anything about this file so skip it
return;
@@ -523,7 +525,7 @@ cmMakefileTargetGenerator
void
cmMakefileTargetGenerator
::WriteObjectBuildFile(std::string &obj,
- const char *lang,
+ const std::string& lang,
cmSourceFile& source,
std::vector<std::string>& depends)
{
@@ -552,7 +554,7 @@ cmMakefileTargetGenerator
cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName);
// Add Fortran format flags.
- if(strcmp(lang, "Fortran") == 0)
+ if(lang == "Fortran")
{
this->AppendFortranFormatFlags(flags, source);
}
@@ -664,7 +666,7 @@ cmMakefileTargetGenerator
cmLocalGenerator::RuleVariables vars;
vars.RuleLauncher = "RULE_LAUNCH_COMPILE";
vars.CMTarget = this->Target;
- vars.Language = lang;
+ vars.Language = lang.c_str();
vars.Target = targetOutPathReal.c_str();
vars.TargetPDB = targetOutPathPDB.c_str();
vars.TargetCompilePDB = targetOutPathCompilePDB.c_str();
@@ -689,8 +691,7 @@ cmMakefileTargetGenerator
vars.Defines = definesString.c_str();
- bool lang_is_c_or_cxx = ((strcmp(lang, "C") == 0) ||
- (strcmp(lang, "CXX") == 0));
+ bool lang_is_c_or_cxx = ((lang == "C") || (lang == "CXX"));
// Construct the compile rules.
{
@@ -1070,7 +1071,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
<< "set(CMAKE_C_TARGET_INCLUDE_PATH\n";
std::vector<std::string> includes;
- const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
+ const std::string& config =
+ this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
this->LocalGenerator->GetIncludeDirectories(includes,
this->GeneratorTarget,
"C", config);
@@ -1347,7 +1349,7 @@ cmMakefileTargetGenerator
// Write a make variable assignment that lists all objects for the
// target.
variableName =
- this->LocalGenerator->CreateMakeVariable(this->Target->GetName(),
+ this->LocalGenerator->CreateMakeVariable(this->Target->GetName().c_str(),
"_OBJECTS");
*this->BuildFileStream
<< "# Object files for target " << this->Target->GetName() << "\n"
@@ -1382,7 +1384,7 @@ cmMakefileTargetGenerator
// Write a make variable assignment that lists all external objects
// for the target.
variableNameExternal =
- this->LocalGenerator->CreateMakeVariable(this->Target->GetName(),
+ this->LocalGenerator->CreateMakeVariable(this->Target->GetName().c_str(),
"_EXTERNAL_OBJECTS");
*this->BuildFileStream
<< "\n"
@@ -1494,8 +1496,9 @@ cmMakefileTargetGenerator
}
//----------------------------------------------------------------------------
-void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output,
- bool relink)
+void cmMakefileTargetGenerator::WriteTargetDriverRule(
+ const std::string& main_output,
+ bool relink)
{
// Compute the name of the driver target.
std::string dir =
@@ -1508,10 +1511,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output,
// Build the list of target outputs to drive.
std::vector<std::string> depends;
- if(main_output)
- {
- depends.push_back(main_output);
- }
+ depends.push_back(main_output);
const char* comment = 0;
if(relink)
@@ -1531,7 +1531,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output,
}
// Make sure the extra files are built.
- for(std::set<cmStdString>::const_iterator i = this->ExtraFiles.begin();
+ for(std::set<std::string>::const_iterator i = this->ExtraFiles.begin();
i != this->ExtraFiles.end(); ++i)
{
depends.push_back(*i);
@@ -1561,13 +1561,14 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l)
return std::string();
}
- std::set<cmStdString> emitted;
+ std::set<std::string> emitted;
#ifdef __APPLE__ /* don't insert this when crosscompiling e.g. to iphone */
emitted.insert("/System/Library/Frameworks");
#endif
std::vector<std::string> includes;
- const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
+ const std::string& config =
+ this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
this->LocalGenerator->GetIncludeDirectories(includes,
this->GeneratorTarget,
"C", config);
@@ -1682,7 +1683,8 @@ void cmMakefileTargetGenerator
}
//----------------------------------------------------------------------------
-std::string cmMakefileTargetGenerator::GetLinkRule(const char* linkRuleVar)
+std::string cmMakefileTargetGenerator::GetLinkRule(
+ const std::string& linkRuleVar)
{
std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar);
if(this->Target->HasImplibGNUtoMS())
@@ -1708,8 +1710,8 @@ void cmMakefileTargetGenerator
}
void cmMakefileTargetGenerator::RemoveForbiddenFlags(const char* flagVar,
- const char* linkLang,
- std::string& linkFlags)
+ const std::string& linkLang,
+ std::string& linkFlags)
{
// check for language flags that are not allowed at link time, and
// remove them, -w on darwin for gcc -w -dynamiclib sends -w to libtool
@@ -1942,7 +1944,7 @@ cmMakefileTargetGenerator
//----------------------------------------------------------------------------
void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
- const char* lang)
+ const std::string& lang)
{
std::string responseVar = "CMAKE_";
responseVar += lang;
@@ -1951,7 +1953,8 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
std::vector<std::string> includes;
- const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
+ const std::string& config =
+ this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
this->LocalGenerator->GetIncludeDirectories(includes,
this->GeneratorTarget,
lang, config);
@@ -2058,7 +2061,8 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags)
this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG"))
{
std::vector<std::string> includes;
- const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
+ const std::string& config =
+ this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
this->LocalGenerator->GetIncludeDirectories(includes,
this->GeneratorTarget,
"C", config);
@@ -2099,20 +2103,20 @@ void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
}
//----------------------------------------------------------------------------
-const char* cmMakefileTargetGenerator::GetFeature(const char* feature)
+const char* cmMakefileTargetGenerator::GetFeature(const std::string& feature)
{
return this->Target->GetFeature(feature, this->ConfigName);
}
//----------------------------------------------------------------------------
-bool cmMakefileTargetGenerator::GetFeatureAsBool(const char* feature)
+bool cmMakefileTargetGenerator::GetFeatureAsBool(const std::string& feature)
{
return cmSystemTools::IsOn(this->GetFeature(feature));
}
//----------------------------------------------------------------------------
void cmMakefileTargetGenerator::AddFeatureFlags(
- std::string& flags, const char* lang
+ std::string& flags, const std::string& lang
)
{
// Add language-specific flags.
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index 72dc6bc..bed945b 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -93,7 +93,7 @@ protected:
// write the build rule for an object
void WriteObjectBuildFile(std::string &obj,
- const char *lang,
+ const std::string& lang,
cmSourceFile& source,
std::vector<std::string>& depends);
@@ -119,7 +119,7 @@ protected:
std::string::size_type limit = std::string::npos);
// write the driver rule to build target outputs
- void WriteTargetDriverRule(const char* main_output, bool relink);
+ void WriteTargetDriverRule(const std::string& main_output, bool relink);
void DriveCustomCommands(std::vector<std::string>& depends);
@@ -138,7 +138,7 @@ protected:
void AppendLinkDepends(std::vector<std::string>& depends);
// Lookup the link rule for this target.
- std::string GetLinkRule(const char* linkRuleVar);
+ std::string GetLinkRule(const std::string& linkRuleVar);
/** In order to support parallel builds for custom commands with
multiple outputs the outputs are given a serial order, and only
@@ -173,17 +173,17 @@ protected:
bool useResponseFile, std::string& buildObjs,
std::vector<std::string>& makefile_depends);
- void AddIncludeFlags(std::string& flags, const char* lang);
+ void AddIncludeFlags(std::string& flags, const std::string& lang);
virtual void CloseFileStreams();
- void RemoveForbiddenFlags(const char* flagVar, const char* linkLang,
+ void RemoveForbiddenFlags(const char* flagVar, const std::string& linkLang,
std::string& linkFlags);
cmTarget *Target;
cmGeneratorTarget* GeneratorTarget;
cmLocalUnixMakefileGenerator3 *LocalGenerator;
cmGlobalUnixMakefileGenerator3 *GlobalGenerator;
cmMakefile *Makefile;
- const char *ConfigName;
+ std::string ConfigName;
enum CustomCommandDriveType { OnBuild, OnDepends, OnUtility };
CustomCommandDriveType CustomCommandDriver;
@@ -208,7 +208,7 @@ protected:
std::string FlagFileNameFull;
cmGeneratedFileStream *FlagFileStream;
class StringList: public std::vector<std::string> {};
- std::map<cmStdString, StringList> FlagFileDepends;
+ std::map<std::string, StringList> FlagFileDepends;
// the stream for the info file
std::string InfoFileNameFull;
@@ -222,12 +222,12 @@ protected:
std::vector<std::string> ExternalObjects;
// Set of object file names that will be built in this directory.
- std::set<cmStdString> ObjectFiles;
+ std::set<std::string> ObjectFiles;
// Set of extra output files to be driven by the build.
- std::set<cmStdString> ExtraFiles;
+ std::set<std::string> ExtraFiles;
- typedef std::map<cmStdString, cmStdString> MultipleOutputPairsType;
+ typedef std::map<std::string, std::string> MultipleOutputPairsType;
MultipleOutputPairsType MultipleOutputPairs;
// Target name info.
@@ -238,11 +238,11 @@ protected:
std::string TargetNamePDB;
// Mac OS X content info.
- std::set<cmStdString> MacContentFolders;
+ std::set<std::string> MacContentFolders;
cmOSXBundleGenerator* OSXBundleGenerator;
MacOSXContentGeneratorType* MacOSXContentGenerator;
- typedef std::map<cmStdString, cmStdString> ByLanguageMap;
+ typedef std::map<std::string, std::string> ByLanguageMap;
std::string GetFlags(const std::string &l);
ByLanguageMap FlagsByLanguage;
std::string GetDefines(const std::string &l);
@@ -260,16 +260,16 @@ protected:
void AddModuleDefinitionFlag(std::string& flags);
// Add language feature flags.
- void AddFeatureFlags(std::string& flags, const char* lang);
+ void AddFeatureFlags(std::string& flags, const std::string& lang);
// Feature query methods.
- const char* GetFeature(const char* feature);
- bool GetFeatureAsBool(const char* feature);
+ const char* GetFeature(const std::string& feature);
+ bool GetFeatureAsBool(const std::string& feature);
//==================================================================
// Convenience routines that do nothing more than forward to
// implementaitons
- std::string Convert(const char* source,
+ std::string Convert(const std::string& source,
cmLocalGenerator::RelativeRoot relative,
cmLocalGenerator::OutputFormat output =
cmLocalGenerator::UNCHANGED,
diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx
index 7751ad9..2066fc2 100644
--- a/Source/cmMakefileUtilityTargetGenerator.cxx
+++ b/Source/cmMakefileUtilityTargetGenerator.cxx
@@ -105,7 +105,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
depends, commands, true);
// Write the main driver rule to build everything in this target.
- this->WriteTargetDriverRule(this->Target->GetName(), false);
+ this->WriteTargetDriverRule(this->Target->GetName().c_str(), false);
// Write clean target
this->WriteTargetCleanRules();
diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h
index b65e4a8..38064a3 100644
--- a/Source/cmMarkAsAdvancedCommand.h
+++ b/Source/cmMarkAsAdvancedCommand.h
@@ -40,7 +40,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "mark_as_advanced";}
+ virtual std::string GetName() const {return "mark_as_advanced";}
/**
* This determines if the command is invoked when in script mode.
diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h
index c826ef1..76dc102 100644
--- a/Source/cmMathCommand.h
+++ b/Source/cmMathCommand.h
@@ -41,7 +41,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "math";}
+ virtual std::string GetName() const { return "math";}
cmTypeMacro(cmMathCommand, cmCommand);
protected:
diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h
index fec9a32..c0ae2a3 100644
--- a/Source/cmMessageCommand.h
+++ b/Source/cmMessageCommand.h
@@ -39,7 +39,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "message";}
+ virtual std::string GetName() const { return "message";}
/**
* This determines if the command is invoked when in script mode.
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 73ba815..a49fc2d 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -35,7 +35,7 @@ cmNinjaNormalTargetGenerator(cmGeneratorTarget* target)
, TargetNameReal()
, TargetNameImport()
, TargetNamePDB()
- , TargetLinkLanguage(0)
+ , TargetLinkLanguage("")
{
this->TargetLinkLanguage = target->Target
->GetLinkerLanguage(this->GetConfigName());
@@ -72,10 +72,10 @@ cmNinjaNormalTargetGenerator::~cmNinjaNormalTargetGenerator()
void cmNinjaNormalTargetGenerator::Generate()
{
- if (!this->TargetLinkLanguage) {
+ if (this->TargetLinkLanguage.empty()) {
cmSystemTools::Error("CMake can not determine linker language for "
"target: ",
- this->GetTarget()->GetName());
+ this->GetTarget()->GetName().c_str());
return;
}
@@ -109,9 +109,9 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules()
<< "\n\n";
#endif
- std::set<cmStdString> languages;
+ std::set<std::string> languages;
this->GetTarget()->GetLanguages(languages);
- for(std::set<cmStdString>::const_iterator l = languages.begin();
+ for(std::set<std::string>::const_iterator l = languages.begin();
l != languages.end();
++l)
this->WriteLanguageRules(*l);
@@ -140,7 +140,7 @@ std::string
cmNinjaNormalTargetGenerator
::LanguageLinkerRule() const
{
- return std::string(this->TargetLinkLanguage)
+ return this->TargetLinkLanguage
+ "_"
+ cmTarget::GetTargetTypeName(this->GetTarget()->GetType())
+ "_LINKER";
@@ -163,7 +163,7 @@ cmNinjaNormalTargetGenerator
cmLocalGenerator::RuleVariables vars;
vars.RuleLauncher = "RULE_LAUNCH_LINK";
vars.CMTarget = this->GetTarget();
- vars.Language = this->TargetLinkLanguage;
+ vars.Language = this->TargetLinkLanguage.c_str();
std::string responseFlag;
if (!useResponseFile) {
diff --git a/Source/cmNinjaNormalTargetGenerator.h b/Source/cmNinjaNormalTargetGenerator.h
index c7a089c..556ed5e 100644
--- a/Source/cmNinjaNormalTargetGenerator.h
+++ b/Source/cmNinjaNormalTargetGenerator.h
@@ -47,7 +47,7 @@ private:
std::string TargetNameReal;
std::string TargetNameImport;
std::string TargetNamePDB;
- const char *TargetLinkLanguage;
+ std::string TargetLinkLanguage;
};
#endif // ! cmNinjaNormalTargetGenerator_h
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 00b0441..3ef236a 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -91,26 +91,26 @@ cmGlobalNinjaGenerator* cmNinjaTargetGenerator::GetGlobalGenerator() const
return this->LocalGenerator->GetGlobalNinjaGenerator();
}
-const char* cmNinjaTargetGenerator::GetConfigName() const
+std::string const& cmNinjaTargetGenerator::GetConfigName() const
{
return this->LocalGenerator->GetConfigName();
}
// TODO: Picked up from cmMakefileTargetGenerator. Refactor it.
-const char* cmNinjaTargetGenerator::GetFeature(const char* feature)
+const char* cmNinjaTargetGenerator::GetFeature(const std::string& feature)
{
return this->Target->GetFeature(feature, this->GetConfigName());
}
// TODO: Picked up from cmMakefileTargetGenerator. Refactor it.
-bool cmNinjaTargetGenerator::GetFeatureAsBool(const char* feature)
+bool cmNinjaTargetGenerator::GetFeatureAsBool(const std::string& feature)
{
return cmSystemTools::IsOn(this->GetFeature(feature));
}
// TODO: Picked up from cmMakefileTargetGenerator. Refactor it.
void cmNinjaTargetGenerator::AddFeatureFlags(std::string& flags,
- const char* lang)
+ const std::string& lang)
{
// Add language-specific flags.
this->LocalGenerator->AddLanguageFlags(flags, lang, this->GetConfigName());
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 43f2279..e66e55f 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -65,14 +65,14 @@ protected:
cmMakefile* GetMakefile() const
{ return this->Makefile; }
- const char* GetConfigName() const;
+ std::string const& GetConfigName() const;
std::string LanguageCompilerRule(const std::string& lang) const
{ return lang + "_COMPILER"; }
- const char* GetFeature(const char* feature);
- bool GetFeatureAsBool(const char* feature);
- void AddFeatureFlags(std::string& flags, const char* lang);
+ const char* GetFeature(const std::string& feature);
+ bool GetFeatureAsBool(const std::string& feature);
+ void AddFeatureFlags(std::string& flags, const std::string& lang);
/**
* Compute the flags for compilation of object files for a given @a language.
@@ -140,7 +140,7 @@ protected:
MacOSXContentGeneratorType* MacOSXContentGenerator;
// Properly initialized by sub-classes.
cmOSXBundleGenerator* OSXBundleGenerator;
- std::set<cmStdString> MacContentFolders;
+ std::set<std::string> MacContentFolders;
void addPoolNinjaVariable(const char* pool_property,
cmTarget* target,
diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index 78b59b3..449f923 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/Source/cmOSXBundleGenerator.cxx
@@ -19,7 +19,7 @@
//----------------------------------------------------------------------------
cmOSXBundleGenerator::
cmOSXBundleGenerator(cmGeneratorTarget* target,
- const char* configName)
+ const std::string& configName)
: GT(target)
, Makefile(target->Target->GetMakefile())
, LocalGenerator(Makefile->GetLocalGenerator())
diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h
index 2f36394..95b4aef 100644
--- a/Source/cmOSXBundleGenerator.h
+++ b/Source/cmOSXBundleGenerator.h
@@ -27,7 +27,7 @@ class cmOSXBundleGenerator
{
public:
cmOSXBundleGenerator(cmGeneratorTarget* target,
- const char* configName);
+ const std::string& configName);
// create an app bundle at a given root, and return
// the directory within the bundle that contains the executable
@@ -52,7 +52,7 @@ public:
MacOSXContentGeneratorType* generator);
std::string InitMacOSXContentDirectory(const char* pkgloc);
- void SetMacContentFolders(std::set<cmStdString>* macContentFolders)
+ void SetMacContentFolders(std::set<std::string>* macContentFolders)
{ this->MacContentFolders = macContentFolders; }
private:
@@ -62,8 +62,8 @@ private:
cmGeneratorTarget* GT;
cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator;
- const char* ConfigName;
- std::set<cmStdString>* MacContentFolders;
+ std::string ConfigName;
+ std::set<std::string>* MacContentFolders;
};
diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx
index 776a3a4..dbe2478 100644
--- a/Source/cmOptionCommand.cxx
+++ b/Source/cmOptionCommand.cxx
@@ -55,10 +55,7 @@ bool cmOptionCommand
it.SetProperty("HELPSTRING", args[1].c_str());
return true;
}
- if ( it.GetValue() )
- {
- initialValue = it.GetValue();
- }
+ initialValue = it.GetValue();
}
if(args.size() == 3)
{
diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h
index 89e3ac1..12a6472 100644
--- a/Source/cmOptionCommand.h
+++ b/Source/cmOptionCommand.h
@@ -40,7 +40,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "option";}
+ virtual std::string GetName() const {return "option";}
/**
* This determines if the command is invoked when in script mode.
diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx
index 86beb97..79677e3 100644
--- a/Source/cmOrderDirectories.cxx
+++ b/Source/cmOrderDirectories.cxx
@@ -138,9 +138,9 @@ bool cmOrderDirectoriesConstraint::FileMayConflict(std::string const& dir,
}
// Check if the file will be built by cmake.
- std::set<cmStdString> const& files =
+ std::set<std::string> const& files =
(this->GlobalGenerator->GetDirectoryContent(dir, false));
- std::set<cmStdString>::const_iterator fi = files.find(name);
+ std::set<std::string>::const_iterator fi = files.find(name);
return fi != files.end();
}
@@ -200,7 +200,7 @@ bool cmOrderDirectoriesConstraintSOName::FindConflict(std::string const& dir)
{
// We do not have the soname. Look for files in the directory
// that may conflict.
- std::set<cmStdString> const& files =
+ std::set<std::string> const& files =
(this->GlobalGenerator
->GetDirectoryContent(dir, true));
@@ -208,9 +208,9 @@ bool cmOrderDirectoriesConstraintSOName::FindConflict(std::string const& dir)
// know the soname just look at all files that start with the
// file name. Usually the soname starts with the library name.
std::string base = this->FileName;
- std::set<cmStdString>::const_iterator first = files.lower_bound(base);
+ std::set<std::string>::const_iterator first = files.lower_bound(base);
++base[base.size()-1];
- std::set<cmStdString>::const_iterator last = files.upper_bound(base);
+ std::set<std::string>::const_iterator last = files.upper_bound(base);
if(first != last)
{
return true;
@@ -251,8 +251,8 @@ bool cmOrderDirectoriesConstraintLibrary::FindConflict(std::string const& dir)
if(!this->OD->LinkExtensions.empty() &&
this->OD->RemoveLibraryExtension.find(this->FileName))
{
- cmStdString lib = this->OD->RemoveLibraryExtension.match(1);
- cmStdString ext = this->OD->RemoveLibraryExtension.match(2);
+ std::string lib = this->OD->RemoveLibraryExtension.match(1);
+ std::string ext = this->OD->RemoveLibraryExtension.match(2);
for(std::vector<std::string>::iterator
i = this->OD->LinkExtensions.begin();
i != this->OD->LinkExtensions.end(); ++i)
@@ -407,7 +407,7 @@ cmOrderDirectories
//----------------------------------------------------------------------------
void
cmOrderDirectories
-::SetImplicitDirectories(std::set<cmStdString> const& implicitDirs)
+::SetImplicitDirectories(std::set<std::string> const& implicitDirs)
{
this->ImplicitDirectories = implicitDirs;
}
@@ -444,11 +444,11 @@ void cmOrderDirectories::CollectOriginalDirectories()
int cmOrderDirectories::AddOriginalDirectory(std::string const& dir)
{
// Add the runtime directory with a unique index.
- std::map<cmStdString, int>::iterator i =
+ std::map<std::string, int>::iterator i =
this->DirectoryIndex.find(dir);
if(i == this->DirectoryIndex.end())
{
- std::map<cmStdString, int>::value_type
+ std::map<std::string, int>::value_type
entry(dir, static_cast<int>(this->OriginalDirectories.size()));
i = this->DirectoryIndex.insert(entry).first;
this->OriginalDirectories.push_back(dir);
diff --git a/Source/cmOrderDirectories.h b/Source/cmOrderDirectories.h
index 76bf429..07c85dd 100644
--- a/Source/cmOrderDirectories.h
+++ b/Source/cmOrderDirectories.h
@@ -34,7 +34,7 @@ public:
void AddLinkLibrary(std::string const& fullPath);
void AddUserDirectories(std::vector<std::string> const& extra);
void AddLanguageDirectories(std::vector<std::string> const& dirs);
- void SetImplicitDirectories(std::set<cmStdString> const& implicitDirs);
+ void SetImplicitDirectories(std::set<std::string> const& implicitDirs);
void SetLinkExtensionInfo(std::vector<std::string> const& linkExtensions,
std::string const& removeExtRegex);
@@ -54,11 +54,11 @@ private:
std::vector<std::string> LanguageDirectories;
cmsys::RegularExpression RemoveLibraryExtension;
std::vector<std::string> LinkExtensions;
- std::set<cmStdString> ImplicitDirectories;
- std::set<cmStdString> EmmittedConstraintSOName;
- std::set<cmStdString> EmmittedConstraintLibrary;
+ std::set<std::string> ImplicitDirectories;
+ std::set<std::string> EmmittedConstraintSOName;
+ std::set<std::string> EmmittedConstraintLibrary;
std::vector<std::string> OriginalDirectories;
- std::map<cmStdString, int> DirectoryIndex;
+ std::map<std::string, int> DirectoryIndex;
std::vector<int> DirectoryVisited;
void CollectOriginalDirectories();
int AddOriginalDirectory(std::string const& dir);
diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h
index dd5ed6c..95eba38 100644
--- a/Source/cmOutputRequiredFilesCommand.h
+++ b/Source/cmOutputRequiredFilesCommand.h
@@ -22,7 +22,7 @@ public:
virtual cmCommand* Clone() { return new cmOutputRequiredFilesCommand; }
virtual bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus &status);
- virtual const char* GetName() const { return "output_required_files";}
+ virtual std::string GetName() const { return "output_required_files";}
virtual bool IsDiscouraged() const { return true; }
void ListDependencies(cmDependInformation const *info,
diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h
index f7d086d..7aacb55 100644
--- a/Source/cmProjectCommand.h
+++ b/Source/cmProjectCommand.h
@@ -43,7 +43,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "project";}
+ virtual std::string GetName() const {return "project";}
cmTypeMacro(cmProjectCommand, cmCommand);
};
diff --git a/Source/cmProperty.cxx b/Source/cmProperty.cxx
index 3b37cf3..40976db 100644
--- a/Source/cmProperty.cxx
+++ b/Source/cmProperty.cxx
@@ -12,14 +12,15 @@
#include "cmProperty.h"
#include "cmSystemTools.h"
-void cmProperty::Set(const char *name, const char *value)
+void cmProperty::Set(const std::string& name, const char *value)
{
this->Name = name;
this->Value = value;
this->ValueHasBeenSet = true;
}
-void cmProperty::Append(const char *name, const char *value, bool asString)
+void cmProperty::Append(const std::string& name, const char *value,
+ bool asString)
{
this->Name = name;
if(!this->Value.empty() && *value && !asString)
diff --git a/Source/cmProperty.h b/Source/cmProperty.h
index bb75bb0..789be1d 100644
--- a/Source/cmProperty.h
+++ b/Source/cmProperty.h
@@ -21,10 +21,11 @@ public:
TEST, VARIABLE, CACHED_VARIABLE };
// set this property
- void Set(const char *name, const char *value);
+ void Set(const std::string& name, const char *value);
// append to this property
- void Append(const char *name, const char *value, bool asString = false);
+ void Append(const std::string& name, const char *value,
+ bool asString = false);
// get the value
const char *GetValue() const;
diff --git a/Source/cmPropertyDefinition.cxx b/Source/cmPropertyDefinition.cxx
index abc57ce..1af967c 100644
--- a/Source/cmPropertyDefinition.cxx
+++ b/Source/cmPropertyDefinition.cxx
@@ -13,7 +13,7 @@
#include "cmSystemTools.h"
void cmPropertyDefinition
-::DefineProperty(const char *name, cmProperty::ScopeType scope,
+::DefineProperty(const std::string& name, cmProperty::ScopeType scope,
const char *shortDescription,
const char *fullDescription,
bool chain)
diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h
index 1b6a7a6..9ca8222 100644
--- a/Source/cmPropertyDefinition.h
+++ b/Source/cmPropertyDefinition.h
@@ -27,7 +27,7 @@ class cmPropertyDefinition
{
public:
/// Define this property
- void DefineProperty(const char *name, cmProperty::ScopeType scope,
+ void DefineProperty(const std::string& name, cmProperty::ScopeType scope,
const char *ShortDescription,
const char *FullDescription,
bool chained);
diff --git a/Source/cmPropertyDefinitionMap.cxx b/Source/cmPropertyDefinitionMap.cxx
index db29504..3875318 100644
--- a/Source/cmPropertyDefinitionMap.cxx
+++ b/Source/cmPropertyDefinitionMap.cxx
@@ -14,16 +14,11 @@
#include "cmDocumentationSection.h"
void cmPropertyDefinitionMap
-::DefineProperty(const char *name, cmProperty::ScopeType scope,
+::DefineProperty(const std::string& name, cmProperty::ScopeType scope,
const char *ShortDescription,
const char *FullDescription,
bool chain)
{
- if (!name)
- {
- return;
- }
-
cmPropertyDefinitionMap::iterator it = this->find(name);
cmPropertyDefinition *prop;
if (it == this->end())
@@ -34,13 +29,8 @@ void cmPropertyDefinitionMap
}
}
-bool cmPropertyDefinitionMap::IsPropertyDefined(const char *name)
+bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name)
{
- if (!name)
- {
- return false;
- }
-
cmPropertyDefinitionMap::iterator it = this->find(name);
if (it == this->end())
{
@@ -50,13 +40,8 @@ bool cmPropertyDefinitionMap::IsPropertyDefined(const char *name)
return true;
}
-bool cmPropertyDefinitionMap::IsPropertyChained(const char *name)
+bool cmPropertyDefinitionMap::IsPropertyChained(const std::string& name)
{
- if (!name)
- {
- return false;
- }
-
cmPropertyDefinitionMap::iterator it = this->find(name);
if (it == this->end())
{
diff --git a/Source/cmPropertyDefinitionMap.h b/Source/cmPropertyDefinitionMap.h
index 736e243..00c7328 100644
--- a/Source/cmPropertyDefinitionMap.h
+++ b/Source/cmPropertyDefinitionMap.h
@@ -17,20 +17,20 @@
class cmDocumentationSection;
class cmPropertyDefinitionMap :
-public std::map<cmStdString,cmPropertyDefinition>
+public std::map<std::string,cmPropertyDefinition>
{
public:
// define the property
- void DefineProperty(const char *name, cmProperty::ScopeType scope,
+ void DefineProperty(const std::string& name, cmProperty::ScopeType scope,
const char *ShortDescription,
const char *FullDescription,
bool chain);
// has a named property been defined
- bool IsPropertyDefined(const char *name);
+ bool IsPropertyDefined(const std::string& name);
// is a named property set to chain
- bool IsPropertyChained(const char *name);
+ bool IsPropertyChained(const std::string& name);
};
#endif
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index e94e3e9..e335b3b 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -13,7 +13,7 @@
#include "cmSystemTools.h"
#include "cmake.h"
-cmProperty *cmPropertyMap::GetOrCreateProperty(const char *name)
+cmProperty *cmPropertyMap::GetOrCreateProperty(const std::string& name)
{
cmPropertyMap::iterator it = this->find(name);
cmProperty *prop;
@@ -28,13 +28,9 @@ cmProperty *cmPropertyMap::GetOrCreateProperty(const char *name)
return prop;
}
-void cmPropertyMap::SetProperty(const char *name, const char *value,
+void cmPropertyMap::SetProperty(const std::string& name, const char *value,
cmProperty::ScopeType scope)
{
- if (!name)
- {
- return;
- }
if(!value)
{
this->erase(name);
@@ -46,11 +42,11 @@ void cmPropertyMap::SetProperty(const char *name, const char *value,
prop->Set(name,value);
}
-void cmPropertyMap::AppendProperty(const char* name, const char* value,
+void cmPropertyMap::AppendProperty(const std::string& name, const char* value,
cmProperty::ScopeType scope, bool asString)
{
// Skip if nothing to append.
- if(!name || !value || !*value)
+ if(!value || !*value)
{
return;
}
@@ -61,12 +57,12 @@ void cmPropertyMap::AppendProperty(const char* name, const char* value,
}
const char *cmPropertyMap
-::GetPropertyValue(const char *name,
+::GetPropertyValue(const std::string& name,
cmProperty::ScopeType scope,
bool &chain) const
{
chain = false;
- if (!name)
+ if (name.empty())
{
return 0;
}
diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h
index 0c3aad4..fa33848 100644
--- a/Source/cmPropertyMap.h
+++ b/Source/cmPropertyMap.h
@@ -16,18 +16,18 @@
class cmake;
-class cmPropertyMap : public std::map<cmStdString,cmProperty>
+class cmPropertyMap : public std::map<std::string,cmProperty>
{
public:
- cmProperty *GetOrCreateProperty(const char *name);
+ cmProperty *GetOrCreateProperty(const std::string& name);
- void SetProperty(const char *name, const char *value,
+ void SetProperty(const std::string& name, const char *value,
cmProperty::ScopeType scope);
- void AppendProperty(const char* name, const char* value,
+ void AppendProperty(const std::string& name, const char* value,
cmProperty::ScopeType scope, bool asString=false);
- const char *GetPropertyValue(const char *name,
+ const char *GetPropertyValue(const std::string& name,
cmProperty::ScopeType scope,
bool &chain) const;
diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx
index 0d3c994..ca007cb 100644
--- a/Source/cmQTWrapCPPCommand.cxx
+++ b/Source/cmQTWrapCPPCommand.cxx
@@ -97,7 +97,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& argsIn,
depends.push_back(moc_exe);
depends.push_back(hname);
- const char* no_main_dependency = 0;
+ std::string no_main_dependency = "";
const char* no_working_dir = 0;
this->Makefile->AddCustomCommandToOutput(newName.c_str(),
depends,
diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h
index 868eb91..85729dd 100644
--- a/Source/cmQTWrapCPPCommand.h
+++ b/Source/cmQTWrapCPPCommand.h
@@ -45,7 +45,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "qt_wrap_cpp";}
+ virtual std::string GetName() const { return "qt_wrap_cpp";}
};
diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx
index a6a4b51..2a1129d 100644
--- a/Source/cmQTWrapUICommand.cxx
+++ b/Source/cmQTWrapUICommand.cxx
@@ -128,7 +128,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& argsIn,
std::vector<std::string> depends;
depends.push_back(uiName);
- const char* no_main_dependency = 0;
+ std::string no_main_dependency = "";
const char* no_comment = 0;
const char* no_working_dir = 0;
this->Makefile->AddCustomCommandToOutput(hName.c_str(),
diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h
index 3406dac..4aa9a61 100644
--- a/Source/cmQTWrapUICommand.h
+++ b/Source/cmQTWrapUICommand.h
@@ -43,7 +43,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "qt_wrap_ui";}
+ virtual std::string GetName() const { return "qt_wrap_ui";}
};
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index dfb310e..c32f624 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -105,7 +105,7 @@ static std::string extractSubDir(const std::string& absPath,
static void copyTargetProperty(cmTarget* destinationTarget,
cmTarget* sourceTarget,
- const char* propertyName)
+ const std::string& propertyName)
{
const char* propertyValue = sourceTarget->GetProperty(propertyName);
if (propertyValue)
@@ -251,7 +251,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
bool usePRE_BUILD = false;
cmLocalGenerator* localGen = makefile->GetLocalGenerator();
cmGlobalGenerator* gg = localGen->GetGlobalGenerator();
- if(strstr(gg->GetName(), "Visual Studio"))
+ if(gg->GetName().find("Visual Studio") != std::string::npos)
{
cmLocalVisualStudioGenerator* vslg =
static_cast<cmLocalVisualStudioGenerator*>(localGen);
@@ -306,7 +306,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
}
static void GetCompileDefinitionsAndDirectories(cmTarget const* target,
- const char * config,
+ const std::string& config,
std::string &incs,
std::string &defs)
{
@@ -366,7 +366,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target)
qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR");
}
if (const char *targetQtVersion =
- target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", 0))
+ target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", ""))
{
qtVersion = targetQtVersion;
}
@@ -563,7 +563,7 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
std::string _moc_incs;
std::string _moc_compile_defs;
std::vector<std::string> configs;
- const char *config = makefile->GetConfigurations(configs);
+ const std::string& config = makefile->GetConfigurations(configs);
GetCompileDefinitionsAndDirectories(target, config,
_moc_incs, _moc_compile_defs);
@@ -610,7 +610,7 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
autogenTargetName.c_str());
return;
}
- makefile->AddDefinition("_qt_moc_executable", qt5Moc->GetLocation(0));
+ makefile->AddDefinition("_qt_moc_executable", qt5Moc->GetLocation(""));
}
else if (strcmp(qtVersion, "4") == 0)
{
@@ -621,7 +621,7 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
autogenTargetName.c_str());
return;
}
- makefile->AddDefinition("_qt_moc_executable", qt4Moc->GetLocation(0));
+ makefile->AddDefinition("_qt_moc_executable", qt4Moc->GetLocation(""));
}
else
{
@@ -660,7 +660,7 @@ void cmQtAutoGenerators::MergeUicOptions(std::vector<std::string> &opts,
++o;
}
if (std::find_if(cmArrayBegin(valueOptions), cmArrayEnd(valueOptions),
- cmStrCmp(o)) != cmArrayEnd(valueOptions))
+ cmStrCmp(*it)) != cmArrayEnd(valueOptions))
{
assert(existingIt + 1 != opts.end());
*(existingIt + 1) = *(it + 1);
@@ -675,7 +675,7 @@ void cmQtAutoGenerators::MergeUicOptions(std::vector<std::string> &opts,
opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
}
-static void GetUicOpts(cmTarget const* target, const char * config,
+static void GetUicOpts(cmTarget const* target, const std::string& config,
std::string &optString)
{
std::vector<std::string> opts;
@@ -697,7 +697,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
{
cmMakefile *makefile = target->GetMakefile();
- std::set<cmStdString> skipped;
+ std::set<std::string> skipped;
std::vector<std::string> skipVec;
cmSystemTools::ExpandListArgument(this->SkipUic.c_str(), skipVec);
@@ -717,7 +717,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
std::string _uic_opts;
std::vector<std::string> configs;
- const char *config = makefile->GetConfigurations(configs);
+ const std::string& config = makefile->GetConfigurations(configs);
GetUicOpts(target, config, _uic_opts);
if (!_uic_opts.empty())
@@ -772,7 +772,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
makefile->AddDefinition("_qt_uic_options_options",
cmLocalGenerator::EscapeForCMake(uiFileOptions.c_str()).c_str());
- const char* targetName = target->GetName();
+ std::string targetName = target->GetName();
if (strcmp(qtVersion, "5") == 0)
{
cmTarget *qt5Uic = makefile->FindTargetToUse("Qt5::uic");
@@ -782,7 +782,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
}
else
{
- makefile->AddDefinition("_qt_uic_executable", qt5Uic->GetLocation(0));
+ makefile->AddDefinition("_qt_uic_executable", qt5Uic->GetLocation(""));
}
}
else if (strcmp(qtVersion, "4") == 0)
@@ -791,15 +791,15 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
if (!qt4Uic)
{
cmSystemTools::Error("Qt4::uic target not found ",
- targetName);
+ targetName.c_str());
return;
}
- makefile->AddDefinition("_qt_uic_executable", qt4Uic->GetLocation(0));
+ makefile->AddDefinition("_qt_uic_executable", qt4Uic->GetLocation(""));
}
else
{
cmSystemTools::Error("The CMAKE_AUTOUIC feature supports only Qt 4 and "
- "Qt 5 ", targetName);
+ "Qt 5 ", targetName.c_str());
}
}
@@ -831,7 +831,7 @@ void cmQtAutoGenerators::MergeRccOptions(std::vector<std::string> &opts,
++o;
}
if (std::find_if(cmArrayBegin(valueOptions), cmArrayEnd(valueOptions),
- cmStrCmp(o)) != cmArrayEnd(valueOptions))
+ cmStrCmp(*it)) != cmArrayEnd(valueOptions))
{
assert(existingIt + 1 != opts.end());
*(existingIt + 1) = *(it + 1);
@@ -921,17 +921,17 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target)
makefile->AddDefinition("_qt_rcc_options_options",
cmLocalGenerator::EscapeForCMake(rccFileOptions.c_str()).c_str());
- const char* targetName = target->GetName();
+ std::string targetName = target->GetName();
if (strcmp(qtVersion, "5") == 0)
{
cmTarget *qt5Rcc = makefile->FindTargetToUse("Qt5::rcc");
if (!qt5Rcc)
{
cmSystemTools::Error("Qt5::rcc target not found ",
- targetName);
+ targetName.c_str());
return;
}
- makefile->AddDefinition("_qt_rcc_executable", qt5Rcc->GetLocation(0));
+ makefile->AddDefinition("_qt_rcc_executable", qt5Rcc->GetLocation(""));
}
else if (strcmp(qtVersion, "4") == 0)
{
@@ -939,20 +939,20 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target)
if (!qt4Rcc)
{
cmSystemTools::Error("Qt4::rcc target not found ",
- targetName);
+ targetName.c_str());
return;
}
- makefile->AddDefinition("_qt_rcc_executable", qt4Rcc->GetLocation(0));
+ makefile->AddDefinition("_qt_rcc_executable", qt4Rcc->GetLocation(""));
}
else
{
cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and "
- "Qt 5 ", targetName);
+ "Qt 5 ", targetName.c_str());
}
}
static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
- const char* targetDirectory)
+ const std::string& targetDirectory)
{
cmGlobalGenerator* gg = new cmGlobalGenerator();
gg->SetCMakeInstance(cm);
@@ -967,7 +967,8 @@ static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
return gg;
}
-bool cmQtAutoGenerators::Run(const char* targetDirectory, const char *config)
+bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
+ const std::string& config)
{
bool success = true;
cmake cm;
@@ -993,10 +994,11 @@ bool cmQtAutoGenerators::Run(const char* targetDirectory, const char *config)
}
bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile,
- const char* targetDirectory,
- const char *config)
+ const std::string& targetDirectory,
+ const std::string& config)
{
- std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
+ std::string filename(
+ cmSystemTools::CollapseFullPath(targetDirectory.c_str()));
cmSystemTools::ConvertToUnixSlashes(filename);
filename += "/AutogenInfo.cmake";
@@ -1027,7 +1029,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile,
{
std::string compileDefsPropOrig = "AM_MOC_COMPILE_DEFINITIONS";
std::string compileDefsProp = compileDefsPropOrig;
- if(config)
+ if(!config.empty())
{
compileDefsProp += "_";
compileDefsProp += config;
@@ -1039,7 +1041,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile,
{
std::string includesPropOrig = "AM_MOC_INCLUDES";
std::string includesProp = includesPropOrig;
- if(config)
+ if(!config.empty())
{
includesProp += "_";
includesProp += config;
@@ -1058,7 +1060,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile,
= makefile->GetSafeDefinition("AM_UIC_OPTIONS_FILES");
std::string uicOptionsPropOrig = "AM_UIC_TARGET_OPTIONS";
std::string uicOptionsProp = uicOptionsPropOrig;
- if(config)
+ if(!config.empty())
{
uicOptionsProp += "_";
uicOptionsProp += config;
@@ -1136,9 +1138,10 @@ std::string cmQtAutoGenerators::MakeCompileSettingsString(cmMakefile* makefile)
bool cmQtAutoGenerators::ReadOldMocDefinitionsFile(cmMakefile* makefile,
- const char* targetDirectory)
+ const std::string& targetDirectory)
{
- std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
+ std::string filename(
+ cmSystemTools::CollapseFullPath(targetDirectory.c_str()));
cmSystemTools::ConvertToUnixSlashes(filename);
filename += "/AutomocOldMocDefinitions.cmake";
@@ -1152,9 +1155,11 @@ bool cmQtAutoGenerators::ReadOldMocDefinitionsFile(cmMakefile* makefile,
void
-cmQtAutoGenerators::WriteOldMocDefinitionsFile(const char* targetDirectory)
+cmQtAutoGenerators::WriteOldMocDefinitionsFile(
+ const std::string& targetDirectory)
{
- std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
+ std::string filename(
+ cmSystemTools::CollapseFullPath(targetDirectory.c_str()));
cmSystemTools::ConvertToUnixSlashes(filename);
filename += "/AutomocOldMocDefinitions.cmake";
@@ -1895,7 +1900,7 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
|cmsysTerminal_Color_ForegroundBold,
msg.c_str(), true, this->ColorOutput);
- std::vector<cmStdString> command;
+ std::vector<std::string> command;
command.push_back(this->MocExecutable);
for (std::list<std::string>::const_iterator it = this->MocIncludes.begin();
it != this->MocIncludes.end();
@@ -1924,7 +1929,7 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
if (this->Verbose)
{
- for(std::vector<cmStdString>::const_iterator cmdIt = command.begin();
+ for(std::vector<std::string>::const_iterator cmdIt = command.begin();
cmdIt != command.end();
++cmdIt)
{
@@ -1971,7 +1976,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& path,
|cmsysTerminal_Color_ForegroundBold,
msg.c_str(), true, this->ColorOutput);
- std::vector<cmStdString> command;
+ std::vector<std::string> command;
command.push_back(this->UicExecutable);
std::vector<std::string> opts = this->UicTargetOptions;
@@ -1996,7 +2001,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& path,
if (this->Verbose)
{
- for(std::vector<cmStdString>::const_iterator cmdIt = command.begin();
+ for(std::vector<std::string>::const_iterator cmdIt = command.begin();
cmdIt != command.end();
++cmdIt)
{
@@ -2034,7 +2039,7 @@ bool cmQtAutoGenerators::GenerateQrc()
{
continue;
}
- std::vector<cmStdString> command;
+ std::vector<std::string> command;
command.push_back(this->RccExecutable);
std::string basename = cmsys::SystemTools::
@@ -2068,7 +2073,7 @@ bool cmQtAutoGenerators::GenerateQrc()
if (this->Verbose)
{
- for(std::vector<cmStdString>::const_iterator cmdIt = command.begin();
+ for(std::vector<std::string>::const_iterator cmdIt = command.begin();
cmdIt != command.end();
++cmdIt)
{
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 2840fbf..a593dd5 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -21,7 +21,7 @@ class cmQtAutoGenerators
{
public:
cmQtAutoGenerators();
- bool Run(const char* targetDirectory, const char *config);
+ bool Run(const std::string& targetDirectory, const std::string& config);
bool InitializeAutogenTarget(cmTarget* target);
void SetupAutoGenerateTarget(cmTarget const* target);
@@ -37,11 +37,11 @@ private:
void SetupAutoRccTarget(cmTarget const* target);
bool ReadAutogenInfoFile(cmMakefile* makefile,
- const char* targetDirectory,
- const char *config);
+ const std::string& targetDirectory,
+ const std::string& config);
bool ReadOldMocDefinitionsFile(cmMakefile* makefile,
- const char* targetDirectory);
- void WriteOldMocDefinitionsFile(const char* targetDirectory);
+ const std::string& targetDirectory);
+ void WriteOldMocDefinitionsFile(const std::string& targetDirectory);
std::string MakeCompileSettingsString(cmMakefile* makefile);
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index 11a9913..7ff12dd 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -326,11 +326,11 @@ std::string cmRST::ReplaceSubstitutions(std::string const& line)
std::string::size_type start = this->Substitution.start(2);
std::string::size_type end = this->Substitution.end(2);
std::string substitute = this->Substitution.match(3);
- std::map<cmStdString, cmStdString>::iterator
+ std::map<std::string, std::string>::iterator
replace = this->Replace.find(substitute);
if(replace != this->Replace.end())
{
- std::pair<std::set<cmStdString>::iterator, bool> replaced =
+ std::pair<std::set<std::string>::iterator, bool> replaced =
this->Replaced.insert(substitute);
if(replaced.second)
{
diff --git a/Source/cmRST.h b/Source/cmRST.h
index 3356008..b9b2366 100644
--- a/Source/cmRST.h
+++ b/Source/cmRST.h
@@ -92,8 +92,8 @@ private:
std::vector<std::string> MarkupLines;
std::string DocDir;
- std::map<cmStdString, cmStdString> Replace;
- std::set<cmStdString> Replaced;
+ std::map<std::string, std::string> Replace;
+ std::set<std::string> Replaced;
std::string ReplaceName;
};
diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h
index ad73908..94161f8 100644
--- a/Source/cmRemoveCommand.h
+++ b/Source/cmRemoveCommand.h
@@ -45,7 +45,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "remove";}
+ virtual std::string GetName() const {return "remove";}
/** This command is kept for compatibility with older CMake versions. */
virtual bool IsDiscouraged() const
diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h
index 4e291fc..cac94be 100644
--- a/Source/cmRemoveDefinitionsCommand.h
+++ b/Source/cmRemoveDefinitionsCommand.h
@@ -42,7 +42,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "remove_definitions";}
+ virtual std::string GetName() const {return "remove_definitions";}
cmTypeMacro(cmRemoveDefinitionsCommand, cmCommand);
};
diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h
index 2822b62..4ff81ef 100644
--- a/Source/cmReturnCommand.h
+++ b/Source/cmReturnCommand.h
@@ -45,7 +45,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "return";}
+ virtual std::string GetName() const {return "return";}
cmTypeMacro(cmReturnCommand, cmCommand);
};
diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx
index 3b6a49b..7685d40 100644
--- a/Source/cmScriptGenerator.cxx
+++ b/Source/cmScriptGenerator.cxx
@@ -15,11 +15,11 @@
//----------------------------------------------------------------------------
cmScriptGenerator
-::cmScriptGenerator(const char* config_var,
+::cmScriptGenerator(const std::string& config_var,
std::vector<std::string> const& configurations):
RuntimeConfigVariable(config_var),
Configurations(configurations),
- ConfigurationName(0),
+ ConfigurationName(""),
ConfigurationTypes(0),
ActionsPerConfig(false)
{
@@ -34,21 +34,21 @@ cmScriptGenerator
//----------------------------------------------------------------------------
void
cmScriptGenerator
-::Generate(std::ostream& os, const char* config,
+::Generate(std::ostream& os, const std::string& config,
std::vector<std::string> const& configurationTypes)
{
this->ConfigurationName = config;
this->ConfigurationTypes = &configurationTypes;
this->GenerateScript(os);
- this->ConfigurationName = 0;
+ this->ConfigurationName = "";
this->ConfigurationTypes = 0;
}
//----------------------------------------------------------------------------
-static void cmScriptGeneratorEncodeConfig(const char* config,
+static void cmScriptGeneratorEncodeConfig(const std::string& config,
std::string& result)
{
- for(const char* c = config; *c; ++c)
+ for(const char* c = config.c_str(); *c; ++c)
{
if(*c >= 'a' && *c <= 'z')
{
@@ -73,12 +73,12 @@ static void cmScriptGeneratorEncodeConfig(const char* config,
//----------------------------------------------------------------------------
std::string
-cmScriptGenerator::CreateConfigTest(const char* config)
+cmScriptGenerator::CreateConfigTest(const std::string& config)
{
std::string result = "\"${";
result += this->RuntimeConfigVariable;
result += "}\" MATCHES \"^(";
- if(config && *config)
+ if(!config.empty())
{
cmScriptGeneratorEncodeConfig(config, result);
}
@@ -142,14 +142,15 @@ void cmScriptGenerator::GenerateScriptActions(std::ostream& os,
}
//----------------------------------------------------------------------------
-void cmScriptGenerator::GenerateScriptForConfig(std::ostream&, const char*,
+void cmScriptGenerator::GenerateScriptForConfig(std::ostream&,
+ const std::string&,
Indent const&)
{
// No actions for this generator.
}
//----------------------------------------------------------------------------
-bool cmScriptGenerator::GeneratesForConfig(const char* config)
+bool cmScriptGenerator::GeneratesForConfig(const std::string& config)
{
// If this is not a configuration-specific rule then we install.
if(this->Configurations.empty())
@@ -159,7 +160,7 @@ bool cmScriptGenerator::GeneratesForConfig(const char* config)
// This is a configuration-specific rule. Check if the config
// matches this rule.
- std::string config_upper = cmSystemTools::UpperCase(config?config:"");
+ std::string config_upper = cmSystemTools::UpperCase(config);
for(std::vector<std::string>::const_iterator i =
this->Configurations.begin();
i != this->Configurations.end(); ++i)
diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h
index 8b2ca33..9ab04f1 100644
--- a/Source/cmScriptGenerator.h
+++ b/Source/cmScriptGenerator.h
@@ -47,11 +47,11 @@ inline std::ostream& operator<<(std::ostream& os,
class cmScriptGenerator
{
public:
- cmScriptGenerator(const char* config_var,
+ cmScriptGenerator(const std::string& config_var,
std::vector<std::string> const& configurations);
virtual ~cmScriptGenerator();
- void Generate(std::ostream& os, const char* config,
+ void Generate(std::ostream& os, const std::string& config,
std::vector<std::string> const& configurationTypes);
const std::vector<std::string>& GetConfigurations() const
@@ -63,15 +63,15 @@ protected:
virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent);
virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
virtual void GenerateScriptForConfig(std::ostream& os,
- const char* config,
+ const std::string& config,
Indent const& indent);
virtual void GenerateScriptNoConfig(std::ostream&, Indent const&) {}
virtual bool NeedsScriptNoConfig() const { return false; }
// Test if this generator does something for a given configuration.
- bool GeneratesForConfig(const char*);
+ bool GeneratesForConfig(const std::string&);
- std::string CreateConfigTest(const char* config);
+ std::string CreateConfigTest(const std::string& config);
std::string CreateConfigTest(std::vector<std::string> const& configs);
std::string CreateComponentTest(const char* component);
@@ -80,7 +80,7 @@ protected:
std::vector<std::string> const Configurations;
// Information used during generation.
- const char* ConfigurationName;
+ std::string ConfigurationName;
std::vector<std::string> const* ConfigurationTypes;
// True if the subclass needs to generate an explicit rule for each
diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h
index ce02360..a527ae7 100644
--- a/Source/cmSeparateArgumentsCommand.h
+++ b/Source/cmSeparateArgumentsCommand.h
@@ -45,7 +45,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "separate_arguments";}
+ virtual std::string GetName() const {return "separate_arguments";}
cmTypeMacro(cmSeparateArgumentsCommand, cmCommand);
};
diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h
index 6cef0a0..4adc2d9 100644
--- a/Source/cmSetCommand.h
+++ b/Source/cmSetCommand.h
@@ -45,7 +45,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "set";}
+ virtual std::string GetName() const {return "set";}
cmTypeMacro(cmSetCommand, cmCommand);
};
diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h
index 6240598..f444a1b 100644
--- a/Source/cmSetDirectoryPropertiesCommand.h
+++ b/Source/cmSetDirectoryPropertiesCommand.h
@@ -37,7 +37,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "set_directory_properties";}
+ virtual std::string GetName() const { return "set_directory_properties";}
/**
* Static entry point for use by other commands
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 1a6f1d6..84c7610 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -203,7 +203,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode()
// Lookup the generator.
if(cmLocalGenerator* lg =
(this->Makefile->GetLocalGenerator()
- ->GetGlobalGenerator()->FindLocalGenerator(dir.c_str())))
+ ->GetGlobalGenerator()->FindLocalGenerator(dir)))
{
// Use the makefile for the directory found.
mf = lg->GetMakefile();
@@ -241,7 +241,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode()
//----------------------------------------------------------------------------
bool cmSetPropertyCommand::HandleTargetMode()
{
- for(std::set<cmStdString>::const_iterator ni = this->Names.begin();
+ for(std::set<std::string>::const_iterator ni = this->Names.begin();
ni != this->Names.end(); ++ni)
{
if (this->Makefile->IsAlias(*ni))
@@ -297,7 +297,7 @@ bool cmSetPropertyCommand::HandleTarget(cmTarget* target)
//----------------------------------------------------------------------------
bool cmSetPropertyCommand::HandleSourceMode()
{
- for(std::set<cmStdString>::const_iterator ni = this->Names.begin();
+ for(std::set<std::string>::const_iterator ni = this->Names.begin();
ni != this->Names.end(); ++ni)
{
// Get the source file.
@@ -345,8 +345,8 @@ bool cmSetPropertyCommand::HandleSource(cmSourceFile* sf)
bool cmSetPropertyCommand::HandleTestMode()
{
// Look for tests with all names given.
- std::set<cmStdString>::iterator next;
- for(std::set<cmStdString>::iterator ni = this->Names.begin();
+ std::set<std::string>::iterator next;
+ for(std::set<std::string>::iterator ni = this->Names.begin();
ni != this->Names.end(); ni = next)
{
next = ni;
@@ -369,7 +369,7 @@ bool cmSetPropertyCommand::HandleTestMode()
{
cmOStringStream e;
e << "given TEST names that do not exist:\n";
- for(std::set<cmStdString>::const_iterator ni = this->Names.begin();
+ for(std::set<std::string>::const_iterator ni = this->Names.begin();
ni != this->Names.end(); ++ni)
{
e << " " << *ni << "\n";
@@ -440,7 +440,7 @@ bool cmSetPropertyCommand::HandleCacheMode()
return false;
}
- for(std::set<cmStdString>::const_iterator ni = this->Names.begin();
+ for(std::set<std::string>::const_iterator ni = this->Names.begin();
ni != this->Names.end(); ++ni)
{
// Get the source file.
diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h
index 5470314..eaa0233 100644
--- a/Source/cmSetPropertyCommand.h
+++ b/Source/cmSetPropertyCommand.h
@@ -34,7 +34,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "set_property";}
+ virtual std::string GetName() const { return "set_property";}
/**
* This determines if the command is invoked when in script mode.
@@ -44,7 +44,7 @@ public:
cmTypeMacro(cmSetPropertyCommand, cmCommand);
private:
- std::set<cmStdString> Names;
+ std::set<std::string> Names;
std::string PropertyName;
std::string PropertyValue;
bool Remove;
diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h
index 8541a96..5fa5a3a 100644
--- a/Source/cmSetSourceFilesPropertiesCommand.h
+++ b/Source/cmSetSourceFilesPropertiesCommand.h
@@ -32,7 +32,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "set_source_files_properties";}
+ virtual std::string GetName() const { return "set_source_files_properties";}
cmTypeMacro(cmSetSourceFilesPropertiesCommand, cmCommand);
diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx
index dab4180..fa5aafe 100644
--- a/Source/cmSetTargetPropertiesCommand.cxx
+++ b/Source/cmSetTargetPropertiesCommand.cxx
@@ -91,7 +91,7 @@ bool cmSetTargetPropertiesCommand
}
bool cmSetTargetPropertiesCommand
-::SetOneTarget(const char *tname,
+::SetOneTarget(const std::string& tname,
std::vector<std::string> &propertyPairs,
cmMakefile *mf)
{
diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h
index 6221a18..3981ef3 100644
--- a/Source/cmSetTargetPropertiesCommand.h
+++ b/Source/cmSetTargetPropertiesCommand.h
@@ -32,12 +32,12 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "set_target_properties";}
+ virtual std::string GetName() const { return "set_target_properties";}
/**
* Used by this command and cmSetPropertiesCommand
*/
- static bool SetOneTarget(const char *tname,
+ static bool SetOneTarget(const std::string& tname,
std::vector<std::string> &propertyPairs,
cmMakefile *mf);
diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx
index 3d52cf2..c725d35 100644
--- a/Source/cmSetTestsPropertiesCommand.cxx
+++ b/Source/cmSetTestsPropertiesCommand.cxx
@@ -91,7 +91,7 @@ bool cmSetTestsPropertiesCommand
bool cmSetTestsPropertiesCommand
-::SetOneTest(const char *tname,
+::SetOneTest(const std::string& tname,
std::vector<std::string> &propertyPairs,
cmMakefile *mf, std::string &errors)
{
diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h
index 9e85495..dabe944 100644
--- a/Source/cmSetTestsPropertiesCommand.h
+++ b/Source/cmSetTestsPropertiesCommand.h
@@ -32,11 +32,11 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "set_tests_properties";}
+ virtual std::string GetName() const { return "set_tests_properties";}
cmTypeMacro(cmSetTestsPropertiesCommand, cmCommand);
- static bool SetOneTest(const char *tname,
+ static bool SetOneTest(const std::string& tname,
std::vector<std::string> &propertyPairs,
cmMakefile *mf,
std::string &errors);
diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h
index eb9d4d8..ec63ef8 100644
--- a/Source/cmSiteNameCommand.h
+++ b/Source/cmSiteNameCommand.h
@@ -45,7 +45,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "site_name";}
+ virtual std::string GetName() const {return "site_name";}
cmTypeMacro(cmSiteNameCommand, cmCommand);
};
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 23422a2..0d37205 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -18,7 +18,7 @@
#include "cmake.h"
//----------------------------------------------------------------------------
-cmSourceFile::cmSourceFile(cmMakefile* mf, const char* name):
+cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name):
Location(mf, name)
{
this->CustomCommand = 0;
@@ -39,7 +39,7 @@ std::string const& cmSourceFile::GetExtension() const
}
//----------------------------------------------------------------------------
-const char* cmSourceFile::GetLanguage()
+std::string cmSourceFile::GetLanguage()
{
// If the language was set explicitly by the user then use it.
if(const char* lang = this->GetProperty("LANGUAGE"))
@@ -76,7 +76,7 @@ const char* cmSourceFile::GetLanguage()
}
//----------------------------------------------------------------------------
-const char* cmSourceFile::GetLanguage() const
+std::string cmSourceFile::GetLanguage() const
{
// If the language was set explicitly by the user then use it.
if(const char* lang = this->GetProperty("LANGUAGE"))
@@ -87,11 +87,11 @@ const char* cmSourceFile::GetLanguage() const
// If the language was determined from the source file extension use it.
if(!this->Language.empty())
{
- return this->Language.c_str();
+ return this->Language;
}
// The language is not known.
- return 0;
+ return "";
}
//----------------------------------------------------------------------------
@@ -164,7 +164,7 @@ bool cmSourceFile::FindFullPath(std::string* error)
}
tryPath += this->Location.GetName();
tryPath = cmSystemTools::CollapseFullPath(tryPath.c_str(), *di);
- if(this->TryFullPath(tryPath.c_str(), 0))
+ if(this->TryFullPath(tryPath.c_str(), ""))
{
return true;
}
@@ -217,10 +217,11 @@ bool cmSourceFile::FindFullPath(std::string* error)
}
//----------------------------------------------------------------------------
-bool cmSourceFile::TryFullPath(const char* tp, const char* ext)
+bool cmSourceFile::TryFullPath(const std::string& path,
+ const std::string& ext)
{
- std::string tryPath = tp;
- if(ext && *ext)
+ std::string tryPath = path;
+ if(!ext.empty())
{
tryPath += ".";
tryPath += ext;
@@ -266,7 +267,8 @@ void cmSourceFile::CheckLanguage(std::string const& ext)
// Try to identify the source file language from the extension.
cmMakefile const* mf = this->Location.GetMakefile();
cmGlobalGenerator* gg = mf->GetLocalGenerator()->GetGlobalGenerator();
- if(const char* l = gg->GetLanguageFromExtension(ext.c_str()))
+ std::string l = gg->GetLanguageFromExtension(ext.c_str());
+ if(!l.empty())
{
this->Language = l;
}
@@ -279,13 +281,8 @@ bool cmSourceFile::Matches(cmSourceFileLocation const& loc)
}
//----------------------------------------------------------------------------
-void cmSourceFile::SetProperty(const char* prop, const char* value)
+void cmSourceFile::SetProperty(const std::string& prop, const char* value)
{
- if (!prop)
- {
- return;
- }
-
this->Properties.SetProperty(prop, value, cmProperty::SOURCE_FILE);
std::string ext =
@@ -293,7 +290,7 @@ void cmSourceFile::SetProperty(const char* prop, const char* value)
if (ext == ".ui")
{
cmMakefile const* mf = this->Location.GetMakefile();
- if (strcmp(prop, "AUTOUIC_OPTIONS") == 0)
+ if (prop == "AUTOUIC_OPTIONS")
{
const_cast<cmMakefile*>(mf)->AddQtUiFileWithOptions(this);
}
@@ -301,19 +298,15 @@ void cmSourceFile::SetProperty(const char* prop, const char* value)
}
//----------------------------------------------------------------------------
-void cmSourceFile::AppendProperty(const char* prop, const char* value,
+void cmSourceFile::AppendProperty(const std::string& prop, const char* value,
bool asString)
{
- if (!prop)
- {
- return;
- }
this->Properties.AppendProperty(prop, value, cmProperty::SOURCE_FILE,
asString);
}
//----------------------------------------------------------------------------
-const char* cmSourceFile::GetPropertyForUser(const char *prop)
+const char* cmSourceFile::GetPropertyForUser(const std::string& prop)
{
// This method is a consequence of design history and backwards
// compatibility. GetProperty is (and should be) a const method.
@@ -329,7 +322,7 @@ const char* cmSourceFile::GetPropertyForUser(const char *prop)
// cmSourceFileLocation class to commit to a particular full path to
// the source file as late as possible. If the users requests the
// LOCATION property we must commit now.
- if(strcmp(prop, "LOCATION") == 0)
+ if(prop == "LOCATION")
{
// Commit to a location.
this->GetFullPath();
@@ -340,10 +333,10 @@ const char* cmSourceFile::GetPropertyForUser(const char *prop)
}
//----------------------------------------------------------------------------
-const char* cmSourceFile::GetProperty(const char* prop) const
+const char* cmSourceFile::GetProperty(const std::string& prop) const
{
// Check for computed properties.
- if(strcmp(prop, "LOCATION") == 0)
+ if(prop == "LOCATION")
{
if(this->FullPath.empty())
{
@@ -368,7 +361,7 @@ const char* cmSourceFile::GetProperty(const char* prop) const
}
//----------------------------------------------------------------------------
-bool cmSourceFile::GetPropertyAsBool(const char* prop) const
+bool cmSourceFile::GetPropertyAsBool(const std::string& prop) const
{
return cmSystemTools::IsOn(this->GetProperty(prop));
}
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index 4440b05..17c96ac 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -31,7 +31,7 @@ public:
* Construct with the makefile storing the source and the initial
* name referencing it.
*/
- cmSourceFile(cmMakefile* mf, const char* name);
+ cmSourceFile(cmMakefile* mf, const std::string& name);
~cmSourceFile();
@@ -43,14 +43,15 @@ public:
void SetCustomCommand(cmCustomCommand *cc);
///! Set/Get a property of this source file
- void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char* prop, const char* value,bool asString=false);
- const char *GetProperty(const char *prop) const;
- bool GetPropertyAsBool(const char *prop) const;
+ void SetProperty(const std::string& prop, const char *value);
+ void AppendProperty(const std::string& prop,
+ const char* value,bool asString=false);
+ const char *GetProperty(const std::string& prop) const;
+ bool GetPropertyAsBool(const std::string& prop) const;
/** Implement getting a property when called from a CMake language
command like get_property or get_source_file_property. */
- const char* GetPropertyForUser(const char *prop);
+ const char* GetPropertyForUser(const std::string& prop);
/**
* The full path to the file. The non-const version of this method
@@ -78,8 +79,8 @@ public:
/**
* Get the language of the compiler to use for this source file.
*/
- const char* GetLanguage();
- const char* GetLanguage() const;
+ std::string GetLanguage();
+ std::string GetLanguage() const;
/**
* Return the vector that holds the list of dependencies
@@ -106,7 +107,7 @@ private:
bool FindFullPathFailed;
bool FindFullPath(std::string* error);
- bool TryFullPath(const char* tryPath, const char* ext);
+ bool TryFullPath(const std::string& path, const std::string& ext);
void CheckExtension();
void CheckLanguage(std::string const& ext);
diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index 5a8578b..30a53cb 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -18,9 +18,10 @@
//----------------------------------------------------------------------------
cmSourceFileLocation
-::cmSourceFileLocation(cmMakefile const* mf, const char* name): Makefile(mf)
+::cmSourceFileLocation(cmMakefile const* mf, const std::string& name)
+ : Makefile(mf)
{
- this->AmbiguousDirectory = !cmSystemTools::FileIsFullPath(name);
+ this->AmbiguousDirectory = !cmSystemTools::FileIsFullPath(name.c_str());
this->AmbiguousExtension = true;
this->Directory = cmSystemTools::GetFilenamePath(name);
this->Name = cmSystemTools::GetFilenameName(name);
@@ -28,7 +29,7 @@ cmSourceFileLocation
}
//----------------------------------------------------------------------------
-void cmSourceFileLocation::Update(const char* name)
+void cmSourceFileLocation::Update(const std::string& name)
{
if(this->AmbiguousDirectory)
{
@@ -80,7 +81,7 @@ void cmSourceFileLocation::DirectoryUseBinary()
}
//----------------------------------------------------------------------------
-void cmSourceFileLocation::UpdateExtension(const char* name)
+void cmSourceFileLocation::UpdateExtension(const std::string& name)
{
// Check the extension.
std::string ext = cmSystemTools::GetFilenameLastExtension(name);
@@ -92,7 +93,7 @@ void cmSourceFileLocation::UpdateExtension(const char* name)
cmMakefile const* mf = this->Makefile;
const std::vector<std::string>& srcExts = mf->GetSourceExtensions();
const std::vector<std::string>& hdrExts = mf->GetHeaderExtensions();
- if(gg->GetLanguageFromExtension(ext.c_str()) ||
+ if(!gg->GetLanguageFromExtension(ext.c_str()).empty() ||
std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end() ||
std::find(hdrExts.begin(), hdrExts.end(), ext) != hdrExts.end())
{
@@ -136,10 +137,10 @@ void cmSourceFileLocation::UpdateExtension(const char* name)
}
//----------------------------------------------------------------------------
-void cmSourceFileLocation::UpdateDirectory(const char* name)
+void cmSourceFileLocation::UpdateDirectory(const std::string& name)
{
// If a full path was given we know the directory.
- if(cmSystemTools::FileIsFullPath(name))
+ if(cmSystemTools::FileIsFullPath(name.c_str()))
{
this->Directory = cmSystemTools::GetFilenamePath(name);
this->AmbiguousDirectory = false;
diff --git a/Source/cmSourceFileLocation.h b/Source/cmSourceFileLocation.h
index c03eee7..c83e8c0 100644
--- a/Source/cmSourceFileLocation.h
+++ b/Source/cmSourceFileLocation.h
@@ -33,7 +33,7 @@ public:
* Construct for a source file created in a given cmMakefile
* instance with an initial name.
*/
- cmSourceFileLocation(cmMakefile const* mf, const char* name);
+ cmSourceFileLocation(cmMakefile const* mf, const std::string& name);
/**
* Return whether the givne source file location could refers to the
@@ -76,7 +76,7 @@ public:
* final name (but could be). Otherwise the returned name is the
* final name.
*/
- const char* GetName() const { return this->Name.c_str(); }
+ const std::string& GetName() const { return this->Name; }
/**
* Get the cmMakefile instance for which the source file was created.
@@ -93,9 +93,9 @@ private:
// Update the location with additional knowledge.
void Update(cmSourceFileLocation const& loc);
- void Update(const char* name);
- void UpdateExtension(const char* name);
- void UpdateDirectory(const char* name);
+ void Update(const std::string& name);
+ void UpdateExtension(const std::string& name);
+ void UpdateDirectory(const std::string& name);
};
#endif
diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx
index d272b6c..8fed95e 100644
--- a/Source/cmSourceGroup.cxx
+++ b/Source/cmSourceGroup.cxx
@@ -73,7 +73,7 @@ void cmSourceGroup::SetGroupRegex(const char* regex)
}
//----------------------------------------------------------------------------
-void cmSourceGroup::AddGroupFile(const char* name)
+void cmSourceGroup::AddGroupFile(const std::string& name)
{
this->GroupFiles.insert(name);
}
@@ -99,7 +99,7 @@ bool cmSourceGroup::MatchesRegex(const char* name)
//----------------------------------------------------------------------------
bool cmSourceGroup::MatchesFiles(const char* name)
{
- std::set<cmStdString>::const_iterator i = this->GroupFiles.find(name);
+ std::set<std::string>::const_iterator i = this->GroupFiles.find(name);
if(i != this->GroupFiles.end())
{
return true;
diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h
index 3bbdef9..e8cf519 100644
--- a/Source/cmSourceGroup.h
+++ b/Source/cmSourceGroup.h
@@ -46,7 +46,7 @@ public:
/**
* Add a file name to the explicit list of files for this group.
*/
- void AddGroupFile(const char* name);
+ void AddGroupFile(const std::string& name);
/**
* Add child to this sourcegroup
@@ -118,7 +118,7 @@ private:
/**
* Set of file names explicitly added to this group.
*/
- std::set<cmStdString> GroupFiles;
+ std::set<std::string> GroupFiles;
/**
* Vector of all source files that have been assigned to
diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h
index 5d8b48c..410411b 100644
--- a/Source/cmSourceGroupCommand.h
+++ b/Source/cmSourceGroupCommand.h
@@ -41,7 +41,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "source_group";}
+ virtual std::string GetName() const {return "source_group";}
cmTypeMacro(cmSourceGroupCommand, cmCommand);
};
diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index b4ae657..ed8efcc 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -241,7 +241,7 @@ inline bool operator==(std::string const& a, const char* b)
// std::string is really basic_string<....lots of stuff....>
// when combined with a map or set, the symbols can be > 2000 chars!
#include <cmsys/String.hxx>
-typedef cmsys::String cmStdString;
+//typedef cmsys::String std::string;
// Define cmOStringStream and cmIStringStream wrappers to hide
// differences between std::stringstream and the old strstream.
@@ -449,11 +449,16 @@ bool cmHasLiteralSuffix(T str1, const char (&str2)[N])
struct cmStrCmp {
cmStrCmp(const char *test) : m_test(test) {}
- cmStrCmp(std::string &test) : m_test(test.c_str()) {}
+ cmStrCmp(const std::string &test) : m_test(test) {}
+
+ bool operator()(const std::string& input) const
+ {
+ return m_test == input;
+ }
bool operator()(const char * input) const
{
- return strcmp(input, m_test) == 0;
+ return strcmp(input, m_test.c_str()) == 0;
}
// For use with binary_search
@@ -463,7 +468,7 @@ struct cmStrCmp {
}
private:
- const char * const m_test;
+ const std::string m_test;
};
#endif
diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h
index 66b48e6..b8053c5 100644
--- a/Source/cmStringCommand.h
+++ b/Source/cmStringCommand.h
@@ -50,7 +50,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "string";}
+ virtual std::string GetName() const { return "string";}
cmTypeMacro(cmStringCommand, cmCommand);
static void ClearMatches(cmMakefile* mf);
diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h
index 8be8335..6addd8f 100644
--- a/Source/cmSubdirCommand.h
+++ b/Source/cmSubdirCommand.h
@@ -42,7 +42,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "subdirs";}
+ virtual std::string GetName() const { return "subdirs";}
/** This command is kept for compatibility with older CMake versions. */
virtual bool IsDiscouraged() const
diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h
index f78cfb7..75a5685 100644
--- a/Source/cmSubdirDependsCommand.h
+++ b/Source/cmSubdirDependsCommand.h
@@ -20,7 +20,7 @@ public:
virtual cmCommand* Clone() { return new cmSubdirDependsCommand; }
virtual bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus &status);
- virtual const char* GetName() const { return "subdir_depends";}
+ virtual std::string GetName() const { return "subdir_depends";}
virtual bool IsDiscouraged() const { return true; }
cmTypeMacro(cmSubdirDependsCommand, cmCommand);
};
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 7cc63bb..39b53bf 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -179,10 +179,11 @@ void cmSystemTools::ExpandRegistryValues(std::string& source, KeyWOW64)
}
#endif
-std::string cmSystemTools::EscapeQuotes(const char* str)
+std::string cmSystemTools::EscapeQuotes(const std::string& str)
{
- std::string result = "";
- for(const char* ch = str; *ch != '\0'; ++ch)
+ std::string result;
+ result.reserve(str.size());
+ for(const char* ch = str.c_str(); *ch != '\0'; ++ch)
{
if(*ch == '"')
{
@@ -476,13 +477,6 @@ public:
args.push_back(*arg);
}
}
- void Store(std::vector<cmStdString>& args) const
- {
- for(char** arg = this->ArgV; arg && *arg; ++arg)
- {
- args.push_back(*arg);
- }
- }
};
//----------------------------------------------------------------------------
@@ -494,15 +488,6 @@ void cmSystemTools::ParseUnixCommandLine(const char* command,
argv.Store(args);
}
-//----------------------------------------------------------------------------
-void cmSystemTools::ParseUnixCommandLine(const char* command,
- std::vector<cmStdString>& args)
-{
- // Invoke the underlying parser.
- cmSystemToolsArgV argv = cmsysSystem_Parse_CommandForUnix(command, 0);
- argv.Store(args);
-}
-
std::string cmSystemTools::EscapeWindowsShellArgument(const char* arg,
int shell_flags)
{
@@ -522,9 +507,9 @@ std::string cmSystemTools::EscapeWindowsShellArgument(const char* arg,
return result;
}
-std::vector<cmStdString> cmSystemTools::ParseArguments(const char* command)
+std::vector<std::string> cmSystemTools::ParseArguments(const char* command)
{
- std::vector<cmStdString> args;
+ std::vector<std::string> args;
std::string arg;
bool win_path = false;
@@ -605,22 +590,6 @@ std::vector<cmStdString> cmSystemTools::ParseArguments(const char* command)
}
-bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
- std::string* output ,
- int* retVal , const char* dir ,
- OutputOption outputflag ,
- double timeout )
-{
- std::vector<std::string> cmd;
- for(std::vector<cmStdString>::const_iterator i = command.begin();
- i != command.end(); ++i)
- {
- cmd.push_back(*i);
- }
- return cmSystemTools::RunSingleCommand(cmd, output, retVal, dir,
- outputflag, timeout);
-}
-
bool cmSystemTools::RunSingleCommand(std::vector<std::string>const& command,
std::string* output ,
int* retVal , const char* dir ,
@@ -780,7 +749,7 @@ bool cmSystemTools::RunSingleCommand(
outputflag = OUTPUT_NONE;
}
- std::vector<cmStdString> args = cmSystemTools::ParseArguments(command);
+ std::vector<std::string> args = cmSystemTools::ParseArguments(command);
if(args.size() < 1)
{
@@ -944,7 +913,7 @@ bool cmSystemTools::RenameFile(const char* oldname, const char* newname)
#endif
}
-bool cmSystemTools::ComputeFileMD5(const char* source, char* md5out)
+bool cmSystemTools::ComputeFileMD5(const std::string& source, char* md5out)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
cmCryptoHashMD5 md5;
@@ -959,7 +928,7 @@ bool cmSystemTools::ComputeFileMD5(const char* source, char* md5out)
#endif
}
-std::string cmSystemTools::ComputeStringMD5(const char* input)
+std::string cmSystemTools::ComputeStringMD5(const std::string& input)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
cmCryptoHashMD5 md5;
@@ -971,13 +940,14 @@ std::string cmSystemTools::ComputeStringMD5(const char* input)
#endif
}
-void cmSystemTools::Glob(const char *directory, const char *regexp,
+void cmSystemTools::Glob(const std::string& directory,
+ const std::string& regexp,
std::vector<std::string>& files)
{
cmsys::Directory d;
- cmsys::RegularExpression reg(regexp);
+ cmsys::RegularExpression reg(regexp.c_str());
- if (d.Load(directory))
+ if (d.Load(directory.c_str()))
{
size_t numf;
unsigned int i;
@@ -994,14 +964,13 @@ void cmSystemTools::Glob(const char *directory, const char *regexp,
}
-void cmSystemTools::GlobDirs(const char *fullPath,
+void cmSystemTools::GlobDirs(const std::string& path,
std::vector<std::string>& files)
{
- std::string path = fullPath;
std::string::size_type pos = path.find("/*");
if(pos == std::string::npos)
{
- files.push_back(fullPath);
+ files.push_back(path);
return;
}
std::string startPath = path.substr(0, pos);
@@ -1113,8 +1082,8 @@ void cmSystemTools::ExpandListArgument(const std::string& arg,
}
}
-bool cmSystemTools::SimpleGlob(const cmStdString& glob,
- std::vector<cmStdString>& files,
+bool cmSystemTools::SimpleGlob(const std::string& glob,
+ std::vector<std::string>& files,
int type /* = 0 */)
{
files.clear();
@@ -1232,7 +1201,7 @@ cmSystemTools::FileFormat cmSystemTools::GetFileFormat(const char* cext)
return cmSystemTools::UNKNOWN_FILE_FORMAT;
}
-bool cmSystemTools::Split(const char* s, std::vector<cmStdString>& l)
+bool cmSystemTools::Split(const char* s, std::vector<std::string>& l)
{
std::vector<std::string> temp;
bool res = Superclass::Split(s, temp);
@@ -1444,7 +1413,7 @@ bool cmSystemTools::IsPathToFramework(const char* path)
}
bool cmSystemTools::CreateTar(const char* outFileName,
- const std::vector<cmStdString>& files,
+ const std::vector<std::string>& files,
bool gzip, bool bzip2, bool verbose)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -1464,7 +1433,7 @@ bool cmSystemTools::CreateTar(const char* outFileName,
cmArchiveWrite::CompressNone)),
cmArchiveWrite::TypeTAR);
a.SetVerbose(verbose);
- for(std::vector<cmStdString>::const_iterator i = files.begin();
+ for(std::vector<std::string>::const_iterator i = files.begin();
i != files.end(); ++i)
{
std::string path = *i;
@@ -2316,7 +2285,7 @@ bool cmSystemTools::GuessLibrarySOName(std::string const& fullPath,
bool cmSystemTools::GuessLibraryInstallName(std::string const& fullPath,
std::string& soname)
{
- std::vector<cmStdString> cmds;
+ std::vector<std::string> cmds;
cmds.push_back("otool");
cmds.push_back("-D");
cmds.push_back(fullPath.c_str());
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 4a5d298..27b4bce 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -47,7 +47,7 @@ public:
KeyWOW64 view = KeyWOW64_Default);
///! Escape quotes in a string.
- static std::string EscapeQuotes(const char* str);
+ static std::string EscapeQuotes(const std::string& str);
/** Map help document name to file name. */
static std::string HelpFileName(std::string);
@@ -158,9 +158,10 @@ public:
static std::string FileExistsInParentDirectories(const char* fname,
const char* directory, const char* toplevel);
- static void Glob(const char *directory, const char *regexp,
+ static void Glob(const std::string& directory, const std::string& regexp,
std::vector<std::string>& files);
- static void GlobDirs(const char *fullPath, std::vector<std::string>& files);
+ static void GlobDirs(const std::string& fullPath,
+ std::vector<std::string>& files);
/**
* Try to find a list of files that match the "simple" globbing
@@ -171,8 +172,8 @@ public:
* want to find. 0 means all files, -1 means directories, 1 means
* files only. This method returns true if search was succesfull.
*/
- static bool SimpleGlob(const cmStdString& glob,
- std::vector<cmStdString>& files,
+ static bool SimpleGlob(const std::string& glob,
+ std::vector<std::string>& files,
int type = 0);
///! Copy a file.
@@ -185,10 +186,10 @@ public:
static bool RenameFile(const char* oldname, const char* newname);
///! Compute the md5sum of a file
- static bool ComputeFileMD5(const char* source, char* md5out);
+ static bool ComputeFileMD5(const std::string& source, char* md5out);
/** Compute the md5sum of a string. */
- static std::string ComputeStringMD5(const char* input);
+ static std::string ComputeStringMD5(const std::string& input);
/**
* Run a single executable command
@@ -233,18 +234,13 @@ public:
int* retVal = 0, const char* dir = 0,
OutputOption outputflag = OUTPUT_MERGE,
double timeout = 0.0);
- static bool RunSingleCommand(std::vector<cmStdString> const& command,
- std::string* output = 0,
- int* retVal = 0, const char* dir = 0,
- OutputOption outputflag = OUTPUT_MERGE,
- double timeout = 0.0);
static std::string PrintSingleCommand(std::vector<std::string> const&);
/**
* Parse arguments out of a single string command
*/
- static std::vector<cmStdString> ParseArguments(const char* command);
+ static std::vector<std::string> ParseArguments(const char* command);
/** Parse arguments out of a windows command line string. */
static void ParseWindowsCommandLine(const char* command,
@@ -253,8 +249,6 @@ public:
/** Parse arguments out of a unix command line string. */
static void ParseUnixCommandLine(const char* command,
std::vector<std::string>& args);
- static void ParseUnixCommandLine(const char* command,
- std::vector<cmStdString>& args);
/** Compute an escaped version of the given argument for use in a
windows shell. See kwsys/System.h.in for details. */
@@ -320,7 +314,7 @@ public:
/** Split a string on its newlines into multiple lines. Returns
false only if the last line stored had no newline. */
- static bool Split(const char* s, std::vector<cmStdString>& l);
+ static bool Split(const char* s, std::vector<std::string>& l);
static void SetForceUnixPaths(bool v)
{
s_ForceUnixPaths = v;
@@ -389,7 +383,7 @@ public:
static bool ListTar(const char* outFileName,
bool gzip, bool verbose);
static bool CreateTar(const char* outFileName,
- const std::vector<cmStdString>& files, bool gzip,
+ const std::vector<std::string>& files, bool gzip,
bool bzip2, bool verbose);
static bool ExtractTar(const char* inFileName, bool gzip,
bool verbose);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 1c2b27a..5952444 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -109,7 +109,8 @@ public:
const char* ExplicitLibraries;
};
void ComputeLinkInterface(cmTarget const* thisTarget,
- const char* config, OptionalLinkInterface& iface,
+ const std::string& config,
+ OptionalLinkInterface& iface,
cmTarget const* head,
const char *explicitLibraries) const;
@@ -118,7 +119,7 @@ public:
LinkInterfaceMapType LinkInterfaceMap;
bool PolicyWarnedCMP0022;
- typedef std::map<cmStdString, cmTarget::OutputInfo> OutputInfoMapType;
+ typedef std::map<std::string, cmTarget::OutputInfo> OutputInfoMapType;
OutputInfoMapType OutputInfoMap;
typedef std::map<TargetConfigPair, cmTarget::ImportInfo>
@@ -234,7 +235,7 @@ void cmTarget::DefineProperties(cmake *cm)
"", "", true);
}
-void cmTarget::SetType(TargetType type, const char* name)
+void cmTarget::SetType(TargetType type, const std::string& name)
{
this->Name = name;
// only add dependency information for library targets
@@ -356,10 +357,10 @@ void cmTarget::SetMakefile(cmMakefile* mf)
{
this->InsertInclude(*it);
}
- const std::set<cmStdString> parentSystemIncludes =
+ const std::set<std::string> parentSystemIncludes =
this->Makefile->GetSystemIncludeDirectories();
- for (std::set<cmStdString>::const_iterator it
+ for (std::set<std::string>::const_iterator it
= parentSystemIncludes.begin();
it != parentSystemIncludes.end(); ++it)
{
@@ -415,7 +416,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
}
//----------------------------------------------------------------------------
-void cmTarget::AddUtility(const char *u, cmMakefile *makefile)
+void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile)
{
this->Utilities.insert(u);
if(makefile)
@@ -425,9 +426,10 @@ void cmTarget::AddUtility(const char *u, cmMakefile *makefile)
}
//----------------------------------------------------------------------------
-cmListFileBacktrace const* cmTarget::GetUtilityBacktrace(const char *u) const
+cmListFileBacktrace const* cmTarget::GetUtilityBacktrace(
+ const std::string& u) const
{
- std::map<cmStdString, cmListFileBacktrace>::const_iterator i =
+ std::map<std::string, cmListFileBacktrace>::const_iterator i =
this->UtilityBacktraces.find(u);
if(i == this->UtilityBacktraces.end()) return 0;
@@ -592,7 +594,7 @@ void cmTarget::AddSources(std::vector<std::string> const& srcs)
}
//----------------------------------------------------------------------------
-cmSourceFile* cmTarget::AddSource(const char* s)
+cmSourceFile* cmTarget::AddSource(const std::string& s)
{
std::string src = s;
@@ -657,7 +659,7 @@ void cmTarget::ProcessSourceExpression(std::string const& expr)
//----------------------------------------------------------------------------
void cmTarget::MergeLinkLibraries( cmMakefile& mf,
- const char *selfname,
+ const std::string& selfname,
const LinkLibraryVectorType& libs )
{
// Only add on libraries we haven't added on before.
@@ -675,7 +677,7 @@ void cmTarget::MergeLinkLibraries( cmMakefile& mf,
}
//----------------------------------------------------------------------------
-void cmTarget::AddLinkDirectory(const char* d)
+void cmTarget::AddLinkDirectory(const std::string& d)
{
// Make sure we don't add unnecessary search directories.
if(this->LinkDirectoriesEmmitted.insert(d).second)
@@ -691,10 +693,11 @@ const std::vector<std::string>& cmTarget::GetLinkDirectories() const
}
//----------------------------------------------------------------------------
-cmTarget::LinkLibraryType cmTarget::ComputeLinkType(const char* config) const
+cmTarget::LinkLibraryType cmTarget::ComputeLinkType(
+ const std::string& config) const
{
// No configuration is always optimized.
- if(!(config && *config))
+ if(config.empty())
{
return cmTarget::OPTIMIZED;
}
@@ -720,7 +723,7 @@ cmTarget::LinkLibraryType cmTarget::ComputeLinkType(const char* config) const
//----------------------------------------------------------------------------
void cmTarget::ClearDependencyInformation( cmMakefile& mf,
- const char* target )
+ const std::string& target )
{
// Clear the dependencies. The cache variable must exist iff we are
// recording dependency information for this target.
@@ -754,7 +757,7 @@ bool cmTarget::NameResolvesToFramework(const std::string& libname) const
}
//----------------------------------------------------------------------------
-void cmTarget::GetDirectLinkLibraries(const char *config,
+void cmTarget::GetDirectLinkLibraries(const std::string& config,
std::vector<std::string> &libs,
cmTarget const* head) const
{
@@ -775,8 +778,8 @@ void cmTarget::GetDirectLinkLibraries(const char *config,
&dagChecker),
libs);
- std::set<cmStdString> seenProps = cge->GetSeenTargetProperties();
- for (std::set<cmStdString>::const_iterator it = seenProps.begin();
+ std::set<std::string> seenProps = cge->GetSeenTargetProperties();
+ for (std::set<std::string>::const_iterator it = seenProps.begin();
it != seenProps.end(); ++it)
{
if (!this->GetProperty(it->c_str()))
@@ -788,7 +791,7 @@ void cmTarget::GetDirectLinkLibraries(const char *config,
}
//----------------------------------------------------------------------------
-void cmTarget::GetInterfaceLinkLibraries(const char *config,
+void cmTarget::GetInterfaceLinkLibraries(const std::string& config,
std::vector<std::string> &libs,
cmTarget const* head) const
{
@@ -844,9 +847,9 @@ std::string cmTarget::GetDebugGeneratorExpressions(const std::string &value,
}
//----------------------------------------------------------------------------
-static std::string targetNameGenex(const char *lib)
+static std::string targetNameGenex(const std::string& lib)
{
- return std::string("$<TARGET_NAME:") + lib + ">";
+ return "$<TARGET_NAME:" + lib + ">";
}
//----------------------------------------------------------------------------
@@ -886,7 +889,7 @@ void cmTarget::GetTllSignatureTraces(cmOStringStream &s,
= (sig == cmTarget::KeywordTLLSignature ? "keyword"
: "plain");
s << "The uses of the " << sigString << " signature are here:\n";
- std::set<cmStdString> emitted;
+ std::set<std::string> emitted;
for(std::vector<cmListFileBacktrace>::const_iterator it = sigs.begin();
it != sigs.end(); ++it)
{
@@ -908,7 +911,8 @@ void cmTarget::GetTllSignatureTraces(cmOStringStream &s,
//----------------------------------------------------------------------------
void cmTarget::AddLinkLibrary(cmMakefile& mf,
- const char *target, const char* lib,
+ const std::string& target,
+ const std::string& lib,
LinkLibraryType llt)
{
cmTarget *tgt = this->Makefile->FindTargetToUse(lib);
@@ -917,7 +921,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
const std::string libName = (isNonImportedTarget && llt != GENERAL)
? targetNameGenex(lib)
- : std::string(lib);
+ : lib;
this->AppendProperty("LINK_LIBRARIES",
this->GetDebugGeneratorExpressions(libName,
llt).c_str());
@@ -925,7 +929,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
if (cmGeneratorExpression::Find(lib) != std::string::npos
|| (tgt && tgt->GetType() == INTERFACE_LIBRARY)
- || (strcmp( target, lib ) == 0))
+ || (target == lib ))
{
return;
}
@@ -979,9 +983,9 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
//----------------------------------------------------------------------------
void
-cmTarget::AddSystemIncludeDirectories(const std::set<cmStdString> &incs)
+cmTarget::AddSystemIncludeDirectories(const std::set<std::string> &incs)
{
- for(std::set<cmStdString>::const_iterator li = incs.begin();
+ for(std::set<std::string>::const_iterator li = incs.begin();
li != incs.end(); ++li)
{
this->SystemIncludeDirectories.insert(*li);
@@ -1293,7 +1297,7 @@ void cmTarget::GatherDependencies( const cmMakefile& mf,
}
//----------------------------------------------------------------------------
-static bool whiteListedInterfaceProperty(const char *prop)
+static bool whiteListedInterfaceProperty(const std::string& prop)
{
if(cmHasLiteralPrefix(prop, "INTERFACE_"))
{
@@ -1313,7 +1317,7 @@ static bool whiteListedInterfaceProperty(const char *prop)
if (std::binary_search(cmArrayBegin(builtIns),
cmArrayEnd(builtIns),
- prop,
+ prop.c_str(),
cmStrCmp(prop)))
{
return true;
@@ -1328,12 +1332,8 @@ static bool whiteListedInterfaceProperty(const char *prop)
}
//----------------------------------------------------------------------------
-void cmTarget::SetProperty(const char* prop, const char* value)
+void cmTarget::SetProperty(const std::string& prop, const char* value)
{
- if (!prop)
- {
- return;
- }
if (this->GetType() == INTERFACE_LIBRARY
&& !whiteListedInterfaceProperty(prop))
{
@@ -1344,14 +1344,14 @@ void cmTarget::SetProperty(const char* prop, const char* value)
return;
}
- if (strcmp(prop, "NAME") == 0)
+ if (prop == "NAME")
{
cmOStringStream e;
e << "NAME property is read-only\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
return;
}
- if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0)
+ if(prop == "INCLUDE_DIRECTORIES")
{
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
@@ -1362,7 +1362,7 @@ void cmTarget::SetProperty(const char* prop, const char* value)
new cmTargetInternals::TargetPropertyEntry(cge));
return;
}
- if(strcmp(prop,"COMPILE_OPTIONS") == 0)
+ if(prop == "COMPILE_OPTIONS")
{
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
@@ -1373,7 +1373,7 @@ void cmTarget::SetProperty(const char* prop, const char* value)
new cmTargetInternals::TargetPropertyEntry(cge));
return;
}
- if(strcmp(prop,"COMPILE_DEFINITIONS") == 0)
+ if(prop == "COMPILE_DEFINITIONS")
{
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
@@ -1384,7 +1384,7 @@ void cmTarget::SetProperty(const char* prop, const char* value)
new cmTargetInternals::TargetPropertyEntry(cge));
return;
}
- if(strcmp(prop,"EXPORT_NAME") == 0 && this->IsImported())
+ if(prop == "EXPORT_NAME" && this->IsImported())
{
cmOStringStream e;
e << "EXPORT_NAME property can't be set on imported targets (\""
@@ -1392,7 +1392,7 @@ void cmTarget::SetProperty(const char* prop, const char* value)
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
return;
}
- if (strcmp(prop, "LINK_LIBRARIES") == 0)
+ if (prop == "LINK_LIBRARIES")
{
this->Internal->LinkImplementationPropertyEntries.clear();
cmListFileBacktrace lfbt;
@@ -1406,13 +1406,9 @@ void cmTarget::SetProperty(const char* prop, const char* value)
}
//----------------------------------------------------------------------------
-void cmTarget::AppendProperty(const char* prop, const char* value,
+void cmTarget::AppendProperty(const std::string& prop, const char* value,
bool asString)
{
- if (!prop)
- {
- return;
- }
if (this->GetType() == INTERFACE_LIBRARY
&& !whiteListedInterfaceProperty(prop))
{
@@ -1422,14 +1418,14 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
return;
}
- if (strcmp(prop, "NAME") == 0)
+ if (prop == "NAME")
{
cmOStringStream e;
e << "NAME property is read-only\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
return;
}
- if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0)
+ if(prop == "INCLUDE_DIRECTORIES")
{
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
@@ -1438,7 +1434,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
return;
}
- if(strcmp(prop,"COMPILE_OPTIONS") == 0)
+ if(prop == "COMPILE_OPTIONS")
{
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
@@ -1447,7 +1443,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
return;
}
- if(strcmp(prop,"COMPILE_DEFINITIONS") == 0)
+ if(prop == "COMPILE_DEFINITIONS")
{
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
@@ -1456,7 +1452,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
return;
}
- if(strcmp(prop,"EXPORT_NAME") == 0 && this->IsImported())
+ if(prop == "EXPORT_NAME" && this->IsImported())
{
cmOStringStream e;
e << "EXPORT_NAME property can't be set on imported targets (\""
@@ -1464,7 +1460,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
return;
}
- if (strcmp(prop, "LINK_LIBRARIES") == 0)
+ if (prop == "LINK_LIBRARIES")
{
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
@@ -1477,7 +1473,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
}
//----------------------------------------------------------------------------
-const char* cmTarget::GetExportName() const
+std::string cmTarget::GetExportName() const
{
const char *exportName = this->GetProperty("EXPORT_NAME");
@@ -1571,7 +1567,7 @@ static void processIncludeDirectories(cmTarget const* tgt,
std::vector<std::string> &includes,
std::set<std::string> &uniqueIncludes,
cmGeneratorExpressionDAGChecker *dagChecker,
- const char *config, bool debugIncludes)
+ const std::string& config, bool debugIncludes)
{
cmMakefile *mf = tgt->GetMakefile();
@@ -1580,7 +1576,7 @@ static void processIncludeDirectories(cmTarget const* tgt,
{
bool testIsOff = true;
bool cacheIncludes = false;
- std::vector<std::string> entryIncludes = (*it)->CachedEntries;
+ std::vector<std::string>& entryIncludes = (*it)->CachedEntries;
if(!entryIncludes.empty())
{
testIsOff = false;
@@ -1736,7 +1732,7 @@ static void processIncludeDirectories(cmTarget const* tgt,
//----------------------------------------------------------------------------
std::vector<std::string>
-cmTarget::GetIncludeDirectories(const char *config) const
+cmTarget::GetIncludeDirectories(const std::string& config) const
{
std::vector<std::string> includes;
std::set<std::string> uniqueIncludes;
@@ -1773,8 +1769,7 @@ cmTarget::GetIncludeDirectories(const char *config) const
config,
debugIncludes);
- std::string configString = config ? config : "";
- if (!this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[configString])
+ if (!this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[config])
{
for (std::vector<cmValueWithOrigin>::const_iterator
it = this->Internal->LinkImplementationPropertyEntries.begin(),
@@ -1811,7 +1806,7 @@ cmTarget::GetIncludeDirectories(const char *config) const
includeGenex);
this->Internal
- ->CachedLinkInterfaceIncludeDirectoriesEntries[configString].push_back(
+ ->CachedLinkInterfaceIncludeDirectoriesEntries[config].push_back(
new cmTargetInternals::TargetPropertyEntry(cge,
it->Value));
}
@@ -1839,14 +1834,14 @@ cmTarget::GetIncludeDirectories(const char *config) const
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(libDir.c_str());
this->Internal
- ->CachedLinkInterfaceIncludeDirectoriesEntries[configString]
+ ->CachedLinkInterfaceIncludeDirectoriesEntries[config]
.push_back(new cmTargetInternals::TargetPropertyEntry(cge));
}
}
}
processIncludeDirectories(this,
- this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[configString],
+ this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[config],
includes,
uniqueIncludes,
&dagChecker,
@@ -1860,7 +1855,7 @@ cmTarget::GetIncludeDirectories(const char *config) const
}
else
{
- this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[configString]
+ this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[config]
= true;
}
@@ -1873,7 +1868,7 @@ static void processCompileOptionsInternal(cmTarget const* tgt,
std::vector<std::string> &options,
std::set<std::string> &uniqueOptions,
cmGeneratorExpressionDAGChecker *dagChecker,
- const char *config, bool debugOptions, const char *logName)
+ const std::string& config, bool debugOptions, const char *logName)
{
cmMakefile *mf = tgt->GetMakefile();
@@ -1932,7 +1927,7 @@ static void processCompileOptions(cmTarget const* tgt,
std::vector<std::string> &options,
std::set<std::string> &uniqueOptions,
cmGeneratorExpressionDAGChecker *dagChecker,
- const char *config, bool debugOptions)
+ const std::string& config, bool debugOptions)
{
processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
dagChecker, config, debugOptions, "options");
@@ -1940,7 +1935,7 @@ static void processCompileOptions(cmTarget const* tgt,
//----------------------------------------------------------------------------
void cmTarget::GetAutoUicOptions(std::vector<std::string> &result,
- const char *config) const
+ const std::string& config) const
{
const char *prop
= this->GetLinkInterfaceDependentStringProperty("AUTOUIC_OPTIONS",
@@ -1966,7 +1961,7 @@ void cmTarget::GetAutoUicOptions(std::vector<std::string> &result,
//----------------------------------------------------------------------------
void cmTarget::GetCompileOptions(std::vector<std::string> &result,
- const char *config) const
+ const std::string& config) const
{
std::set<std::string> uniqueOptions;
cmListFileBacktrace lfbt;
@@ -2002,8 +1997,7 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
config,
debugOptions);
- std::string configString = config ? config : "";
- if (!this->Internal->CacheLinkInterfaceCompileOptionsDone[configString])
+ if (!this->Internal->CacheLinkInterfaceCompileOptionsDone[config])
{
for (std::vector<cmValueWithOrigin>::const_iterator
it = this->Internal->LinkImplementationPropertyEntries.begin(),
@@ -2040,14 +2034,14 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
optionGenex);
this->Internal
- ->CachedLinkInterfaceCompileOptionsEntries[configString].push_back(
+ ->CachedLinkInterfaceCompileOptionsEntries[config].push_back(
new cmTargetInternals::TargetPropertyEntry(cge,
it->Value));
}
}
processCompileOptions(this,
- this->Internal->CachedLinkInterfaceCompileOptionsEntries[configString],
+ this->Internal->CachedLinkInterfaceCompileOptionsEntries[config],
result,
uniqueOptions,
&dagChecker,
@@ -2060,7 +2054,7 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
}
else
{
- this->Internal->CacheLinkInterfaceCompileOptionsDone[configString] = true;
+ this->Internal->CacheLinkInterfaceCompileOptionsDone[config] = true;
}
}
@@ -2070,7 +2064,7 @@ static void processCompileDefinitions(cmTarget const* tgt,
std::vector<std::string> &options,
std::set<std::string> &uniqueOptions,
cmGeneratorExpressionDAGChecker *dagChecker,
- const char *config, bool debugOptions)
+ const std::string& config, bool debugOptions)
{
processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
dagChecker, config, debugOptions,
@@ -2079,7 +2073,7 @@ static void processCompileDefinitions(cmTarget const* tgt,
//----------------------------------------------------------------------------
void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
- const char *config) const
+ const std::string& config) const
{
std::set<std::string> uniqueOptions;
cmListFileBacktrace lfbt;
@@ -2115,8 +2109,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
config,
debugDefines);
- std::string configString = config ? config : "";
- if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString])
+ if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[config])
{
for (std::vector<cmValueWithOrigin>::const_iterator
it = this->Internal->LinkImplementationPropertyEntries.begin(),
@@ -2153,11 +2146,11 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
defsGenex);
this->Internal
- ->CachedLinkInterfaceCompileDefinitionsEntries[configString].push_back(
+ ->CachedLinkInterfaceCompileDefinitionsEntries[config].push_back(
new cmTargetInternals::TargetPropertyEntry(cge,
it->Value));
}
- if (config)
+ if (!config.empty())
{
std::string configPropName = "COMPILE_DEFINITIONS_"
+ cmSystemTools::UpperCase(config);
@@ -2180,7 +2173,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(configProp);
this->Internal
- ->CachedLinkInterfaceCompileDefinitionsEntries[configString]
+ ->CachedLinkInterfaceCompileDefinitionsEntries[config]
.push_back(new cmTargetInternals::TargetPropertyEntry(cge));
}
break;
@@ -2195,7 +2188,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
}
processCompileDefinitions(this,
- this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[configString],
+ this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[config],
list,
uniqueOptions,
&dagChecker,
@@ -2209,13 +2202,13 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
}
else
{
- this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString]
+ this->Internal->CacheLinkInterfaceCompileDefinitionsDone[config]
= true;
}
}
//----------------------------------------------------------------------------
-void cmTarget::MaybeInvalidatePropertyCache(const char* prop)
+void cmTarget::MaybeInvalidatePropertyCache(const std::string& prop)
{
// Wipe out maps caching information affected by this property.
if(this->IsImported() && cmHasLiteralPrefix(prop, "IMPORTED"))
@@ -2230,8 +2223,8 @@ void cmTarget::MaybeInvalidatePropertyCache(const char* prop)
//----------------------------------------------------------------------------
static void cmTargetCheckLINK_INTERFACE_LIBRARIES(
- const char* prop, const char* value, cmMakefile* context, bool imported
- )
+ const std::string& prop, const char* value, cmMakefile* context,
+ bool imported)
{
// Look for link-type keywords in the value.
static cmsys::RegularExpression
@@ -2295,7 +2288,8 @@ static void cmTargetCheckINTERFACE_LINK_LIBRARIES(const char* value,
}
//----------------------------------------------------------------------------
-void cmTarget::CheckProperty(const char* prop, cmMakefile* context) const
+void cmTarget::CheckProperty(const std::string& prop,
+ cmMakefile* context) const
{
// Certain properties need checking.
if(cmHasLiteralPrefix(prop, "LINK_INTERFACE_LIBRARIES"))
@@ -2338,7 +2332,8 @@ bool cmTarget::HaveWellDefinedOutputFiles() const
}
//----------------------------------------------------------------------------
-cmTarget::OutputInfo const* cmTarget::GetOutputInfo(const char* config) const
+cmTarget::OutputInfo const* cmTarget::GetOutputInfo(
+ const std::string& config) const
{
// There is no output information for imported targets.
if(this->IsImported())
@@ -2360,7 +2355,7 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo(const char* config) const
// Lookup/compute/cache the output information for this configuration.
std::string config_upper;
- if(config && *config)
+ if(!config.empty())
{
config_upper = cmSystemTools::UpperCase(config);
}
@@ -2383,7 +2378,8 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo(const char* config) const
}
//----------------------------------------------------------------------------
-cmTarget::CompileInfo const* cmTarget::GetCompileInfo(const char* config) const
+cmTarget::CompileInfo const* cmTarget::GetCompileInfo(
+ const std::string& config) const
{
// There is no compile information for imported targets.
if(this->IsImported())
@@ -2404,7 +2400,7 @@ cmTarget::CompileInfo const* cmTarget::GetCompileInfo(const char* config) const
// Lookup/compute/cache the compile information for this configuration.
std::string config_upper;
- if(config && *config)
+ if(!config.empty())
{
config_upper = cmSystemTools::UpperCase(config);
}
@@ -2422,7 +2418,8 @@ cmTarget::CompileInfo const* cmTarget::GetCompileInfo(const char* config) const
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetDirectory(const char* config, bool implib) const
+std::string cmTarget::GetDirectory(const std::string& config,
+ bool implib) const
{
if (this->IsImported())
{
@@ -2440,7 +2437,7 @@ std::string cmTarget::GetDirectory(const char* config, bool implib) const
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetPDBDirectory(const char* config) const
+std::string cmTarget::GetPDBDirectory(const std::string& config) const
{
if(OutputInfo const* info = this->GetOutputInfo(config))
{
@@ -2451,7 +2448,7 @@ std::string cmTarget::GetPDBDirectory(const char* config) const
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetCompilePDBDirectory(const char* config) const
+std::string cmTarget::GetCompilePDBDirectory(const std::string& config) const
{
if(CompileInfo const* info = this->GetCompileInfo(config))
{
@@ -2461,34 +2458,27 @@ std::string cmTarget::GetCompilePDBDirectory(const char* config) const
}
//----------------------------------------------------------------------------
-const char* cmTarget::GetLocation(const char* config) const
+const char* cmTarget::GetLocation(const std::string& config) const
{
+ static std::string location;
if (this->IsImported())
{
- return this->ImportedGetLocation(config);
+ location = this->ImportedGetFullPath(config, false);
}
else
{
- return this->NormalGetLocation(config);
+ location = this->GetFullPath(config, false);
}
-}
-
-//----------------------------------------------------------------------------
-const char* cmTarget::ImportedGetLocation(const char* config) const
-{
- static std::string location;
- location = this->ImportedGetFullPath(config, false);
return location.c_str();
}
//----------------------------------------------------------------------------
-const char* cmTarget::NormalGetLocation(const char* config) const
+const char* cmTarget::GetLocationForBuild() const
{
static std::string location;
- // Handle the configuration-specific case first.
- if(config)
+ if(this->IsImported())
{
- location = this->GetFullPath(config, false);
+ location = this->ImportedGetFullPath("", false);
return location.c_str();
}
@@ -2508,7 +2498,7 @@ const char* cmTarget::NormalGetLocation(const char* config) const
if(this->IsAppBundleOnApple())
{
- std::string macdir = this->BuildMacContentDirectory("", config, false);
+ std::string macdir = this->BuildMacContentDirectory("", "", false);
if(!macdir.empty())
{
location += "/";
@@ -2516,7 +2506,7 @@ const char* cmTarget::NormalGetLocation(const char* config) const
}
}
location += "/";
- location += this->GetFullName(config, false);
+ location += this->GetFullName("", false);
return location.c_str();
}
@@ -2559,9 +2549,10 @@ void cmTarget::GetTargetVersion(bool soversion,
}
//----------------------------------------------------------------------------
-const char* cmTarget::GetFeature(const char* feature, const char* config) const
+const char* cmTarget::GetFeature(const std::string& feature,
+ const std::string& config) const
{
- if(config && *config)
+ if(!config.empty())
{
std::string featureConfig = feature;
featureConfig += "_";
@@ -2579,7 +2570,7 @@ const char* cmTarget::GetFeature(const char* feature, const char* config) const
}
//----------------------------------------------------------------------------
-const char *cmTarget::GetProperty(const char* prop) const
+const char *cmTarget::GetProperty(const std::string& prop) const
{
return this->GetProperty(prop, cmProperty::TARGET);
}
@@ -2622,14 +2613,9 @@ bool cmTarget::HandleLocationPropertyPolicy() const
}
//----------------------------------------------------------------------------
-const char *cmTarget::GetProperty(const char* prop,
+const char *cmTarget::GetProperty(const std::string& prop,
cmProperty::ScopeType scope) const
{
- if(!prop)
- {
- return 0;
- }
-
if (this->GetType() == INTERFACE_LIBRARY
&& !whiteListedInterfaceProperty(prop))
{
@@ -2640,9 +2626,9 @@ const char *cmTarget::GetProperty(const char* prop,
return 0;
}
- if (strcmp(prop, "NAME") == 0)
+ if (prop == "NAME")
{
- return this->GetName();
+ return this->GetName().c_str();
}
// Watch for special "computed" properties that are dependent on
@@ -2653,7 +2639,7 @@ const char *cmTarget::GetProperty(const char* prop,
this->GetType() == cmTarget::MODULE_LIBRARY ||
this->GetType() == cmTarget::UNKNOWN_LIBRARY)
{
- if(strcmp(prop,"LOCATION") == 0)
+ if(prop == "LOCATION")
{
if (!this->HandleLocationPropertyPolicy())
{
@@ -2669,7 +2655,7 @@ const char *cmTarget::GetProperty(const char* prop,
// cannot take into account the per-configuration name of the
// target because the configuration type may not be known at
// CMake time.
- this->Properties.SetProperty("LOCATION", this->GetLocation(0),
+ this->Properties.SetProperty("LOCATION", this->GetLocationForBuild(),
cmProperty::TARGET);
}
@@ -2680,13 +2666,13 @@ const char *cmTarget::GetProperty(const char* prop,
{
return 0;
}
- std::string configName = prop+9;
+ const char* configName = prop.c_str() + 9;
this->Properties.SetProperty(prop,
- this->GetLocation(configName.c_str()),
+ this->GetLocation(configName),
cmProperty::TARGET);
}
}
- if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0)
+ if(prop == "INCLUDE_DIRECTORIES")
{
static std::string output;
output = "";
@@ -2704,7 +2690,7 @@ const char *cmTarget::GetProperty(const char* prop,
}
return output.c_str();
}
- if(strcmp(prop,"COMPILE_OPTIONS") == 0)
+ if(prop == "COMPILE_OPTIONS")
{
static std::string output;
output = "";
@@ -2722,7 +2708,7 @@ const char *cmTarget::GetProperty(const char* prop,
}
return output.c_str();
}
- if(strcmp(prop,"COMPILE_DEFINITIONS") == 0)
+ if(prop == "COMPILE_DEFINITIONS")
{
static std::string output;
output = "";
@@ -2740,7 +2726,7 @@ const char *cmTarget::GetProperty(const char* prop,
}
return output.c_str();
}
- if(strcmp(prop,"LINK_LIBRARIES") == 0)
+ if(prop == "LINK_LIBRARIES")
{
static std::string output;
output = "";
@@ -2757,12 +2743,12 @@ const char *cmTarget::GetProperty(const char* prop,
return output.c_str();
}
- if (strcmp(prop,"IMPORTED") == 0)
+ if (prop == "IMPORTED")
{
return this->IsImported()?"TRUE":"FALSE";
}
- if(!strcmp(prop,"SOURCES"))
+ if(prop == "SOURCES")
{
cmOStringStream ss;
const char* sep = "";
@@ -2791,7 +2777,7 @@ const char *cmTarget::GetProperty(const char* prop,
}
// the type property returns what type the target is
- if (!strcmp(prop,"TYPE"))
+ if (prop == "TYPE")
{
return cmTarget::GetTargetTypeName(this->GetType());
}
@@ -2806,7 +2792,7 @@ const char *cmTarget::GetProperty(const char* prop,
}
//----------------------------------------------------------------------------
-bool cmTarget::GetPropertyAsBool(const char* prop) const
+bool cmTarget::GetPropertyAsBool(const std::string& prop) const
{
return cmSystemTools::IsOn(this->GetProperty(prop));
}
@@ -2815,8 +2801,9 @@ bool cmTarget::GetPropertyAsBool(const char* prop) const
class cmTargetCollectLinkLanguages
{
public:
- cmTargetCollectLinkLanguages(cmTarget const* target, const char* config,
- std::set<cmStdString>& languages,
+ cmTargetCollectLinkLanguages(cmTarget const* target,
+ const std::string& config,
+ std::set<std::string>& languages,
cmTarget const* head):
Config(config), Languages(languages), HeadTarget(head),
Makefile(target->GetMakefile()), Target(target)
@@ -2887,8 +2874,8 @@ public:
}
}
private:
- const char* Config;
- std::set<cmStdString>& Languages;
+ std::string Config;
+ std::set<std::string>& Languages;
cmTarget const* HeadTarget;
cmMakefile* Makefile;
const cmTarget* Target;
@@ -2896,20 +2883,19 @@ private:
};
//----------------------------------------------------------------------------
-const char* cmTarget::GetLinkerLanguage(const char* config,
+std::string cmTarget::GetLinkerLanguage(const std::string& config,
cmTarget const* head) const
{
cmTarget const* headTarget = head ? head : this;
- const char* lang = this->GetLinkClosure(config, headTarget)
- ->LinkerLanguage.c_str();
- return *lang? lang : 0;
+ return this->GetLinkClosure(config, headTarget)->LinkerLanguage;
}
//----------------------------------------------------------------------------
-cmTarget::LinkClosure const* cmTarget::GetLinkClosure(const char* config,
+cmTarget::LinkClosure const* cmTarget::GetLinkClosure(
+ const std::string& config,
cmTarget const* head) const
{
- TargetConfigPair key(head, cmSystemTools::UpperCase(config ? config : ""));
+ TargetConfigPair key(head, cmSystemTools::UpperCase(config));
cmTargetInternals::LinkClosureMapType::iterator
i = this->Internal->LinkClosureMap.find(key);
if(i == this->Internal->LinkClosureMap.end())
@@ -2929,14 +2915,14 @@ class cmTargetSelectLinker
cmTarget const* Target;
cmMakefile* Makefile;
cmGlobalGenerator* GG;
- std::set<cmStdString> Preferred;
+ std::set<std::string> Preferred;
public:
cmTargetSelectLinker(cmTarget const* target): Preference(0), Target(target)
{
this->Makefile = this->Target->GetMakefile();
this->GG = this->Makefile->GetLocalGenerator()->GetGlobalGenerator();
}
- void Consider(const char* lang)
+ void Consider(const std::string& lang)
{
int preference = this->GG->GetLinkerPreference(lang);
if(preference > this->Preference)
@@ -2961,7 +2947,7 @@ public:
e << "Target " << this->Target->GetName()
<< " contains multiple languages with the highest linker preference"
<< " (" << this->Preference << "):\n";
- for(std::set<cmStdString>::const_iterator
+ for(std::set<std::string>::const_iterator
li = this->Preferred.begin(); li != this->Preferred.end(); ++li)
{
e << " " << *li << "\n";
@@ -2976,11 +2962,11 @@ public:
};
//----------------------------------------------------------------------------
-void cmTarget::ComputeLinkClosure(const char* config, LinkClosure& lc,
+void cmTarget::ComputeLinkClosure(const std::string& config, LinkClosure& lc,
cmTarget const* head) const
{
// Get languages built in this target.
- std::set<cmStdString> languages;
+ std::set<std::string> languages;
LinkImplementation const* impl = this->GetLinkImplementation(config, head);
for(std::vector<std::string>::const_iterator li = impl->Languages.begin();
li != impl->Languages.end(); ++li)
@@ -2997,7 +2983,7 @@ void cmTarget::ComputeLinkClosure(const char* config, LinkClosure& lc,
}
// Store the transitive closure of languages.
- for(std::set<cmStdString>::const_iterator li = languages.begin();
+ for(std::set<std::string>::const_iterator li = languages.begin();
li != languages.end(); ++li)
{
lc.Languages.push_back(*li);
@@ -3025,7 +3011,7 @@ void cmTarget::ComputeLinkClosure(const char* config, LinkClosure& lc,
}
// Now consider languages that propagate from linked targets.
- for(std::set<cmStdString>::const_iterator sit = languages.begin();
+ for(std::set<std::string>::const_iterator sit = languages.begin();
sit != languages.end(); ++sit)
{
std::string propagates = "CMAKE_"+*sit+"_LINKER_PREFERENCE_PROPAGATES";
@@ -3089,7 +3075,7 @@ const char* cmTarget::GetPrefixVariableInternal(bool implib) const
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetPDBName(const char* config) const
+std::string cmTarget::GetPDBName(const std::string& config) const
{
std::string prefix;
std::string base;
@@ -3097,8 +3083,7 @@ std::string cmTarget::GetPDBName(const char* config) const
this->GetFullNameInternal(config, false, prefix, base, suffix);
std::vector<std::string> props;
- std::string configUpper =
- cmSystemTools::UpperCase(config? config : "");
+ std::string configUpper = cmSystemTools::UpperCase(config);
if(!configUpper.empty())
{
// PDB_NAME_<CONFIG>
@@ -3121,7 +3106,7 @@ std::string cmTarget::GetPDBName(const char* config) const
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetCompilePDBName(const char* config) const
+std::string cmTarget::GetCompilePDBName(const std::string& config) const
{
std::string prefix;
std::string base;
@@ -3129,7 +3114,7 @@ std::string cmTarget::GetCompilePDBName(const char* config) const
this->GetFullNameInternal(config, false, prefix, base, suffix);
// Check for a per-configuration output directory target property.
- std::string configUpper = cmSystemTools::UpperCase(config? config : "");
+ std::string configUpper = cmSystemTools::UpperCase(config);
std::string configProp = "COMPILE_PDB_NAME_";
configProp += configUpper;
const char* config_name = this->GetProperty(configProp.c_str());
@@ -3148,7 +3133,7 @@ std::string cmTarget::GetCompilePDBName(const char* config) const
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetCompilePDBPath(const char* config) const
+std::string cmTarget::GetCompilePDBPath(const std::string& config) const
{
std::string dir = this->GetCompilePDBDirectory(config);
std::string name = this->GetCompilePDBName(config);
@@ -3164,7 +3149,7 @@ std::string cmTarget::GetCompilePDBPath(const char* config) const
}
//----------------------------------------------------------------------------
-bool cmTarget::HasSOName(const char* config) const
+bool cmTarget::HasSOName(const std::string& config) const
{
// soname is supported only for shared libraries and modules,
// and then only when the platform supports an soname flag.
@@ -3176,7 +3161,7 @@ bool cmTarget::HasSOName(const char* config) const
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetSOName(const char* config) const
+std::string cmTarget::GetSOName(const std::string& config) const
{
if(this->IsImported())
{
@@ -3218,7 +3203,7 @@ std::string cmTarget::GetSOName(const char* config) const
}
//----------------------------------------------------------------------------
-bool cmTarget::HasMacOSXRpathInstallNameDir(const char* config) const
+bool cmTarget::HasMacOSXRpathInstallNameDir(const std::string& config) const
{
bool install_name_is_rpath = false;
bool macosx_rpath = false;
@@ -3330,7 +3315,8 @@ bool cmTarget::MacOSXRpathInstallNameDirDefault() const
}
//----------------------------------------------------------------------------
-bool cmTarget::IsImportedSharedLibWithoutSOName(const char* config) const
+bool cmTarget::IsImportedSharedLibWithoutSOName(
+ const std::string& config) const
{
if(this->IsImported() && this->GetType() == cmTarget::SHARED_LIBRARY)
{
@@ -3343,7 +3329,7 @@ bool cmTarget::IsImportedSharedLibWithoutSOName(const char* config) const
}
//----------------------------------------------------------------------------
-std::string cmTarget::NormalGetRealName(const char* config) const
+std::string cmTarget::NormalGetRealName(const std::string& config) const
{
// This should not be called for imported targets.
// TODO: Split cmTarget into a class hierarchy to get compile-time
@@ -3381,7 +3367,8 @@ std::string cmTarget::NormalGetRealName(const char* config) const
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetFullName(const char* config, bool implib) const
+std::string cmTarget::GetFullName(const std::string& config,
+ bool implib) const
{
if(this->IsImported())
{
@@ -3395,7 +3382,7 @@ std::string cmTarget::GetFullName(const char* config, bool implib) const
//----------------------------------------------------------------------------
std::string
-cmTarget::GetFullNameImported(const char* config, bool implib) const
+cmTarget::GetFullNameImported(const std::string& config, bool implib) const
{
return cmSystemTools::GetFilenameName(
this->ImportedGetFullPath(config, implib));
@@ -3403,14 +3390,15 @@ cmTarget::GetFullNameImported(const char* config, bool implib) const
//----------------------------------------------------------------------------
void cmTarget::GetFullNameComponents(std::string& prefix, std::string& base,
- std::string& suffix, const char* config,
+ std::string& suffix,
+ const std::string& config,
bool implib) const
{
this->GetFullNameInternal(config, implib, prefix, base, suffix);
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetFullPath(const char* config, bool implib,
+std::string cmTarget::GetFullPath(const std::string& config, bool implib,
bool realname) const
{
if(this->IsImported())
@@ -3424,8 +3412,8 @@ std::string cmTarget::GetFullPath(const char* config, bool implib,
}
//----------------------------------------------------------------------------
-std::string cmTarget::NormalGetFullPath(const char* config, bool implib,
- bool realname) const
+std::string cmTarget::NormalGetFullPath(const std::string& config,
+ bool implib, bool realname) const
{
std::string fpath = this->GetDirectory(config, implib);
fpath += "/";
@@ -3453,7 +3441,7 @@ std::string cmTarget::NormalGetFullPath(const char* config, bool implib,
//----------------------------------------------------------------------------
std::string
-cmTarget::ImportedGetFullPath(const char* config, bool implib) const
+cmTarget::ImportedGetFullPath(const std::string& config, bool implib) const
{
std::string result;
if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, this))
@@ -3470,7 +3458,7 @@ cmTarget::ImportedGetFullPath(const char* config, bool implib) const
//----------------------------------------------------------------------------
std::string
-cmTarget::GetFullNameInternal(const char* config, bool implib) const
+cmTarget::GetFullNameInternal(const std::string& config, bool implib) const
{
std::string prefix;
std::string base;
@@ -3480,7 +3468,7 @@ cmTarget::GetFullNameInternal(const char* config, bool implib) const
}
//----------------------------------------------------------------------------
-void cmTarget::GetFullNameInternal(const char* config,
+void cmTarget::GetFullNameInternal(const std::string& config,
bool implib,
std::string& outPrefix,
std::string& outBase,
@@ -3526,7 +3514,7 @@ void cmTarget::GetFullNameInternal(const char* config,
? this->GetProperty("IMPORT_SUFFIX")
: this->GetProperty("SUFFIX"));
const char* configPostfix = 0;
- if(config && *config)
+ if(!config.empty())
{
std::string configProp = cmSystemTools::UpperCase(config);
configProp += "_POSTFIX";
@@ -3542,7 +3530,8 @@ void cmTarget::GetFullNameInternal(const char* config,
const char* suffixVar = this->GetSuffixVariableInternal(implib);
// Check for language-specific default prefix and suffix.
- if(const char* ll = this->GetLinkerLanguage(config, this))
+ std::string ll = this->GetLinkerLanguage(config, this);
+ if(!ll.empty())
{
if(!targetSuffix && suffixVar && *suffixVar)
{
@@ -3622,7 +3611,7 @@ void cmTarget::GetLibraryNames(std::string& name,
std::string& realName,
std::string& impName,
std::string& pdbName,
- const char* config) const
+ const std::string& config) const
{
// This should not be called for imported targets.
// TODO: Split cmTarget into a class hierarchy to get compile-time
@@ -3726,7 +3715,7 @@ void cmTarget::GetExecutableNames(std::string& name,
std::string& realName,
std::string& impName,
std::string& pdbName,
- const char* config) const
+ const std::string& config) const
{
// This should not be called for imported targets.
// TODO: Split cmTarget into a class hierarchy to get compile-time
@@ -3804,7 +3793,7 @@ bool cmTarget::GetImplibGNUtoMS(std::string const& gnuName,
}
//----------------------------------------------------------------------------
-void cmTarget::SetPropertyDefault(const char* property,
+void cmTarget::SetPropertyDefault(const std::string& property,
const char* default_value)
{
// Compute the name of the variable holding the default value.
@@ -3822,7 +3811,7 @@ void cmTarget::SetPropertyDefault(const char* property,
}
//----------------------------------------------------------------------------
-bool cmTarget::HaveBuildTreeRPATH(const char *config) const
+bool cmTarget::HaveBuildTreeRPATH(const std::string& config) const
{
if (this->GetPropertyAsBool("SKIP_BUILD_RPATH"))
{
@@ -3842,7 +3831,7 @@ bool cmTarget::HaveInstallTreeRPATH() const
}
//----------------------------------------------------------------------------
-bool cmTarget::NeedRelinkBeforeInstall(const char* config) const
+bool cmTarget::NeedRelinkBeforeInstall(const std::string& config) const
{
// Only executables and shared libraries can have an rpath and may
// need relinking.
@@ -3879,7 +3868,8 @@ bool cmTarget::NeedRelinkBeforeInstall(const char* config) const
}
// Check for rpath support on this platform.
- if(const char* ll = this->GetLinkerLanguage(config, this))
+ std::string ll = this->GetLinkerLanguage(config, this);
+ if(!ll.empty())
{
std::string flagVar = "CMAKE_SHARED_LIBRARY_RUNTIME_";
flagVar += ll;
@@ -3905,7 +3895,8 @@ bool cmTarget::NeedRelinkBeforeInstall(const char* config) const
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetInstallNameDirForBuildTree(const char* config) const
+std::string cmTarget::GetInstallNameDirForBuildTree(
+ const std::string& config) const
{
// If building directly for installation then the build tree install_name
// is the same as the install tree.
@@ -4027,10 +4018,11 @@ const char* cmTarget::GetOutputTargetType(bool implib) const
}
//----------------------------------------------------------------------------
-bool cmTarget::ComputeOutputDir(const char* config,
+bool cmTarget::ComputeOutputDir(const std::string& config,
bool implib, std::string& out) const
{
bool usesDefaultOutputDir = false;
+ std::string conf = config;
// Look for a target property defining the target output directory
// based on the target type.
@@ -4044,7 +4036,7 @@ bool cmTarget::ComputeOutputDir(const char* config,
}
// Check for a per-configuration output directory target property.
- std::string configUpper = cmSystemTools::UpperCase(config? config : "");
+ std::string configUpper = cmSystemTools::UpperCase(conf);
const char* configProp = 0;
std::string configPropStr = targetTypeName;
if(!configPropStr.empty())
@@ -4061,7 +4053,7 @@ bool cmTarget::ComputeOutputDir(const char* config,
out = config_outdir;
// Skip per-configuration subdirectory.
- config = 0;
+ conf = "";
}
else if(const char* outdir = this->GetProperty(propertyName))
{
@@ -4094,21 +4086,22 @@ bool cmTarget::ComputeOutputDir(const char* config,
(out.c_str(), this->Makefile->GetStartOutputDirectory()));
// The generator may add the configuration's subdirectory.
- if(config && *config)
+ if(!conf.empty())
{
const char *platforms = this->Makefile->GetDefinition(
"CMAKE_XCODE_EFFECTIVE_PLATFORMS");
std::string suffix =
usesDefaultOutputDir && platforms ? "$(EFFECTIVE_PLATFORM_NAME)" : "";
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->
- AppendDirectoryForConfig("/", config, suffix.c_str(), out);
+ AppendDirectoryForConfig("/", conf, suffix.c_str(), out);
}
return usesDefaultOutputDir;
}
//----------------------------------------------------------------------------
-bool cmTarget::ComputePDBOutputDir(const char* kind, const char* config,
+bool cmTarget::ComputePDBOutputDir(const std::string& kind,
+ const std::string& config,
std::string& out) const
{
// Look for a target property defining the target output directory
@@ -4120,9 +4113,10 @@ bool cmTarget::ComputePDBOutputDir(const char* kind, const char* config,
propertyNameStr += "_OUTPUT_DIRECTORY";
propertyName = propertyNameStr.c_str();
}
+ std::string conf = config;
// Check for a per-configuration output directory target property.
- std::string configUpper = cmSystemTools::UpperCase(config? config : "");
+ std::string configUpper = cmSystemTools::UpperCase(conf);
const char* configProp = 0;
std::string configPropStr = kind;
if(!configPropStr.empty())
@@ -4139,7 +4133,7 @@ bool cmTarget::ComputePDBOutputDir(const char* kind, const char* config,
out = config_outdir;
// Skip per-configuration subdirectory.
- config = 0;
+ conf = "";
}
else if(const char* outdir = this->GetProperty(propertyName))
{
@@ -4158,27 +4152,29 @@ bool cmTarget::ComputePDBOutputDir(const char* kind, const char* config,
(out.c_str(), this->Makefile->GetStartOutputDirectory()));
// The generator may add the configuration's subdirectory.
- if(config && *config)
+ if(!conf.empty())
{
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->
- AppendDirectoryForConfig("/", config, "", out);
+ AppendDirectoryForConfig("/", conf, "", out);
}
return true;
}
//----------------------------------------------------------------------------
-bool cmTarget::UsesDefaultOutputDir(const char* config, bool implib) const
+bool cmTarget::UsesDefaultOutputDir(const std::string& config,
+ bool implib) const
{
std::string dir;
return this->ComputeOutputDir(config, implib, dir);
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetOutputName(const char* config, bool implib) const
+std::string cmTarget::GetOutputName(const std::string& config,
+ bool implib) const
{
std::vector<std::string> props;
std::string type = this->GetOutputTargetType(implib);
- std::string configUpper = cmSystemTools::UpperCase(config? config : "");
+ std::string configUpper = cmSystemTools::UpperCase(config);
if(!type.empty() && !configUpper.empty())
{
// <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME_<CONFIG>
@@ -4512,7 +4508,7 @@ std::string compatibilityAgree(CompatibleType t, bool dominant)
template<typename PropertyType>
PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
const std::string &p,
- const char *config,
+ const std::string& config,
const char *defaultValue,
CompatibleType t,
PropertyType *)
@@ -4696,7 +4692,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
//----------------------------------------------------------------------------
bool cmTarget::GetLinkInterfaceDependentBoolProperty(const std::string &p,
- const char *config) const
+ const std::string& config) const
{
return checkInterfacePropertyCompatibility<bool>(this, p, config, "FALSE",
BoolType, 0);
@@ -4704,8 +4700,8 @@ bool cmTarget::GetLinkInterfaceDependentBoolProperty(const std::string &p,
//----------------------------------------------------------------------------
const char * cmTarget::GetLinkInterfaceDependentStringProperty(
- const std::string &p,
- const char *config) const
+ const std::string &p,
+ const std::string& config) const
{
return checkInterfacePropertyCompatibility<const char *>(this,
p,
@@ -4716,8 +4712,8 @@ const char * cmTarget::GetLinkInterfaceDependentStringProperty(
//----------------------------------------------------------------------------
const char * cmTarget::GetLinkInterfaceDependentNumberMinProperty(
- const std::string &p,
- const char *config) const
+ const std::string &p,
+ const std::string& config) const
{
return checkInterfacePropertyCompatibility<const char *>(this,
p,
@@ -4728,8 +4724,8 @@ const char * cmTarget::GetLinkInterfaceDependentNumberMinProperty(
//----------------------------------------------------------------------------
const char * cmTarget::GetLinkInterfaceDependentNumberMaxProperty(
- const std::string &p,
- const char *config) const
+ const std::string &p,
+ const std::string& config) const
{
return checkInterfacePropertyCompatibility<const char *>(this,
p,
@@ -4740,8 +4736,8 @@ const char * cmTarget::GetLinkInterfaceDependentNumberMaxProperty(
//----------------------------------------------------------------------------
bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p,
- const char *interfaceProperty,
- const char *config)
+ const std::string& interfaceProperty,
+ const std::string& config)
{
std::vector<cmTarget*> deps;
tgt->GetTransitiveTargetClosure(config, tgt, deps);
@@ -4779,7 +4775,7 @@ bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p,
//----------------------------------------------------------------------------
bool cmTarget::IsLinkInterfaceDependentBoolProperty(const std::string &p,
- const char *config) const
+ const std::string& config) const
{
if (this->TargetTypeValue == OBJECT_LIBRARY
|| this->TargetTypeValue == INTERFACE_LIBRARY)
@@ -4793,7 +4789,7 @@ bool cmTarget::IsLinkInterfaceDependentBoolProperty(const std::string &p,
//----------------------------------------------------------------------------
bool cmTarget::IsLinkInterfaceDependentStringProperty(const std::string &p,
- const char *config) const
+ const std::string& config) const
{
if (this->TargetTypeValue == OBJECT_LIBRARY
|| this->TargetTypeValue == INTERFACE_LIBRARY)
@@ -4807,7 +4803,7 @@ bool cmTarget::IsLinkInterfaceDependentStringProperty(const std::string &p,
//----------------------------------------------------------------------------
bool cmTarget::IsLinkInterfaceDependentNumberMinProperty(const std::string &p,
- const char *config) const
+ const std::string& config) const
{
if (this->TargetTypeValue == OBJECT_LIBRARY
|| this->TargetTypeValue == INTERFACE_LIBRARY)
@@ -4820,7 +4816,7 @@ bool cmTarget::IsLinkInterfaceDependentNumberMinProperty(const std::string &p,
//----------------------------------------------------------------------------
bool cmTarget::IsLinkInterfaceDependentNumberMaxProperty(const std::string &p,
- const char *config) const
+ const std::string& config) const
{
if (this->TargetTypeValue == OBJECT_LIBRARY
|| this->TargetTypeValue == INTERFACE_LIBRARY)
@@ -4832,12 +4828,13 @@ bool cmTarget::IsLinkInterfaceDependentNumberMaxProperty(const std::string &p,
}
//----------------------------------------------------------------------------
-void cmTarget::GetLanguages(std::set<cmStdString>& languages) const
+void cmTarget::GetLanguages(std::set<std::string>& languages) const
{
for(std::vector<cmSourceFile*>::const_iterator
i = this->SourceFiles.begin(); i != this->SourceFiles.end(); ++i)
{
- if(const char* lang = (*i)->GetLanguage())
+ const std::string& lang = (*i)->GetLanguage();
+ if(!lang.empty())
{
languages.insert(lang);
}
@@ -4845,7 +4842,7 @@ void cmTarget::GetLanguages(std::set<cmStdString>& languages) const
}
//----------------------------------------------------------------------------
-bool cmTarget::IsChrpathUsed(const char* config) const
+bool cmTarget::IsChrpathUsed(const std::string& config) const
{
// Only certain target types have an rpath.
if(!(this->GetType() == cmTarget::SHARED_LIBRARY ||
@@ -4888,7 +4885,8 @@ bool cmTarget::IsChrpathUsed(const char* config) const
#if defined(CMAKE_USE_ELF_PARSER)
// Enable if the rpath flag uses a separator and the target uses ELF
// binaries.
- if(const char* ll = this->GetLinkerLanguage(config, this))
+ std::string ll = this->GetLinkerLanguage(config, this);
+ if(!ll.empty())
{
std::string sepVar = "CMAKE_SHARED_LIBRARY_RUNTIME_";
sepVar += ll;
@@ -4912,7 +4910,8 @@ bool cmTarget::IsChrpathUsed(const char* config) const
//----------------------------------------------------------------------------
cmTarget::ImportInfo const*
-cmTarget::GetImportInfo(const char* config, cmTarget const* headTarget) const
+cmTarget::GetImportInfo(const std::string& config,
+ cmTarget const* headTarget) const
{
// There is no imported information for non-imported targets.
if(!this->IsImported())
@@ -4923,7 +4922,7 @@ cmTarget::GetImportInfo(const char* config, cmTarget const* headTarget) const
// Lookup/compute/cache the import information for this
// configuration.
std::string config_upper;
- if(config && *config)
+ if(!config.empty())
{
config_upper = cmSystemTools::UpperCase(config);
}
@@ -5277,7 +5276,8 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
}
//----------------------------------------------------------------------------
-cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config,
+cmTarget::LinkInterface const* cmTarget::GetLinkInterface(
+ const std::string& config,
cmTarget const* head) const
{
// Imported targets have their own link interface.
@@ -5299,7 +5299,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config,
}
// Lookup any existing link interface for this configuration.
- TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : ""));
+ TargetConfigPair key(head, cmSystemTools::UpperCase(config));
cmTargetInternals::LinkInterfaceMapType::iterator
i = this->Internal->LinkInterfaceMap.find(key);
@@ -5330,7 +5330,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config,
//----------------------------------------------------------------------------
cmTarget::LinkInterface const*
-cmTarget::GetLinkInterfaceLibraries(const char* config,
+cmTarget::GetLinkInterfaceLibraries(const std::string& config,
cmTarget const* head) const
{
// Imported targets have their own link interface.
@@ -5352,7 +5352,7 @@ cmTarget::GetLinkInterfaceLibraries(const char* config,
}
// Lookup any existing link interface for this configuration.
- TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : ""));
+ TargetConfigPair key(head, cmSystemTools::UpperCase(config));
cmTargetInternals::LinkInterfaceMapType::iterator
i = this->Internal->LinkInterfaceMap.find(key);
@@ -5374,7 +5374,7 @@ cmTarget::GetLinkInterfaceLibraries(const char* config,
}
//----------------------------------------------------------------------------
-void processILibs(const char* config,
+void processILibs(const std::string& config,
cmTarget const* headTarget,
std::string const& name,
std::vector<cmTarget*>& tgts, std::set<cmTarget*>& emitted)
@@ -5402,7 +5402,7 @@ void processILibs(const char* config,
}
//----------------------------------------------------------------------------
-void cmTarget::GetTransitiveTargetClosure(const char* config,
+void cmTarget::GetTransitiveTargetClosure(const std::string& config,
cmTarget const* headTarget,
std::vector<cmTarget*> &tgts) const
{
@@ -5419,7 +5419,7 @@ void cmTarget::GetTransitiveTargetClosure(const char* config,
}
//----------------------------------------------------------------------------
-void cmTarget::GetTransitivePropertyTargets(const char* config,
+void cmTarget::GetTransitivePropertyTargets(const std::string& config,
cmTarget const* headTarget,
std::vector<cmTarget*> &tgts) const
{
@@ -5479,14 +5479,14 @@ void cmTarget::GetTransitivePropertyTargets(const char* config,
}
//----------------------------------------------------------------------------
-const char* cmTarget::ComputeLinkInterfaceLibraries(const char* config,
+const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
LinkInterface& iface,
cmTarget const* headTarget,
bool &exists) const
{
// Construct the property name suffix for this configuration.
std::string suffix = "_";
- if(config && *config)
+ if(!config.empty())
{
suffix += cmSystemTools::UpperCase(config);
}
@@ -5657,7 +5657,7 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const char* config,
//----------------------------------------------------------------------------
void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
- const char* config,
+ const std::string& config,
OptionalLinkInterface& iface,
cmTarget const* headTarget,
const char* explicitLibraries) const
@@ -5670,7 +5670,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
{
// Shared libraries may have runtime implementation dependencies
// on other shared libraries that are not in the interface.
- std::set<cmStdString> emitted;
+ std::set<std::string> emitted;
for(std::vector<std::string>::const_iterator
li = iface.Libraries.begin(); li != iface.Libraries.end(); ++li)
{
@@ -5729,7 +5729,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
{
// Construct the property name suffix for this configuration.
std::string suffix = "_";
- if(config && *config)
+ if(!config.empty())
{
suffix += cmSystemTools::UpperCase(config);
}
@@ -5757,7 +5757,8 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
//----------------------------------------------------------------------------
cmTarget::LinkImplementation const*
-cmTarget::GetLinkImplementation(const char* config, cmTarget const* head) const
+cmTarget::GetLinkImplementation(const std::string& config,
+ cmTarget const* head) const
{
// There is no link implementation for imported targets.
if(this->IsImported())
@@ -5766,7 +5767,7 @@ cmTarget::GetLinkImplementation(const char* config, cmTarget const* head) const
}
// Lookup any existing link implementation for this configuration.
- TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : ""));
+ TargetConfigPair key(head, cmSystemTools::UpperCase(config));
cmTargetInternals::LinkImplMapType::iterator
i = this->Internal->LinkImplMap.find(key);
@@ -5791,7 +5792,7 @@ cmTarget::GetLinkImplementation(const char* config, cmTarget const* head) const
//----------------------------------------------------------------------------
cmTarget::LinkImplementation const*
-cmTarget::GetLinkImplementationLibraries(const char* config,
+cmTarget::GetLinkImplementationLibraries(const std::string& config,
cmTarget const* head) const
{
// There is no link implementation for imported targets.
@@ -5801,7 +5802,7 @@ cmTarget::GetLinkImplementationLibraries(const char* config,
}
// Lookup any existing link implementation for this configuration.
- TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : ""));
+ TargetConfigPair key(head, cmSystemTools::UpperCase(config));
cmTargetInternals::LinkImplMapType::iterator
i = this->Internal->LinkImplMap.find(key);
@@ -5820,7 +5821,7 @@ cmTarget::GetLinkImplementationLibraries(const char* config,
}
//----------------------------------------------------------------------------
-void cmTarget::ComputeLinkImplementation(const char* config,
+void cmTarget::ComputeLinkImplementation(const std::string& config,
LinkImplementation& impl,
cmTarget const* head) const
{
@@ -5899,7 +5900,7 @@ void
cmTarget::ComputeLinkImplementationLanguages(LinkImplementation& impl) const
{
// This target needs runtime libraries for its source languages.
- std::set<cmStdString> languages;
+ std::set<std::string> languages;
// Get languages used in our source files.
this->GetLanguages(languages);
// Get languages used in object library sources.
@@ -5916,7 +5917,7 @@ cmTarget::ComputeLinkImplementationLanguages(LinkImplementation& impl) const
}
}
// Copy the set of langauges to the link implementation.
- for(std::set<cmStdString>::iterator li = languages.begin();
+ for(std::set<std::string>::iterator li = languages.begin();
li != languages.end(); ++li)
{
impl.Languages.push_back(*li);
@@ -5984,15 +5985,15 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const
template<typename PropertyType>
PropertyType getLinkInterfaceDependentProperty(cmTarget const* tgt,
- const std::string prop,
- const char *config,
+ const std::string& prop,
+ const std::string& config,
CompatibleType,
PropertyType *);
template<>
bool getLinkInterfaceDependentProperty(cmTarget const* tgt,
- const std::string prop,
- const char *config,
+ const std::string& prop,
+ const std::string& config,
CompatibleType, bool *)
{
return tgt->GetLinkInterfaceDependentBoolProperty(prop, config);
@@ -6000,8 +6001,8 @@ bool getLinkInterfaceDependentProperty(cmTarget const* tgt,
template<>
const char * getLinkInterfaceDependentProperty(cmTarget const* tgt,
- const std::string prop,
- const char *config,
+ const std::string& prop,
+ const std::string& config,
CompatibleType t,
const char **)
{
@@ -6025,9 +6026,9 @@ const char * getLinkInterfaceDependentProperty(cmTarget const* tgt,
template<typename PropertyType>
void checkPropertyConsistency(cmTarget const* depender,
cmTarget const* dependee,
- const char *propName,
- std::set<cmStdString> &emitted,
- const char *config,
+ const std::string& propName,
+ std::set<std::string> &emitted,
+ const std::string& config,
CompatibleType t,
PropertyType *)
{
@@ -6070,10 +6071,10 @@ void checkPropertyConsistency(cmTarget const* depender,
}
}
-static cmStdString intersect(const std::set<cmStdString> &s1,
- const std::set<cmStdString> &s2)
+static std::string intersect(const std::set<std::string> &s1,
+ const std::set<std::string> &s2)
{
- std::set<cmStdString> intersect;
+ std::set<std::string> intersect;
std::set_intersection(s1.begin(),s1.end(),
s2.begin(),s2.end(),
std::inserter(intersect,intersect.begin()));
@@ -6083,11 +6084,11 @@ static cmStdString intersect(const std::set<cmStdString> &s1,
}
return "";
}
-static cmStdString intersect(const std::set<cmStdString> &s1,
- const std::set<cmStdString> &s2,
- const std::set<cmStdString> &s3)
+static std::string intersect(const std::set<std::string> &s1,
+ const std::set<std::string> &s2,
+ const std::set<std::string> &s3)
{
- cmStdString result;
+ std::string result;
result = intersect(s1, s2);
if (!result.empty())
return result;
@@ -6096,12 +6097,12 @@ static cmStdString intersect(const std::set<cmStdString> &s1,
return result;
return intersect(s2, s3);
}
-static cmStdString intersect(const std::set<cmStdString> &s1,
- const std::set<cmStdString> &s2,
- const std::set<cmStdString> &s3,
- const std::set<cmStdString> &s4)
+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)
{
- cmStdString result;
+ std::string result;
result = intersect(s1, s2);
if (!result.empty())
return result;
@@ -6116,14 +6117,14 @@ static cmStdString intersect(const std::set<cmStdString> &s1,
//----------------------------------------------------------------------------
void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
- const char* config) const
+ const std::string& config) const
{
const cmComputeLinkInformation::ItemVector &deps = info->GetItems();
- std::set<cmStdString> emittedBools;
- std::set<cmStdString> emittedStrings;
- std::set<cmStdString> emittedMinNumbers;
- std::set<cmStdString> emittedMaxNumbers;
+ std::set<std::string> emittedBools;
+ std::set<std::string> emittedStrings;
+ std::set<std::string> emittedMinNumbers;
+ std::set<std::string> emittedMaxNumbers;
for(cmComputeLinkInformation::ItemVector::const_iterator li =
deps.begin();
@@ -6135,32 +6136,32 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
}
checkPropertyConsistency<bool>(this, li->Target,
- "COMPATIBLE_INTERFACE_BOOL",
- emittedBools, config, BoolType, 0);
+ std::string("COMPATIBLE_INTERFACE_BOOL"),
+ emittedBools, config, BoolType, 0);
if (cmSystemTools::GetErrorOccuredFlag())
{
return;
}
checkPropertyConsistency<const char *>(this, li->Target,
- "COMPATIBLE_INTERFACE_STRING",
- emittedStrings, config,
- StringType, 0);
+ std::string("COMPATIBLE_INTERFACE_STRING"),
+ emittedStrings, config,
+ StringType, 0);
if (cmSystemTools::GetErrorOccuredFlag())
{
return;
}
checkPropertyConsistency<const char *>(this, li->Target,
- "COMPATIBLE_INTERFACE_NUMBER_MIN",
- emittedMinNumbers, config,
- NumberMinType, 0);
+ std::string("COMPATIBLE_INTERFACE_NUMBER_MIN"),
+ emittedMinNumbers, config,
+ NumberMinType, 0);
if (cmSystemTools::GetErrorOccuredFlag())
{
return;
}
checkPropertyConsistency<const char *>(this, li->Target,
- "COMPATIBLE_INTERFACE_NUMBER_MAX",
- emittedMaxNumbers, config,
- NumberMaxType, 0);
+ std::string("COMPATIBLE_INTERFACE_NUMBER_MAX"),
+ emittedMaxNumbers, config,
+ NumberMaxType, 0);
if (cmSystemTools::GetErrorOccuredFlag())
{
return;
@@ -6175,7 +6176,7 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
if (!prop.empty())
{
std::set<std::string> props;
- std::set<cmStdString>::const_iterator i = emittedBools.find(prop);
+ std::set<std::string>::const_iterator i = emittedBools.find(prop);
if (i != emittedBools.end())
{
props.insert("COMPATIBLE_INTERFACE_BOOL");
@@ -6220,12 +6221,12 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
//----------------------------------------------------------------------------
cmComputeLinkInformation*
-cmTarget::GetLinkInformation(const char* config, cmTarget const* head) const
+cmTarget::GetLinkInformation(const std::string& config,
+ cmTarget const* head) const
{
cmTarget const* headTarget = head ? head : this;
// Lookup any existing information for this configuration.
- TargetConfigPair key(headTarget,
- cmSystemTools::UpperCase(config?config:""));
+ TargetConfigPair key(headTarget, cmSystemTools::UpperCase(config));
cmTargetLinkInformationMap::iterator
i = this->LinkInformation.find(key);
if(i == this->LinkInformation.end())
@@ -6252,7 +6253,7 @@ cmTarget::GetLinkInformation(const char* config, cmTarget const* head) const
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetFrameworkDirectory(const char* config,
+std::string cmTarget::GetFrameworkDirectory(const std::string& config,
bool rootDir) const
{
std::string fpath;
@@ -6267,7 +6268,7 @@ std::string cmTarget::GetFrameworkDirectory(const char* config,
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetCFBundleDirectory(const char* config,
+std::string cmTarget::GetCFBundleDirectory(const std::string& config,
bool contentOnly) const
{
std::string fpath;
@@ -6286,7 +6287,7 @@ std::string cmTarget::GetCFBundleDirectory(const char* config,
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetAppBundleDirectory(const char* config,
+std::string cmTarget::GetAppBundleDirectory(const std::string& config,
bool contentOnly) const
{
std::string fpath = this->GetFullName(config, false);
@@ -6298,7 +6299,7 @@ std::string cmTarget::GetAppBundleDirectory(const char* config,
//----------------------------------------------------------------------------
std::string cmTarget::BuildMacContentDirectory(const std::string& base,
- const char* config,
+ const std::string& config,
bool contentOnly) const
{
std::string fpath = base;
@@ -6318,7 +6319,7 @@ std::string cmTarget::BuildMacContentDirectory(const std::string& base,
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetMacContentDirectory(const char* config,
+std::string cmTarget::GetMacContentDirectory(const std::string& config,
bool implib) const
{
// Start with the output directory for the target.
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 471ea94..d5ef18d 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -93,13 +93,13 @@ public:
/**
* Set the target type
*/
- void SetType(TargetType f, const char* name);
+ void SetType(TargetType f, const std::string& name);
void MarkAsImported();
///! Set/Get the name of the target
- const char* GetName() const {return this->Name.c_str();}
- const char* GetExportName() const;
+ const std::string& GetName() const {return this->Name;}
+ std::string GetExportName() const;
///! Set the cmMakefile that owns this target
void SetMakefile(cmMakefile *mf);
@@ -143,37 +143,37 @@ public:
* Add sources to the target.
*/
void AddSources(std::vector<std::string> const& srcs);
- cmSourceFile* AddSource(const char* src);
+ cmSourceFile* AddSource(const std::string& src);
enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED};
//* how we identify a library, by name and type
- typedef std::pair<cmStdString, LinkLibraryType> LibraryID;
+ typedef std::pair<std::string, LinkLibraryType> LibraryID;
typedef std::vector<LibraryID > LinkLibraryVectorType;
const LinkLibraryVectorType &GetLinkLibraries() const {
return this->LinkLibraries;}
const LinkLibraryVectorType &GetOriginalLinkLibraries() const
{return this->OriginalLinkLibraries;}
- void GetDirectLinkLibraries(const char *config,
+ void GetDirectLinkLibraries(const std::string& config,
std::vector<std::string> &,
cmTarget const* head) const;
- void GetInterfaceLinkLibraries(const char *config,
+ void GetInterfaceLinkLibraries(const std::string& config,
std::vector<std::string> &,
cmTarget const* head) const;
/** Compute the link type to use for the given configuration. */
- LinkLibraryType ComputeLinkType(const char* config) const;
+ LinkLibraryType ComputeLinkType(const std::string& config) const;
/**
* Clear the dependency information recorded for this target, if any.
*/
- void ClearDependencyInformation(cmMakefile& mf, const char* target);
+ void ClearDependencyInformation(cmMakefile& mf, const std::string& target);
// Check to see if a library is a framework and treat it different on Mac
bool NameResolvesToFramework(const std::string& libname) const;
void AddLinkLibrary(cmMakefile& mf,
- const char *target, const char* lib,
+ const std::string& target, const std::string& lib,
LinkLibraryType llt);
enum TLLSignature {
KeywordTLLSignature,
@@ -182,12 +182,12 @@ public:
bool PushTLLCommandTrace(TLLSignature signature);
void GetTllSignatureTraces(cmOStringStream &s, TLLSignature sig) const;
- void MergeLinkLibraries( cmMakefile& mf, const char* selfname,
+ void MergeLinkLibraries( cmMakefile& mf, const std::string& selfname,
const LinkLibraryVectorType& libs );
const std::vector<std::string>& GetLinkDirectories() const;
- void AddLinkDirectory(const char* d);
+ void AddLinkDirectory(const std::string& d);
/**
* Set the path where this target should be installed. This is relative to
@@ -214,23 +214,26 @@ public:
* name as would be specified to the ADD_EXECUTABLE or UTILITY_SOURCE
* commands. It is not a full path nor does it have an extension.
*/
- void AddUtility(const char* u, cmMakefile *makefile = 0);
+ void AddUtility(const std::string& u, cmMakefile *makefile = 0);
///! Get the utilities used by this target
- std::set<cmStdString>const& GetUtilities() const { return this->Utilities; }
- cmListFileBacktrace const* GetUtilityBacktrace(const char* u) const;
+ std::set<std::string>const& GetUtilities() const { return this->Utilities; }
+ cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const;
/** Finalize the target at the end of the Configure step. */
void FinishConfigure();
///! Set/Get a property of this target file
- void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char* prop, const char* value,bool asString=false);
- const char *GetProperty(const char *prop) const;
- const char *GetProperty(const char *prop, cmProperty::ScopeType scope) const;
- bool GetPropertyAsBool(const char *prop) const;
- void CheckProperty(const char* prop, cmMakefile* context) const;
-
- const char* GetFeature(const char* feature, const char* config) const;
+ void SetProperty(const std::string& prop, const char *value);
+ void AppendProperty(const std::string& prop, const char* value,
+ bool asString=false);
+ const char *GetProperty(const std::string& prop) const;
+ const char *GetProperty(const std::string& prop,
+ cmProperty::ScopeType scope) const;
+ bool GetPropertyAsBool(const std::string& prop) const;
+ void CheckProperty(const std::string& prop, cmMakefile* context) const;
+
+ const char* GetFeature(const std::string& feature,
+ const std::string& config) const;
bool IsImported() const {return this->IsImportedTarget;}
@@ -262,14 +265,14 @@ public:
/** Get the link interface for the given configuration. Returns 0
if the target cannot be linked. */
- LinkInterface const* GetLinkInterface(const char* config,
+ LinkInterface const* GetLinkInterface(const std::string& config,
cmTarget const* headTarget) const;
- LinkInterface const* GetLinkInterfaceLibraries(const char* config,
+ LinkInterface const* GetLinkInterfaceLibraries(const std::string& config,
cmTarget const* headTarget) const;
- void GetTransitivePropertyTargets(const char* config,
+ void GetTransitivePropertyTargets(const std::string& config,
cmTarget const* headTarget,
std::vector<cmTarget*> &libs) const;
- void GetTransitiveTargetClosure(const char* config,
+ void GetTransitiveTargetClosure(const std::string& config,
cmTarget const* headTarget,
std::vector<cmTarget*> &libs) const;
@@ -287,10 +290,11 @@ public:
// Needed only for OLD behavior of CMP0003.
std::vector<std::string> WrongConfigLibraries;
};
- LinkImplementation const* GetLinkImplementation(const char* config,
+ LinkImplementation const* GetLinkImplementation(const std::string& config,
cmTarget const* head) const;
- LinkImplementation const* GetLinkImplementationLibraries(const char* config,
+ LinkImplementation const* GetLinkImplementationLibraries(
+ const std::string& config,
cmTarget const* head) const;
/** Link information from the transitive closure of the link
@@ -303,7 +307,7 @@ public:
// Languages whose runtime libraries must be linked.
std::vector<std::string> Languages;
};
- LinkClosure const* GetLinkClosure(const char* config,
+ LinkClosure const* GetLinkClosure(const std::string& config,
cmTarget const* head) const;
/** Strip off leading and trailing whitespace from an item named in
@@ -314,24 +318,29 @@ public:
configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
output directory is given. */
- std::string GetDirectory(const char* config = 0, bool implib = false) const;
+ std::string GetDirectory(const std::string& config = "",
+ bool implib = false) const;
/** Get the directory in which this targets .pdb files will be placed.
If the configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
pdb output directory is given. */
- std::string GetPDBDirectory(const char* config) const;
+ std::string GetPDBDirectory(const std::string& config) const;
/** Get the directory in which to place the target compiler .pdb file.
If the configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
compiler pdb output directory is given. */
- std::string GetCompilePDBDirectory(const char* config = 0) const;
+ std::string GetCompilePDBDirectory(const std::string& config = "") const;
/** Get the location of the target in the build tree for the given
- configuration. This location is suitable for use as the LOCATION
- target property. */
- const char* GetLocation(const char* config) const;
+ configuration. */
+ const char* GetLocation(const std::string& config) const;
+
+ /** Get the location of the target in the build tree with a placeholder
+ referencing the configuration in the native build system. This
+ location is suitable for use as the LOCATION target property. */
+ const char* GetLocationForBuild() const;
/** Get the target major and minor version numbers interpreted from
the VERSION property. Version 0 is returned if the property is
@@ -345,44 +354,46 @@ public:
GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const;
///! Return the preferred linker language for this target
- const char* GetLinkerLanguage(const char* config = 0,
+ std::string GetLinkerLanguage(const std::string& config = "",
cmTarget const* head = 0) const;
/** Get the full name of the target according to the settings in its
makefile. */
- std::string GetFullName(const char* config=0, bool implib = false) const;
+ std::string GetFullName(const std::string& config="",
+ bool implib = false) const;
void GetFullNameComponents(std::string& prefix,
std::string& base, std::string& suffix,
- const char* config=0, bool implib = false) const;
+ const std::string& config="",
+ bool implib = false) const;
/** Get the name of the pdb file for the target. */
- std::string GetPDBName(const char* config) const;
+ std::string GetPDBName(const std::string& config) const;
/** Get the name of the compiler pdb file for the target. */
- std::string GetCompilePDBName(const char* config=0) const;
+ std::string GetCompilePDBName(const std::string& config="") const;
/** Get the path for the MSVC /Fd option for this target. */
- std::string GetCompilePDBPath(const char* config=0) const;
+ std::string GetCompilePDBPath(const std::string& config="") const;
/** Whether this library has soname enabled and platform supports it. */
- bool HasSOName(const char* config) const;
+ bool HasSOName(const std::string& config) const;
/** Get the soname of the target. Allowed only for a shared library. */
- std::string GetSOName(const char* config) const;
+ std::string GetSOName(const std::string& config) const;
/** Whether this library has \@rpath and platform supports it. */
- bool HasMacOSXRpathInstallNameDir(const char* config) const;
+ bool HasMacOSXRpathInstallNameDir(const std::string& config) const;
/** Whether this library defaults to \@rpath. */
bool MacOSXRpathInstallNameDirDefault() const;
/** Test for special case of a third-party shared library that has
no soname at all. */
- bool IsImportedSharedLibWithoutSOName(const char* config) const;
+ bool IsImportedSharedLibWithoutSOName(const std::string& config) const;
/** Get the full path to the target according to the settings in its
makefile and the configuration type. */
- std::string GetFullPath(const char* config=0, bool implib = false,
+ std::string GetFullPath(const std::string& config="", bool implib = false,
bool realname = false) const;
/** Get the names of the library needed to generate a build rule
@@ -390,14 +401,15 @@ public:
should be called only on a library target. */
void GetLibraryNames(std::string& name, std::string& soName,
std::string& realName, std::string& impName,
- std::string& pdbName, const char* config) const;
+ std::string& pdbName, const std::string& config) const;
/** Get the names of the executable needed to generate a build rule
that takes into account executable version numbers. This should
be called only on an executable target. */
void GetExecutableNames(std::string& name, std::string& realName,
std::string& impName,
- std::string& pdbName, const char* config) const;
+ std::string& pdbName,
+ const std::string& config) const;
/** Does this target have a GNU implib to convert to MS format? */
bool HasImplibGNUtoMS() const;
@@ -410,24 +422,24 @@ public:
/**
* Compute whether this target must be relinked before installing.
*/
- bool NeedRelinkBeforeInstall(const char* config) const;
+ bool NeedRelinkBeforeInstall(const std::string& config) const;
- bool HaveBuildTreeRPATH(const char *config) const;
+ bool HaveBuildTreeRPATH(const std::string& config) const;
bool HaveInstallTreeRPATH() const;
/** Return true if builtin chrpath will work for this target */
- bool IsChrpathUsed(const char* config) const;
+ bool IsChrpathUsed(const std::string& config) const;
/** Return the install name directory for the target in the
* build tree. For example: "\@rpath/", "\@loader_path/",
* or "/full/path/to/library". */
- std::string GetInstallNameDirForBuildTree(const char* config) const;
+ std::string GetInstallNameDirForBuildTree(const std::string& config) const;
/** Return the install name directory for the target in the
* install tree. For example: "\@rpath/" or "\@loader_path/". */
std::string GetInstallNameDirForInstallTree() const;
- cmComputeLinkInformation* GetLinkInformation(const char* config,
+ cmComputeLinkInformation* GetLinkInformation(const std::string& config,
cmTarget const* head = 0) const;
// Get the properties
@@ -446,14 +458,14 @@ public:
const char* GetExportMacro() const;
void GetCompileDefinitions(std::vector<std::string> &result,
- const char *config) const;
+ const std::string& config) const;
// Compute the set of languages compiled by the target. This is
// computed every time it is called because the languages can change
// when source file properties are changed and we do not have enough
// information to forward these property changes to the targets
// until we have per-target object file properties.
- void GetLanguages(std::set<cmStdString>& languages) const;
+ void GetLanguages(std::set<std::string>& languages) const;
/** Return whether this target is an executable with symbol exports
enabled. */
@@ -494,26 +506,29 @@ public:
/** Return whether this target uses the default value for its output
directory. */
- bool UsesDefaultOutputDir(const char* config, bool implib) const;
+ bool UsesDefaultOutputDir(const std::string& config, bool implib) const;
/** @return the mac content directory for this target. */
- std::string GetMacContentDirectory(const char* config,
+ std::string GetMacContentDirectory(const std::string& config,
bool implib) const;
/** @return whether this target have a well defined output file name. */
bool HaveWellDefinedOutputFiles() const;
/** @return the Mac framework directory without the base. */
- std::string GetFrameworkDirectory(const char* config, bool rootDir) const;
+ std::string GetFrameworkDirectory(const std::string& config,
+ bool rootDir) const;
/** @return the Mac CFBundle directory without the base */
- std::string GetCFBundleDirectory(const char* config, bool contentOnly) const;
+ std::string GetCFBundleDirectory(const std::string& config,
+ bool contentOnly) const;
/** @return the Mac App directory without the base */
- std::string GetAppBundleDirectory(const char* config,
+ std::string GetAppBundleDirectory(const std::string& config,
bool contentOnly) const;
- std::vector<std::string> GetIncludeDirectories(const char *config) const;
+ std::vector<std::string> GetIncludeDirectories(
+ const std::string& config) const;
void InsertInclude(const cmValueWithOrigin &entry,
bool before = false);
void InsertCompileOption(const cmValueWithOrigin &entry,
@@ -523,36 +538,36 @@ public:
void AppendBuildInterfaceIncludes();
void GetCompileOptions(std::vector<std::string> &result,
- const char *config) const;
+ const std::string& config) const;
void GetAutoUicOptions(std::vector<std::string> &result,
- const char *config) const;
+ const std::string& config) const;
bool IsNullImpliedByLinkLibraries(const std::string &p) const;
bool IsLinkInterfaceDependentBoolProperty(const std::string &p,
- const char *config) const;
+ const std::string& config) const;
bool IsLinkInterfaceDependentStringProperty(const std::string &p,
- const char *config) const;
+ const std::string& config) const;
bool IsLinkInterfaceDependentNumberMinProperty(const std::string &p,
- const char *config) const;
+ const std::string& config) const;
bool IsLinkInterfaceDependentNumberMaxProperty(const std::string &p,
- const char *config) const;
+ const std::string& config) const;
bool GetLinkInterfaceDependentBoolProperty(const std::string &p,
- const char *config) const;
+ const std::string& config) const;
const char *GetLinkInterfaceDependentStringProperty(const std::string &p,
- const char *config) const;
+ const std::string& config) const;
const char *GetLinkInterfaceDependentNumberMinProperty(const std::string &p,
- const char *config) const;
+ const std::string& config) const;
const char *GetLinkInterfaceDependentNumberMaxProperty(const std::string &p,
- const char *config) const;
+ const std::string& config) const;
std::string GetDebugGeneratorExpressions(const std::string &value,
cmTarget::LinkLibraryType llt) const;
- void AddSystemIncludeDirectories(const std::set<cmStdString> &incs);
+ void AddSystemIncludeDirectories(const std::set<std::string> &incs);
void AddSystemIncludeDirectories(const std::vector<std::string> &incs);
- std::set<cmStdString> const & GetSystemIncludeDirectories() const
+ std::set<std::string> const & GetSystemIncludeDirectories() const
{ return this->SystemIncludeDirectories; }
bool LinkLanguagePropagatesToDependents() const
@@ -568,7 +583,7 @@ private:
// The set of include directories that are marked as system include
// directories.
- std::set<cmStdString> SystemIncludeDirectories;
+ std::set<std::string> SystemIncludeDirectories;
std::vector<std::pair<TLLSignature, cmListFileBacktrace> > TLLCommands;
@@ -625,39 +640,40 @@ private:
const char* GetSuffixVariableInternal(bool implib) const;
const char* GetPrefixVariableInternal(bool implib) const;
- std::string GetFullNameInternal(const char* config, bool implib) const;
- void GetFullNameInternal(const char* config, bool implib,
+ std::string GetFullNameInternal(const std::string& config,
+ bool implib) const;
+ void GetFullNameInternal(const std::string& config, bool implib,
std::string& outPrefix, std::string& outBase,
std::string& outSuffix) const;
// Use a makefile variable to set a default for the given property.
// If the variable is not defined use the given default instead.
- void SetPropertyDefault(const char* property, const char* default_value);
+ void SetPropertyDefault(const std::string& property,
+ const char* default_value);
// Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type.
const char* GetOutputTargetType(bool implib) const;
// Get the target base name.
- std::string GetOutputName(const char* config, bool implib) const;
-
- const char* ImportedGetLocation(const char* config) const;
- const char* NormalGetLocation(const char* config) const;
+ std::string GetOutputName(const std::string& config, bool implib) const;
- std::string GetFullNameImported(const char* config, bool implib) const;
+ std::string GetFullNameImported(const std::string& config,
+ bool implib) const;
- std::string ImportedGetFullPath(const char* config, bool implib) const;
- std::string NormalGetFullPath(const char* config, bool implib,
+ std::string ImportedGetFullPath(const std::string& config,
+ bool implib) const;
+ std::string NormalGetFullPath(const std::string& config, bool implib,
bool realname) const;
/** Get the real name of the target. Allowed only for non-imported
targets. When a library or executable file is versioned this is
the full versioned name. If the target is not versioned this is
the same as GetFullName. */
- std::string NormalGetRealName(const char* config) const;
+ std::string NormalGetRealName(const std::string& config) const;
/** Append to @a base the mac content directory and return it. */
std::string BuildMacContentDirectory(const std::string& base,
- const char* config,
+ const std::string& config,
bool contentOnly) const;
private:
@@ -672,13 +688,13 @@ private:
LinkLibraryVectorType PrevLinkedLibraries;
bool LinkLibrariesAnalyzed;
std::vector<std::string> LinkDirectories;
- std::set<cmStdString> LinkDirectoriesEmmitted;
+ std::set<std::string> LinkDirectoriesEmmitted;
bool HaveInstallRule;
std::string InstallPath;
std::string RuntimeInstallPath;
mutable std::string ExportMacro;
- std::set<cmStdString> Utilities;
- std::map<cmStdString, cmListFileBacktrace> UtilityBacktraces;
+ std::set<std::string> Utilities;
+ std::map<std::string, cmListFileBacktrace> UtilityBacktraces;
bool RecordDependencies;
mutable cmPropertyMap Properties;
LinkLibraryVectorType OriginalLinkLibraries;
@@ -694,42 +710,43 @@ private:
// Cache target output paths for each configuration.
struct OutputInfo;
- OutputInfo const* GetOutputInfo(const char* config) const;
+ OutputInfo const* GetOutputInfo(const std::string& config) const;
bool
- ComputeOutputDir(const char* config, bool implib, std::string& out) const;
- bool ComputePDBOutputDir(const char* kind, const char* config,
+ ComputeOutputDir(const std::string& config,
+ bool implib, std::string& out) const;
+ bool ComputePDBOutputDir(const std::string& kind, const std::string& config,
std::string& out) const;
// Cache import information from properties for each configuration.
struct ImportInfo;
- ImportInfo const* GetImportInfo(const char* config,
+ ImportInfo const* GetImportInfo(const std::string& config,
cmTarget const* workingTarget) const;
void ComputeImportInfo(std::string const& desired_config, ImportInfo& info,
cmTarget const* head) const;
// Cache target compile paths for each configuration.
struct CompileInfo;
- CompileInfo const* GetCompileInfo(const char* config) const;
+ CompileInfo const* GetCompileInfo(const std::string& config) const;
mutable cmTargetLinkInformationMap LinkInformation;
void CheckPropertyCompatibility(cmComputeLinkInformation *info,
- const char* config) const;
+ const std::string& config) const;
- const char* ComputeLinkInterfaceLibraries(const char* config,
+ const char* ComputeLinkInterfaceLibraries(const std::string& config,
LinkInterface& iface,
cmTarget const* head,
bool &exists) const;
- void ComputeLinkImplementation(const char* config,
+ void ComputeLinkImplementation(const std::string& config,
LinkImplementation& impl,
cmTarget const* head) const;
void ComputeLinkImplementationLanguages(LinkImplementation& impl) const;
- void ComputeLinkClosure(const char* config, LinkClosure& lc,
+ void ComputeLinkClosure(const std::string& config, LinkClosure& lc,
cmTarget const* head) const;
void ClearLinkMaps();
- void MaybeInvalidatePropertyCache(const char* prop);
+ void MaybeInvalidatePropertyCache(const std::string& prop);
void ProcessSourceExpression(std::string const& expr);
@@ -759,9 +776,9 @@ private:
const char* version) const;
};
-typedef std::map<cmStdString,cmTarget> cmTargets;
+typedef std::map<std::string,cmTarget> cmTargets;
-class cmTargetSet: public std::set<cmStdString> {};
-class cmTargetManifest: public std::map<cmStdString, cmTargetSet> {};
+class cmTargetSet: public std::set<std::string> {};
+class cmTargetManifest: public std::map<std::string, cmTargetSet> {};
#endif
diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h
index 7405e90..5ba9e03 100644
--- a/Source/cmTargetCompileDefinitionsCommand.h
+++ b/Source/cmTargetCompileDefinitionsCommand.h
@@ -36,7 +36,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "target_compile_definitions";}
+ virtual std::string GetName() const { return "target_compile_definitions";}
cmTypeMacro(cmTargetCompileDefinitionsCommand, cmTargetPropCommandBase);
diff --git a/Source/cmTargetCompileOptionsCommand.h b/Source/cmTargetCompileOptionsCommand.h
index 3713e5a..d58dc07 100644
--- a/Source/cmTargetCompileOptionsCommand.h
+++ b/Source/cmTargetCompileOptionsCommand.h
@@ -36,7 +36,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "target_compile_options";}
+ virtual std::string GetName() const { return "target_compile_options";}
cmTypeMacro(cmTargetCompileOptionsCommand, cmTargetPropCommandBase);
diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h
index 6863ee5..c8b22fb 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.h
+++ b/Source/cmTargetIncludeDirectoriesCommand.h
@@ -37,7 +37,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "target_include_directories";}
+ virtual std::string GetName() const { return "target_include_directories";}
cmTypeMacro(cmTargetIncludeDirectoriesCommand, cmTargetPropCommandBase);
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 02da933..8dc407b 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -39,7 +39,7 @@ bool cmTargetLinkLibrariesCommand
// Lookup the target for which libraries are specified.
this->Target =
this->Makefile->GetCMakeInstance()
- ->GetGlobalGenerator()->FindTarget(0, args[0].c_str());
+ ->GetGlobalGenerator()->FindTarget(args[0].c_str());
if(!this->Target)
{
cmake::MessageType t = cmake::FATAL_ERROR; // fail by default
@@ -272,7 +272,7 @@ bool cmTargetLinkLibrariesCommand
{
// The link type was specified by the previous argument.
haveLLT = false;
- if (!this->HandleLibrary(args[i].c_str(), llt))
+ if (!this->HandleLibrary(args[i], llt))
{
return false;
}
@@ -301,7 +301,7 @@ bool cmTargetLinkLibrariesCommand
llt = cmTarget::OPTIMIZED;
}
}
- if (!this->HandleLibrary(args[i].c_str(), llt))
+ if (!this->HandleLibrary(args[i], llt))
{
return false;
}
@@ -352,7 +352,7 @@ cmTargetLinkLibrariesCommand
//----------------------------------------------------------------------------
bool
-cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
+cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
cmTarget::LinkLibraryType llt)
{
if(this->Target->GetType() == cmTarget::INTERFACE_LIBRARY
@@ -479,13 +479,13 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
{
prop = "LINK_INTERFACE_LIBRARIES_";
prop += *i;
- this->Target->AppendProperty(prop.c_str(), lib);
+ this->Target->AppendProperty(prop.c_str(), lib.c_str());
}
}
if(llt == cmTarget::OPTIMIZED || llt == cmTarget::GENERAL)
{
// Put in the non-DEBUG configuration interfaces.
- this->Target->AppendProperty("LINK_INTERFACE_LIBRARIES", lib);
+ this->Target->AppendProperty("LINK_INTERFACE_LIBRARIES", lib.c_str());
// Make sure the DEBUG configuration interfaces exist so that the
// general one will not be used as a fall-back.
diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index 6fbf722..47dd8bd 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -42,7 +42,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "target_link_libraries";}
+ virtual std::string GetName() const { return "target_link_libraries";}
cmTypeMacro(cmTargetLinkLibrariesCommand, cmCommand);
private:
@@ -62,7 +62,7 @@ private:
ProcessingState CurrentProcessingState;
- bool HandleLibrary(const char* lib, cmTarget::LinkLibraryType llt);
+ bool HandleLibrary(const std::string& lib, cmTarget::LinkLibraryType llt);
};
diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx
index 195690e..1a1cfa0 100644
--- a/Source/cmTargetPropCommandBase.cxx
+++ b/Source/cmTargetPropCommandBase.cxx
@@ -16,8 +16,9 @@
//----------------------------------------------------------------------------
bool cmTargetPropCommandBase
-::HandleArguments(std::vector<std::string> const& args, const char *prop,
- ArgumentFlags flags)
+::HandleArguments(std::vector<std::string> const& args,
+ const std::string& prop,
+ ArgumentFlags flags)
{
if(args.size() < 2)
{
@@ -33,7 +34,7 @@ bool cmTargetPropCommandBase
}
this->Target =
this->Makefile->GetCMakeInstance()
- ->GetGlobalGenerator()->FindTarget(0, args[0].c_str());
+ ->GetGlobalGenerator()->FindTarget(args[0].c_str());
if(!this->Target)
{
this->Target = this->Makefile->FindTargetToUse(args[0]);
diff --git a/Source/cmTargetPropCommandBase.h b/Source/cmTargetPropCommandBase.h
index c402836..555a08a 100644
--- a/Source/cmTargetPropCommandBase.h
+++ b/Source/cmTargetPropCommandBase.h
@@ -29,7 +29,8 @@ public:
};
bool HandleArguments(std::vector<std::string> const& args,
- const char *prop, ArgumentFlags flags = NO_FLAGS);
+ const std::string& prop,
+ ArgumentFlags flags = NO_FLAGS);
cmTypeMacro(cmTargetPropCommandBase, cmCommand);
protected:
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index 9cda978..28a7bb1 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -38,12 +38,8 @@ cmListFileBacktrace const& cmTest::GetBacktrace() const
}
//----------------------------------------------------------------------------
-void cmTest::SetName(const char* name)
+void cmTest::SetName(const std::string& name)
{
- if ( !name )
- {
- name = "";
- }
this->Name = name;
}
@@ -54,7 +50,7 @@ void cmTest::SetCommand(std::vector<std::string> const& command)
}
//----------------------------------------------------------------------------
-const char *cmTest::GetProperty(const char* prop) const
+const char *cmTest::GetProperty(const std::string& prop) const
{
bool chain = false;
const char *retVal =
@@ -67,28 +63,20 @@ const char *cmTest::GetProperty(const char* prop) const
}
//----------------------------------------------------------------------------
-bool cmTest::GetPropertyAsBool(const char* prop) const
+bool cmTest::GetPropertyAsBool(const std::string& prop) const
{
return cmSystemTools::IsOn(this->GetProperty(prop));
}
//----------------------------------------------------------------------------
-void cmTest::SetProperty(const char* prop, const char* value)
+void cmTest::SetProperty(const std::string& prop, const char* value)
{
- if (!prop)
- {
- return;
- }
-
this->Properties.SetProperty(prop, value, cmProperty::TEST);
}
//----------------------------------------------------------------------------
-void cmTest::AppendProperty(const char* prop, const char* value, bool asString)
+void cmTest::AppendProperty(const std::string& prop,
+ const char* value, bool asString)
{
- if (!prop)
- {
- return;
- }
this->Properties.AppendProperty(prop, value, cmProperty::TEST, asString);
}
diff --git a/Source/cmTest.h b/Source/cmTest.h
index 1fe8fc0..b3785f6 100644
--- a/Source/cmTest.h
+++ b/Source/cmTest.h
@@ -31,8 +31,8 @@ public:
~cmTest();
///! Set the test name
- void SetName(const char* name);
- const char* GetName() const { return this->Name.c_str(); }
+ void SetName(const std::string& name);
+ std::string GetName() const { return this->Name; }
void SetCommand(std::vector<std::string> const& command);
std::vector<std::string> const& GetCommand() const
@@ -46,10 +46,11 @@ public:
void Print() const;
///! Set/Get a property of this source file
- void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char* prop, const char* value,bool asString=false);
- const char *GetProperty(const char *prop) const;
- bool GetPropertyAsBool(const char *prop) const;
+ void SetProperty(const std::string& prop, const char *value);
+ void AppendProperty(const std::string& prop,
+ const char* value,bool asString=false);
+ const char *GetProperty(const std::string& prop) const;
+ bool GetPropertyAsBool(const std::string& prop) const;
cmPropertyMap &GetProperties() { return this->Properties; };
/** Get the cmMakefile instance that owns this test. */
@@ -64,7 +65,7 @@ public:
private:
cmPropertyMap Properties;
- cmStdString Name;
+ std::string Name;
std::vector<std::string> Command;
bool OldStyle;
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 5dc3e60..a21e1aa 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -64,7 +64,7 @@ void cmTestGenerator::GenerateScriptActions(std::ostream& os,
//----------------------------------------------------------------------------
void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
- const char* config,
+ const std::string& config,
Indent const& indent)
{
this->TestGenerated = true;
diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h
index 2c69fc3..5446553 100644
--- a/Source/cmTestGenerator.h
+++ b/Source/cmTestGenerator.h
@@ -32,7 +32,7 @@ protected:
virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent);
virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
virtual void GenerateScriptForConfig(std::ostream& os,
- const char* config,
+ const std::string& config,
Indent const& indent);
virtual void GenerateScriptNoConfig(std::ostream& os, Indent const& indent);
virtual bool NeedsScriptNoConfig() const;
diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h
index 8e6bbc1..a09c47f 100644
--- a/Source/cmTryCompileCommand.h
+++ b/Source/cmTryCompileCommand.h
@@ -40,7 +40,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "try_compile";}
+ virtual std::string GetName() const { return "try_compile";}
cmTypeMacro(cmTryCompileCommand, cmCoreTryCompile);
diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h
index d0bf9ce..9b97b16 100644
--- a/Source/cmTryRunCommand.h
+++ b/Source/cmTryRunCommand.h
@@ -40,7 +40,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "try_run";}
+ virtual std::string GetName() const { return "try_run";}
cmTypeMacro(cmTryRunCommand, cmCoreTryCompile);
private:
diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h
index 2308139..62c2bd3 100644
--- a/Source/cmUnsetCommand.h
+++ b/Source/cmUnsetCommand.h
@@ -45,7 +45,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const {return "unset";}
+ virtual std::string GetName() const {return "unset";}
cmTypeMacro(cmUnsetCommand, cmCommand);
};
diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h
index dca75a5..da927c7 100644
--- a/Source/cmUseMangledMesaCommand.h
+++ b/Source/cmUseMangledMesaCommand.h
@@ -21,7 +21,7 @@ public:
virtual cmCommand* Clone() { return new cmUseMangledMesaCommand; }
virtual bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus &status);
- virtual const char* GetName() const { return "use_mangled_mesa";}
+ virtual std::string GetName() const { return "use_mangled_mesa";}
virtual bool IsScriptable() const { return true; }
virtual bool IsDiscouraged() const { return true; }
protected:
diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h
index 83d115c..23afdbe 100644
--- a/Source/cmUtilitySourceCommand.h
+++ b/Source/cmUtilitySourceCommand.h
@@ -21,7 +21,7 @@ public:
virtual cmCommand* Clone() { return new cmUtilitySourceCommand; }
virtual bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus &status);
- virtual const char* GetName() const { return "utility_source";}
+ virtual std::string GetName() const { return "utility_source";}
virtual bool IsDiscouraged() const { return true; }
};
diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h
index 881b149..7e68de1 100644
--- a/Source/cmVariableRequiresCommand.h
+++ b/Source/cmVariableRequiresCommand.h
@@ -21,7 +21,7 @@ public:
virtual cmCommand* Clone() { return new cmVariableRequiresCommand; }
virtual bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus &status);
- virtual const char* GetName() const { return "variable_requires";}
+ virtual std::string GetName() const { return "variable_requires";}
virtual bool IsDiscouraged() const { return true; }
};
diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h
index 790c75a..c86fad0 100644
--- a/Source/cmVariableWatch.h
+++ b/Source/cmVariableWatch.h
@@ -81,7 +81,7 @@ protected:
};
typedef std::vector< Pair* > VectorOfPairs;
- typedef std::map<cmStdString, VectorOfPairs > StringToVectorOfPairs;
+ typedef std::map<std::string, VectorOfPairs > StringToVectorOfPairs;
StringToVectorOfPairs WatchMap;
};
diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h
index fb6062c..c1ee9b1 100644
--- a/Source/cmVariableWatchCommand.h
+++ b/Source/cmVariableWatchCommand.h
@@ -54,7 +54,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "variable_watch";}
+ virtual std::string GetName() const { return "variable_watch";}
cmTypeMacro(cmVariableWatchCommand, cmCommand);
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 2d21a3d..90155b4 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -140,7 +140,7 @@ cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator()
void cmVisualStudio10TargetGenerator::WritePlatformConfigTag(
const char* tag,
- const char* config,
+ const std::string& config,
int indentLevel,
const char* attribute,
const char* end,
@@ -1012,18 +1012,18 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
si = objectSources.begin();
si != objectSources.end(); ++si)
{
- const char* lang = (*si)->GetLanguage();
+ const std::string& lang = (*si)->GetLanguage();
const char* tool = NULL;
- if (strcmp(lang, "C") == 0 || strcmp(lang, "CXX") == 0)
+ if (lang == "C"|| lang == "CXX")
{
tool = "ClCompile";
}
- else if (strcmp(lang, "ASM_MASM") == 0 &&
+ else if (lang == "ASM_NASM" &&
this->GlobalGenerator->IsMasmEnabled())
{
tool = "MASM";
}
- else if (strcmp(lang, "RC") == 0)
+ else if (lang == "RC")
{
tool = "ResourceCompile";
}
@@ -1108,29 +1108,28 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
{
defines += cdefs;
}
- const char* lang =
+ std::string lang =
this->GlobalGenerator->GetLanguageFromExtension
(sf.GetExtension().c_str());
- const char* sourceLang = this->LocalGenerator->GetSourceFileLanguage(sf);
- const char* linkLanguage = this->Target->GetLinkerLanguage();
+ std::string sourceLang = this->LocalGenerator->GetSourceFileLanguage(sf);
+ const std::string& linkLanguage = this->Target->GetLinkerLanguage();
bool needForceLang = false;
// source file does not match its extension language
- if(lang && sourceLang && strcmp(lang, sourceLang) != 0)
+ if(lang != sourceLang)
{
needForceLang = true;
lang = sourceLang;
}
// if the source file does not match the linker language
// then force c or c++
- if(needForceLang || (linkLanguage && lang
- && strcmp(lang, linkLanguage) != 0))
+ if(needForceLang || (linkLanguage != lang))
{
- if(strcmp(lang, "CXX") == 0)
+ if(lang == "CXX")
{
// force a C++ file type
flags += " /TP ";
}
- else if(strcmp(lang, "C") == 0)
+ else if(lang == "C")
{
// force to c
flags += " /TC ";
@@ -1341,17 +1340,17 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// collect up flags for
if(this->Target->GetType() < cmTarget::UTILITY)
{
- const char* linkLanguage =
+ const std::string& linkLanguage =
this->Target->GetLinkerLanguage(configName.c_str());
- if(!linkLanguage)
+ if(linkLanguage.empty())
{
cmSystemTools::Error
("CMake can not determine linker language for target: ",
this->Name.c_str());
return false;
}
- if(strcmp(linkLanguage, "C") == 0 || strcmp(linkLanguage, "CXX") == 0
- || strcmp(linkLanguage, "Fortran") == 0)
+ if(linkLanguage == "C" || linkLanguage == "CXX"
+ || linkLanguage == "Fortran")
{
std::string baseFlagVar = "CMAKE_";
baseFlagVar += linkLanguage;
@@ -1365,11 +1364,11 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
Target->GetMakefile()->GetRequiredDefinition(flagVar.c_str());
}
// set the correct language
- if(strcmp(linkLanguage, "C") == 0)
+ if(linkLanguage == "C")
{
flags += " /TC ";
}
- if(strcmp(linkLanguage, "CXX") == 0)
+ if(linkLanguage == "CXX")
{
flags += " /TP ";
}
@@ -1525,9 +1524,9 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
cmVSGetLinkFlagTable(this->LocalGenerator), 0, this));
Options& linkOptions = *pOptions;
- const char* linkLanguage =
+ const std::string& linkLanguage =
this->Target->GetLinkerLanguage(config.c_str());
- if(!linkLanguage)
+ if(linkLanguage.empty())
{
cmSystemTools::Error
("CMake can not determine linker language for target: ",
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index d1f3d19..02b951c 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -35,7 +35,7 @@ public:
// used by cmVisualStudioGeneratorOptions
void WritePlatformConfigTag(
const char* tag,
- const char* config,
+ const std::string& config,
int indentLevel,
const char* attribute = 0,
const char* end = 0,
@@ -98,7 +98,7 @@ private:
private:
typedef cmVisualStudioGeneratorOptions Options;
- typedef std::map<cmStdString, Options*> OptionsMap;
+ typedef std::map<std::string, Options*> OptionsMap;
OptionsMap ClOptions;
OptionsMap LinkOptions;
std::string PathToVcxproj;
@@ -113,7 +113,7 @@ private:
cmLocalVisualStudio7Generator* LocalGenerator;
std::set<cmSourceFile*> SourcesVisited;
- typedef std::map<cmStdString, ToolSources> ToolSourceMap;
+ typedef std::map<std::string, ToolSources> ToolSourceMap;
ToolSourceMap Tools;
};
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 6aca787..81adb56 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -222,7 +222,7 @@ cmVisualStudioGeneratorOptions
::OutputPreprocessorDefinitions(std::ostream& fout,
const char* prefix,
const char* suffix,
- const char* lang)
+ const std::string& lang)
{
if(this->Defines.empty())
{
@@ -270,7 +270,7 @@ cmVisualStudioGeneratorOptions
{
define = cmVisualStudio10GeneratorOptionsEscapeForXML(define.c_str());
- if(0 == strcmp(lang, "RC"))
+ if(lang == "RC")
{
cmSystemTools::ReplaceString(define, "\"", "\\\"");
}
@@ -300,7 +300,7 @@ cmVisualStudioGeneratorOptions
{
if(this->Version >= cmLocalVisualStudioGenerator::VS10)
{
- for(std::map<cmStdString, cmStdString>::iterator m = this->FlagMap.begin();
+ for(std::map<std::string, std::string>::iterator m = this->FlagMap.begin();
m != this->FlagMap.end(); ++m)
{
fout << indent;
@@ -326,7 +326,7 @@ cmVisualStudioGeneratorOptions
}
else
{
- for(std::map<cmStdString, cmStdString>::iterator m = this->FlagMap.begin();
+ for(std::map<std::string, std::string>::iterator m = this->FlagMap.begin();
m != this->FlagMap.end(); ++m)
{
fout << indent << m->first << "=\"" << m->second << "\"\n";
diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h
index 90f7667..214b893 100644
--- a/Source/cmVisualStudioGeneratorOptions.h
+++ b/Source/cmVisualStudioGeneratorOptions.h
@@ -55,7 +55,7 @@ public:
void OutputPreprocessorDefinitions(std::ostream& fout,
const char* prefix,
const char* suffix,
- const char* lang);
+ const std::string& lang);
void OutputFlagMap(std::ostream& fout, const char* indent);
void OutputAdditionalOptions(std::ostream& fout,
const char* prefix,
diff --git a/Source/cmVisualStudioWCEPlatformParser.cxx b/Source/cmVisualStudioWCEPlatformParser.cxx
index 219a5eb..ca226fb 100644
--- a/Source/cmVisualStudioWCEPlatformParser.cxx
+++ b/Source/cmVisualStudioWCEPlatformParser.cxx
@@ -62,7 +62,7 @@ const char* cmVisualStudioWCEPlatformParser::GetArchitectureFamily() const
return 0;
}
-void cmVisualStudioWCEPlatformParser::StartElement(const char* name,
+void cmVisualStudioWCEPlatformParser::StartElement(const std::string& name,
const char** attributes)
{
if(this->FoundRequiredName)
@@ -72,7 +72,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name,
this->CharacterData = "";
- if(strcmp(name, "PlatformData") == 0)
+ if(name == "PlatformData")
{
this->PlatformName = "";
this->OSMajorVersion = "";
@@ -80,7 +80,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name,
this->Macros.clear();
}
- if(strcmp(name, "Macro") == 0)
+ if(name == "Macro")
{
std::string macroName;
std::string macroValue;
@@ -102,7 +102,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name,
this->Macros[macroName] = macroValue;
}
}
- else if(strcmp(name, "Directories") == 0)
+ else if(name == "Directories")
{
for(const char** attr = attributes; *attr; attr += 2)
{
@@ -122,11 +122,11 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name,
}
}
-void cmVisualStudioWCEPlatformParser::EndElement(const char* name)
+void cmVisualStudioWCEPlatformParser::EndElement(const std::string& name)
{
if(!this->RequiredName)
{
- if(strcmp(name, "PlatformName") == 0)
+ if(name == "PlatformName")
{
this->AvailablePlatforms.push_back(this->CharacterData);
}
@@ -138,19 +138,19 @@ void cmVisualStudioWCEPlatformParser::EndElement(const char* name)
return;
}
- if(strcmp(name, "PlatformName") == 0)
+ if(name == "PlatformName")
{
this->PlatformName = this->CharacterData;
}
- else if(strcmp(name, "OSMajorVersion") == 0)
+ else if(name == "OSMajorVersion")
{
this->OSMajorVersion = this->CharacterData;
}
- else if(strcmp(name, "OSMinorVersion") == 0)
+ else if(name == "OSMinorVersion")
{
this->OSMinorVersion = this->CharacterData;
}
- else if(strcmp(name, "Platform") == 0)
+ else if(name == "Platform")
{
if(this->PlatformName == this->RequiredName)
{
diff --git a/Source/cmVisualStudioWCEPlatformParser.h b/Source/cmVisualStudioWCEPlatformParser.h
index 466e1dd..042df01 100644
--- a/Source/cmVisualStudioWCEPlatformParser.h
+++ b/Source/cmVisualStudioWCEPlatformParser.h
@@ -41,8 +41,8 @@ public:
return this->AvailablePlatforms; }
protected:
- virtual void StartElement(const char* name, const char** attributes);
- void EndElement(const char* name);
+ virtual void StartElement(const std::string& name, const char** attributes);
+ void EndElement(const std::string& name);
void CharacterDataHandler(const char* data, int length);
private:
diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h
index 45badd0..9fafffc 100644
--- a/Source/cmWhileCommand.h
+++ b/Source/cmWhileCommand.h
@@ -66,7 +66,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "while";}
+ virtual std::string GetName() const { return "while";}
cmTypeMacro(cmWhileCommand, cmCommand);
};
diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h
index 84a38fc..0d06878 100644
--- a/Source/cmWriteFileCommand.h
+++ b/Source/cmWriteFileCommand.h
@@ -44,7 +44,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "write_file";}
+ virtual std::string GetName() const { return "write_file";}
/** This command is kept for compatibility with older CMake versions. */
virtual bool IsDiscouraged() const
diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx
index 6abf6bf..3302a8d 100644
--- a/Source/cmXCodeObject.cxx
+++ b/Source/cmXCodeObject.cxx
@@ -108,7 +108,7 @@ void cmXCodeObject::Print(std::ostream& out)
{
out << separator;
}
- std::map<cmStdString, cmXCodeObject*>::iterator i;
+ std::map<std::string, cmXCodeObject*>::iterator i;
cmXCodeObject::Indent(3*indentFactor, out);
out << "isa = " << PBXTypeNames[this->IsA] << ";" << separator;
for(i = this->ObjectAttributes.begin();
@@ -138,7 +138,7 @@ void cmXCodeObject::Print(std::ostream& out)
}
else if(object->TypeValue == ATTRIBUTE_GROUP)
{
- std::map<cmStdString, cmXCodeObject*>::iterator j;
+ std::map<std::string, cmXCodeObject*>::iterator j;
out << i->first << " = {" << separator;
for(j = object->ObjectAttributes.begin(); j !=
object->ObjectAttributes.end(); ++j)
@@ -236,7 +236,7 @@ void cmXCodeObject::CopyAttributes(cmXCodeObject* copy)
}
//----------------------------------------------------------------------------
-void cmXCodeObject::PrintString(std::ostream& os,cmStdString String)
+void cmXCodeObject::PrintString(std::ostream& os,std::string String)
{
// The string needs to be quoted if it contains any characters
// considered special by the Xcode project file parser.
@@ -266,7 +266,7 @@ void cmXCodeObject::PrintString(std::ostream& os) const
}
//----------------------------------------------------------------------------
-void cmXCodeObject::SetString(const char* s)
+void cmXCodeObject::SetString(const std::string& s)
{
this->String = s;
}
diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h
index b89f78c..ed2940a 100644
--- a/Source/cmXCodeObject.h
+++ b/Source/cmXCodeObject.h
@@ -30,20 +30,20 @@ public:
PBXCopyFilesBuildPhase,
None
};
- class StringVec: public std::vector<cmStdString> {};
+ class StringVec: public std::vector<std::string> {};
static const char* PBXTypeNames[];
virtual ~cmXCodeObject();
cmXCodeObject(PBXType ptype, Type type);
Type GetType() { return this->TypeValue;}
PBXType GetIsA() { return this->IsA;}
- void SetString(const char* s);
- const char* GetString()
+ void SetString(const std::string& s);
+ const std::string& GetString()
{
- return this->String.c_str();
+ return this->String;
}
- void AddAttribute(const char* name, cmXCodeObject* value)
+ void AddAttribute(const std::string& name, cmXCodeObject* value)
{
this->ObjectAttributes[name] = value;
}
@@ -79,11 +79,11 @@ public:
static void PrintList(std::vector<cmXCodeObject*> const&,
std::ostream& out);
- const char* GetId()
+ const std::string& GetId()
{
- return this->Id.c_str();
+ return this->Id;
}
- void SetId(const char* id)
+ void SetId(const std::string& id)
{
this->Id = id;
}
@@ -95,8 +95,8 @@ public:
{
this->Target = t;
}
- const char* GetComment() {return this->Comment.c_str();}
- bool HasComment() { return (this->Comment.size() != 0);}
+ const std::string& GetComment() {return this->Comment;}
+ bool HasComment() { return (!this->Comment.empty());}
cmXCodeObject* GetObject(const char* name)
{
if(this->ObjectAttributes.count(name))
@@ -122,49 +122,41 @@ public:
void CopyAttributes(cmXCodeObject* );
- void AddDependLibrary(const char* configName,
- const char* l)
+ void AddDependLibrary(const std::string& configName,
+ const std::string& l)
{
- if(!configName)
- {
- configName = "";
- }
this->DependLibraries[configName].push_back(l);
}
- std::map<cmStdString, StringVec> const& GetDependLibraries()
+ std::map<std::string, StringVec> const& GetDependLibraries()
{
return this->DependLibraries;
}
- void AddDependTarget(const char* configName,
- const char* tName)
+ void AddDependTarget(const std::string& configName,
+ const std::string& tName)
{
- if(!configName)
- {
- configName = "";
- }
this->DependTargets[configName].push_back(tName);
}
- std::map<cmStdString, StringVec> const& GetDependTargets()
+ std::map<std::string, StringVec> const& GetDependTargets()
{
return this->DependTargets;
}
std::vector<cmXCodeObject*> const& GetObjectList() { return this->List;}
- void SetComment(const char* c) { this->Comment = c;}
- static void PrintString(std::ostream& os,cmStdString String);
+ void SetComment(const std::string& c) { this->Comment = c;}
+ static void PrintString(std::ostream& os,std::string String);
protected:
void PrintString(std::ostream& os) const;
cmTarget* Target;
Type TypeValue;
- cmStdString Id;
+ std::string Id;
PBXType IsA;
int Version;
- cmStdString Comment;
- cmStdString String;
+ std::string Comment;
+ std::string String;
cmXCodeObject* Object;
std::vector<cmXCodeObject*> List;
- std::map<cmStdString, StringVec> DependLibraries;
- std::map<cmStdString, StringVec> DependTargets;
- std::map<cmStdString, cmXCodeObject*> ObjectAttributes;
+ std::map<std::string, StringVec> DependLibraries;
+ std::map<std::string, StringVec> DependTargets;
+ std::map<std::string, cmXCodeObject*> ObjectAttributes;
};
#endif
diff --git a/Source/cmXMLParser.cxx b/Source/cmXMLParser.cxx
index 0c53440..a73fd70 100644
--- a/Source/cmXMLParser.cxx
+++ b/Source/cmXMLParser.cxx
@@ -152,14 +152,14 @@ int cmXMLParser::ParsingComplete()
}
//----------------------------------------------------------------------------
-void cmXMLParser::StartElement(const char * name,
+void cmXMLParser::StartElement(const std::string& name,
const char ** /*atts*/)
{
std::cout << "Start element: " << name << std::endl;
}
//----------------------------------------------------------------------------
-void cmXMLParser::EndElement(const char * name)
+void cmXMLParser::EndElement(const std::string& name)
{
std::cout << "End element: " << name << std::endl;
}
diff --git a/Source/cmXMLParser.h b/Source/cmXMLParser.h
index d916075..84a5a7d 100644
--- a/Source/cmXMLParser.h
+++ b/Source/cmXMLParser.h
@@ -74,11 +74,11 @@ protected:
* element. atts = Null-terminated array of attribute name/value pairs.
* Even indices are attribute names, and odd indices are values.
*/
- virtual void StartElement(const char* name, const char** atts);
+ virtual void StartElement(const std::string& name, const char** atts);
//! Called at the end of an element in the XML source opened when
//StartElement was called.
- virtual void EndElement(const char* name);
+ virtual void EndElement(const std::string& name);
//! Called when there is character data to handle.
virtual void CharacterDataHandler(const char* data, int length);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index abbabe7..d37bd94 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -221,13 +221,13 @@ void cmake::CleanupCommandsAndMacros()
}
}
-bool cmake::CommandExists(const char* name) const
+bool cmake::CommandExists(const std::string& name) const
{
std::string sName = cmSystemTools::LowerCase(name);
return (this->Commands.find(sName) != this->Commands.end());
}
-cmCommand *cmake::GetCommand(const char *name)
+cmCommand *cmake::GetCommand(const std::string& name)
{
cmCommand* rm = 0;
std::string sName = cmSystemTools::LowerCase(name);
@@ -239,7 +239,8 @@ cmCommand *cmake::GetCommand(const char *name)
return rm;
}
-void cmake::RenameCommand(const char*oldName, const char* newName)
+void cmake::RenameCommand(const std::string& oldName,
+ const std::string& newName)
{
// if the command already exists, free the old one
std::string sOldName = cmSystemTools::LowerCase(oldName);
@@ -262,7 +263,7 @@ void cmake::RenameCommand(const char*oldName, const char* newName)
this->Commands.erase(pos);
}
-void cmake::RemoveCommand(const char* name)
+void cmake::RemoveCommand(const std::string& name)
{
std::string sName = cmSystemTools::LowerCase(name);
RegisteredCommandsMap::iterator pos = this->Commands.find(sName);
@@ -965,7 +966,7 @@ int cmake::AddCMakePaths()
return 1;
}
-void cmake::AddExtraGenerator(const char* name,
+void cmake::AddExtraGenerator(const std::string& name,
CreateExtraGeneratorFunctionType newFunction)
{
cmExternalMakefileProjectGenerator* extraGenerator = newFunction();
@@ -1034,9 +1035,10 @@ void cmake::GetRegisteredGenerators(std::vector<std::string>& names)
}
}
-cmGlobalGenerator* cmake::CreateGlobalGenerator(const char* name)
+cmGlobalGenerator* cmake::CreateGlobalGenerator(const std::string& gname)
{
cmExternalMakefileProjectGenerator* extraGenerator = 0;
+ std::string name = gname;
RegisteredExtraGeneratorsMap::const_iterator extraGenIt =
this->ExtraGenerators.find(name);
if (extraGenIt != this->ExtraGenerators.end())
@@ -1069,13 +1071,13 @@ cmGlobalGenerator* cmake::CreateGlobalGenerator(const char* name)
return generator;
}
-void cmake::SetHomeDirectory(const char* dir)
+void cmake::SetHomeDirectory(const std::string& dir)
{
this->cmHomeDirectory = dir;
cmSystemTools::ConvertToUnixSlashes(this->cmHomeDirectory);
}
-void cmake::SetHomeOutputDirectory(const char* lib)
+void cmake::SetHomeOutputDirectory(const std::string& lib)
{
this->HomeOutputDirectory = lib;
cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory);
@@ -1202,7 +1204,7 @@ struct SaveCacheEntry
cmCacheManager::CacheEntryType type;
};
-int cmake::HandleDeleteCacheVariables(const char* var)
+int cmake::HandleDeleteCacheVariables(const std::string& var)
{
std::vector<std::string> argsSplit;
cmSystemTools::ExpandListArgument(std::string(var), argsSplit, true);
@@ -1324,7 +1326,8 @@ int cmake::ActualConfigure()
if(genName)
{
std::string fullName = cmExternalMakefileProjectGenerator::
- CreateFullGeneratorName(genName, extraGenName);
+ CreateFullGeneratorName(genName,
+ extraGenName ? extraGenName : "");
this->GlobalGenerator = this->CreateGlobalGenerator(fullName.c_str());
}
if(this->GlobalGenerator)
@@ -1417,13 +1420,13 @@ int cmake::ActualConfigure()
if(!this->CacheManager->GetCacheValue("CMAKE_GENERATOR"))
{
this->CacheManager->AddCacheEntry("CMAKE_GENERATOR",
- this->GlobalGenerator->GetName(),
+ this->GlobalGenerator->GetName().c_str(),
"Name of generator.",
cmCacheManager::INTERNAL);
this->CacheManager->AddCacheEntry("CMAKE_EXTRA_GENERATOR",
- this->GlobalGenerator->GetExtraGeneratorName(),
- "Name of external makefile project generator.",
- cmCacheManager::INTERNAL);
+ this->GlobalGenerator->GetExtraGeneratorName().c_str(),
+ "Name of external makefile project generator.",
+ cmCacheManager::INTERNAL);
}
if(const char* tsName =
@@ -1725,7 +1728,7 @@ int cmake::Generate()
return 0;
}
-void cmake::AddCacheEntry(const char* key, const char* value,
+void cmake::AddCacheEntry(const std::string& key, const char* value,
const char* helpString,
int type)
{
@@ -1734,7 +1737,7 @@ void cmake::AddCacheEntry(const char* key, const char* value,
cmCacheManager::CacheEntryType(type));
}
-const char* cmake::GetCacheDefinition(const char* name) const
+const char* cmake::GetCacheDefinition(const std::string& name) const
{
return this->CacheManager->GetCacheValue(name);
}
@@ -2144,7 +2147,8 @@ void cmake::GenerateGraphViz(const char* fileName) const
#endif
}
-void cmake::DefineProperty(const char *name, cmProperty::ScopeType scope,
+void cmake::DefineProperty(const std::string& name,
+ cmProperty::ScopeType scope,
const char *ShortDescription,
const char *FullDescription,
bool chained)
@@ -2155,7 +2159,7 @@ void cmake::DefineProperty(const char *name, cmProperty::ScopeType scope,
}
cmPropertyDefinition *cmake
-::GetPropertyDefinition(const char *name,
+::GetPropertyDefinition(const std::string& name,
cmProperty::ScopeType scope)
{
if (this->IsPropertyDefined(name,scope))
@@ -2165,25 +2169,22 @@ cmPropertyDefinition *cmake
return 0;
}
-bool cmake::IsPropertyDefined(const char *name, cmProperty::ScopeType scope)
+bool cmake::IsPropertyDefined(const std::string& name,
+ cmProperty::ScopeType scope)
{
return this->PropertyDefinitions[scope].IsPropertyDefined(name);
}
-bool cmake::IsPropertyChained(const char *name, cmProperty::ScopeType scope)
+bool cmake::IsPropertyChained(const std::string& name,
+ cmProperty::ScopeType scope)
{
return this->PropertyDefinitions[scope].IsPropertyChained(name);
}
-void cmake::SetProperty(const char* prop, const char* value)
+void cmake::SetProperty(const std::string& prop, const char* value)
{
- if (!prop)
- {
- return;
- }
-
// Special hook to invalidate cached value.
- if(strcmp(prop, "DEBUG_CONFIGURATIONS") == 0)
+ if(prop == "DEBUG_CONFIGURATIONS")
{
this->DebugConfigs.clear();
}
@@ -2191,15 +2192,11 @@ void cmake::SetProperty(const char* prop, const char* value)
this->Properties.SetProperty(prop, value, cmProperty::GLOBAL);
}
-void cmake::AppendProperty(const char* prop, const char* value, bool asString)
+void cmake::AppendProperty(const std::string& prop,
+ const char* value, bool asString)
{
- if (!prop)
- {
- return;
- }
-
// Special hook to invalidate cached value.
- if(strcmp(prop, "DEBUG_CONFIGURATIONS") == 0)
+ if(prop == "DEBUG_CONFIGURATIONS")
{
this->DebugConfigs.clear();
}
@@ -2207,23 +2204,19 @@ void cmake::AppendProperty(const char* prop, const char* value, bool asString)
this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL, asString);
}
-const char *cmake::GetProperty(const char* prop)
+const char *cmake::GetProperty(const std::string& prop)
{
return this->GetProperty(prop, cmProperty::GLOBAL);
}
-const char *cmake::GetProperty(const char* prop, cmProperty::ScopeType scope)
+const char *cmake::GetProperty(const std::string& prop,
+ cmProperty::ScopeType scope)
{
- if(!prop)
- {
- return 0;
- }
bool chain = false;
// watch for special properties
- std::string propname = prop;
std::string output = "";
- if ( propname == "CACHE_VARIABLES" )
+ if ( prop == "CACHE_VARIABLES" )
{
cmCacheManager::CacheIterator cit =
this->GetCacheManager()->GetCacheIterator();
@@ -2237,7 +2230,7 @@ const char *cmake::GetProperty(const char* prop, cmProperty::ScopeType scope)
}
this->SetProperty("CACHE_VARIABLES", output.c_str());
}
- else if ( propname == "COMMANDS" )
+ else if ( prop == "COMMANDS" )
{
cmake::RegisteredCommandsMap::iterator cmds
= this->GetCommands()->begin();
@@ -2252,12 +2245,12 @@ const char *cmake::GetProperty(const char* prop, cmProperty::ScopeType scope)
}
this->SetProperty("COMMANDS",output.c_str());
}
- else if ( propname == "IN_TRY_COMPILE" )
+ else if ( prop == "IN_TRY_COMPILE" )
{
this->SetProperty("IN_TRY_COMPILE",
this->GetIsInTryCompile()? "1":"0");
}
- else if ( propname == "ENABLED_LANGUAGES" )
+ else if ( prop == "ENABLED_LANGUAGES" )
{
std::string lang;
if(this->GlobalGenerator)
@@ -2278,7 +2271,7 @@ const char *cmake::GetProperty(const char* prop, cmProperty::ScopeType scope)
return this->Properties.GetPropertyValue(prop, scope, chain);
}
-bool cmake::GetPropertyAsBool(const char* prop)
+bool cmake::GetPropertyAsBool(const std::string& prop)
{
return cmSystemTools::IsOn(this->GetProperty(prop));
}
@@ -2677,16 +2670,16 @@ int cmake::Build(const std::string& dir,
return 1;
}
projName = it.GetValue();
- return gen->Build(0, dir.c_str(),
+ return gen->Build("", dir.c_str(),
projName.c_str(), target.c_str(),
&output,
- 0,
+ "",
config.c_str(), clean, false, 0,
cmSystemTools::OUTPUT_PASSTHROUGH,
nativeOptions);
}
-void cmake::WatchUnusedCli(const char* var)
+void cmake::WatchUnusedCli(const std::string& var)
{
#ifdef CMAKE_BUILD_WITH_CMAKE
this->VariableWatch->AddWatch(var, cmWarnUnusedCliWarning, this);
@@ -2697,7 +2690,7 @@ void cmake::WatchUnusedCli(const char* var)
#endif
}
-void cmake::UnwatchUnusedCli(const char* var)
+void cmake::UnwatchUnusedCli(const std::string& var)
{
#ifdef CMAKE_BUILD_WITH_CMAKE
this->VariableWatch->RemoveWatch(var, cmWarnUnusedCliWarning);
@@ -2711,7 +2704,7 @@ void cmake::RunCheckForUnusedVariables()
bool haveUnused = false;
cmOStringStream msg;
msg << "Manually-specified variables were not used by the project:";
- for(std::map<cmStdString, bool>::const_iterator
+ for(std::map<std::string, bool>::const_iterator
it = this->UsedCliVariables.begin();
it != this->UsedCliVariables.end(); ++it)
{
diff --git a/Source/cmake.h b/Source/cmake.h
index dfec55c..6772740 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -91,7 +91,7 @@ class cmake
*/
FIND_PACKAGE_MODE
};
- typedef std::map<cmStdString, cmCommand*> RegisteredCommandsMap;
+ typedef std::map<std::string, cmCommand*> RegisteredCommandsMap;
/// Default constructor
cmake();
@@ -110,12 +110,12 @@ class cmake
* CMakeLists files by recursing up the tree starting at the StartDirectory
* and going up until it reaches the HomeDirectory.
*/
- void SetHomeDirectory(const char* dir);
+ void SetHomeDirectory(const std::string& dir);
const char* GetHomeDirectory() const
{
return this->cmHomeDirectory.c_str();
}
- void SetHomeOutputDirectory(const char* lib);
+ void SetHomeOutputDirectory(const std::string& lib);
const char* GetHomeOutputDirectory() const
{
return this->HomeOutputDirectory.c_str();
@@ -130,7 +130,7 @@ class cmake
* recursing up the tree starting at the StartDirectory and going up until
* it reaches the HomeDirectory.
*/
- void SetStartDirectory(const char* dir)
+ void SetStartDirectory(const std::string& dir)
{
this->cmStartDirectory = dir;
cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory);
@@ -139,7 +139,7 @@ class cmake
{
return this->cmStartDirectory.c_str();
}
- void SetStartOutputDirectory(const char* lib)
+ void SetStartOutputDirectory(const std::string& lib)
{
this->StartOutputDirectory = lib;
cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory);
@@ -175,7 +175,7 @@ class cmake
void PreLoadCMakeFiles();
///! Create a GlobalGenerator
- cmGlobalGenerator* CreateGlobalGenerator(const char* name);
+ cmGlobalGenerator* CreateGlobalGenerator(const std::string& name);
///! Return the global generator assigned to this instance of cmake
cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; }
@@ -203,9 +203,9 @@ class cmake
/**
* Given a variable name, return its value (as a string).
*/
- const char* GetCacheDefinition(const char*) const;
+ const char* GetCacheDefinition(const std::string&) const;
///! Add an entry into the cache
- void AddCacheEntry(const char* key, const char* value,
+ void AddCacheEntry(const std::string& key, const char* value,
const char* helpString,
int type);
@@ -218,20 +218,20 @@ class cmake
* Add a command to this cmake instance
*/
void AddCommand(cmCommand* );
- void RenameCommand(const char* oldName, const char* newName);
- void RemoveCommand(const char* name);
+ void RenameCommand(const std::string& oldName, const std::string& newName);
+ void RemoveCommand(const std::string& name);
void RemoveUnscriptableCommands();
/**
* Get a command by its name
*/
- cmCommand *GetCommand(const char *name);
+ cmCommand *GetCommand(const std::string& name);
/** Get list of all commands */
RegisteredCommandsMap* GetCommands() { return &this->Commands; }
/** Check if a command exists. */
- bool CommandExists(const char* name) const;
+ bool CommandExists(const std::string& name) const;
///! Parse command line arguments
void SetArgs(const std::vector<std::string>&,
@@ -269,11 +269,13 @@ class cmake
void GetGeneratorDocumentation(std::vector<cmDocumentationEntry>&);
///! Set/Get a property of this target file
- void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char *prop, const char *value,bool asString=false);
- const char *GetProperty(const char *prop);
- const char *GetProperty(const char *prop, cmProperty::ScopeType scope);
- bool GetPropertyAsBool(const char *prop);
+ void SetProperty(const std::string& prop, const char *value);
+ void AppendProperty(const std::string& prop,
+ const char *value,bool asString=false);
+ const char *GetProperty(const std::string& prop);
+ const char *GetProperty(const std::string& prop,
+ cmProperty::ScopeType scope);
+ bool GetPropertyAsBool(const std::string& prop);
// Get the properties
cmPropertyMap &GetProperties() { return this->Properties; };
@@ -317,18 +319,18 @@ class cmake
void MarkCliAsUsed(const std::string& variable);
// Define a property
- void DefineProperty(const char *name, cmProperty::ScopeType scope,
+ void DefineProperty(const std::string& name, cmProperty::ScopeType scope,
const char *ShortDescription,
const char *FullDescription,
bool chain = false);
// get property definition
cmPropertyDefinition *GetPropertyDefinition
- (const char *name, cmProperty::ScopeType scope);
+ (const std::string& name, cmProperty::ScopeType scope);
// Is a property defined?
- bool IsPropertyDefined(const char *name, cmProperty::ScopeType scope);
- bool IsPropertyChained(const char *name, cmProperty::ScopeType scope);
+ bool IsPropertyDefined(const std::string& name, cmProperty::ScopeType scope);
+ bool IsPropertyChained(const std::string& name, cmProperty::ScopeType scope);
/** Get the list of configurations (in upper case) considered to be
debugging configurations.*/
@@ -355,21 +357,21 @@ class cmake
const std::vector<std::string>& nativeOptions,
bool clean);
- void UnwatchUnusedCli(const char* var);
- void WatchUnusedCli(const char* var);
+ void UnwatchUnusedCli(const std::string& var);
+ void WatchUnusedCli(const std::string& var);
protected:
void RunCheckForUnusedVariables();
void InitializeProperties();
- int HandleDeleteCacheVariables(const char* var);
+ int HandleDeleteCacheVariables(const std::string& var);
cmPropertyMap Properties;
- std::set<std::pair<cmStdString,cmProperty::ScopeType> > AccessedProperties;
+ std::set<std::pair<std::string,cmProperty::ScopeType> > AccessedProperties;
std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>
PropertyDefinitions;
typedef
cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)();
- typedef std::map<cmStdString,
+ typedef std::map<std::string,
CreateExtraGeneratorFunctionType> RegisteredExtraGeneratorsMap;
typedef std::vector<cmGlobalGeneratorFactory*> RegisteredGeneratorsVector;
RegisteredCommandsMap Commands;
@@ -378,7 +380,7 @@ protected:
void AddDefaultCommands();
void AddDefaultGenerators();
void AddDefaultExtraGenerators();
- void AddExtraGenerator(const char* name,
+ void AddExtraGenerator(const std::string& name,
CreateExtraGeneratorFunctionType newFunction);
cmPolicies *Policies;
@@ -430,7 +432,7 @@ private:
bool WarnUnused;
bool WarnUnusedCli;
bool CheckSystemVars;
- std::map<cmStdString, bool> UsedCliVariables;
+ std::map<std::string, bool> UsedCliVariables;
std::string CMakeEditCommand;
std::string CXXEnvironment;
std::string CCEnvironment;
diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx
index faa5fa7..55fc633 100644
--- a/Source/cmcldeps.cxx
+++ b/Source/cmcldeps.cxx
@@ -198,7 +198,7 @@ static int process( const std::string& srcfilename,
std::vector<std::string> args;
cmSystemTools::ParseWindowsCommandLine(cmd.c_str(), args);
// convert to correct vector type for RunSingleCommand
- std::vector<cmStdString> command;
+ std::vector<std::string> command;
for(std::vector<std::string>::iterator i = args.begin();
i != args.end(); ++i)
{
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 4ac1986..047f09d 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -666,7 +666,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
else if (args[1] == "cmake_autogen" && args.size() >= 4)
{
cmQtAutoGenerators autogen;
- const char *config = args[3].empty() ? 0 : args[3].c_str();
+ std::string const& config = args[3];
bool autogenSuccess = autogen.Run(args[2].c_str(), config);
return autogenSuccess ? 0 : 1;
}
@@ -677,7 +677,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
{
std::string flags = args[2];
std::string outFile = args[3];
- std::vector<cmStdString> files;
+ std::vector<std::string> files;
for (std::string::size_type cc = 4; cc < args.size(); cc ++)
{
files.push_back(args[cc]);
@@ -1143,7 +1143,7 @@ int cmcmd::VisualStudioLink(std::vector<std::string>& args, int type)
}
int cmcmd::ParseVisualStudioLinkCommand(std::vector<std::string>& args,
- std::vector<cmStdString>& command,
+ std::vector<std::string>& command,
std::string& targetName)
{
std::vector<std::string>::iterator i = args.begin();
@@ -1171,14 +1171,14 @@ int cmcmd::ParseVisualStudioLinkCommand(std::vector<std::string>& args,
}
bool cmcmd::RunCommand(const char* comment,
- std::vector<cmStdString>& command,
+ std::vector<std::string>& command,
bool verbose,
int* retCodeOut)
{
if(verbose)
{
std::cout << comment << ":\n";
- for(std::vector<cmStdString>::iterator i = command.begin();
+ for(std::vector<std::string>::iterator i = command.begin();
i != command.end(); ++i)
{
std::cout << i->c_str() << " ";
@@ -1239,16 +1239,16 @@ int cmcmd::VisualStudioLinkIncremental(std::vector<std::string>& args,
// 7. Finally, the Linker does another incremental link, but since the
// only thing that has changed is the *.res file that contains the
// manifest it is a short link.
- std::vector<cmStdString> linkCommand;
+ std::vector<std::string> linkCommand;
std::string targetName;
if(cmcmd::ParseVisualStudioLinkCommand(args, linkCommand, targetName) == -1)
{
return -1;
}
std::string manifestArg = "/MANIFESTFILE:";
- std::vector<cmStdString> rcCommand;
+ std::vector<std::string> rcCommand;
rcCommand.push_back(cmSystemTools::FindProgram("rc.exe"));
- std::vector<cmStdString> mtCommand;
+ std::vector<std::string> mtCommand;
mtCommand.push_back(cmSystemTools::FindProgram("mt.exe"));
std::string tempManifest;
tempManifest = targetName;
@@ -1349,7 +1349,7 @@ int cmcmd::VisualStudioLinkNonIncremental(std::vector<std::string>& args,
bool hasManifest,
bool verbose)
{
- std::vector<cmStdString> linkCommand;
+ std::vector<std::string> linkCommand;
std::string targetName;
if(cmcmd::ParseVisualStudioLinkCommand(args, linkCommand, targetName) == -1)
{
@@ -1368,7 +1368,7 @@ int cmcmd::VisualStudioLinkNonIncremental(std::vector<std::string>& args,
{
return 0;
}
- std::vector<cmStdString> mtCommand;
+ std::vector<std::string> mtCommand;
mtCommand.push_back(cmSystemTools::FindProgram("mt.exe"));
mtCommand.push_back("/nologo");
mtCommand.push_back("/manifest");
diff --git a/Source/cmcmd.h b/Source/cmcmd.h
index 4517ebf..2bfbae7 100644
--- a/Source/cmcmd.h
+++ b/Source/cmcmd.h
@@ -43,10 +43,10 @@ protected:
bool hasManifest,
bool verbose);
static int ParseVisualStudioLinkCommand(std::vector<std::string>& args,
- std::vector<cmStdString>& command,
+ std::vector<std::string>& command,
std::string& targetName);
static bool RunCommand(const char* comment,
- std::vector<cmStdString>& command,
+ std::vector<std::string>& command,
bool verbose,
int* retCodeOut = 0);
};
diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx
index dc1ce24..279bcd5 100644
--- a/Tests/CMakeLib/run_compile_commands.cxx
+++ b/Tests/CMakeLib/run_compile_commands.cxx
@@ -2,14 +2,14 @@
class CompileCommandParser {
public:
- class CommandType: public std::map<cmStdString, cmStdString>
+ class CommandType: public std::map<std::string, std::string>
{
public:
- cmStdString const& at(cmStdString const& k) const
+ std::string const& at(std::string const& k) const
{
const_iterator i = this->find(k);
if(i != this->end()) { return i->second; }
- static cmStdString emptyString;
+ static std::string emptyString;
return emptyString;
}
};
@@ -127,7 +127,7 @@ int main ()
it = parser.GetTranslationUnits().begin(),
end = parser.GetTranslationUnits().end(); it != end; ++it)
{
- std::vector<cmStdString> command;
+ std::vector<std::string> command;
cmSystemTools::ParseUnixCommandLine(it->at("command").c_str(), command);
if (!cmSystemTools::RunSingleCommand(
command, 0, 0, it->at("directory").c_str()))
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index ea04911..726e790 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -829,6 +829,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
if(WIX_LIGHT_EXECUTABLE)
add_test(CPackWiXGenerator ${CMAKE_CTEST_COMMAND}
+ -C \${CTEST_CONFIGURATION_TYPE}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator"
"${CMake_BINARY_DIR}/Tests/CPackWiXGenerator"
@@ -837,6 +838,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
--build-options ${build_options}
--test-command ${CMAKE_CMAKE_COMMAND}
"-DCPackWiXGenerator_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackWiXGenerator"
+ "-Dconfig=\${CTEST_CONFIGURATION_TYPE}"
-P "${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake")
endif()
endif()
diff --git a/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake b/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake
index 30e33cf2..ca9fd90 100644
--- a/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake
+++ b/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake
@@ -10,7 +10,12 @@ message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}")
message(STATUS "CMAKE_CPACK_COMMAND: ${CMAKE_CPACK_COMMAND}")
message(STATUS "CPackWiXGenerator_BINARY_DIR: ${CPackWiXGenerator_BINARY_DIR}")
+if(config)
+ set(_C_config -C ${config})
+endif()
+
execute_process(COMMAND "${CMAKE_CPACK_COMMAND}"
+ ${_C_config}
RESULT_VARIABLE CPack_result
OUTPUT_VARIABLE CPack_output
ERROR_VARIABLE CPack_error